From 326572d7c2bdae4fc5d9b70a25ac4c85e5b3ba9a Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Fri, 10 May 2013 08:53:24 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E8=AF=84=E5=AE=A1=E4=B8=AD=E5=8F=91?= =?UTF-8?q?=E5=87=BA=E5=8F=8D=E9=A6=88=E7=9A=84=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 6 +- .../admin/controllers/ReviewController.php | 130 ++++++++++-------- .../views/scripts/data/author-edit.phtml | 66 +++++---- application/admin/views/scripts/footer.phtml | 3 + .../admin/views/scripts/post-message.phtml | 21 +++ .../admin/views/scripts/review/accept.phtml | 96 ++++++------- .../admin/views/scripts/review/left.phtml | 20 +-- .../admin/views/scripts/review/myreview.phtml | 126 +++++++++-------- .../admin/views/scripts/review/reply.phtml | 64 +++++---- .../default/views/scripts/breadcrumbs.phtml | 4 + .../default/views/scripts/post-message.phtml | 10 +- application/models/data/Author.php | 24 ++++ application/models/data/Review.php | 18 ++- htdocs/css/admin.css | 1 - 14 files changed, 342 insertions(+), 247 deletions(-) create mode 100644 application/admin/views/scripts/post-message.phtml create mode 100644 application/default/views/scripts/breadcrumbs.phtml diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 7f6ac475..8b1eb4f2 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -2568,9 +2568,9 @@ class Admin_DataController extends Zend_Controller_Action if(!empty($keywords)) { - $search=new Search($keywords); + $search=new SimpleSearch($keywords); $where=$search->sql_expr(array("md.title")); - $sql.=' and '.$where; + $sql.=' and ('.$where.")"; } $sql .= "GROUP by md.id,md.title,md.uuid,md.ts_created @@ -2816,7 +2816,7 @@ class Admin_DataController extends Zend_Controller_Action if(!empty($keywords)) { - $search=new Search($keywords); + $search=new SimpleSearch($keywords); $where=$search->sql_expr(array("md.title")); $sql.=' WHERE '.$where; } diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index c79e2953..ac7642bb 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -5,13 +5,9 @@ class Admin_ReviewController extends Zend_Controller_Action { $this->db=Zend_Registry::get('db'); $this->view->config = Zend_Registry::get('config'); - $this->messenger=$this->_helper->getHelper('FlashMessenger'); - $this->view->messages = $this->messenger->getMessages(); - } - - function postDispatch() - { - //$this->view->messages = $this->messenger->getMessages(); + $this->view->theme = new Theme(); + $this->_helper->layout->setLayout('administry'); + $this->view->pageID = "review-".$this->_request->getActionName(); } /* @@ -148,7 +144,7 @@ class Admin_ReviewController extends Zend_Controller_Action if($cancel>0) { if($this->changestatus($cancel,-1)) - { + { //update search document $search=new Search(); //create search view in xunsearch @@ -283,7 +279,7 @@ class Admin_ReviewController extends Zend_Controller_Action } $sql = "select m.id,md.title,m.status,m.uuid,u.username,u.realname from mdstatus m - right join metadata md on md.uuid=m.uuid + right join metadata md on md.uuid=m.uuid left join users u on u.id=m.userid where m.status in (2,3,4) $searchjoin order by m.ts_accepted desc"; $rs = $this->db->query($sql); @@ -752,17 +748,17 @@ class Admin_ReviewController extends Zend_Controller_Action else $ids=$update; if($this->changestatus($ids,1)) - { + { //update search document $search=new Search(); //create search view in xunsearch $sql="select * from xunsearch where uuid in (select uuid from mdstatus where id in (".$ids."))"; $sth = $this->db->prepare($sql); - $sth->execute(); - while ($data = $sth->fetch()) + $sth->execute(); + while ($data = $sth->fetch()) { - $search->update($data); - } + $search->update($data); + } //仅对单条数据发送email信息,并且注册为数据作者 if (is_numeric($ids)) @@ -1497,74 +1493,86 @@ class Admin_ReviewController extends Zend_Controller_Action function replyAction(){ $uuid = $this->_getParam('uuid'); - $send = $this->_getParam('send'); + $submit = $this->_getParam('submit'); + + include_once("helper/view.php"); + include_once("data/Review.php"); + include_once("data/Metadata.php"); + include_once("data/Author.php"); if(empty($uuid)) { - $jump_url = $this->view->jump_url = 'javascript:history.go(-1);'; - $this->view->msg = "参数错误,如果页面没有跳转请点击这里"; + view::Post($this,array('content'=>'参数错误','url' => -1)); return true; } + $review = new Review($this->db); + $this->view->uuid = $uuid; - $sql = "SELECT mr.*,u.username,u.realname FROM mdreview mr - LEFT JOIN users u ON mr.userid = u.id - WHERE mr.uuid = '$uuid'"; - - $sth = $this->db->query($sql); - $reviews = $sth->fetchAll(); - + $reviews = $review->getReviews($uuid); $this->view->review = $reviews; - if(!empty($send)) + $metadata = new Metadata($this->db); + $this->view->md = $metadata->View($uuid); + + $body = "元数据《".$this->view->md['title']."》的作者,您好:\r\n + 以下是您的元数据《".$this->view->md['title']."》的反馈信息。\r\n"; + + $body .= "--------------------------------------\r\n"; + if(!empty($reviews)) + foreach($reviews as $k=>$v) { - $sql = "SELECT md.title,u.email FROM metadata md - LEFT JOIN mdauthor a ON md.uuid=a.uuid - WHERE md.uuid='$uuid'"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); + $body .= $v['username'].":".$v['mdcomment']."\r\n"; + } + else + $body .= "\r\n\r\n\r\n"; + $body .= "--------------------------------------"; + $body .= "\r\n           西部数据中心服务组"; - $emails = array(); - foreach($rows as $v); - { - if(!empty($v['email'])) - { - $emails[] = $v['email']; - } - } + $author = new Author($this->db); + $emails = $author->getAuthor($uuid,'email'); + + if(count($emails)<1) + { + $email = ""; + }else{ + $email = join(";",$emails); + } - if(count($emails)<1) - { - $jump_url = $this->view->jump_url = 'javascript:history.go(-1);'; - $this->view->msg = "该元数据未指派作者,如果页面没有跳转请点击这里"; - return true; - } + $data = array( + 'title'=>"您的元数据《".$this->view->md['title']."》有新的反馈", + 'content'=>$body, + 'email'=>$email - $title = $rows[0]['title']; - - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $body = "元数据《$title》的作者,您好:\r\n -您的元数据《$title》有反馈信息。\r\n"; - - foreach($reviews as $k=>$v) - { - $body .= $v['username'].":".$v['mdcomment']."\r\n"; - } - - $body .= "\r\n           西部数据中心服务组"; + ); + $this->view->data = $data; + + if(!empty($submit)) + { + $this->view->data['title'] = $title = $this->_getParam('title'); + $this->view->data['email'] = $email = $this->_getParam('email'); + $this->view->data['content'] = $cotent = $this->_getParam('content'); + $emails = explode(";",$email); + $mail=new WestdcMailer($this->view->config->smtp); - $mail->setBodyText($body); + $mail->setBodyText($cotent); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); foreach($emails as $v) { $mail->addTo($v); } - $mail->setSubject("您的元数据《$title》有新的反馈"); - $mail->send(); + $mail->setSubject($title); + + if($mail->send()) + { + view::Post($this,array('content'=>'发送成功!','url'=>'/admin/review/reply/uuid/'.$uuid)); + return true; + }else{ + $this->view->error = view::Error('邮件发送失败'); + return true; + } } }//replyAction() diff --git a/application/admin/views/scripts/data/author-edit.phtml b/application/admin/views/scripts/data/author-edit.phtml index 2ec8eb93..ac0fd819 100644 --- a/application/admin/views/scripts/data/author-edit.phtml +++ b/application/admin/views/scripts/data/author-edit.phtml @@ -2,46 +2,44 @@ $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->headLink()->appendStylesheet('/css/admin.css'); -$this->headScript()->appendFile('/js/jquery.colorbox-min.js'); -$this->headLink()->appendStylesheet('/css/author.css'); -$this->headLink()->appendStylesheet('/css/colorbox.css'); $this->breadcrumb('首页'); $this->breadcrumb('数据管理'); $this->breadcrumb('数据作者管理'); $this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,"colorbox"); ?> - -
- partial('data/left.phtml'); ?> +
+
+ partial('data/left.phtml'); ?> +
+
+
+
+ authors)) { ?> +

authors[0]['title']; ?>

+ 添加作者 + + 添加作者 + + +
+
- - - -
-
-
-

authors[0]['title']; ?>

- 添加作者 -
-
- + \ No newline at end of file diff --git a/application/admin/views/scripts/post-message.phtml b/application/admin/views/scripts/post-message.phtml new file mode 100644 index 00000000..89d2f043 --- /dev/null +++ b/application/admin/views/scripts/post-message.phtml @@ -0,0 +1,21 @@ +headTitle('寒区旱区科学数据中心'); +if(!empty($this->pageTitle)) +{ + $this->headTitle()->setSeparator(' - '); + $this->headTitle($this->pageTitle); +} +?> +
+
+

content ?>url)) echo ",系统正在为您跳转..."?>

