From a36fecad2a7f5303d8b9674a964d56bbd77dcdbc Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 9 Oct 2013 08:03:47 +0000 Subject: [PATCH] merge heihedata branch from r3925 to r3955. --- .../admin/controllers/DataController.php | 112 +++++++-- .../admin/controllers/DownController.php | 30 ++- .../admin/views/scripts/data/ref-add.phtml | 16 +- .../admin/views/scripts/data/ref-files.phtml | 105 +++++++++ .../views/scripts/data/ref-multiupload.phtml | 120 ++++++++++ .../admin/views/scripts/data/ref-nav.phtml | 1 + .../admin/views/scripts/data/ref.phtml | 126 +++------- .../admin/views/scripts/data/reference.phtml | 2 +- .../admin/views/scripts/down/offlineapp.phtml | 2 +- .../admin/views/scripts/post-message.phtml | 4 +- .../default/controllers/AccountController.php | 15 +- application/models/Dataorder.php | 8 +- application/module/Helpers/Table.php | 6 + application/module/Helpers/View.php | 27 ++- application/module/Order/Order.php | 28 ++- .../module/Order/listener/OrderListener.php | 1 + application/module/Order/mount/PdfOperate.php | 21 ++ .../module/Reference/Event/ReferenceEvent.php | 1 + .../Reference/Handler/ReferenceHandler.php | 32 ++- .../Reference/Listener/ReferenceListener.php | 1 + application/module/Reference/Reference.php | 216 ++++++++++++++++-- 21 files changed, 712 insertions(+), 162 deletions(-) create mode 100644 application/admin/views/scripts/data/ref-files.phtml create mode 100644 application/admin/views/scripts/data/ref-multiupload.phtml diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 616c90fc..88297844 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -1,6 +1,7 @@ db->select(); - $select->from('mdref',array('id as mdid','refid','place')) - ->join('metadata','metadata.uuid=mdref.uuid') - ->join('reference','reference.id=mdref.refid') - ->order('metadata.ts_created desc') - ->order('mdref.place'); - $paginator = Zend_Paginator::factory($select); + else{ + $sql="select m.title as mdtitle,m.uuid,mr.id as mdid,mr.refid,mr.place,r.reference + from mdref mr right join metadata m on mr.uuid=m.uuid + left join reference r on mr.refid=r.id + order by m.ts_created desc,mr.place"; + $re=$this->db->query($sql); + $row=$re->fetchAll(); + $paginator = Zend_Paginator::factory($row); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(30); $paginator->setView($this->view); @@ -1122,13 +1123,36 @@ class Admin_DataController extends Zend_Controller_Action { $this->view->ac = $ac = $this->_getParam('ac'); $submit = $this->_getParam('submit'); + $keyword = $this->view->q = trim($this->_getParam('q')); + $order = $this->view->search_order = trim($this->_getParam('order')); + $sort = $this->view->search_sort = trim($this->_getParam('sort')); $reference = new Reference(); + if(!empty($keyword)) + { + $reference->keyword = $keyword; + } + + if(!empty($order)) + { + $reference->order = $order; + } + + if(!empty($sort)) + { + $reference->sort = $sort; + } + //文献首页 if(empty($ac)) { - view::addPaginator($reference->fetchReferences(),$this,10); + view::addPaginator($reference->fetchReferences(),$this,12); + return true; + } + else if ($ac == "water") + { + view::addPaginator($reference->fetchThemeReferences('water'),$this,10); return true; } @@ -1137,9 +1161,13 @@ class Admin_DataController extends Zend_Controller_Action { $this->_helper->viewRenderer('ref-add'); $id = $this->_getParam('id'); + $attid = $this->_getParam('attid'); if(!empty($submit)) { + $this->view->data = $reference->getReferenceParam(); + $attid = $this->view->data['attid']; + if(empty($id) || !is_numeric($id)) { $status = $reference->reference(); @@ -1154,18 +1182,30 @@ class Admin_DataController extends Zend_Controller_Action if(!empty($id)) { $msg = "文献修改成功!"; + view::Post($this,$msg,-2); + return true; }else{ $msg = "文献添加成功!"; + view::Post($this,$msg,"/admin/data/ref/ac/add"); + return true; } - view::Post($this,$msg,"/admin/data/ref/ac/add"); } }else{ + $this->view->data = array(); if(!empty($id) && is_numeric($id)) { $this->view->data = $reference->getOneReferenceData($id); } } + if(!empty($attid)) + { + $files = new Files(); + $attfile = $files->getOne($attid); + $this->view->data['attid'] = $attid; + $this->view->data['file'] = $attfile; + } + return true; } @@ -1174,7 +1214,12 @@ class Admin_DataController extends Zend_Controller_Action { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - $statu = $reference->uploadReferencePdf($_FILES['Filedata']); + $autoread = false; + if($this->_getParam('multi')) + { + $autoread = true; + } + $statu = $reference->uploadReferencePdf($_FILES['Filedata'],$autoread); $this->jsonexit($statu); return true; } @@ -1189,6 +1234,35 @@ class Admin_DataController extends Zend_Controller_Action return true; } + //批量上传 + if($ac == "multiupload") + { + $this->_helper->viewRenderer('ref-multiupload'); + return true; + } + + //文件管理 + if($ac == "files") + { + $this->_helper->viewRenderer('ref-files'); + view::addPaginator($reference->getReferenceFiles(),$this,10); + return true; + } + + //删除文献 + if($ac == "deleteref") + { + $refid = $this->_getParam('id'); + if($reference->deleteReference($refid)) + { + view::Post($this,"删除成功!",-1); + }else{ + view::Post($this,"删除失败!",-1); + } + return true; + } + + }//文献管理 refAction() /* @@ -2567,7 +2641,7 @@ class Admin_DataController extends Zend_Controller_Action }else{ $mail->addTo($this->debug_email); } - @$mail->send(); + //@$mail->send(); $data = array("commited"=>1,"error"=>'该版本已经成功发布!'); $this->jsonexit($data); @@ -3488,13 +3562,13 @@ class Admin_DataController extends Zend_Controller_Action if(empty($uuid)) { $rows = $fund->fetch(NULL,true,0,$keyword); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); }else{ include('data/Metadata.php'); $md = new Metadata($this->db); $this->view->md = $md->view($uuid); $rows = $fund->fetch($uuid); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); } return true; } @@ -3504,7 +3578,7 @@ class Admin_DataController extends Zend_Controller_Action $this->_helper->viewRenderer('fund-data-list'); $this->view->q = $q = $this->_getParam('q'); $rows = $fund->fetchFromData(true,0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; } @@ -3515,7 +3589,7 @@ class Admin_DataController extends Zend_Controller_Action $id = $this->_getParam('id'); $this->view->fund = $fund->view($id); $rows = $fund->fetchFromData($id,0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; } @@ -3647,7 +3721,7 @@ class Admin_DataController extends Zend_Controller_Action $md = new Metadata($this->db); $this->view->md = $md->view($uuid); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; }//formd @@ -3695,7 +3769,7 @@ class Admin_DataController extends Zend_Controller_Action } $rows = $fund->getData($id,$keyword); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); } }//fund @@ -3716,7 +3790,7 @@ class Admin_DataController extends Zend_Controller_Action if(empty($uuid)) { $rows = $doi->fetch(0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); }else{ $this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid); return true; diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index c153ee28..b28592ff 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -170,6 +170,7 @@ class Admin_DownController extends Zend_Controller_Action //离线数据申请管理 function offlineappAction() { + set_time_limit(0); include_once("Dataorder.php"); $DO = new Dataorder($this->db); @@ -181,8 +182,23 @@ class Admin_DownController extends Zend_Controller_Action $page =(int)$this->_getParam('page'); $reset =(int)$this->_getParam('reset'); $status =(int)$this->_getParam('status'); + $ac = $this->_getParam('ac'); $q = $this->_getParam('q'); + if($ac == "pending") + { + $keyword = ""; + if(!empty($q)) + { + $keyword = $q; + } + + $rows = $DO->fetchAllOfflineApp(3,$keyword); + + view::addPaginator($rows,$this,10); + return true; + } + if (!$page) $page=1; if ($view) { //查看此次申请的pdf @@ -215,10 +231,10 @@ class Admin_DownController extends Zend_Controller_Action //如果是wsn数据则生成数据 $dataservice = new DataService(); - $offlineapp = new Offlineapp(); - if ($offlineapp->hasWsnData($start)) - { - @$dataservice->makeWsnData(array('uid'=>$row['userid'],'action'=>'prepare')); + $offlineapp = new Offlineapp(); + if ($offlineapp->hasWsnData($start)) + { + @$dataservice->makeWsnData(array('uid'=>$row['userid'],'action'=>'prepare')); } $sql="select applicationform as pdflink from offlineapp where id=?"; @@ -547,14 +563,14 @@ class Admin_DownController extends Zend_Controller_Action //$this->_redirect('/admin/down/offlineapp/'.$page); } - //如果是wsn数据则生成数据 + //如果是wsn数据则生成数据 //wsn数据在ftp服务器端进行处理 /*$dataservice = new DataService(); @$dataservice->makeWsnData();*/ $sql="update dataorder set status=5,ts_approved=now() where offlineappid=?"; $this->db->query($sql,array($finish)); - $sql="update offlineapp set ts_approved=now() where id=? and ts_approved is null"; + $sql="update offlineapp set ts_approved=now(),status=5 where id=? and ts_approved is null"; $this->db->query($sql,array($finish)); $sql="select * from offlineapp where id=?"; $row=$this->db->fetchRow($sql,array($finish)); @@ -1122,7 +1138,7 @@ class Admin_DownController extends Zend_Controller_Action } $select=$this->db->select(); - $select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status=0')->order('ts_created desc'); + $select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status>=0')->order('ts_created desc'); $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage($this->view->config->page->max); diff --git a/application/admin/views/scripts/data/ref-add.phtml b/application/admin/views/scripts/data/ref-add.phtml index e9b4f818..ed074b1c 100644 --- a/application/admin/views/scripts/data/ref-add.phtml +++ b/application/admin/views/scripts/data/ref-add.phtml @@ -45,6 +45,12 @@ table thead tr th {background:#EBF2F6;} +
+ +
+ "> +
+
@@ -58,9 +64,15 @@ table thead tr th {background:#EBF2F6;}
- +
- + +
+
+
+ +
+
diff --git a/application/admin/views/scripts/data/ref-files.phtml b/application/admin/views/scripts/data/ref-files.phtml new file mode 100644 index 00000000..9bf1e160 --- /dev/null +++ b/application/admin/views/scripts/data/ref-files.phtml @@ -0,0 +1,105 @@ +headTitle($this->config->title->site); +$this->headTitle('后台管理'); +$this->headTitle()->setSeparator(' - '); +$this->breadcrumb('首页'); +$this->breadcrumb('数据管理'); +$this->breadcrumb('文献管理'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +$this->theme->AppendPlus($this,'admin_plugin'); +?> + +
+
+ partial('data/left.phtml'); ?> +
+
+
+ partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?> +
+
+
+
+ + +
+
+
+ error)) { ?> + error ?> + + msg)) { ?> + msg ?> + +
+ paginator)): ?> + + + + + + + + + + paginator as $item): + $autoindex++;?> + + + + + + + +
文件名状态操作
未编辑':"已编辑" ?> + 编辑 + 删除 +
+ + +
+ +
+
+ + \ No newline at end of file diff --git a/application/admin/views/scripts/data/ref-multiupload.phtml b/application/admin/views/scripts/data/ref-multiupload.phtml new file mode 100644 index 00000000..c2cdb1bf --- /dev/null +++ b/application/admin/views/scripts/data/ref-multiupload.phtml @@ -0,0 +1,120 @@ +headTitle($this->config->title->site); +$this->headTitle('后台管理'); +$this->headTitle()->setSeparator(' - '); +$this->breadcrumb('首页'); +$this->breadcrumb('数据管理'); +$this->breadcrumb('文献管理'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +$this->theme->AppendPlus($this,"uploadify"); +$this->theme->AppendPlus($this,'admin_plugin'); +?> + +
+
+ partial('data/left.phtml'); ?> +
+
+
+ partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?> +
+ error)) { ?> + error ?> + + msg)) { ?> + msg ?> + +
+
+ +
+ +
+
+
+ +
+ +
+
+ + +data['attid']) && !empty($this->data['attid'])){ ?> +' /> + + \ No newline at end of file diff --git a/application/admin/views/scripts/data/ref-nav.phtml b/application/admin/views/scripts/data/ref-nav.phtml index 7d0a6605..5605b874 100644 --- a/application/admin/views/scripts/data/ref-nav.phtml +++ b/application/admin/views/scripts/data/ref-nav.phtml @@ -1,5 +1,6 @@
diff --git a/application/admin/views/scripts/data/reference.phtml b/application/admin/views/scripts/data/reference.phtml index 5e426ae5..39ff21ce 100644 --- a/application/admin/views/scripts/data/reference.phtml +++ b/application/admin/views/scripts/data/reference.phtml @@ -56,7 +56,7 @@ foreach ($this->paginator as $item): $i=0; $u=$item['uuid']; endif; - if ($i==0) echo '

元数据:'.$item['title'].'添加

    '; + if ($i==0) echo '

    元数据:'.$item['mdtitle'].'添加

      '; echo '
    1. 文献(编辑 删除 排序):'.$item['place'].'. '.$item['reference'].'
    2. '; endforeach; echo ''; diff --git a/application/admin/views/scripts/down/offlineapp.phtml b/application/admin/views/scripts/down/offlineapp.phtml index b1c55745..fdf6189a 100644 --- a/application/admin/views/scripts/down/offlineapp.phtml +++ b/application/admin/views/scripts/down/offlineapp.phtml @@ -32,7 +32,7 @@ 重置1年前的所有未收到申请表的记录 | 已收到的申请 | 已拒绝的申请 - | 待处理的申请 + | 待处理的申请 | 已通过的申请(离线服务记录)