修改后台我负责的元数据管理功能,增加了分字段排序功能

This commit is contained in:
Li Jianxuan 2013-07-10 09:04:43 +00:00
parent c94f452eb6
commit e393f8085a
5 changed files with 137 additions and 48 deletions

View File

@ -586,6 +586,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$search=$this->_request->getParam('search'); $search=$this->_request->getParam('search');
$filter['keyword'] = $this->_request->getParam('keyword'); $filter['keyword'] = $this->_request->getParam('keyword');
$filter['code'] = $this->_request->getParam('code'); $filter['code'] = $this->_request->getParam('code');
$filter['order'] = $this->_request->getParam('order');
$filter['sort'] = $this->_request->getParam('sort');
$review = new Review($this->db); $review = new Review($this->db);
if(!empty($search) && !empty($filter)) if(!empty($search) && !empty($filter))
@ -593,6 +595,9 @@ class Admin_ReviewController extends Zend_Controller_Action
$rows = $review->adminReviews($filter); $rows = $review->adminReviews($filter);
$this->view->keyword = $filter['keyword']; $this->view->keyword = $filter['keyword'];
$this->view->code = $filter['code']; $this->view->code = $filter['code'];
}if(!empty($filter))
{
$rows = $review->adminReviews($filter);
}else{ }else{
$rows = $review->adminReviews(); $rows = $review->adminReviews();
} }

View File

@ -36,7 +36,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
<table class="table table-bordered table-hover"><thead> <table class="table table-bordered table-hover"><thead>
<tr> <tr>
<th width='600'>元数据标题</th> <th width='600'>元数据标题</th>
<th width='120'>责编辑</th> <th width='120'>编辑</th>
<th width='120'>接收时间</th> <th width='120'>接收时间</th>
<th width='180'>操作</th> <th width='180'>操作</th>
</tr></thead> </tr></thead>

View File

