diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 3bb6a7f8..6127a54d 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -605,17 +605,8 @@ class DataController extends Zend_Controller_Action $sql.=" 1<>1 limit 10"; $this->view->literature=$this->db->fetchAll($sql); //数据附件 - $sql = "select id from mdattach where uuid='$uuid'"; - $re = $this->db->query($sql); - $row = $re->fetch(); - if(empty($row['id'])) - { - $this->view->attachment = "无"; - } - else - { - $this->view->attachment = "有可下载的附件"; - } + $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 * from comments where uuid=? order by id desc"; $this->view->comments=$this->db->fetchAll($sql,array($uuid)); @@ -656,9 +647,15 @@ class DataController extends Zend_Controller_Action $formdata['email']=$user->email; } $commentForm->populate($formdata); - $this->view->commentForm=$commentForm; - - //metadata,keyword,series,category, + $this->view->commentForm=$commentForm; + //自动跳转 + $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)); + $jump=(int)$this->_request->getParam('jump'); + if ($row->has_pages && ($jump!=0)) + { + $this->_helper->viewRenderer($row->code.'/view',null,true); + } } /* * 数据评论,根据UUID读取 @@ -1266,7 +1263,7 @@ class DataController extends Zend_Controller_Action $atts = $re->fetchAll(); $zip = new ZipArchive(); - $url=Zend_Registry::get('upload')."tmp/attachments_$uuid.zip";//创建临时文件 + $url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件 $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); if( $opened !== true ){ die("cannot open {$url} for writing."); @@ -1276,9 +1273,9 @@ class DataController extends Zend_Controller_Action foreach ($atts as $k=>$v) { - if (is_file(Zend_Registry::get('upload').$v['filename'])) { + if (is_file($this->view->config->upload.$v['filename'])) { $updates[]=$v['id']; - $zip->addFile(Zend_Registry::get('upload').$v['filename'],'/'.basename($v['filename'])); + $zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename'])); } } $zip->close();