后台添加已发布数据的未发布版本浏览功能

This commit is contained in:
wlx 2015-02-16 02:13:26 +00:00
parent 0007081dbf
commit e97afc2e40
4 changed files with 156 additions and 2 deletions

View File

@ -2459,6 +2459,41 @@ group by m.uuid,m.title,m.description) md ON md.uuid=v.uuid
}
//未发布版本浏览
else if($ac=="unpublish")
{
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,gm.owner,v.id,u.username,u.realname FROM mdversion v
LEFT JOIN metadata md ON md.uuid=v.uuid
left join geonetworkmetadata gm on md.uuid=gm.uuid
left join users u on gm.owner=u.id
left join mdstatus st on md.uuid=st.uuid
WHERE md.title IS NOT NULL and v.changelog is null and st.status>4 ";
if(!empty($keywords))
{
$search=new Search($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
$sql.=" order by v.ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('version-unpublish');
}
//删除某个版本
else if($ac=="delete")
{

View File

@ -19,8 +19,11 @@
<!-- 页面内容 -->
<div class="col-md-10 col-sm-12">
<div class="form-group">
<a class="btn btn-primary btn-sm" href="/admin/data/version">所有版本概况</a>
<a class="btn btn-primary btn-sm" href="/admin/data/version/ac/bydata">逐数据浏览</a>
<ul class="nav nav-tabs" role="tablist">
<li class=""><a href="/admin/data/version">所有版本概况</a></li>
<li class=""><a href="/admin/data/version/ac/unpublish">已发布数据的未发布版本</a></li>
<li class="active"><a href="/admin/data/version/ac/bydata">逐数据浏览</a></li>
</ul>
</div>
<div class="input-group form-group">
<form id="datasearch" class="search_form input-group" action="/admin/data/version/ac/bydata">

View File

@ -0,0 +1,115 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/lib/colorbox/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/js/lib/colorbox/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('数据版本管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<!-- 左侧导航 -->
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div class="col-md-10 col-sm-12">
<div class="form-group">
<ul class="nav nav-tabs" role="tablist">
<li class=""><a href="/admin/data/version">所有版本概况</a></li>
<li class="active"><a href="/admin/data/version/ac/unpublish">已发布数据的未发布版本</a></li>
<li class=""><a href="/admin/data/version/ac/bydata">逐数据浏览</a></li>
</ul>
</div>
<?php
if (count($this->paginator)):
if ($this->mdtitle) echo "<h2>元数据:".$this->mdtitle."</h2>";
echo "<ul class=list-unstyled>";
$autoindex=0;
$edited=false;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'];?>" class="well well-sm">
<h4><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
<small><a class="" href="/admin/data/version/uuid/<?php echo $item['uuid']; ?>">查看此数据所有版本</a>
<?php if (!$edited && @$item['gid'])
{ $edited=true; echo '<a href="/service/geonetwork?url=metadata.edit?id='.$item['gid'].'" target="_blank">编辑最新版本</a> ';} ?>
</small></h4>
<p>版本创建时间: <?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?>
<?php if ($item['owner']) :
echo "修改者: ".(empty($item['realname'])?$item['username']:$item['realname'])." ";
endif;
?>
</p>
<h5>
<a class="label label-danger" onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete','<?php echo $item['id'];?>');" class="more">
<span class="glyphicon glyphicon-trash"> 删除</a></span>
<a class="label label-primary" class="label label-danger" onclick="return confirm('是否确定将这个版本恢复到geonetwork');" href="javascript:action('restore','<?php echo $item['id'];?>');" class="more">恢复到geonetwork</a>
<a class="label label-primary" href="/admin/data/version/ac/diff/id/<?php echo $item['id'];?>" class="more">与前一版对比</a>
<a class="label label-primary" href="/admin/data/version/ac/diff1/id/<?php echo $item['id'];?>" class="more">与前一发布或提交版对比</a>
<a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline label label-primary">提交评审发布</a>
</h5>
<?php if ($item['changelog']) : ?>
<p><?php echo $item['changelog']; ?></p>
<?php endif; ?>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function action(ac,id){
$.ajax({
'type':"POST",
'url':'/admin/data/version/',
'data':'ac='+ ac +'&id='+id,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{$('#changelog').val('');$('#commit_submit').attr('onclick','');}
}
else{
$.colorbox({'innerWidth':'50%','html':'<h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%", height:"50%"});
function commit(id){
action('commit&changelog='+$('#changelog').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="commitform">
<form>
<p>
<label>版本改动:</label><br />
<textarea rows="12" class="full" style="width:100%;" id="changelog"></textarea>
<br /><small>请输入此版本与之前版本的差别</small>
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-success pull-right" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>

View File

@ -23,6 +23,7 @@
<div class="form-group">
<ul class="nav nav-tabs" role="tablist">
<li class="<?php if(!$this->mdtitle) echo "active";?>"><a href="/admin/data/version">所有版本概况</a></li>
<li class=""><a href="/admin/data/version/ac/unpublish">已发布数据的未发布版本</a></li>
<li class=""><a href="/admin/data/version/ac/bydata">逐数据浏览</a></li>
</ul>
</div>