diff --git a/config/config.php b/config/config.php
index db8f6334ed..386c991251 100644
--- a/config/config.php
+++ b/config/config.php
@@ -88,6 +88,7 @@ define('TABLE_CASESTEP', $config->db->prefix . 'caseStep');
define('TABLE_TESTTASK', $config->db->prefix . 'testTask');
define('TABLE_TESTRUN', $config->db->prefix . 'testRun');
define('TABLE_TESTRESULT', $config->db->prefix . 'testResult');
+define('TABLE_USERTPL', $config->db->prefix . 'userTPL');
define('TABLE_PRODUCT', $config->db->prefix . 'product');
define('TABLE_STORY', $config->db->prefix . 'story');
diff --git a/module/bug/control.php b/module/bug/control.php
index abfdcf2c3b..7c6966c5e2 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -397,6 +397,7 @@ class bug extends control
$this->view->openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$this->view->resolvedBuilds = array('' => '') + $this->view->openedBuilds;
$this->view->actions = $this->action->getList('bug', $bugID);
+ $this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);
$this->display();
}
@@ -530,6 +531,26 @@ class bug extends control
die(html::select('bug', $bugs, '', 'class=select-1'));
}
+ public function saveTemplate()
+ {
+ $this->bug->saveUserBugTemplate();
+ if(dao::isError()) die(js::error(dao::getError()));
+ die($this->fetch('bug', 'createTPLS'));
+ }
+
+ public function createTPLS()
+ {
+ $this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);
+ $this->display('bug', 'createTPLS');
+ }
+
+ /* 删除一个bug模板。*/
+ public function deleteTemplate($templateID)
+ {
+ $this->dao->delete()->from(TABLE_USERTPL)->where('id')->eq($templateID)->andWhere('account')->eq($this->app->user->account)->exec();
+ die();
+ }
+
/* 发送邮件。*/
private function sendmail($bugID, $actionID)
{
diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php
index 53137122cb..d1974f0762 100644
--- a/module/bug/lang/zh-cn.php
+++ b/module/bug/lang/zh-cn.php
@@ -131,6 +131,7 @@ $lang->bug->buttonToList = '返回';
/* 交互提示。*/
$lang->bug->confirmChangeProduct = '修改产品会导致相应的项目、需求和任务发生变化,确定吗?';
$lang->bug->confirmDelete = '您确认要删除该Bug吗?';
+$lang->bug->setTemplateTitle = '请输入bug模板标题(保存之前请先填写bug重现步骤):';
/* 模板。*/
$lang->bug->tblStep = "[步骤]\n";
diff --git a/module/bug/model.php b/module/bug/model.php
index df5a459d39..9710d282bf 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -438,4 +438,26 @@ class bugModel extends model
/* 合并配置。*/
foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value;
}
+
+ /* 获得用户的Bug模板列表。*/
+ public function getUserBugTemplates($account)
+ {
+ $templates = $this->dao->select('id, title, content')
+ ->from(TABLE_USERTPL)
+ ->where('account')->eq($account)
+ ->orderBy('id')
+ ->fetchAll();
+ return $templates;
+ }
+
+ /* 保存用户的BUG模板。*/
+ public function saveUserBugTemplate()
+ {
+ $template = fixer::input('post')
+ ->specialChars('title, content')
+ ->add('account', $this->app->user->account)
+ ->add('type', 'bug')
+ ->get();
+ $this->dao->insert(TABLE_USERTPL)->data($template)->autoCheck('title, content', 'notempty')->check('title', 'unique')->exec();
+ }
}
diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php
index 761af7e62e..d3e6d9f254 100644
--- a/module/bug/view/create.html.php
+++ b/module/bug/view/create.html.php
@@ -24,11 +24,13 @@
?>
+
diff --git a/www/theme/default/style.css b/www/theme/default/style.css
index 5d048d543f..8f929a2bf3 100644
--- a/www/theme/default/style.css
+++ b/www/theme/default/style.css
@@ -159,9 +159,11 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
.w-type {width:80px}
.w-resolution{width:60px}
+.margin-zero {margin: 0}
.margin-10px {margin: 10px}
.margin-15px {margin: 15px}
.margin-20px {margin: 20px}
+.padding-zero{padding: 0}
.padding-10px{padding: 10px}
.padding-5px {padding: 5px}