diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index c7768085..4989e19b 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -232,6 +232,7 @@ class Admin_DataController extends Zend_Controller_Action $down=(int)$this->_getParam('down'); $search = $this->_getParam('search'); $keyword = $this->_getParam('keyword'); + $att=$this->_getParam('att'); if ($delete) { @@ -243,7 +244,81 @@ class Admin_DataController extends Zend_Controller_Action $this->messenger->addMessage($e->getMessage()); } $this->_redirect("/admin/data/md"); - } elseif ($down) { + }//删除 + + elseif($att>0){ + $submit=$this->_request->getParam('submit'); + $uuid=$this->_request->getParam('uuid'); + $atts=$this->_request->getParam('ids'); + $addatts=$this->_request->getParam('addatts'); + + $this->view->id = $att; + $this->view->uuid = $uuid; + + if(!empty($addatts)) + { + + if(empty($submit)) + { + $sql = "select title from metadata where uuid='$uuid'"; + $re = $this->db->query($sql); + $rows = $re->fetch(); + + + $this->view->id = $att; + $this->view->uuid = $uuid; + $this->view->mdtitle = $rows['title']; + $this->view->thisatt = $rows; + + $this->_redirect("/admin/data/attachments/uuid/$uuid/mdtitle/{$rows['title']}"); + } + else + { + if(!empty($uuid)) + { + foreach($atts as $v) + { + $sql = "insert into mdattach (uuid,id) values ('$uuid','$v')"; + try{ + $this->db->exec($sql); + $this->messenger->addMessage('成功添加附件:'.$v); + }catch (Exception $e) + { + $this->messenger->addMessage('添加附件失败:'.$v); + } + } + $this->_redirect("/admin/data/md/att/1/uuid/$uuid"); + } + } + }//empty($addatts) + else + { + if(!empty($uuid)) + { + + $sql = "select m.*,a.*,d.title from mdattach m + left join attachments a on m.id = a.id + left join metadata d on m.uuid=d.uuid where m.uuid='$uuid'"; + $re = $this->db->query($sql); + + $rows = $re->fetchAll(); + + $sql = "select title from metadata where uuid='$uuid'"; + $re = $this->db->query($sql); + $title = $re->fetch(); + + $this->view->atts=$rows; + $this->view->mdtitle = $title['title']; + + $this->_helper->viewRenderer('attmanager'); + } + + + } + + }//编辑附件 + + elseif ($down) { $zip = new ZipArchive(); $url="/tmp/xml.zip"; $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); @@ -734,6 +809,14 @@ class Admin_DataController extends Zend_Controller_Action $delete = $this->_request->getParam('delete'); $edit = $this->_request->getParam('edit'); $down = $this->_request->getParam('down'); + $uuid = $this->_request->getParam('uuid'); + $mdtitle = $this->_request->getParam('mdtitle'); + + if(!empty($uuid)&&!empty($mdtitle)) + { + $this->view->uuid= $uuid; + $this->view->mdtitle=$mdtitle; + } if($add && empty($edit)) { @@ -938,6 +1021,7 @@ class Admin_DataController extends Zend_Controller_Action else { + $sql="select * from attachments order by id desc"; $re= $this->db->query($sql); $rows = $re->fetchAll(); diff --git a/application/admin/views/scripts/data/attachments.phtml b/application/admin/views/scripts/data/attachments.phtml index 68af4811..2ae4e37f 100644 --- a/application/admin/views/scripts/data/attachments.phtml +++ b/application/admin/views/scripts/data/attachments.phtml @@ -38,8 +38,13 @@ paginator)): ?> +
msg; ?>
+messages): foreach($this->messages as $msg): ?> + + +描述 | +类型 | +大小 | +下载次数 | +上传时间 | +操作 | +
---|---|---|---|---|---|
'.$v['filedesc'].' | +'.$v['filetype'].' | +'.$v['filesize'].' | +'.$v['downtimes'].' | +'.date('Y-m-d H:i:s',strtotime($v['ts_created'])).' | ++ 从此元数据中移除 + | +