元数据管理中增加了存档的查看和修改功能,修改了元数据管理列表的调用sql和样式

This commit is contained in:
Li Jianxuan 2012-06-13 10:12:30 +00:00
parent 0e70c35397
commit 62143e2438
4 changed files with 194 additions and 28 deletions

View File

@ -249,6 +249,13 @@ class Admin_DataController extends Zend_Controller_Action
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator;
}
/*
*
* mdAction()
* 元数据管理
*
*/
function mdAction()
{
$delete=(int)$this->_getParam('delete');
@ -444,13 +451,18 @@ class Admin_DataController extends Zend_Controller_Action
}//search
else{
$select=$this->db->select();
$select->from('metadata')
->joinLeft('mdstat','metadata.uuid=mdstat.uuid','viewed')
->joinLeft('geonetworkmetadata','geonetworkmetadata.uuid=metadata.uuid','id as gid')
->joinLeft('mdstatus','metadata.uuid=mdstatus.uuid','status as mdstatus')
->order('metadata.id desc');
$paginator = Zend_Paginator::factory($select);
$sql = "SELECT md.*,s.viewed,g.id as gid,st.status as mdstatus,ds.id as datasetid FROM metadata md
LEFT JOIN mdstat s ON md.uuid=s.uuid
LEFT JOIN geonetworkmetadata g ON g.uuid=md.uuid
LEFT JOIN mdstatus st ON md.uuid=st.uuid
LEFT JOIN dataset ds ON md.uuid=ds.uuid
ORDER BY md.id DESC";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
@ -458,7 +470,65 @@ class Admin_DataController extends Zend_Controller_Action
$this->view->paginator=$paginator;
}
}//mdAction 元数据管理
/*
* datasetAction()
* 数据存档
*
*/
function datasetAction()
{
$ac = $this->_request->getParam('ac');
if($ac == "getdataset")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer('md-dataset');
$uuid = $this->_request->getParam('uuid');
$sql = "SELECT * FROM dataset WHERE uuid=?";
$sth = $this->db->prepare($sql);
$sth ->execute(array($uuid));
$row = $sth->fetch();
$this->view->dataset = $row;
}
if($ac == "update")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->_request->getParam('uuid');
$host = $this->_getParam('host');
$path = $this->_getParam('path');
$sql = "UPDATE dataset SET host=?,path=? WHERE uuid=?";
$sth = $this->db->prepare($sql);
$ds = $sth ->execute(array($host,$path,$uuid));
if($ds)
{
$data = array("ok"=>1);
$this->jsonexit($data);
return true;
}else{
$data = array("error"=>"处理中出现错误");
$this->jsonexit($data);
return true;
}
}
}//datasetAction存档管理
/*
* commentAction()
* 反馈管理
*/
function commentAction()
{
$delete=(int)$this->_getParam('delete');

View File

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据存档</title>
<link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
<link href="/static/js/uploadify/uploadify.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
<style>
#loading{margin:0px;border:none;height:50px;width:98%;background:url(/static/img/colorbox-images/loading.gif) center center no-repeat;display:none;position:absolute;left:0px;top:0px;overflow:hidden;background:#ccc;}
</style>
</head>
<body>
<!-- 页面内容 -->
<div id="warpper">
<div id="loading" class="info info-box"></div>
<div id="datalist">
<?php
if(isset($this->dataset))
{?>
<p>主机:<br /><input type="text" id="host" name="host" value="<?= $this->dataset['host']?>" class="full" /></p>
<p>路径:<br /><input type="text" id="path" name="path" value="<?= $this->dataset['path']?>" class="full" /></p>
<p><button type="button" class="btn btn-green" onclick="updateDataSet()">修改</button></p>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
function updateDataSet(){
if(confirm("是否确定修改") == false)
{return false;}
$.ajax({
'type':"POST",
'url':'/admin/data/dataset',
'data':'ac=update&uuid=<?= $this->dataset['uuid']?>&host='+$('#host').val()+'&path='+$('#path').val(),
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(data.ok != null)
{
Alert('修改成功!');
setTimeout("parent.$.fn.colorbox.close();parent.window.location.href=parent.window.location.href;",2000);
}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"50%"});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
</script>
</body>
</html>

View File

@ -8,6 +8,9 @@
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('元数据管理</a>');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
@ -37,30 +40,43 @@
<a href="/admin/data/md/down/1">下载全部xml元数据</a>
<?php if (count($this->paginator)): ?>
<div id="metadata">
<div class="datalist">
<ul>
<?php foreach ($this->paginator as $item): ?>
<ul><li><a href="/data/<?= $item['uuid']; ?>"><?= $item['title']; ?></a>
大小:<?= $item['filesize']; ?>M创建时间<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
<li><p><a href="/data/<?= $item['uuid']; ?>" class="title"><?= $item['title']; ?></a></p>
<p>大小:<?= $item['filesize']; ?>M创建时间<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
,查看:<?= $item['viewed']; ?>次。 操作:
<a href="/service/geonetwork?url=metadata.edit?id=<?= $item['gid']; ?>" target="_blank">编辑</a>
<a href="/admin/data/md/delete/<?= $item['id']; ?>">删除</a>
<a href="/admin/data/sync/uuid/<?= $item['uuid']; ?>">同步</a>
<a href="/admin/data/reference/show/<?php echo $item['uuid'];?>">文献管理</a>
<a href="/admin/data/md/att/1/uuid/<?php echo $item['uuid'];?>">附件管理</a>
<a href="/admin/data/comment/uuid/<?php echo $item['uuid'];?>">反馈管理</a>
<a href="/admin/data/author/uuid/<?php echo $item['uuid'];?>">作者管理</a>
<a href="/admin/data/version/uuid/<?php echo $item['uuid'];?>">版本管理</a>
<a href="/service/geonetwork?url=metadata.edit?id=<?= $item['gid']; ?>" target="_blank">编辑</a> |
<a href="/admin/data/md/delete/<?= $item['id']; ?>">删除</a> |
<a href="/admin/data/sync/uuid/<?= $item['uuid']; ?>">同步</a> |
<a href="/admin/data/reference/show/<?php echo $item['uuid'];?>">文献管理</a> |
<a href="/admin/data/md/att/1/uuid/<?php echo $item['uuid'];?>">附件管理</a> |
<a href="/admin/data/comment/uuid/<?php echo $item['uuid'];?>">反馈管理</a> |
<a href="/admin/data/author/uuid/<?php echo $item['uuid'];?>">作者管理</a> |
<a href="/admin/data/version/uuid/<?php echo $item['uuid'];?>">版本管理</a> |
<?php if (@!is_numeric($item['mdstatus'])) : ?>
<a href="/admin/review/addon/uuid/<?php echo $item['uuid'];?>">放入元数据评审</a>
<a href="/admin/review/addon/uuid/<?php echo $item['uuid'];?>">放入元数据评审</a> |
<?php endif; ?>
<a href="/admin/data/source/do/datasource/uuid/<?php echo $item['uuid'];?>">编辑数据来源</a>
</li>
<li>数据贡献者:<?= $item['author']; ?></li>
<li><?= $item['description']; ?></li>
</ul>
<a href="/admin/data/source/do/datasource/uuid/<?php echo $item['uuid'];?>">编辑数据来源</a> |
<?php if($item['datasetid']):?>
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">存档</a>
<?php endif;?>
</p>
<?php if($item['author']) :?>
<p>数据贡献者:<?= $item['author']; ?></p>
<?php endif;?>
<p class="content"><?= $item['description']; ?></p>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php echo $this->paginator; ?>
</div>
<script>
$(".iframe").colorbox({iframe:true, width:"50%", height:"50%"});
$(".inline").colorbox({inline:true, width:"50%"});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
</script>

View File

@ -373,3 +373,14 @@ fieldset small {
}
.tables{width:320px;float:left;}
.tables .stitle{width:100%;font-size:16px;font-weight:bold;}
.datalist{overflow:hidden;width:100%;}
.datalist ul{overflow:hidden;}
.datalist ul li{margin:5px 0px;padding:5px 0px;background:#f6f6f6;border:1px solid #FFF;border-radius:3px;word-break:break-all;width:99%;}
.datalist ul li:hover,#datalist ul li:focus{border:1px solid #ccc;background:#fefefe;}
.datalist ul li a{font-size:12px;}
.datalist ul li a.title{font-size:14px;}
.datalist ul li a.more{font-size:12px;}
.datalist ul li p{font-size:12px;line-height:24px;word-break:break-all;white-space:normal;padding:5px;}
.datalist ul li p.content{text-indent:24px;}
.datalist ul li p img {vertical-align:middle;}