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 @@ = $this->partial('data/left.phtml'); ?>