#197 添加了评审意见反馈功能

This commit is contained in:
Li Jianxuan 2012-11-29 08:02:10 +00:00
parent c7828e79a9
commit c6426e0c3e
3 changed files with 194 additions and 37 deletions

View File

@ -99,7 +99,7 @@ class Admin_ReviewController extends Zend_Controller_Action
2, //开始邀请专家,送审阶段 2, //开始邀请专家,送审阶段
3, //专家接受邀请,在审阶段 3, //专家接受邀请,在审阶段
4, //专家反馈,在审 4, //专家反馈,在审
5, //评审结束,发布 5, //评审结束,发布
6,7 6,7
); );
if(empty($id) || !isset($status) || !in_array($status,$stvalues)) if(empty($id) || !isset($status) || !in_array($status,$stvalues))
@ -516,9 +516,9 @@ class Admin_ReviewController extends Zend_Controller_Action
* *
* return view * return view
*/ */
function addonAction() function addonAction()
{ {
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$userid=Zend_Auth::getInstance()->getIdentity()->id; $userid=Zend_Auth::getInstance()->getIdentity()->id;
$sql = "select * from mdstatus where uuid='$uuid'"; $sql = "select * from mdstatus where uuid='$uuid'";
@ -538,11 +538,11 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->messenger->addMessage('操作失败:'.$e->getMessage()); $this->messenger->addMessage('操作失败:'.$e->getMessage());
$this->_redirect("/admin/review/draft"); $this->_redirect("/admin/review/draft");
} }
} else if ($row['status']==5){ } else if ($row['status']==5){
$sql="update mdstatus set status=1,ts_accepted=now() where status=5 and id=".$row['id']; $sql="update mdstatus set status=1,ts_accepted=now() where status=5 and id=".$row['id'];
$this->db->query($sql); $this->db->query($sql);
$this->messenger->addMessage('操作成功!该数据已重新放入评审'); $this->messenger->addMessage('操作成功!该数据已重新放入评审');
$this->_redirect("/admin/review/accept"); $this->_redirect("/admin/review/accept");
} else { } else {
$this->messenger->addMessage('该数据已放入评审'); $this->messenger->addMessage('该数据已放入评审');
$this->_redirect("/admin/data/md"); $this->_redirect("/admin/data/md");
@ -654,12 +654,12 @@ class Admin_ReviewController extends Zend_Controller_Action
if($this->changestatus($id,5)) if($this->changestatus($id,5))
{ {
$this->messenger->addMessage('操作成功:该元数据成功发布'); $this->messenger->addMessage('操作成功:该元数据成功发布');
//发布正式版本 //发布正式版本
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)"; $sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid in (select uuid from mdstatus where id=?) order by ts_created desc limit 1)";
$this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$id)); $this->db->query($sql,array('发布第一个正式版本 version 1.0',$userid,$id));
//删除所有的中间版本 //删除所有的中间版本
$sql="delete from mdversion where changelog is null and uuid in (select uuid from mdstatus where id=?)"; $sql="delete from mdversion where changelog is null and uuid in (select uuid from mdstatus where id=?)";
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
//email message //email message
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
@ -743,25 +743,25 @@ class Admin_ReviewController extends Zend_Controller_Action
else $ids=$update; else $ids=$update;
if($this->changestatus($ids,1)) if($this->changestatus($ids,1))
{ {
//仅对单条数据发送email信息并且注册为数据作者 //仅对单条数据发送email信息并且注册为数据作者
if (is_numeric($ids)) if (is_numeric($ids))
{ {
$sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid $sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid
left join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; left join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email";
$rs=$this->db->query($sql,array($ids)); $rs=$this->db->query($sql,array($ids));
$rows=$rs->fetchAll($rs); $rows=$rs->fetchAll($rs);
if ($rows) if ($rows)
{ {
//有数据作者 //有数据作者
$mail=array(); $mail=array();
foreach ($rows as $row) foreach ($rows as $row)
{ {
$mail[]=$row['email']; $mail[]=$row['email'];
} }
$title=$rows[0]['title']; $title=$rows[0]['title'];
$uuid=$rows[0]['uuid']; $uuid=$rows[0]['uuid'];
//send email //send email
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mailtp=new EmailText($this->db,"review-new-accept",array( $mailtp=new EmailText($this->db,"review-new-accept",array(
@ -769,12 +769,12 @@ class Admin_ReviewController extends Zend_Controller_Action
'title'=> $iso->resTitle 'title'=> $iso->resTitle
)); ));
$mail->setBodyText($mailtp->getBody()); $mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$mail->addTo($mail); $mail->addTo($mail);
$mail->addCC($this->view->config->service->email); $mail->addCC($this->view->config->service->email);
$mail->send(); $mail->send();
} }
} }
$this->messenger->addMessage('操作成功!'); $this->messenger->addMessage('操作成功!');
$this->_redirect("/admin/review/draft"); $this->_redirect("/admin/review/draft");
} }
@ -1471,5 +1471,83 @@ class Admin_ReviewController extends Zend_Controller_Action
}//commentsAction 查看所有评审意见 }//commentsAction 查看所有评审意见
//replyAction() 数据评审信息反馈
function replyAction(){
$uuid = $this->_getParam('uuid');
$send = $this->_getParam('send');
if(empty($uuid))
{
$jump_url = $this->view->jump_url = 'javascript:history.go(-1);';
$this->view->msg = "参数错误,<a href='$jump_url'>如果页面没有跳转请点击这里</a>";
return true;
}
$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();
$this->view->review = $reviews;
if(!empty($send))
{
$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();
$emails = array();
foreach($rows as $v);
{
if(!empty($v['email']))
{
$emails[] = $v['email'];
}
}
if(count($emails)<1)
{
$jump_url = $this->view->jump_url = 'javascript:history.go(-1);';
$this->view->msg = "该元数据未指派作者,<a href='$jump_url'>如果页面没有跳转请点击这里</a>";
return true;
}
$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           西部数据中心服务组";
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setBodyText($body);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
foreach($emails as $v)
{
$mail->addTo($v);
}
$mail->setSubject("您的元数据《$title》有新的反馈");
$mail->send();
}
}//replyAction()
} }

