From 6b2edc0adc1fee309aedb5cadf3d65717d44a590 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 17 May 2012 10:00:27 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=96=87=E7=8C=AE=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=E4=B9=8B=E5=89=8D=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AuthorController.php | 66 ++++++++- .../scripts/author/document-upload.phtml | 4 +- .../views/scripts/author/literature-add.phtml | 133 ++++++++++++++++++ .../scripts/author/literature-bydata.phtml | 30 ++-- .../views/scripts/author/literature.phtml | 49 +++---- htdocs/static/js/jquery-1.7.2.min.js | 4 + 6 files changed, 234 insertions(+), 52 deletions(-) create mode 100644 application/default/views/scripts/author/literature-add.phtml create mode 100644 htdocs/static/js/jquery-1.7.2.min.js diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 693cc567..eb847a2d 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -2415,6 +2415,9 @@ class AuthorController extends Zend_Controller_Action //添加文献信息 else if($ac == "add") { + $submit = $this->_request->getParam('submit'); + if(!empty($submit)) + { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); @@ -2423,6 +2426,7 @@ class AuthorController extends Zend_Controller_Action $uuid = $this->_request->getParam('uuid'); $ref=$this->_request->getParam('ref'); $reftype=$this->_request->getParam('reftype'); + $url = $this->_request->getParam('url'); if(empty($uuid) || empty($ref) || !is_numeric($reftype)) { $data = array("error"=>"参数错误"); @@ -2449,7 +2453,7 @@ class AuthorController extends Zend_Controller_Action { $sql="insert into reference (reference,link) values(?,?)"; $sth = $this->db->prepare($sql); - $sth->execute(array(trim($ref),'')); + $sth->execute(array(trim($ref),$url)); $sql="select id from reference where reference=?"; $sth = $this->db->prepare($sql); $sth->execute(array(trim($ref))); @@ -2477,6 +2481,11 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } + }else{ + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer('literature-add'); + $this->view->uuid = $this->_request->getParam('uuid'); + } }//添加文献 //删除某个文献 @@ -2520,8 +2529,59 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } - } - } + } + + //文献附件上传 + else if($ac=='upload') + { + + $this->_helper->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $uuid = $this->_getParam('uuid'); + + try{ + + $files=new files(); + $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'md'); + + if(empty($msg['error'])) + { + $msg['error']=""; + $filename = $msg['db_path']; + $filesize = $msg['file_size']; + $filedesc = $this->_request->getParam('filedesc'); + $filetype = $msg['file_type']; + $realname = $msg['realname']; + + + $sql = "insert into attachments (filename,filetype,filedesc,userid,filesize,realname) values ('$filename','$filetype','$filedesc','$u_id','$filesize','$realname') RETURNING id"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $att = $sth->fetch(PDO::FETCH_ASSOC); + $msg['attid'] = $attid = $att['id']; + + $msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]
'; + echo Zend_Json::encode($msg); + exit(); + + + + }else{ + $msg['error'] = '附件上传失败:'.$msg['error']; + @unlink($filename); + echo Zend_Json::encode($msg); + exit(); + } + + }catch(Exception $e){ + $msg['error'] = "错误:".$e->getMessage(); + echo Zend_Json::encode($msg); + exit(); + } + }//文件上传 + + }//文献管理 //文档管理 function documentAction(){ diff --git a/application/default/views/scripts/author/document-upload.phtml b/application/default/views/scripts/author/document-upload.phtml index 0f867f19..0871373d 100644 --- a/application/default/views/scripts/author/document-upload.phtml +++ b/application/default/views/scripts/author/document-upload.phtml @@ -3,7 +3,7 @@ 数据上传 - + @@ -111,7 +111,7 @@ function Submit(){ function deleteatt(attid){ $.ajax({ type:"POST", - url:'/submit/upload/ac/del/id/'+attid, + url:'/service/delreviewatt/id/'+attid, data:'', success:function(html){ $('#uploadedItem_'+attid).remove(); diff --git a/application/default/views/scripts/author/literature-add.phtml b/application/default/views/scripts/author/literature-add.phtml new file mode 100644 index 00000000..045a7ee9 --- /dev/null +++ b/application/default/views/scripts/author/literature-add.phtml @@ -0,0 +1,133 @@ + + + + +数据上传 + + + + + + + + + + + + + +
+
+ +
+
+

+
+
+ + 数据作者的文献 + 数据用户的文献
+ +

+
+ +

+

+

+

+
+ +

+
+
+
+
+ + + + diff --git a/application/default/views/scripts/author/literature-bydata.phtml b/application/default/views/scripts/author/literature-bydata.phtml index 0163967e..02b5e2c9 100644 --- a/application/default/views/scripts/author/literature-bydata.phtml +++ b/application/default/views/scripts/author/literature-bydata.phtml @@ -2,9 +2,9 @@ $this->headTitle($this->config->title->site); $this->headTitle($this->config->title->author); $this->headTitle()->setSeparator(' - '); -$this->headScript()->appendFile('/js/jquery-1.7.min.js'); +$this->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->headScript()->appendFile('/js/jquery.colorbox-min.js'); -$this->headLink()->appendStylesheet('/css/author.css'); +$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/colorbox.css'); $this->breadcrumb('首页'); $this->breadcrumb('数据作者'); @@ -23,7 +23,7 @@ $this->breadcrumb()->setSeparator(' > ');
@@ -42,9 +42,9 @@ $this->breadcrumb()->setSeparator(' > '); $autoindex++;?>
  • -

    共有数据文献篇。 - 【 查看详细 - | 添加文献 +

    共有数据文献篇。 + 【 查看详细 + | 添加文献

  • 处理中出现错误,请刷新页面后重试

    '}); } }); -} -$(".inline").colorbox({inline:true, width:"50%"}); +} +$(".iframe").colorbox({iframe:true, width:"60%", height:"80%"}); +$(".inline").colorbox({inline:true, width:"50%"}); function commit(id){ action('add&ref='+$('#ref').val()+'&reftype='+$('#reftype').val(),id); } - +