+ url)) {?> + url == -1) { ?> + 如果没有跳转请点击这样 + + + 如果没有跳转请点击这样 + + +
+
\ No newline at end of file diff --git a/application/admin/views/scripts/review/accept.phtml b/application/admin/views/scripts/review/accept.phtml index 5f73468c..6d6f9e9b 100644 --- a/application/admin/views/scripts/review/accept.phtml +++ b/application/admin/views/scripts/review/accept.phtml @@ -9,52 +9,54 @@ $this->breadcrumb('元数据评审'); $this->breadcrumb()->setSeparator(' > '); ?> -
-partial('review/left.phtml'); ?> -
-
-msg or $this->messages) :?> -
-msg) : ?> -

msg; ?>

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

- -
- - - - - - - - - - - - paginator)): ?> - - paginator as $item): ?> - - - - - - - - - -
元数据标题负责编辑时间操作
- ' onclick="return confirm('是否确定取消评审')">取消评审 - '>邀请专家 - 更改管理员 -
- +
+
+ partial('review/left.phtml'); ?> +
+
+ msg or $this->messages) :?> +
+ msg) : ?> +

msg; ?>

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

+ +
+ + + + + + + + + + + + paginator)): ?> + + paginator as $item): ?> + + + + + + + + + +
元数据标题负责编辑时间操作
+ ' onclick="return confirm('是否确定取消评审')">取消评审 + '>邀请专家 + 更改管理员 +
+ +
\ No newline at end of file diff --git a/application/admin/views/scripts/review/left.phtml b/application/admin/views/scripts/review/left.phtml index b0853341..95440b31 100644 --- a/application/admin/views/scripts/review/left.phtml +++ b/application/admin/views/scripts/review/left.phtml @@ -1,11 +1,11 @@ -
    -
  • 元数据评审
  • -
  • 投稿元数据
  • -
  • 待审元数据
  • -
  • 在审元数据
  • -
  • 我负责的元数据
  • -
  • 通过评审的元数据
  • -
  • 专家库
  • -
  • 已取消评审的元数据
  • -
  • 元数据评审管理
  • + \ No newline at end of file diff --git a/application/admin/views/scripts/review/myreview.phtml b/application/admin/views/scripts/review/myreview.phtml index 17831ba2..4fe9afda 100644 --- a/application/admin/views/scripts/review/myreview.phtml +++ b/application/admin/views/scripts/review/myreview.phtml @@ -2,69 +2,75 @@ $this->headTitle($this->config->title->site); $this->headTitle('后台管理'); $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->breadcrumb('首页'); $this->breadcrumb('后台首页'); $this->breadcrumb('元数据评审'); $this->breadcrumb()->setSeparator(' > '); ?> -
    -partial('review/left.phtml'); ?> + +
    +
    + partial('review/left.phtml'); ?> +
    +
    + msg or $this->messages) :?> +
    + msg) : ?> +

    msg; ?>

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

    + +
    + + + + + + + + + + + + paginator)): ?> + + paginator as $item): ?> + + + + + + + + +
    元数据标题状态操作
    + 邀请专家 + 更改管理员 + 查看详细 + 查看评审意见 + 意见反馈 + ' onclick="return confirm('是否确定取消评审')">取消评审 + 发布 + 删除 +
    + +
    -
    -msg or $this->messages) :?> -
    -msg) : ?> -

    msg; ?>

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

    - -
    - - - - - - - - - - paginator)): ?> - - paginator as $item): ?> - - - - - - - - -
    元数据标题状态操作
    - 邀请专家 - 更改管理员 - 查看详细 - 查看评审意见 - 意见反馈 - ' onclick="return confirm('是否确定取消评审')">取消评审 - 发布 - 删除 -
    - -
    - \ No newline at end of file + \ No newline at end of file diff --git a/application/admin/views/scripts/review/reply.phtml b/application/admin/views/scripts/review/reply.phtml index 382be450..54c6be10 100644 --- a/application/admin/views/scripts/review/reply.phtml +++ b/application/admin/views/scripts/review/reply.phtml @@ -2,41 +2,54 @@ $this->headTitle($this->config->title->site); $this->headTitle('后台管理'); $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->headLink()->appendStylesheet('/css/author.css'); - $this->headScript()->appendFile('/js/jquery-1.7.min.js'); $this->breadcrumb('首页'); $this->breadcrumb('后台首页'); $this->breadcrumb('评审意见反馈'); $this->breadcrumb()->setSeparator(' > '); + $this->theme->AppendPlus($this,"colorbox"); ?> -
    -partial('review/left.phtml'); ?> -
    -
    -msg)) -{ -?> -
    msg;?>
    -jump_url)) {?> - - - +
    +
    + partial('review/left.phtml'); ?> +
    +
    -review)) -{ echo "此数据尚无反馈信息"; -}else{?>
      - review as $v) - {?> + review as $v){?>
    • - +
    - - + error)) { ?> + error ?> + +

    为《md['title'] ?>》的作者反馈

    +
    +
    +
    + +
    + " /> +
    +
    +
    + +
    + " /> +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    - - +
    diff --git a/application/default/views/scripts/breadcrumbs.phtml b/application/default/views/scripts/breadcrumbs.phtml new file mode 100644 index 00000000..31f38920 --- /dev/null +++ b/application/default/views/scripts/breadcrumbs.phtml @@ -0,0 +1,4 @@ +getLabel();'), + $this->pages));?> \ No newline at end of file diff --git a/application/default/views/scripts/post-message.phtml b/application/default/views/scripts/post-message.phtml index f9179d1e..89d2f043 100644 --- a/application/default/views/scripts/post-message.phtml +++ b/application/default/views/scripts/post-message.phtml @@ -10,8 +10,12 @@ if(!empty($this->pageTitle))

    content ?>url)) echo ",系统正在为您跳转..."?>

    url)) {?> - 如果没有跳转请点击这样 - - + url == -1) { ?> + 如果没有跳转请点击这样 + + + 如果没有跳转请点击这样 + +
    \ No newline at end of file diff --git a/application/models/data/Author.php b/application/models/data/Author.php index 8cb14eab..6a133754 100644 --- a/application/models/data/Author.php +++ b/application/models/data/Author.php @@ -7,6 +7,7 @@ class Author extends Zend_Controller_Plugin_Abstract //使用到的公共变量 public $tbl_metadata = "metadata"; //元数据 public $tbl_author = "mdauthor"; //数据作者表 + public $tbl_user = "users"; function __construct($db) { @@ -41,6 +42,29 @@ class Author extends Zend_Controller_Plugin_Abstract return false; } } + + //获取某数据的所有作者 + function getAuthor($uuid,$field = "") + { + $sql = "SELECT md.title,u.email FROM ".$this->tbl_metadata." md + LEFT JOIN ".$this->tbl_author." a ON md.uuid=a.uuid + LEFT JOIN ".$this->tbl_user." u ON a.userid=u.id + WHERE md.uuid='$uuid'"; + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(); + + if(empty($field)) + { + return $rows; + }else{ + $datas = array(); + foreach($rows as $k=>$v) + { + $datas[] = $v[$field]; + } + return $datas; + } + } } class Literature extends Author diff --git a/application/models/data/Review.php b/application/models/data/Review.php index 9a720450..80a0f49e 100644 --- a/application/models/data/Review.php +++ b/application/models/data/Review.php @@ -5,7 +5,9 @@ class Review extends Zend_Controller_Plugin_Abstract private $auth = NULL; //Zend_Auth 对象 //使用到的公共变量 - public $tbl_review = "mdexpertreview"; + public $tbl_reviewexp = "mdexpertreview"; + public $tbl_mdreview = "mdreview"; + public $tbl_user = "users"; function __construct($db) { @@ -26,7 +28,7 @@ class Review extends Zend_Controller_Plugin_Abstract }//非本人操作 try{ - $sql = "update ".$this->tbl_review." set status=$status where id='$id' and uuid='$uuid'"; + $sql = "update ".$this->tbl_reviewexp." set status=$status where id='$id' and uuid='$uuid'"; if($this->db->exec($sql)) { return true; @@ -36,6 +38,18 @@ class Review extends Zend_Controller_Plugin_Abstract }catch(Exception $e){ return "处理中出现错误"; } + } + + //根据UUID获得评审意见 + function getReviews($uuid) + { + $sql = "SELECT mr.*,u.username,u.realname FROM ".$this->tbl_mdreview." mr + LEFT JOIN ".$this->tbl_user." u ON mr.userid = u.id + WHERE mr.uuid = '$uuid'"; + $sth = $this->db->query($sql); + $reviews = $sth->fetchAll(); + + return $reviews; } } diff --git a/htdocs/css/admin.css b/htdocs/css/admin.css index 59d19064..730e6568 100644 --- a/htdocs/css/admin.css +++ b/htdocs/css/admin.css @@ -14,7 +14,6 @@ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input fieldset,img{border:none;} address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;} caption,th{text-align:left;} -h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;} table{border-collapse:collapse;border-spacing:0;} table td,table th{border:1px solid #0a3e68;} table tr td,table th{line-height:24px;}