增加了邮件模板编写说明

This commit is contained in:
Li Jianxuan 2011-10-13 08:18:12 +00:00
parent 3d47587d58
commit 646beea985
2 changed files with 108 additions and 5 deletions

View File

@ -93,12 +93,27 @@ class Admin_SysController extends Zend_Controller_Action
$subject = $this->_request->getParam('subject'); $subject = $this->_request->getParam('subject');
$email = $this->_request->getParam('email'); $email = $this->_request->getParam('email');
$body = $this->_request->getParam('body'); $body = $this->_request->getParam('body');
$body=str_replace("[username]",$this->_request->getParam('user'),$body);
if(empty($subject) || empty($email)) if(empty($subject) || empty($email))
{ {
$this->messenger->addMessage('请填写测试邮件发送信息'); $this->messenger->addMessage('请填写测试邮件发送信息');
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id); $this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
} }
$mailtp=new EmailText();
$mailtp->db = $this->db;
$mailtp->tmpid = $this->_request->getParam('id');
$mailtp->data = array(
'user' => $this->_request->getParam('user')
);
$body = $mailtp->loadtmp();
if($body === false)
{
$this->messenger->addMessage('模板加载失败');
$this->_redirect('/admin/sys/emailtext/ac/test/id/'.$id);
}
$mail=new WestdcMailer($this->view->config->smtp); $mail=new WestdcMailer($this->view->config->smtp);
$mail->setBodyText($body); $mail->setBodyText($body);
@ -129,8 +144,14 @@ class Admin_SysController extends Zend_Controller_Action
}//模板测试 }//模板测试
else if($ac=='help')
{
$this->_helper->viewRenderer('emailtexthelp');
}
else else
{ {
try{
$sql = "select id,subject,template,ts_created,ts_changed from emailtext"; $sql = "select id,subject,template,ts_created,ts_changed from emailtext";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$rows = $rs->fetchAll(); $rows = $rs->fetchAll();
@ -141,6 +162,9 @@ class Admin_SysController extends Zend_Controller_Action
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
}catch (Exception $e){
echo $e->getMessage();
}
}//邮件模板管理首页 }//邮件模板管理首页
}//emailtextAction 邮件模板管理 }//emailtextAction 邮件模板管理

View File

@ -0,0 +1,79 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/sys">系统管理</a>');
$this->breadcrumb('邮件模板管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div class="box box-info">
<?php if ($this->msg) : ?>
<?php echo $this->msg; ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php echo $msg; ?>
<?php endforeach;endif; ?>
<script language="javascript">
setTimeout('$(".box-info").remove()',5000);
</script>
</div>
<?php endif; ?>
<h3>邮件模板编写说明:</h3>
<br />
<p>邮件模板编写时暂时不支持html格式只能使用纯文本编写</p>
<br />
<p>
模板中可以使用变量标记,比如 {user} 将被替换为用户名,变量的起始使用“{”,结束使用"}",完整的变量格式应类似“{param}”
</p>
<br />
<p>
目前程序中已预制的变量包括:
<table>
<thead>
<tr>
<td width="150">变量名</td>
<td width="200">说明</td>
<td width="300">输出值举例</td>
<td width="150">作用域</td>
</tr>
</thead>
<tbody>
<tr>
<td>{user}</td>
<td>用户名</td>
<td>张三</td>
<td>全局</td>
</tr>
<tr>
<td>{uuid}</td>
<td>元数据UUID</td>
<td>76bce7bb-e1b2-49c4-9537-668a6bac42a2</td>
<td>全局</td>
</tr>
<tr>
<td>{title}</td>
<td>元数据title</td>
<td>黑河流域气象观测站点分布图</td>
<td>专家邀请模板</td>
</tr>
</tbody>
</table>
</p>
<br />
<p>
一个邮件模板例子:<br />
<br />
尊敬的{user}您好!想获得元数据《{title}》,请访问 http://westdc.westgis.ac.cn/data/{uuid}
</p>
</div>