diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 9073e0e6..2f074e51 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -1297,6 +1297,13 @@ class Admin_DataController extends Zend_Controller_Action exit(); } + if($user->usertype!='administrator') + { + $msg['error'] = "您无权使用此功能"; + echo Zend_Json::encode($msg); + exit(); + } + $files=new files(); $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'md'); @@ -1319,7 +1326,7 @@ class Admin_DataController extends Zend_Controller_Action $sql = "insert into mdattach (uuid,id) values ('$uuid','$attid')"; if($this->db->exec($sql)) { - $msg['html'] = $realname.'[已完成]
'; + $msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]
'; echo Zend_Json::encode($msg); exit(); }else{ @@ -1343,6 +1350,41 @@ class Admin_DataController extends Zend_Controller_Action exit(); } }// uploadAction ajax上传附件 + + function getattsAction(){ + + $this->_helper->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $uuid = $this->_request->getParam('uuid'); + + if($uuid!='') + { + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + $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'"; + $rs = $this->db->query($sql); + $atts = $rs->fetchAll(); + foreach($atts as $k=>$v) + { + $atts[$k]['html']=$v['realname'].'['. round($v['filesize']/1024,2) .' kb]
'; + } + echo Zend_Json::encode($atts); + exit(); + }else + { + exit(); + } + }else{ + exit(); + } + //不输出错误 + }//获取附件 /* 获得单个文件的信息 diff --git a/application/admin/views/scripts/data/attachmentsadd.phtml b/application/admin/views/scripts/data/attachmentsadd.phtml index 6f252bdf..b385244c 100644 --- a/application/admin/views/scripts/data/attachmentsadd.phtml +++ b/application/admin/views/scripts/data/attachmentsadd.phtml @@ -16,15 +16,24 @@ partial('data/left.phtml'); ?>
-msg or $this->messages) :?> -
-msg) : ?> -

msg; ?>

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

- + + - + +hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + echo $user->usertype; + } + +?> +
@@ -81,5 +90,21 @@ $('#file_upload').uploadify({ } }); } + + $.getJSON("/admin/data/getatts/uuid/uuid;?>", function(data) { + if(data) + { + $.each(data, function(key, val) { + $('
  • ', { + "id":'uploadedItem_'+val['id'], + "class":'uploadifyQueueItem', + "html": val['html'] + }).appendTo('#datalist'); + $('#deletebtn_'+val['id']).bind('click', function() { + deleteatt(val['id']); + }); + }); + } + }); }); \ No newline at end of file diff --git a/application/admin/views/scripts/data/attmanager.phtml b/application/admin/views/scripts/data/attmanager.phtml index feaeadb2..23bd7929 100644 --- a/application/admin/views/scripts/data/attmanager.phtml +++ b/application/admin/views/scripts/data/attmanager.phtml @@ -26,16 +26,17 @@ - + - + '.date('Y-m-d H:i:s',strtotime($v['ts_created'])).''; }
    文件名文件名 类型 大小 下载次数 上传时间操作操作
    从此元数据中移除 + 下载