* finish task#958.
This commit is contained in:
@@ -87,7 +87,11 @@ class testtask extends control
|
||||
{
|
||||
$taskID = $this->testtask->create();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$this->loadModel('action')->create('testtask', $taskID, 'opened');
|
||||
$actionID = $this->loadModel('action')->create('testtask', $taskID, 'opened');
|
||||
if($this->post->owner)
|
||||
{
|
||||
$this->sendmail($taskID, $actionID, 'opened');
|
||||
}
|
||||
die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent'));
|
||||
}
|
||||
|
||||
@@ -268,6 +272,9 @@ class testtask extends control
|
||||
{
|
||||
$actionID = $this->loadModel('action')->create('testtask', $taskID, 'edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
/* send mail.*/
|
||||
$this->sendmail($taskID, $actionID, 'edited');
|
||||
}
|
||||
die(js::locate(inlink('view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
@@ -488,4 +495,37 @@ class testtask extends control
|
||||
->exec();
|
||||
die(js::locate($this->session->caseList));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send mail.
|
||||
*
|
||||
* @param int $testtaskID
|
||||
* @param int $actionID
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function sendmail($testtaskID, $actionID, $actionType)
|
||||
{
|
||||
$testtask = $this->testtask->getByID($testtaskID);
|
||||
$action = $this->action->getById($actionID);
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$this->view->testtask = $testtask;
|
||||
$this->view->action = $action;
|
||||
$this->view->users = $users;
|
||||
|
||||
$mailContent = $this->parse($this->moduleName, 'sendmail');
|
||||
|
||||
if($actionType == 'opened')
|
||||
{
|
||||
$mailTitle = sprintf($this->lang->testtask->mail->create->title, $this->app->user->realname, $testtaskID, $this->post->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailTitle = sprintf($this->lang->testtask->mail->edit->title, $this->app->user->realname, $testtaskID, $this->post->name);
|
||||
}
|
||||
$this->loadModel('mail')->send($this->post->owner, $mailTitle, $mailContent);
|
||||
if($this->mail->isError()) echo js::error($this->mail->getError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,3 +67,6 @@ $lang->testtask->lblResults = 'Result';
|
||||
|
||||
$lang->testtask->placeholder->begin = 'begin date';
|
||||
$lang->testtask->placeholder->end = 'end date';
|
||||
|
||||
$lang->testtask->mail->create->title = "%s created testtask #%s:%s";
|
||||
$lang->testtask->mail->edit->title = "%s finished testtask #%s:%s";
|
||||
|
||||
@@ -64,3 +64,9 @@ $lang->testtask->lblCases = '用例列表';
|
||||
$lang->testtask->lblUnlinkCase = '移除用例';
|
||||
$lang->testtask->lblRunCase = '执行用例';
|
||||
$lang->testtask->lblResults = '执行结果';
|
||||
|
||||
$lang->testtask->placeholder->begin = '开始日期';
|
||||
$lang->testtask->placeholder->end = '结束日期';
|
||||
|
||||
$lang->testtask->mail->create->title = "%s创建了测试任务 #%s:%s";
|
||||
$lang->testtask->mail->edit->title = "%s编辑了测试任务 #%s:%s";
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* The mail file of testtask module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
|
||||
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package bug
|
||||
* @version $Id: sendmail.html.php 3717 2012-12-10 00:37:07Z zhujinyonging@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<table width='98%' align='center'>
|
||||
<tr class='header'>
|
||||
<td>
|
||||
TESTTASK #<?php echo $testtask->id . "=>$testtask->owner " . html::a(common::getSysURL() . $this->createLink('testtask', 'view', "testtaskID=$testtask->id"), $testtask->name);?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang->testtask->desc;?></legend>
|
||||
<div class='content'>
|
||||
<?php
|
||||
if(strpos($testtask->desc, 'src="data/upload'))
|
||||
{
|
||||
$testtask->desc = str_replace('<img src="', '<img src="http://' . $this->server->http_host . $this->config->webRoot, $testtask->desc);
|
||||
$testtask->desc = str_replace('<img alt="" src="', '<img src="http://' . $this->server->http_host . $this->config->webRoot, $testtask->desc);
|
||||
}
|
||||
echo $testtask->desc;
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php include '../../common/view/mail.html.php';?></td>
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user