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):?> -
数据评审意见
-msg; ?>
+ messages): foreach($this->messages as $msg): ?> + + + +