From 8c1738137aaf6642450a0f1da5ee0163fd5b7ff7 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Fri, 14 Oct 2011 10:29:26 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=84=E5=AE=A1=E6=84=8F?= =?UTF-8?q?=E8=A7=81=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B0=9A?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ReviewController.php | 90 +++++++++++++++++-- .../default/views/scripts/review/review.phtml | 79 ++++++++++++++-- 2 files changed, 156 insertions(+), 13 deletions(-) diff --git a/application/default/controllers/ReviewController.php b/application/default/controllers/ReviewController.php index b88328e1..a40a7033 100644 --- a/application/default/controllers/ReviewController.php +++ b/application/default/controllers/ReviewController.php @@ -257,12 +257,90 @@ class ReviewController extends Zend_Controller_Action else {return "";} }//function rewriterstatus - - function reviewAction() { - $uuid = $this->_request->getParam('uuid'); - $sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en from metadata m where m.uuid=?",$uuid); - $this->view->metadata=$this->db->fetchRow($sql); - } + + function replace($string){ + $patterns = array("/\"/i","/\'/i"); + $replacements = array("“","‘"); + ksort($patterns); + ksort($replacements); + return preg_replace($patterns, $replacements, $string); + } + + function reviewAction() { + + $uuid = $this->_request->getParam('uuid'); + $sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en from metadata m where m.uuid=?",$uuid); + $this->view->metadata=$this->db->fetchRow($sql); + + $submit = $this->_request->getParam('submit'); + + if(!empty($submit)){ + + $redirectlink='/review/review/uuid/'.$uuid; + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + }else{ + $this->messenger->addMessage('读取用户信息失败,请刷新页面后重试 :('); + $this->_redirect($redirectlink); + } + + $conclusion = $this->_request->getParam('conclusion'); + $mdcomment = $this->replace(trim($this->_request->getParam('mdcomment'))); + $datacomment = $this->replace(trim($this->_request->getParam('datacomment'))); + $editorcomment = $this->replace(trim($this->_request->getParam('editorcomment'))); + + $this->view->conclusion = $_POST['conclusion']; + $this->view->mdcomment = $mdcomment; + $this->view->datacomment = $datacomment; + $this->view->editorcomment = $editorcomment; + + if(empty($conclusion)) + { + $this->messenger->addMessage('请选择评审意见'); + $this->_redirect($redirectlink); + } + if( !is_numeric($conclusion) || !in_array($conclusion,array(-1,1,2,3)) ) + { + $this->messenger->addMessage('参数有误,请刷新页面 :('); + $this->_redirect($redirectlink); + } + if(empty($mdcomment) ) + { + $this->messenger->addMessage('请填写元数据意见后再发布 :('); + $this->_redirect($redirectlink); + } + if(!empty($_FILES['Filedata'])) + { + $files=new files(); + $msg = $files -> upload(Zend_Registry::get('upload'),$_FILES['Filedata'],$_POST['dir']); + + if(empty($msg['error'])) + { + $filename = $msg['db_path']; + $filesize = $msg['file_size']; + $filedesc = $this->_request->getParam('filedesc'); + $filetype = $this->_request->getParam('dir'); + + $sql = "insert into attachments (filename,filetype,filedesc,userid,filesize) values ('$filename','$filetype','$filedesc','$userid','$filesize') RETURNING id"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $temp = $sth->fetch(); + }else{ + $this->messenger->addMessage('附件上传失败:'.$msg['error']); + @unlink($filename); + $this->_redirect($redirectlink); + } + } + + $sql = ""; + + } + }//reviewAction() + } diff --git a/application/default/views/scripts/review/review.phtml b/application/default/views/scripts/review/review.phtml index 6691bff9..1c10d50b 100755 --- a/application/default/views/scripts/review/review.phtml +++ b/application/default/views/scripts/review/review.phtml @@ -4,17 +4,20 @@ $this->headTitle('数据查看'); $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/mdview.css'); + $this->headLink()->appendStylesheet('/css/mdreview.css'); + $this->headScript()->appendFile('/js/jquery-1.6.4.min.js'); $this->breadcrumb('首页'); $this->breadcrumb(''.$this->config->title->review.''); $this->breadcrumb('评审元数据'); $this->breadcrumb()->setSeparator(' > '); + $auth = Zend_Auth::getInstance(); ?> metadata;if ($md):?> -

escape($md['title']); ?> - [查看 -查看XML源文件 - Word doc格式 - ] +

escape($md['title']); ?> + [查看 +查看XML源文件 + Word doc格式 + ] '.$this->escape($md['title_en']);?>

@@ -28,8 +31,70 @@

数据评审意见

-
-
+
+ hasIdentity()) + { + ?> +
+ + +

+ 评审意见(必选)
+ conclusion == 1) echo 'checked="checked"'; ?> />修改后再审 + conclusion == 2) echo 'checked="checked"'; ?> />修改后发布 + conclusion == 3) echo 'checked="checked"'; ?> />发布 + conclusion == -1) echo 'checked="checked"'; ?> />退稿 +

+

+ 元数据意见(必填)
+ +

+

+ 对数据的意见:
+ +

+

+ 给数据中心的意见:
+ +

+

+ 评审附件:
+ + + +

+

+ +

+
+ 登录'; + } + + ?> + +
+ + msg or $this->messages) :?> +
+ msg) : ?> +

msg; ?>

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

+ + +
+ + +
+ +