View File

@ -55,6 +55,7 @@
<a href="/admin/review/changeadmin/id/<?php echo $item['id'];?>">更改管理员</a> <a href="/admin/review/changeadmin/id/<?php echo $item['id'];?>">更改管理员</a>
<a href="/admin/review/inreview/show/<?php echo $item['id'];?>">查看详细</a> <a href="/admin/review/inreview/show/<?php echo $item['id'];?>">查看详细</a>
<a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>">查看评审意见</a> <a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>">查看评审意见</a>
<a href="/admin/review/reply/uuid/<?php echo $item['uuid'];?>">意见反馈</a>
<a href='/admin/review/accept/cancel/<?php echo $item['id'];?>' onclick="return confirm('是否确定取消评审')">取消评审</a> <a href='/admin/review/accept/cancel/<?php echo $item['id'];?>' onclick="return confirm('是否确定取消评审')">取消评审</a>
<a href="/admin/review/checkmail/id/<?php echo $item['id'];?>" style="color:#6C0">发布</a> <a href="/admin/review/checkmail/id/<?php echo $item['id'];?>" style="color:#6C0">发布</a>
<a href="/admin/review/delete/id/<?php echo $item['id'];?>" style="color:#F00" onclick="return confirm('是否确定删除?该操作不可逆')">删除</a> <a href="/admin/review/delete/id/<?php echo $item['id'];?>" style="color:#F00" onclick="return confirm('是否确定删除?该操作不可逆')">删除</a>

View File

@ -0,0 +1,78 @@
<?php
$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('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('评审意见反馈');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('review/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php
if(!empty($this->msg))
{
?>
<div class="box box-error"><?= $this->msg;?></div>
<?php if(!empty($this->jump_url)) {?>
<script language="javascript">setTimeout("history.go(-1)",3000);</script>
<?php } ?>
<?php } else{?>
<?php if(empty($this->review))
{ echo "此数据尚无反馈信息";
}else{?>
<div id="datalist">
<ul>
<?php foreach($this->review as $v)
{?>
<li><?= empty($v['realname']) ? $v['username'] : $v['realname']?> <?= $v['mdcomment']?></li>
<?php }?>
</ul>
</div>
<button type="button" onclick="send()" id="submit" class="btn btn-green">反馈给元数据作者</button>
<script>
function send(){
var dom = "#submit";
var html = $(dom).html();
$.ajax({
'type':"POST",
'url':'/admin/review/reply/',
'data':'uuid=<?= $this->uuid?>&send=1',
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(typeof(data.msg)!='undefined')
{Alert(data.msg);}
if(typeof(data.invited)!='undefined')
{$('#expert_name_'+id).val('');$('#expert_email_'+id).val('');}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
Alert('处理中出现错误,请刷新页面后重试');
},
'beforeSend':function(){
$(dom).html('<img src="/images/ajax-load-small.gif" />处理中...');
$(dom).attr("disabled","disabled")
},
'complete':function(){
$(dom).html(html);$(dom).removeAttr("disabled");dom = null;
}
});
}
</script>
<?php }?>
<?php } ?>
</div>