* finish task#1599.

This commit is contained in:
azhi
2013-07-23 16:04:01 +08:00
parent 20db39e034
commit 2a9ba9fa98
14 changed files with 276 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
<?php
$config->bug = new stdClass();
$config->bug->batchCreate = 10;
$config->bug->create = new stdclass();
$config->bug->edit = new stdclass();

View File

@@ -336,6 +336,56 @@ class bug extends control
$this->display();
}
/**
* Batch create.
*
* @param int $productID
* @param int $projectID
* @param int $moduleID
* @access public
* @return void
*/
public function batchCreate($productID, $projectID = 0, $moduleID = 0)
{
if(!empty($_POST))
{
$actions = $this->bug->batchCreate($productID);
foreach($actions as $bugID => $action) $this->sendmail($bugID, $actionID);
die(js::locate($this->session->bugList, 'parent'));
}
/* Get product, then set menu. */
$productID = $this->product->saveState($productID, $this->products);
$this->bug->setMenu($this->products, $productID);
/* If projectID is setted, get builds and stories of this project. */
if($projectID)
{
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 'noempty');
$stories = $this->story->getProjectStoryPairs($projectID);
}
else
{
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$stories = $this->story->getProductStoryPairs($productID);
}
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->batchCreate;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->bug->batchCreate;
$this->view->projectBuilds = $projectBuilds;
$this->view->productID = $productID;
$this->view->stories = $stories;
$this->view->builds = $builds;
$this->view->users = $this->user->getPairs('nodeleted,devfirst');
$this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted');
$this->view->projectID = $projectID;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
$this->view->moduleID = $moduleID;
$this->display();
}
/**
* View a bug.
*

View File

@@ -0,0 +1,2 @@
textarea {height:16px}
.w-220px {width:220px}

View File

@@ -0,0 +1,37 @@
$(function()
{
$(".chosenBox select").chosen({no_results_text: noResultsMatch});
$(".chzn-container-multi .chzn-choices li.search-field input").attr('value', chooseBuilds);
})
/**
* Load project builds
*
* @param int $productID
* @param int $projectID
* @param int $index
* @access public
* @return void
*/
function loadProjectBuilds(productID, projectID, index)
{
if(projectID)
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild');
}
else
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild');
}
$.get(link, function(builds)
{
$('#buildBox' + index).html(builds);
$('#openedBuilds' + index + '_chzn').remove();
$('#buildBox' + index + ' select').removeClass('select-3');
$('#buildBox' + index + ' select').addClass('select-1');
$('#buildBox' + index + ' select').attr('id', 'openedBuilds[' + index + '][]');
$('#buildBox' + index + ' select').chosen({no_results_text: ''});
$('#buildBox' + index + ' .chzn-container-multi .chzn-choices li.search-field input').attr('value', chooseBuilds);
});
}

View File

