diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 0ef9793e..ebc6e99f 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -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; + } } diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index a7c103d9..2a109edc 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -150,6 +150,9 @@ endforeach; @@ -466,7 +469,7 @@ function getSubFileList(uuid,id,depth){ return false; } $('
', { - 'style':'max-height:400px; overflow:auto; overflow-x:hidden;', + 'style':'overflow:auto;', 'id': 'div_'+id, "html": '
  • 加载中
  • ' }).appendTo('#li_'+id); @@ -588,7 +591,41 @@ function cnkiSearch(keyword){ }); } +function dataVersion() +{ + $.ajax({ + 'type':"POST", + 'url':'/data/getversion', + 'data':'ac=list&uuid=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+='
  • '+data.list[v].changelog+'

    '+data.list[v].ts_created+' by '+data.list[v].username+'

  • '; + } + $.colorbox({'innerWidth':'50%','innerHeight':'80%','html':'
    '}); + } + } + else{ + Alert('出现错误,请稍后再试');return false; + } +} +function Alert(html){ + $.colorbox({'innerWidth':'50%','html':'

    '+html+'

    '}); +} function gmaploaded() { //google map diff --git a/htdocs/css/watermdview.css b/htdocs/css/watermdview.css index c0c6719d..f5c46c01 100644 --- a/htdocs/css/watermdview.css +++ b/htdocs/css/watermdview.css @@ -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%;} \ No newline at end of file +.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;} \ No newline at end of file