Ticket #262 后台中增加了发布元数据时收信邮箱地址的选择

This commit is contained in:
Li Jianxuan 2011-11-30 07:06:31 +00:00
parent 99688a344f
commit fad45d965c
3 changed files with 84 additions and 12 deletions

View File

@ -324,7 +324,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$mail->setSubject($mailtp->getSubject());
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc');
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid);
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.pdf');
if($mail->send())
{
@ -360,8 +360,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$mail->addTo($row['email']);
$mail->setSubject($mailtp->getSubject());
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/doc/review/1/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc');
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc');
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/service/pdf/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.pdf');
if($mail->send())
{
@ -515,9 +515,27 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->paginator=$paginator;
}//我管理的元数据
function postAction(){
function checkmailAction(){
$id = $this->view->id = $this->_request->getParam('id');
$sql="select m.title,m.uuid,array_to_string(array(select distinct(email) from role r left join responsible rs on r.resid=rs.id where r.uuid=m.uuid and length(rs.email)>4),',') as emails from mdstatus s left join metadata m on s.uuid=m.uuid where s.id=?";
$res=$this->db->fetchRow($this->db->quoteInto($sql,$id));
$rv=explode(',',$res['emails']);
$rows = array();
foreach ($rv as $k=>$v)
{
$rows[$k]['id'] = $k;
$rows[$k]['email'] = $v;
}
$this->view->paginator = $rows;
}
function postAction(){
$id = $this->_request->getParam('id');
$emails = $this->_request->getParam('emails');
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
@ -534,15 +552,13 @@ class Admin_ReviewController extends Zend_Controller_Action
if($this->changestatus($id,5))
{
$this->messenger->addMessage('操作成功:该元数据意见成功发布');
//email message
$mail=new WestdcMailer($this->view->config->smtp);
$sql="select m.title,m.uuid,array_to_string(array(select distinct(email) from role r left join responsible rs on r.resid=rs.id where r.uuid=m.uuid and length(rs.email)>4),',') as emails from mdstatus s left join metadata m on s.uuid=m.uuid where s.id=?";
$res=$this->db->fetchRow($this->db->quoteInto($sql,$id));
$this->messenger->addMessage('操作成功:该元数据成功发布');
//email message
$mail=new WestdcMailer($this->view->config->smtp);
$mailtp=new EmailText($this->db,'metadata-publish',array('uuid'=>$res['uuid'],'title'=>$res['title']));
$mail->setBodyText($mailtp->getBody());
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo(explode(',',$res['emails']));
$mail->addTo($emails);
$mail->setSubject($mailtp->getSubject());
$mail->send();
$this->_redirect("/admin/review/myreview");
@ -565,7 +581,7 @@ class Admin_ReviewController extends Zend_Controller_Action
}
}
}//发布元数据
function draftAction(){

View File

@ -0,0 +1,56 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery-1.6.4.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 ($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; ?>
</div>
<?php endif; ?>
<form action="/admin/review/post">
<?php if (count($this->paginator)): ?>
请选择要发送通知的邮箱
<table class="stylized"><thead>
<tr>
<td width="80">选择</td>
<td width='500'>Email</td>
</tr></thead>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><input type="checkbox" name="emails[]" value="<?php echo $item['email'];?>" /></td>
<td><?= $item['email']?></td>
</tr>
<?php endforeach; ?>
<tr>
<td><input type="checkbox" name="emails[]" value="la5c@qq.com" /></td>
<td>la5c@qq.com</td>
</tr>
<tr>
<td><input type="checkbox" name="emails[]" value="346938798@qq.com" /></td>
<td>346938798@qq.com</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="id" value="<?php echo $this->id ;?>" />
<input type="submit" value="发布该元数据" onclick="return confirm('是否确定发布该元数据?')" />
</form>
</div>
<script>$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})</script>

View File

@ -56,7 +56,7 @@
<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/accept/cancel/<?php echo $item['id'];?>' onclick="return confirm('是否确定取消评审')">取消评审</a>
<a href="/admin/review/post/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>
</td>
</tr>