@@ -69,6 +69,7 @@ $lang->bug->toCase = 'To case';
/* Actions. */
$lang->bug->index = 'Index';
$lang->bug->create = 'Create Bug';
$lang->bug->batchCreate = 'Batch create';
$lang->bug->confirmBug = 'Confirm Bug';
$lang->bug->edit = 'Edit Bug';
$lang->bug->batchEdit = 'Batch edit';
@@ -357,5 +358,5 @@ $lang->bug->action->tostory = array('main' => '$date, To story by <strong>$acto
$lang->bug->action->totask = array('main' => '$date, To task by <strong>$actor</strong>, ID is <strong>$extra</strong>.');
$lang->bug->placeholder = new stdclass();
$lang->bug->placeholder->mailto = 'you can input the user account to select users to mail to.';
$lang->bug->placeholder->keywords = 'keywords';
$lang->bug->placeholder->mailto = 'you can input the user account to select users to mail to.';
$lang->bug->placeholder->chooseBuilds = 'Choose builds...';

View File

@@ -69,6 +69,7 @@ $lang->bug->toCase = '生成用例';
/* 方法列表。*/
$lang->bug->index = '首页';
$lang->bug->create = '提Bug';
$lang->bug->batchCreate = '批量添加';
$lang->bug->confirmBug = '确认';
$lang->bug->edit = '编辑';
$lang->bug->batchEdit = '批量编辑';
@@ -357,4 +358,5 @@ $lang->bug->action->tostory = array('main' => '$date, 由 <strong>$actor</stron
$lang->bug->action->totask = array('main' => '$date, 由 <strong>$actor</strong> 导入为<strong>任务</strong>,编号为 <strong>$extra</strong>。');
$lang->bug->placeholder = new stdclass();
$lang->bug->placeholder->mailto = '输入用户名自动选择';
$lang->bug->placeholder->mailto = '输入用户名自动选择';
$lang->bug->placeholder->chooseBuilds = '选择相关版本...';

View File

@@ -63,6 +63,45 @@ class bugModel extends model
return false;
}
/**
* Batch create
*
* @param int $productID
* @access public
* @return void
*/
public function batchCreate($productID)
{
$this->loadModel('action');
$now = helper::now();
$data = fixer::input('post')->get();
$actions = array();
for($i = 0; $i < $this->config->bug->batchCreate; $i++)
{
if(empty($data->titles[$i])) continue;
$bug = new stdClass();
$bug->openedBy = $this->app->user->account;
$bug->openedDate = $now;
$bug->product = $productID;
$bug->module = $data->modules[$i];
$bug->project = $data->projects[$i];
$bug->openedBuild = implode(',', $data->openedBuilds[$i]);
$bug->title = $data->titles[$i];
$bug->steps = $data->stepses[$i];
$bug->type = $data->types[$i];
$bug->severity = $data->severities[$i];
$bug->os = $data->oses[$i];
$bug->browser = $data->browsers[$i];
$this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck($this->config->bug->create->requiredFields, 'notempty')->exec();
$bugID = $this->dao->lastInsertID();
if(dao::isError()) die(js::error('bug#' . ($i+1) . dao::getError(true)));
$actions[$bugID] = $this->action->create('bug', $bugID, 'Opened');
}
return $actions;
}
/**
* Get bugs of a module.
*

View File

@@ -0,0 +1,51 @@
<?php
/**
* The batch create view of story module of ZenTaoPMS.
*
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
* @package story
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<?php js::set('chooseBuilds', $lang->bug->placeholder->chooseBuilds);?>
<form method='post' target='hiddenwin'>
<table class='table-1 fixed'>
<caption><?php echo $lang->bug->project . $lang->colon . $lang->bug->batchCreate;?></caption>
<tr>
<th class='w-20px'> <?php echo $lang->idAB;?></th>
<th class='w-100px'> <?php echo $lang->bug->module;?></th>
<th class='w-100px'> <?php echo $lang->bug->project;?></th>
<th class='w-150px red'><?php echo $lang->bug->openedBuild;?></th>
<th class='red'> <?php echo $lang->bug->title;?></th>
<th> <?php echo $lang->bug->steps;?></th>
<th class='w-120px'> <?php echo $lang->bug->lblTypeAndSeverity;?></th>
<th class='w-220px'> <?php echo $lang->bug->lblSystemBrowserAndHardware;?></th>
</tr>
<?php for($i = 0; $i < $config->bug->batchCreate; $i++):?>
<tr class='a-center'>
<td><?php echo $i+1;?></td>
<td class='a-left' style='overflow:visible'><?php echo html::select("modules[$i]", $moduleOptionMenu, $moduleID, "class='select-1'");?></td>
<td><?php echo html::select("projects[$i]", $projects, $projectID, "class='select-1' onchange='loadProjectBuilds($productID, this.value, $i)'");?></td>
<td class='a-left chosenBox' style='overflow:visible' id='buildBox<?php echo $i;?>'><?php echo html::select("openedBuilds[$i][]", $builds, '', "class='select-1' multiple");?></td>
<td><?php echo html::input("titles[$i]", '', 'class=select-1');?></td>
<td><?php echo html::textarea("stepses[$i]", '', "rows='1' class=text-1");?></td>
<td>
<?php echo html::select("types[$i]", $lang->bug->typeList, '');?>
<?php echo html::select("severities[$i]", $lang->bug->severityList, '');?>
</td>
<td>
<?php echo html::select("oses[$i]", $lang->bug->osList, '');?>
<?php echo html::select("browsers[$i]", $lang->bug->browserList, '');?>
</td>
</tr>
<?php endfor;?>
<tr><td colspan='8' class='a-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -48,6 +48,7 @@ js::set('customed', $customed);
common::printIcon('bug', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID");
if($browseType != 'needconfirm') common::printIcon('bug', 'export', "productID=$productID&orderBy=$orderBy");
common::printIcon('bug', 'customFields');
common::printIcon('bug', 'batchCreate', "productID=$productID&projectID=0&moduleID=$moduleID");
common::printIcon('bug', 'create', "productID=$productID&extra=moduleID=$moduleID");
?>
</div>

View File

@@ -203,7 +203,7 @@ $lang->bug = new stdclass();
$lang->bug->menu = new stdclass();
$lang->bug->menu->product = '%s';
$lang->bug->menu->bug = array('link' => 'Bug|bug|browse|productID=%s', 'alias' => 'view,create,edit,resolve,close,activate,report,batchedit,confirmbug,assignto', 'subModule' => 'tree');
$lang->bug->menu->bug = array('link' => 'Bug|bug|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,resolve,close,activate,report,batchedit,confirmbug,assignto', 'subModule' => 'tree');
$lang->bug->menu->testcase = array('link' => 'Test Case|testcase|browse|productID=%s', 'alias' => 'view,create,edit');
$lang->bug->menu->testtask = array('link' => 'Test Task|testtask|browse|productID=%s');

View File

@@ -203,7 +203,7 @@ $lang->bug = new stdclass();
$lang->bug->menu = new stdclass();
$lang->bug->menu->product = '%s';
$lang->bug->menu->bug = array('link' => 'Bug|bug|browse|productID=%s', 'alias' => 'view,create,edit,resolve,close,activate,report,batchedit,confirmbug,assignto', 'subModule' => 'tree');
$lang->bug->menu->bug = array('link' => 'Bug|bug|browse|productID=%s', 'alias' => 'view,create,batchcreate,edit,resolve,close,activate,report,batchedit,confirmbug,assignto', 'subModule' => 'tree');
$lang->bug->menu->testcase = array('link' => '用例|testcase|browse|productID=%s', 'alias' => 'view,create,edit');
$lang->bug->menu->testtask = array('link' => '测试任务|testtask|browse|productID=%s');

View File

@@ -345,6 +345,7 @@ $lang->resource->bug = new stdclass();
$lang->resource->bug->index = 'index';
$lang->resource->bug->browse = 'browse';
$lang->resource->bug->create = 'create';
$lang->resource->bug->batchCreate = 'batchCreate';
$lang->resource->bug->confirmBug = 'confirmBug';
$lang->resource->bug->view = 'view';
$lang->resource->bug->edit = 'edit';
@@ -364,20 +365,21 @@ $lang->resource->bug->customFields = 'customFields';
$lang->bug->methodOrder[0] = 'index';
$lang->bug->methodOrder[5] = 'browse';
$lang->bug->methodOrder[10] = 'create';
$lang->bug->methodOrder[15] = 'confirmBug';
$lang->bug->methodOrder[20] = 'view';
$lang->bug->methodOrder[25] = 'edit';
$lang->bug->methodOrder[30] = 'assignTo';
$lang->bug->methodOrder[35] = 'resolve';
$lang->bug->methodOrder[40] = 'activate';
$lang->bug->methodOrder[45] = 'close';
$lang->bug->methodOrder[50] = 'report';
$lang->bug->methodOrder[55] = 'export';
$lang->bug->methodOrder[60] = 'confirmStoryChange';
$lang->bug->methodOrder[65] = 'delete';
$lang->bug->methodOrder[70] = 'saveTemplate';
$lang->bug->methodOrder[75] = 'deleteTemplate';
$lang->bug->methodOrder[80] = 'customFields';
$lang->bug->methodOrder[15] = 'batchCreate';
$lang->bug->methodOrder[20] = 'confirmBug';
$lang->bug->methodOrder[25] = 'view';
$lang->bug->methodOrder[30] = 'edit';
$lang->bug->methodOrder[35] = 'assignTo';
$lang->bug->methodOrder[40] = 'resolve';
$lang->bug->methodOrder[45] = 'activate';
$lang->bug->methodOrder[50] = 'close';
$lang->bug->methodOrder[55] = 'report';
$lang->bug->methodOrder[60] = 'export';
$lang->bug->methodOrder[65] = 'confirmStoryChange';
$lang->bug->methodOrder[70] = 'delete';
$lang->bug->methodOrder[75] = 'saveTemplate';
$lang->bug->methodOrder[80] = 'deleteTemplate';
$lang->bug->methodOrder[85] = 'customFields';
/* Test case. */
$lang->resource->testcase = new stdclass();

View File

@@ -139,6 +139,75 @@
}
/* @end */
/* Multiple select. */
.chzn-container-multi .chzn-choices {
-moz-box-sizing: border-box;
background-color: #FFFFFF;
background-image: linear-gradient(#EEEEEE 1%, #FFFFFF 15%);
border: 1px solid #AAAAAA;
cursor: text;
height: auto !important;
margin: 0;
overflow: hidden;
padding: 0;
position: relative;
width: 100%;
}
.chzn-container-multi .chzn-choices li.search-choice {
background-clip: padding-box;
background-color: #E4E4E4;
background-image: linear-gradient(#F4F4F4 20%, #F0F0F0 50%, #E8E8E8 52%, #EEEEEE 100%);
border: 1px solid #AAAAAA;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
color: #333333;
cursor: default;
line-height: 13px;
margin: 3px 0 3px 5px;
padding: 3px 20px 3px 5px;
position: relative;
}
.chzn-container-multi .chzn-choices li {
float: left;
list-style: none outside none;
}
.chzn-container-multi .chzn-choices li.search-choice .search-choice-close {
background: url("chosen-sprite.png") no-repeat scroll -42px 1px transparent;
display: block;
font-size: 1px;
height: 12px;
position: absolute;
right: 3px;
top: 4px;
width: 12px;
}
.chzn-container-multi .chzn-choices li.search-field input {
background: none repeat scroll 0 0 transparent !important;
border: 0 none !important;
box-shadow: none;
color: #666666;
font-family: sans-serif;
font-size: 100%;
height: 15px;
margin: 1px 0;
outline: 0 none;
padding: 5px;
}
.chzn-container-multi .chzn-choices li.search-choice .search-choice-close {
background: url("./images/chosen/chosen-sprite.png") no-repeat scroll -47px 1px transparent;
display: block;
font-size: 1px;
height: 12px;
position: absolute;
right: 3px;
top: 4px;
width: 12px;
}
/* @end */
/* Product and project seleteGroup. */
.chzn-container-single .chzn-single div b {background: url('./images/chosen/chosen-sprite.png') no-repeat 0 -2px;}

View File

@@ -535,6 +535,8 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
.icon-green-bug-createBug {padding:2px 8px; background:url(images/main/zt-icons.png) 0px -282px;}
.icon-gray-bug-createBug {padding:2px 8px; background:url(images/main/zt-icons.png) 0px -302px;}
#featurebar .f-right .icon-green-bug-batchCreate {padding:2px 8px; background:url(images/main/zt-icons.png) -20px -320px;}
.icon-green-bug-resolve {padding:2px 8px; background:url(images/main/zt-icons.png) -60px -281px;}
.icon-gray-bug-resolve {padding:2px 8px; background:url(images/main/zt-icons.png) -60px -301px;}