增加了ajax存草稿的功能,增加了评审意见发布的逻辑判断和评审意见列表的逻辑判断
This commit is contained in:
parent
2789ecb9b2
commit
b148db6d60
|
@ -138,10 +138,10 @@ class ReviewController extends Zend_Controller_Action
|
|||
{
|
||||
$user = $auth->getIdentity();
|
||||
$userid = $user->id;
|
||||
$sql = "select id from mdreview where userid='$userid' and uuid='$uuid'";
|
||||
$sql = "select * from mdreview where userid='$userid' and uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
$this->view->pms = $row['id'];
|
||||
$this->view->review = $row;
|
||||
}
|
||||
|
||||
$submit = $this->_request->getParam('submit');
|
||||
|
@ -171,10 +171,10 @@ class ReviewController extends Zend_Controller_Action
|
|||
{
|
||||
$user = $auth->getIdentity();
|
||||
$userid = $user->id;
|
||||
$sql = "select id,userid from mdreview where userid='$userid' and uuid='$uuid'";
|
||||
$sql = "select id,userid,status from mdreview where userid='$userid' and uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
if($row['id']!='')
|
||||
if($row['id']!='' && $row['status']>-1)
|
||||
{
|
||||
$this->messenger->addMessage('您已经对该元数据发表过评审了');
|
||||
$this->_redirect($redirectlink);
|
||||
|
@ -226,6 +226,17 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
try{
|
||||
|
||||
if($row['status']<0)
|
||||
{
|
||||
$sql = "delete from mdreview where id='{$row['id']}'";
|
||||
if($this->db->exec($sql)<1)
|
||||
{
|
||||
$this->messenger->addMessage('处理出错,请重试');
|
||||
@unlink($filename);
|
||||
$this->_redirect($redirectlink);
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'userid' => $userid,
|
||||
'uuid' => $uuid,
|
||||
|
@ -289,7 +300,7 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
$sql = "select r.uuid,r.userid,r.ts_created,u.realname,r.mdcomment,r.conclusion from mdreview r
|
||||
left join users u on u.id=r.userid
|
||||
where r.uuid='$uuid'";
|
||||
where r.uuid='$uuid' and r.status>-1";
|
||||
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
|
@ -329,7 +340,121 @@ class ReviewController extends Zend_Controller_Action
|
|||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
echo "保存成功!";
|
||||
$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')));
|
||||
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
$sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en,r.status from metadata m
|
||||
left join mdstatus r on r.uuid=m.uuid
|
||||
where m.uuid=?",$uuid);
|
||||
$md = $this->db->fetchRow($sql);
|
||||
|
||||
if($md['status']>4)
|
||||
{
|
||||
echo '<div class="box box-info">该数据已经通过评审,不能再发表评审意见,如需提交问题,请联系数据管理员</div>';
|
||||
exit();
|
||||
}
|
||||
if($md['status']<1)
|
||||
{
|
||||
echo '<div class="box box-info">已被数据中心接收的数据才可以进行评审</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$userid = $user->id;
|
||||
$sql = "select id,userid,status from mdreview where userid='$userid' and uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
if($row['id']!='' && $row['status']>-1)
|
||||
{
|
||||
echo '<div class="box box-info">您已经对该元数据发表过评审了</div>';
|
||||
exit();
|
||||
}
|
||||
}else{
|
||||
echo '<div class="box box-info">读取用户信息失败,请刷新页面后重试 :(</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
if(empty($conclusion))
|
||||
{
|
||||
echo '<div class="box box-info">请选择评审意见</div>';
|
||||
exit();
|
||||
}
|
||||
if(!is_numeric($conclusion) || !in_array($conclusion,array(-1,1,2,3)))
|
||||
{
|
||||
echo '<div class="box box-info">参数有误,请刷新页面 :(</div>';
|
||||
exit();
|
||||
}
|
||||
if(empty($mdcomment) )
|
||||
{
|
||||
echo '<div class="box box-info">请填写元数据意见后再存草稿 :(</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
if($row['status']<0)
|
||||
{
|
||||
$sql = "delete from mdreview where id='{$row['id']}'";
|
||||
if($this->db->exec($sql)<1)
|
||||
{
|
||||
echo '<div class="box box-error">处理出错,请重试</div>';
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'userid' => $userid,
|
||||
'uuid' => $uuid,
|
||||
'mdcomment' => $mdcomment,
|
||||
'ts_created' => 'now()',
|
||||
'datacomment' => $datacomment,
|
||||
'editorcomment' => $editorcomment,
|
||||
'conclusion' => $conclusion,
|
||||
'status' => -1
|
||||
);
|
||||
|
||||
|
||||
$sql = "select id from mdexpertreview where id='$userid' and uuid='$uuid'";
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
|
||||
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();
|
||||
|
||||
echo '<div class="box box-success">保存成功!</div>';
|
||||
exit();
|
||||
|
||||
}catch (Exception $e){
|
||||
echo '<div class="box box-error">保存失败,请重试!</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}// saveAction 存草稿 ajax
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<?php
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
if(empty($this->pms))
|
||||
if(empty($this->review['id']) || $this->review['status']<0)
|
||||
{
|
||||
if($md['status']==5)
|
||||
{
|
||||
|
@ -54,22 +54,22 @@
|
|||
<input type="hidden" name="submit" value="1" />
|
||||
<p>
|
||||
评审意见(必选)<br />
|
||||
<input type="radio" name="conclusion" value="1" <?php if($this->conclusion == 1) echo 'checked="checked"'; ?> />修改后再审
|
||||
<input type="radio" name="conclusion" value="2" <?php if($this->conclusion == 2) echo 'checked="checked"'; ?> />修改后发布
|
||||
<input type="radio" name="conclusion" value="3" <?php if($this->conclusion == 3) echo 'checked="checked"'; ?> />发布
|
||||
<input type="radio" name="conclusion" value="-1" <?php if($this->conclusion == -1) echo 'checked="checked"'; ?> />退稿
|
||||
<input type="radio" name="conclusion" value="1" <?php if($this->review['conclusion'] == 1) echo 'checked="checked"'; ?> />修改后再审
|
||||
<input type="radio" name="conclusion" value="2" <?php if($this->review['conclusion'] == 2) echo 'checked="checked"'; ?> />修改后发布
|
||||
<input type="radio" name="conclusion" value="3" <?php if($this->review['conclusion'] == 3) echo 'checked="checked"'; ?> />发布
|
||||
<input type="radio" name="conclusion" value="-1" <?php if($this->review['conclusion'] == -1) echo 'checked="checked"'; ?> />退稿
|
||||
</p>
|
||||
<p>
|
||||
元数据意见(必填)<br/>
|
||||
<textarea id="mdcomment" class="medium full" name="mdcomment"><?php echo $this->keyword.$this->mdcomment;?></textarea>
|
||||
<textarea id="mdcomment" class="medium full" name="mdcomment"><?php echo $this->review['mdcomment'];?></textarea>
|
||||
</p>
|
||||
<p>
|
||||
对数据的意见:<br/>
|
||||
<textarea id="datacomment" class="small full" name="datacomment"><?php echo $this->datacomment;?></textarea>
|
||||
<textarea id="datacomment" class="small full" name="datacomment"><?php echo $this->review['datacomment'];?></textarea>
|
||||
</p>
|
||||
<p>
|
||||
给数据中心的意见:<br/>
|
||||
<textarea id="editorcomment" class="small full" name="editorcomment"><?php echo $this->editorcomment;?></textarea>
|
||||
<textarea id="editorcomment" class="small full" name="editorcomment"><?php echo $this->review['editorcomment'];?></textarea>
|
||||
</p>
|
||||
<p>
|
||||
评审附件:<br/>
|
||||
|
@ -82,38 +82,46 @@
|
|||
<button class="btn btn-small" type="button" id="save">存草稿</button>
|
||||
<button class="btn btn-small" type="reset" id="reset" onclick="return confirm('是否确定重置已经填写的意见?')">重置</button>
|
||||
</p>
|
||||
<p id="infobox">
|
||||
<?php
|
||||
if($this->review['status']<0)
|
||||
{
|
||||
echo '<div class="box box-info">您保存的草稿已经加载</div>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<label>注:评审意见提交之后不可更改,存草稿功能不能保存附件,请妥善保存附件。</label>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}else
|
||||
{
|
||||
echo "您已经对此数据作出过评审";
|
||||
echo '<div class="box box-info">您已经对此数据作出过评审</div>';
|
||||
}
|
||||
} else {
|
||||
echo '发表评审意见,请先<a href="/account/login/?href=/review/review/uuid/'.$md['uuid'].'">登录</a>';
|
||||
echo '<div class="box box-info">发表评审意见,请先<a href="/account/login/?href=/review/review/uuid/'.$md['uuid'].'">登录</a></div>';
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if ($this->msg or $this->messages) :?>
|
||||
<div class="box box-success">
|
||||
<?php if ($this->msg) : ?>
|
||||
<?php echo $this->msg; ?>
|
||||
<?php endif; if ($this->messages):?>
|
||||
<ol>
|
||||
<?php foreach($this->messages as $msg): ?>
|
||||
<li><?php echo $msg; ?></li>
|
||||
<?php endforeach;?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
<script></script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if ($this->msg or $this->messages) :?>
|
||||
<div id="message">
|
||||
<?php if ($this->msg) : ?>
|
||||
<p><?php echo $this->msg; ?></p>
|
||||
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
|
||||
<p><?php echo $msg; ?></p>
|
||||
<?php endforeach;endif; ?>
|
||||
<script></script>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -143,8 +151,9 @@ function savereview(){
|
|||
url:url,
|
||||
data:date,
|
||||
success:function(html){
|
||||
$('#save').html(html);
|
||||
setTimeout("$('#save').html('存草稿');$('#save').removeAttr('disabled');",2000)
|
||||
$('#infobox').html(html);
|
||||
$('#save').html('存草稿');
|
||||
setTimeout("$('#save').removeAttr('disabled');$('.box').remove();",3000)
|
||||
},
|
||||
beforeSend:function(){
|
||||
$('#save').attr('disabled','disabled');
|
||||
|
|
Loading…
Reference in New Issue