From a97d92402b4e637496083c3f8f166fe535a9987e Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 29 Sep 2011 07:55:05 +0000 Subject: [PATCH] =?UTF-8?q?Ticket=20#190=20=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E9=80=89=E6=8B=A9=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 86 ++++++++++++++++++- .../views/scripts/data/attachments.phtml | 17 +++- .../admin/views/scripts/data/attmanager.phtml | 62 +++++++++++++ application/admin/views/scripts/data/md.phtml | 2 +- 4 files changed, 164 insertions(+), 3 deletions(-) create mode 100644 application/admin/views/scripts/data/attmanager.phtml 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)): ?> +
+ uuid)) + echo ''; + ?> @@ -52,6 +57,10 @@ paginator as $item): ?> > + uuid)) + echo ''; + ?> -
选择描述 类型 大小
+ + +uuid)) +echo ''; +?> +
paginator; ?> diff --git a/application/admin/views/scripts/data/attmanager.phtml b/application/admin/views/scripts/data/attmanager.phtml new file mode 100644 index 00000000..51c21cd0 --- /dev/null +++ b/application/admin/views/scripts/data/attmanager.phtml @@ -0,0 +1,62 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('数据管理'); + $this->breadcrumb()->setSeparator(' > '); +?> +
+
+partial('data/left.phtml'); ?> +
+ + +msg or $this->messages) :?> +
+msg) : ?> +

msg; ?>

+messages): foreach($this->messages as $msg): ?> +

+ +
+ + +
+
为此元数据添加附件
+ + + + + + + + + + + + atts as $v) + { + if($v['filesize']<1048576) $v['filesize'] = round(($v['filesize']/1024),2).'KB'; else $v['filesize'] = round(($v['filesize']/1024/1024),2).'MB'; + echo ' + + + + + + + + '; + } + ?> +
描述类型大小下载次数上传时间操作
'.$v['filedesc'].''.$v['filetype'].''.$v['filesize'].''.$v['downtimes'].''.date('Y-m-d H:i:s',strtotime($v['ts_created'])).' + 从此元数据中移除 +
+
+
+ +
+
\ No newline at end of file diff --git a/application/admin/views/scripts/data/md.phtml b/application/admin/views/scripts/data/md.phtml index 509bd49c..722629ce 100644 --- a/application/admin/views/scripts/data/md.phtml +++ b/application/admin/views/scripts/data/md.phtml @@ -44,7 +44,7 @@ ,查看:次。 操作: 编辑 删除 - 同步 ] + 同步 附件管理
  • 数据贡献者: