Ticket #204 完善了数据评审意见发布的功能

This commit is contained in:
Li Jianxuan 2011-10-17 03:22:00 +00:00
parent 69502b9a80
commit 489f6cbc50
2 changed files with 79 additions and 23 deletions

View File

@ -274,29 +274,32 @@ class ReviewController extends Zend_Controller_Action
$submit = $this->_request->getParam('submit');
$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')));
if(!empty($submit)){
$redirectlink='/review/review/uuid/'.$uuid;
$redirectlink='/review/review/uuid/'.$uuid.'/';
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "select id,userid from mdreview where userid='$userid'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if($row['id']!='')
{
$this->messenger->addMessage('您已经对该元数据发表过评审了');
$this->_redirect($redirectlink);
}
}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))
{
@ -313,7 +316,7 @@ class ReviewController extends Zend_Controller_Action
$this->messenger->addMessage('请填写元数据意见后再发布 :(');
$this->_redirect($redirectlink);
}
if(!empty($_FILES['Filedata']))
if(!empty($_FILES['Filedata']['name']))
{
$files=new files();
$msg = $files -> upload(Zend_Registry::get('upload'),$_FILES['Filedata'],$_POST['dir']);
@ -328,15 +331,70 @@ class ReviewController extends Zend_Controller_Action
$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();
$att = $sth->fetch(PDO::FETCH_ASSOC);
$attid = $att['id'];
}else{
$this->messenger->addMessage('附件上传失败:'.$msg['error']);
@unlink($filename);
$this->_redirect($redirectlink);
$this->_redirect($redirectlink);
}
}
$sql = "";
try{
$sql = "select id from mdexperts where id='$userid'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$data = array(
'userid' => $userid,
'uuid' => $uuid,
'mdcomment' => $mdcomment,
'ts_created' => 'now()',
'datacomment' => $datacomment,
'editorcomment' => $editorcomment,
'conclusion' => $conclusion
);
if($row['id']!='')
{
$data['is_expert'] = 'true';
}
$keys = array();
$values = array();
foreach ($data as $k=>$v)
{
$keys[]=$k;
$values[]=$v;
}
$keys = join(",",$keys);
$values = "'".join("','",$values)."'";
$sql = "insert into mdreview ($keys) values ($values) RETURNING id";
$sth = $this->db->prepare($sql);
$sth->execute();
$review = $sth->fetch(PDO::FETCH_ASSOC);
$reviewid=$review['id'];
if(!empty($_FILES['Filedata']['name']))
{
$sql = "insert into mdreviewattach (attachid,reviewid) values ('$attid','$reviewid')";
$this->db->exec($sql);
}
$this->messenger->addMessage('提交成功');
$this->_redirect($redirectlink);
}catch (Exception $e){
$this->messenger->addMessage('提交失败,请重试'.$sql.'aa'.$review['id'].$e->getMessage());
$this->_redirect($redirectlink);
}
}
}//reviewAction()

View File

@ -36,8 +36,7 @@
if($auth->hasIdentity())
{
?>
<form method="post" id="postcomment" action="/review/review">
<input type="hidden" name="uuid" value="<?php echo $md['uuid'];?>" />
<form id="postcomment" action="/review/review/uuid/<?php echo $md['uuid'];?>" method="POST" enctype='multipart/form-data'>
<input type="hidden" name="submit" value="1" />
<p>
评审意见(必选)<br />
@ -48,7 +47,7 @@
</p>
<p>
元数据意见(必填)<br/>
<textarea id="mdcomment" class="medium half" name="mdcomment"><?php echo $this->mdcomment;?></textarea>
<textarea id="mdcomment" class="medium half" name="mdcomment"><?php echo $this->keyword.$this->mdcomment;?></textarea>
</p>
<p>
对数据的意见:<br/>
@ -60,13 +59,12 @@
</p>
<p>
评审附件:<br/>
<input type="file" name="Filedata" class="half" />
<select name="dir" style="width:100px;float:left;">
<select name="dir" style="width:100px;">
<option value="file">文件</option>
<option value="image">图片</option>
<option value="media">媒体</option>
</select>
<input type="file" name="Filedata" class="half" />
</p>
<p>
<input id="submit" type="submit" value="提交" class="btn" onclick="return confirm('是否确定提交评审意见?')" />