* finish the feature of bug openedbuild.

This commit is contained in:
wangchunsheng
2010-03-03 02:25:47 +00:00
parent 714fbc9ab3
commit dbade1e8db
6 changed files with 78 additions and 42 deletions

View File

@@ -43,5 +43,8 @@ $config->bug->search['params']['os'] = array('operator' => '=',
$config->bug->search['params']['browser'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->bug->browserList);
$config->bug->search['params']['resolution'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->bug->resolutionList);
$config->bug->search['params']['mailto'] = array('operator' => 'include', 'control' => 'select', 'values' => 'users');
$config->bug->search['params']['openedBuild'] = array('operator' => '=', 'control' => 'select', 'values' => 'builds');
$config->bug->search['params']['openedBuild'] = array('operator' => 'include', 'control' => 'select', 'values' => 'builds');
$config->bug->search['params']['resolvedBuild']= array('operator' => '=', 'control' => 'select', 'values' => 'builds');
$config->bug->create->requiredFields = 'title,openedBuild';
$config->bug->edit->requiredFields = $config->bug->create->requiredFields;

View File

@@ -182,7 +182,7 @@ class bug extends control
$this->view->stories = $this->story->getProductStoryPairs($productID);
$this->view->users = $this->user->getPairs('noclosed');
$this->view->projects = $this->product->getProjectPairs($productID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$this->view->moduleID = $moduleID;
$this->view->projectID = $projectID;
$this->view->taskID = $taskID;
@@ -265,7 +265,8 @@ class bug extends control
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product);
$this->view->tasks = $this->task->getProjectTaskPairs($bug->project);
$this->view->users = $this->user->getPairs();
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
$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->display();

View File

@@ -43,15 +43,15 @@ class bugModel extends model
->add('openedBy', $this->app->user->account)
->add('openedDate', $now)
->setDefault('project,story,task', 0)
->setDefault('openedBuild', '')
->setIF($this->post->assignedTo != '', 'assignedDate', $now)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->stripTags('title')
->specialChars('title,steps')
->cleanInt('product, module, severity')
->specialChars('steps')
->join('mailto', ',')
->join('openedBuild', ',')
->remove('files, labels')
->get();
$this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck('title,type,openedBuild', 'notempty')->exec();
$this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck($this->config->bug->create->requiredFields, 'notempty')->exec();
if(!dao::isError())
{
$bugID = $this->dao->lastInsertID();
@@ -79,7 +79,13 @@ class bugModel extends model
->leftJoin(TABLE_TASK)->alias('t4')->on('t1.task = t4.id')
->where('t1.id')->eq((int)$bugID)->fetch();
foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = '';
$bug->mailto = ltrim(trim($bug->mailto), ',');
if($bug->mailto)
{
$bug->mailto = ltrim(trim($bug->mailto), ','); // 去掉开始的,。
$bug->mailto = str_replace(' ', '', $bug->mailto);
$bug->mailto = rtrim($bug->mailto, ',') . ',';
$bug->mailto = str_replace(',', ', ', $bug->mailto);
}
if($bug->duplicateBug) $bug->duplicateBugTitle = $this->dao->findById($bug->duplicateBug)->from(TABLE_BUG)->fields('title')->fetch('title');
if($bug->case) $bug->caseTitle = $this->dao->findById($bug->case)->from(TABLE_CASE)->fields('title')->fetch('title');
if($bug->linkBug) $bug->linkBugTitles = $this->dao->select('id,title')->from(TABLE_BUG)->where('id')->in($bug->linkBug)->fetchPairs();
@@ -94,22 +100,23 @@ class bugModel extends model
$now = date('Y-m-d H:i:s');
$bug = fixer::input('post')
->cleanInt('product,module,severity,project,story,task')
->stripTags('title')
->specialChars('steps')
->specialChars('title,steps')
->remove('comment,fiels,labels')
->setDefault('project,module,project,story,task,duplicateBug', 0)
->setDefault('openedBuild', '')
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->setIF($this->post->assignedTo != $oldBug->assignedTo, 'assignedDate', $now)
->setIF($this->post->resolvedBy != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
->setIF($this->post->resolution != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
->setIF($this->post->resolution != '' and $this->post->resolvedBy == '', 'resolvedBy', $this->app->user->account)
->setIF($this->post->closedBy != '' and $this->post->closedDate == '', 'closedDate', $now)
->setIF($this->post->closedDate != '' and $this->post->closedBy == '', 'closedBy', $this->app->user->account)
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedTo', 'closed')
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedDate', $now)
->setIF($this->post->resolution != '' or $this->post->resolvedDate != '', 'status', 'resolved')
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'status', 'closed')
->join('openedBuild', ',')
->setIF($this->post->assignedTo != $oldBug->assignedTo, 'assignedDate', $now)
->setIF($this->post->resolvedBy != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
->setIF($this->post->resolution != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
->setIF($this->post->resolution != '' and $this->post->resolvedBy == '', 'resolvedBy', $this->app->user->account)
->setIF($this->post->closedBy != '' and $this->post->closedDate == '', 'closedDate', $now)
->setIF($this->post->closedDate != '' and $this->post->closedBy == '', 'closedBy', $this->app->user->account)
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedTo', 'closed')
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedDate', $now)
->setIF($this->post->resolution != '' or $this->post->resolvedDate != '', 'status', 'resolved')
->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'status', 'closed')
->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedTo', $oldBug->openedBy)
->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedDate', $now)
->setIF($this->post->resolution == '' and $this->post->resolvedDate =='', 'status', 'active')
@@ -118,7 +125,7 @@ class bugModel extends model
$this->dao->update(TABLE_BUG)->data($bug)
->autoCheck()
->batchCheck('title,type', 'notempty')
->batchCheck($this->config->bug->edit->requiredFields, 'notempty')
->checkIF($bug->resolvedBy, 'resolution', 'notempty')
->checkIF($bug->closedBy, 'resolution', 'notempty')
->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty')

View File

@@ -23,8 +23,9 @@
*/
?>
<?php include '../../common/header.html.php';?>
<?php include '../../common/autocomplete.html.php';?>
<style>
#project, #product, #story, #openedBuild {width:245px}
#project, #product, #story{width:245px}
#severity, #browser {width: 113px}
</style>
<script language='Javascript'>
@@ -103,73 +104,78 @@ function loadProjectBuilds(projectID)
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&varName=openedBuild');
$('#buildBox').load(link);
}
var userList = "<?php echo join(',', array_keys($users));?>".split(',');
$(function() {
$("#mailto").autocomplete(userList, { multiple: true, mustMatch: true});
})
</script>
<div class='yui-doc3'>
</script>
<div class='yui-d0'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table align='center' class='table-1'>
<table class='table-1'>
<caption><?php echo $lang->bug->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProductAndModule;?></th>
<td class='a-left'>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, 'class=select-3');?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProjectAndTask;?></th>
<td class='a-left'>
<td>
<span id='projectIdBox'><?php echo html::select('project', $projects, $projectID, 'onchange=loadProjectRelated(this.value)');?></span>
<span id='taskIdBox'></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblStory;?></th>
<td class='a-left'>
<td>
<span id='storyIdBox'><?php echo html::select('story', $stories, $storyID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td class='a-left'>
<span id='buildBox'><?php echo html::select('openedBuild', $builds, $buildID);?></span>
<td>
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=4 multiple=multiple class=select-3');?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblTypeAndSeverity;?></th>
<td class='a-left'>
<td>
<?php echo html::select('type', (array)$lang->bug->typeList, 'codeerror', 'class=select-2');?>
<?php echo html::select('severity', (array)$lang->bug->severityList, '', 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblSystemBrowserAndHardware;?></nobr></th>
<td class='a-left'>
<td>
<?php echo html::select('os', (array)$lang->bug->osList, '', 'class=select-2');?>
<?php echo html::select('browser', (array)$lang->bug->browserList, '', 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblAssignedTo;?></nobr></th>
<td class='a-left'> <?php echo html::select('assignedTo', $users, '', 'class=select-3');?></td>
<td> <?php echo html::select('assignedTo', $users, '', 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblMailto;?></nobr></th>
<td class='a-left'> <?php echo html::select('mailto[]', $users, '', 'class=select-3 size=5 multiple=multiple');?> </td>
<td> <?php echo html::input('mailto', '', 'class=text-1');?> </td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->title;?></th>
<td class='a-left'><input type='text' name='title' class='text-1' value='<?php echo $title;?>' /></td>
<td><?php echo html::input('title', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->steps;?></th>
<td class='a-left'><textarea name='steps' class='area-1' rows='6'><?php echo $steps;?></textarea></td>
<td><textarea name='steps' class='area-1' rows='6'><?php echo $steps;?></textarea></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->files;?></th>
<td class='a-left'><?php echo $this->fetch('file', 'buildform');?></td>
<td><?php echo $this->fetch('file', 'buildform');?></td>
</tr>
<tr>
<td colspan='2'>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::resetButton() . html::hidden('case', $caseID);?>
</td>
</tr>

View File

@@ -23,7 +23,10 @@
*/
?>
<?php include '../../common/header.html.php';?>
<style>#product, #module, #project, #story, #task, #openedBuild, #resolvedBuild{width:245px}</style>
<?php include '../../common/autocomplete.html.php';?>
<style>
#product, #module, #project, #story, #task, #resolvedBuild{width:245px}
</style>
<script language='Javascript'>
changeProductConfirmed = false;
changeProjectConfirmed = false;
@@ -133,6 +136,10 @@ function setDuplicate(resolution)
$('#duplicateBugBox').hide();
}
}
var userList = "<?php echo join(',', array_keys($users));?>".split(',');
$(function() {
$("#mailto").autocomplete(userList, { multiple: true, mustMatch: true});
})
</script>
<form method='post' target='hiddenwin' enctype='multipart/form-data'>
<div class='yui-d0'>
@@ -244,7 +251,7 @@ function setDuplicate(resolution)
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->openedBuild;?></td>
<td><span id='openedBuildBox'><?php echo html::select('openedBuild', $builds, $bug->openedBuild, 'class=select-3');?></span></td>
<td><span id='openedBuildBox'><?php echo html::select('openedBuild[]', $openedBuilds, $bug->openedBuild, 'size=4 multiple=multiple class=select-3');?></span></td>
</tr>
<tr>
<td width='40%' class='rowhead'><?php echo $lang->bug->resolvedBy;?></td>
@@ -256,7 +263,7 @@ function setDuplicate(resolution)
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->resolvedBuild;?></td>
<td><span id='resolvedBuildBox'><?php echo html::select('resolvedBuild', $builds, $bug->resolvedBuild, 'class=select-3');?></span></td>
<td><span id='resolvedBuildBox'><?php echo html::select('resolvedBuild', $resolvedBuilds, $bug->resolvedBuild, 'class=select-3');?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->resolution;?></td>

View File

@@ -122,7 +122,19 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td><?php if(isset($builds[$bug->openedBuild])) echo $builds[$bug->openedBuild]; else echo $bug->openedBuild;?></td>
<td>
<?php
if($bug->openedBuild)
{
$openedBuilds = explode(',', $bug->openedBuild);
foreach($openedBuilds as $openedBuild) isset($builds[$openedBuild]) ? print($builds[$openedBuild] . '<br />') : print($openedBuild . '<br />');
}
else
{
echo $bug->openedBuild;
}
?>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblResolved;?></th>
@@ -174,7 +186,7 @@
<table class='table-1 a-left fixed'>
<tr>
<td class='rowhead w-p20'><?php echo $lang->bug->mailto;?></td>
<td><?php $mailto = explode(',', $bug->mailto); foreach($mailto as $account) echo ' ' . $users[$account]; ?></td>
<td><?php $mailto = explode(',', str_replace(' ', '', $bug->mailto)); foreach($mailto as $account) echo ' ' . $users[$account]; ?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->linkBug;?></td>