添加了数据版本查看功能,修改了文件列表的显示bug
This commit is contained in:
parent
eced991349
commit
b1cda37b4f
|
@ -522,7 +522,7 @@ class DataController extends Zend_Controller_Action
|
|||
* 根据id或uuid来查看元数据
|
||||
* id为一组数字,uuid为唯一标识符
|
||||
*/
|
||||
function viewAction()
|
||||
function viewAction()
|
||||
{
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
$sql="select m.*,s.status,g.id as gid,t.filename from normalmetadata m left join mdstatus s on m.uuid=s.uuid
|
||||
|
@ -621,6 +621,12 @@ class DataController extends Zend_Controller_Action
|
|||
//数据附件
|
||||
$sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
|
||||
$this->view->attachments = $this->db->fetchAll($sql);
|
||||
//数据版本
|
||||
$sql = "SELECT count(id) as c FROM mdversion WHERE uuid=? AND changelog IS NOT NULL";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid));
|
||||
$row = $sth->fetch();
|
||||
$this->view->version = $row;
|
||||
//自动跳转
|
||||
$sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?";
|
||||
$row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
|
||||
|
@ -632,6 +638,45 @@ class DataController extends Zend_Controller_Action
|
|||
}
|
||||
} //viewAction
|
||||
|
||||
/*
|
||||
getversionAction() 获取数据版本
|
||||
*/
|
||||
function getversionAction(){
|
||||
|
||||
$ac = $this->_getParam('ac');
|
||||
$uuid = $this->_getParam('uuid');
|
||||
|
||||
if($ac == 'list')
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$sql = "SELECT v.changelog,v.ts_created,u.username FROM mdversion v
|
||||
LEFT JOIN users u ON v.userid=u.id
|
||||
WHERE v.uuid=? AND v.changelog IS NOT NULL
|
||||
ORDER BY v.ts_created DESC";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
if($rows)
|
||||
{
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
$rows[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
|
||||
}
|
||||
$data = array("list"=>$rows);
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}else{
|
||||
$data = array("error"=>"处理中出现错误");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}//getversionAction()
|
||||
|
||||
function replace($string){
|
||||
$patterns = array("/\"/i","/\'/i");
|
||||
$replacements = array("“","‘");
|
||||
|
@ -1265,7 +1310,7 @@ class DataController extends Zend_Controller_Action
|
|||
$this->_helper->viewRenderer->setNoRender();
|
||||
//生成PDF
|
||||
$pdf = new ApplicantPDF();
|
||||
$pdf->template=$this->view->config->offline->template;
|
||||
$pdf->template=$this->view->config->offline->template;
|
||||
$formData['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']';
|
||||
$pdf->data = $formData;
|
||||
$pdf->drawWestdc();
|
||||
|
@ -1281,8 +1326,8 @@ class DataController extends Zend_Controller_Action
|
|||
//提交
|
||||
//生成PDF
|
||||
$pdf = new ApplicantPDF();
|
||||
$pdf->template=$this->view->config->offline->template;
|
||||
$pdf->data = $formData;
|
||||
$pdf->template=$this->view->config->offline->template;
|
||||
$pdf->data = $formData;
|
||||
$pdf->data['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']';
|
||||
$pdf->drawWestdc();
|
||||
$pdf->addRef($rows);
|
||||
|
@ -1632,5 +1677,10 @@ class DataController extends Zend_Controller_Action
|
|||
->setHeader('Pragma','public')
|
||||
->setBody($content);
|
||||
}
|
||||
|
||||
public function jsonexit($data){
|
||||
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,9 @@ endforeach;
|
|||
<ul>
|
||||
<li>元数据更新时间:<?php print date('Y-m-d',strtotime($md->ts_created)); ?> <a href="/service/xml/uuid/<?php echo $md->uuid;?>"><img src="/images/xml.gif" alt="查看XML源文件"></a><a href="/service/doc/uuid/<?php echo $md->uuid; ?>"><img src="/images/doc-icon.png" alt="Word doc格式"></a></li>
|
||||
<!--<li><a href="/data/detail/id/<?php echo $md->id;?>">详细元数据</a></li>-->
|
||||
<?php if($this->version->c>0):?>
|
||||
<li id="dataversion">数据版本:<a href="javascript:void(0);" onclick="dataVersion()" title=""><?= $this->version->c ?> 个 <img src="/images/list_extensions.gif" style="vertical-align:middle" /></a></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -466,7 +469,7 @@ function getSubFileList(uuid,id,depth){
|
|||
return false;
|
||||
}
|
||||
$('<div/>', {
|
||||
'style':'max-height:400px; overflow:auto; overflow-x:hidden;',
|
||||
'style':'overflow:auto;',
|
||||
'id': 'div_'+id,
|
||||
"html": '<li><img src="/images/loading.gif" />加载中</li>'
|
||||
}).appendTo('#li_'+id);
|
||||
|
@ -588,7 +591,41 @@ function cnkiSearch(keyword){
|
|||
});
|
||||
}
|
||||
|
||||
function dataVersion()
|
||||
{
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/data/getversion',
|
||||
'data':'ac=list&uuid=<?php echo $md->uuid; ?>',
|
||||
'success':onDataVersionLoad,
|
||||
'timeout': 30000,
|
||||
'error': function(){Alert('处理中出现错误,请刷新页面后重试');return false;}
|
||||
});
|
||||
|
||||
}
|
||||
function onDataVersionLoad(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.list)!='undefined')
|
||||
{
|
||||
var html = "";
|
||||
for(v in data.list)
|
||||
{
|
||||
html+='<li><p>'+data.list[v].changelog+'</p><p>'+data.list[v].ts_created+' by '+data.list[v].username+'</p></li>';
|
||||
}
|
||||
$.colorbox({'innerWidth':'50%','innerHeight':'80%','html':'<div class="datalist"><ul>'+html+'</ul></div>'});
|
||||
}
|
||||
}
|
||||
else{
|
||||
Alert('出现错误,请稍后再试');return false;
|
||||
}
|
||||
}
|
||||
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||
}
|
||||
function gmaploaded()
|
||||
{
|
||||
//google map
|
||||
|
|
|
@ -83,11 +83,9 @@ img{border:0px;}
|
|||
top:-3px;
|
||||
left:-3px;
|
||||
background:#FFFFFF none repeat scroll 0 0;
|
||||
border:1px solid #555555;
|
||||
font-weight:normal;
|
||||
padding:2px;
|
||||
position:relative;
|
||||
max-height:500px;
|
||||
overflow:auto;
|
||||
}
|
||||
#window-closer-container {
|
||||
|
@ -144,4 +142,13 @@ h2 {margin-top:10px;}
|
|||
#recommend .pagnv{width:35px;float:left;overflow:hidden;}
|
||||
.recommend .pagnv img{vertical-align:middle;}
|
||||
.recommend .pagnv .pleft{display:block;width:100%;}
|
||||
.recommend .pagnv .pright{display:block;width:100%;}
|
||||
.recommend .pagnv .pright{display:block;width:100%;}
|
||||
|
||||
.datalist{overflow:hidden;}
|
||||
.datalist ul li{margin:5px 0px;padding:5px 0px;background:#f6f6f6;border:1px solid #FFF;border-radius:3px;}
|
||||
.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{text-indent:24px;font-size:12px;line-height:24px;}
|
||||
.datalist ul li p img {vertical-align:middle;}
|
Loading…
Reference in New Issue