@ -7,6 +7,7 @@
$this->breadcrumb('元数据评审'); $this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendModel($this,'sfadmin');
?> ?>
<style> <style>
table thead tr th {background:#EBF2F6;color:#444;} table thead tr th {background:#EBF2F6;color:#444;}
@ -50,10 +51,27 @@ table thead tr th {background:#EBF2F6;color:#444;}
<thead> <thead>
<tr> <tr>
<th style="width:13px;"><input type="checkbox" class="select_rows" data-tbody="list" /></th> <th style="width:13px;"><input type="checkbox" class="select_rows" data-tbody="list" /></th>
<th width='500'>元数据标题</th> <th width='500'>元数据标题<br />
<th width='80'>状态</th> <a href="?order=title&sort=desc" data-order="title" data-sort="desc"></a>
<th>接收时间</th> <a href="?order=title&sort=asc" data-order="title" data-sort="asc"></a>
<th>作者</th> </th>
<th width='80'>
状态<br />
<a href="?order=status&sort=desc" data-order="status" data-sort="desc"></a>
<a href="?order=status&sort=asc" data-order="status" data-sort="asc"></a>
</th>
<th>意见<br />
<a href="?order=reviews&sort=desc" data-order="reviews" data-sort="desc"></a>
<a href="?order=reviews&sort=asc" data-order="reviews" data-sort="asc"></a>
</th>
<th>接收时间<br />
<a href="?order=ts_accepted&sort=desc" data-order="ts_accepted" data-sort="desc"></a>
<a href="?order=ts_accepted&sort=asc" data-order="ts_accepted" data-sort="asc"></a>
</th>
<th>投稿人<br />
<a href="?order=author&sort=desc" data-order="author" data-sort="desc"></a>
<a href="?order=author&sort=asc" data-order="author" data-sort="asc"></a>
</th>
<th width="300">操作</th> <th width="300">操作</th>
</tr> </tr>
</thead> </thead>
@ -75,6 +93,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
if($item['status'] == 4) echo "专家反馈"; if($item['status'] == 4) echo "专家反馈";
if($item['status'] == 5) echo "已发布"; if($item['status'] == 5) echo "已发布";
?></td> ?></td>
<td style="text-align:center"><a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>"><?= $item['reviews'] ?></a></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td> <td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td><?= $item['author']?></td> <td><?= $item['author']?></td>
<td> <td>
@ -97,41 +116,6 @@ table thead tr th {background:#EBF2F6;color:#444;}
</div> </div>
</div> </div>
<script> <script>
var sfadmin = {
def_data_tag : 'tbody',
def_select_input : '.select_item',
init: function() {
$('.select_rows').click(function () {
var tableid = $(this).data(sfadmin.def_data_tag);
$('#'+tableid).find(sfadmin.def_select_input).attr('checked', this.checked);
});
sfadmin.ajax.error();
},
getSelected : function(tableid){
if(tableid == "")
{
dom = $(sfadmin.def_select_input + ':checked');
}else{
dom = $(sfadmin.def_select_input + ':checked', '#'+tableid);
}
datas = new Array();
dom.each(function(index, element) {
datas.push($(this).val());
});
return datas;
},
ajax : {
error : function(){
$(document).ajaxError(function(event, request, settings) {
sfadmin.Alert("请求中发生错误");
})
}
},
Alert : function(content){
$.colorbox({width:'50%',html:'<div class="ajax_error"><div class="text"><h2>'+content+'</h2></div></div>'});
}
}
$(document).ready(function(e) { $(document).ready(function(e) {
$('.version').click(function(){ $('.version').click(function(){
$(this).getversion({'id':$(this).attr('rel')}); $(this).getversion({'id':$(this).attr('rel')});
@ -167,6 +151,37 @@ function getids(){
return data; return data;
} }
(function( $ ){
$.fn.changeorder = function( options ) {
var settings = $.extend( {
order:'',
srt: '',
}, options);
var methods = {
change : function(dom)
{
href = window.location.href + "?order="+settings.order+'&sort';
}
}
this.each(function() {
settings.order = $(this).data('order');
settings.srt = $(this).data('sort');
if( settings.order == '' || settings.srt == "")
{
alert('参数错误');
}
methods.change(this);
});
};
})( jQuery );
(function( $ ){ (function( $ ){
$.fn.getversion = function( options ) { $.fn.getversion = function( options ) {

View File

@ -64,12 +64,13 @@ class Review extends Zend_Controller_Plugin_Abstract
} }
//后台我负责的评审 //后台我负责的评审
function adminReviews($filter = "",$order="") function adminReviews($filter = "")
{ {
include_once('helper/view.php'); include_once('helper/view.php');
$uid = view::User('id'); $uid = \view::User('id');
$wheresql = array(); $wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) "; $wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " u.id=$uid "; $wheresql[] = " u.id=$uid ";
@ -82,6 +83,16 @@ class Review extends Zend_Controller_Plugin_Abstract
{ {
$wheresql[] = " s.sourceid=".$filter['code']." "; $wheresql[] = " s.sourceid=".$filter['code']." ";
} }
if(isset($filter['order']) && !empty($filter['order']))
{
$sort = "DESC";
if(isset($filter['sort']) && !empty($filter['sort']) && in_array( strtolower($filter['sort']),array('desc','asc')))
{
$sort = $filter['sort'];
}
$ordersql[] = " {$filter['order']} $sort ";
}
if(count($wheresql)>0) if(count($wheresql)>0)
{ {
@ -90,15 +101,23 @@ class Review extends Zend_Controller_Plugin_Abstract
$wheresql = ""; $wheresql = "";
} }
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted if(count($ordersql)>0)
{
$ordersql = " ORDER BY ".join(',',$ordersql);
}else{
$ordersql = " ORDER BY m.status desc,m.ts_accepted desc ";
}
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted,count(r.id) as reviews
FROM mdstatus m FROM mdstatus m
right join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid left join geonetworkmetadata g on m.uuid=g.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
left join datasource s on s.uuid=md.uuid left join datasource s on s.uuid=md.uuid
left join mdreview r ON r.uuid=md.uuid
$wheresql $wheresql
order by m.status desc,m.ts_accepted desc"; GROUP BY m.id,g.id, md.uuid,md.title,u.username,u.realname,m.status,md.id,md.author,m.ts_accepted
$ordersql";
$re = $this->db->query($sql); $re = $this->db->query($sql);
$rows = $re->fetchAll(); $rows = $re->fetchAll();
@ -239,15 +258,15 @@ class ReviewListener implements Zend_EventManager_ListenerAggregate
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
//email message //email message
if(isset($emails) &&is_array($emails) && count($emails)>0) if(isset($emails) &&is_array($emails) && count($emails)>0)
{ {
$config=Zend_Registry::get('config'); $config=Zend_Registry::get('config');
$mail=new WestdcMailer($config->smtp); $mail=new WestdcMailer($config->smtp);
$sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'"; $sql="select m.uuid,m.title from metadata m left join mdstatus s on m.uuid=s.uuid where s.id='$id'";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);
$res=$rs->fetch(); $res=$rs->fetch();
$mailtp=new EmailText($this->db,'metadata-publish',array('uuid'=>$res['uuid'],'title'=>$res['title'])); $mailtp=new EmailText($this->db,'metadata-publish',array('uuid'=>$res['uuid'],'title'=>$res['title']));
$mail->setBodyText($mailtp->getBody()); $mail->setBodyText($mailtp->getBody());
$mail->setFrom($config->service->email,'西部数据中心服务组'); $mail->setFrom($config->service->email,'西部数据中心服务组');
foreach($emails as $email) $mail->addTo($email); foreach($emails as $email) $mail->addTo($email);
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$mail->send(); $mail->send();

View File

@ -0,0 +1,50 @@
var sfadmin = {
def_data_tag : 'tbody',
def_select_input : '.select_item',
init: function() {
$('.select_rows').click(function () {
var tableid = $(this).data(sfadmin.def_data_tag);
$('#'+tableid).find(sfadmin.def_select_input).attr('checked', this.checked);
});
sfadmin.ajax.error();
},
getSelected : function(tableid){
if(tableid == "")
{
dom = $(sfadmin.def_select_input + ':checked');
}else{
dom = $(sfadmin.def_select_input + ':checked', '#'+tableid);
}
datas = new Array();
dom.each(function(index, element) {
datas.push($(this).val());
});
return datas;
},
ajax : {
error : function(){
$(document).ajaxError(function(event, request, settings) {
sfadmin.Alert("请求中发生错误");
})
}
},
setCookie : function (name,value){
var Days = 30;
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
},
getCookie : function (name){
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
},
delCookie : function(name){
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
},
Alert : function(content){
$.colorbox({width:'50%',html:'<div class="ajax_error"><div class="text"><h2>'+content+'</h2></div></div>'});
}
}