Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
chenfeiCF
2015-10-29 16:17:26 +08:00
21 changed files with 51 additions and 62 deletions
+13 -21
View File
@@ -123,7 +123,7 @@ class bug extends control
$this->config->bug->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
$this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID);
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID);
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
if($this->session->currentProductType == 'normal')
{
unset($this->config->bug->search['fields']['branch']);
@@ -256,7 +256,7 @@ class bug extends control
$actionID = $this->action->create('bug', $bugID, 'Opened');
$this->sendmail($bugID, $actionID);
$location = $this->createLink('bug', 'browse', "productID={$this->post->product}&type=byModule&param={$this->post->module}");
$location = $this->createLink('bug', 'browse', "productID={$this->post->product}&branch=$branch&type=byModule&param={$this->post->module}");
$response['locate'] = isset($_SESSION['bugList']) ? $this->session->bugList : $location;
$this->send($response);
}
@@ -324,7 +324,7 @@ class bug extends control
}
else
{
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty,noterminate,nodone');
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty,release,noterminate,nodone');
$stories = $this->story->getProductStoryPairs($productID, $branch);
}
@@ -553,29 +553,21 @@ class bug extends control
if($projectID)
{
$openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, 0, 'noempty');
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty');
}
else
{
$openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'noempty');
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty');
}
/* Set the openedBuilds list. */
$oldOpenedBuilds = array();
$bugOpenedBuilds = explode(',', $bug->openedBuild);
foreach($bugOpenedBuilds as $buildID)
/* Set the openedBuilds list*/
$bugOpenedBuilds = array();
foreach($allBuilds as $buildID => $build)
{
if(isset($allBuilds[$buildID])) $oldOpenedBuilds[$buildID] = $allBuilds[$buildID];
}
$openedBuilds = $openedBuilds + $oldOpenedBuilds;
/* Set the resolvedBuilds list. */
$oldResolvedBuild = array();
if($bug->resolvedBuild)
{
if(isset($allBuilds[$bug->resolvedBuild])) $oldResolvedBuild[$bug->resolvedBuild] = $allBuilds[$bug->resolvedBuild];
if(strpos($bug->openedBuild, "$buildID") !== false) $bugOpenedBuilds[$buildID] = $build;
}
$openedBuilds = $openedBuilds + $bugOpenedBuilds;
$this->view->bug = $bug;
$this->view->productID = $productID;
@@ -589,7 +581,7 @@ class bug extends control
$this->view->tasks = $this->task->getProjectTaskPairs($bug->project);
$this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy");
$this->view->openedBuilds = $openedBuilds;
$this->view->resolvedBuilds = array('' => '') + $openedBuilds + $oldResolvedBuild ;
$this->view->resolvedBuilds = array('' => '') + $openedBuilds;
$this->view->actions = $this->action->getList('bug', $bugID);
$this->view->templates = $this->bug->getUserBugTemplates($this->app->user->account);
@@ -839,7 +831,7 @@ class bug extends control
$this->view->bug = $bug;
$this->view->users = $users;
$this->view->assignedTo = $assignedTo;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'noterminate, nodone');
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
$this->view->actions = $this->action->getList('bug', $bugID);
$this->display();
}
@@ -895,7 +887,7 @@ class bug extends control
$this->view->bug = $bug;
$this->view->users = $this->user->getPairs('nodeleted', $bug->resolvedBy);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty');
$this->view->actions = $this->action->getList('bug', $bugID);
$this->display();
+2 -2
View File
@@ -16,11 +16,11 @@ function loadProjectBuilds(productID, projectID, index)
{
if(projectID)
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + "&varName=openedBuilds&build=''&index=" + index);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + "&varName=openedBuilds&build=&branch" + branch + "&index=" + index);
}
else
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=''&index=" + index);
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branch + "&index=" + index);
}
$.get(link, function(builds)
+2 -2
View File
@@ -210,7 +210,7 @@ class bugModel extends model
* @access public
* @return array
*/
public function getModuleBugs($productID, $branch, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null)
public function getModuleBugs($productID, $branch = 0, $moduleIds = 0, $projects, $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('product')->eq((int)$productID)
@@ -642,7 +642,7 @@ class bugModel extends model
$productID = $bug->product;
$users = $this->loadModel('user')->getPairs('nodeleted');
$product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
$stmt = $this->dao->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', ''));
$stmt = $this->dao->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug'));
$modules = array();
while($module = $stmt->fetch()) $modules[$module->id] = $module;
+1
View File
@@ -131,5 +131,6 @@
</tr>
</tbody>
</table>
<?php js::set('branch', $branch)?>
<?php include '../../common/view/pastetext.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -44,7 +44,7 @@ js::set('refresh', $lang->refresh);
if(count($moduleOptionMenu) == 1)
{
echo "<span class='input-group-addon'>";
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=bug"), $lang->tree->manage, '_blank');
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=bug&currentModuleID=0&branch=$branch"), $lang->tree->manage, '_blank');
echo '&nbsp; ';
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
echo '</span>';
+1 -1
View File
@@ -18,7 +18,7 @@
<strong><small class='text-muted'><?php echo html::icon($lang->icons['report']);?></small> <?php echo $lang->bug->report->common;?></strong>
</div>
<div class='actions'>
<?php echo html::a($this->createLink('bug', 'browse', "productID=$productID&browseType=$browseType&moduleID=$moduleID"), $lang->goback, '', "class='btn'");?>
<?php echo html::a($this->createLink('bug', 'browse', "productID=$productID&branch=0&browseType=$browseType&moduleID=$moduleID"), $lang->goback, '', "class='btn'");?>
</div>
</div>
<div class='row-table row-table-side-left'>
+1 -1
View File
@@ -131,7 +131,7 @@
foreach($modulePath as $key => $module)
{
$moduleTitle .= $module->name;
if(!common::printLink('bug', 'browse', "productID=$bug->product&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
if(!common::printLink('bug', 'browse', "productID=$bug->product&branch=$module->branch&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
if(isset($modulePath[$key + 1]))
{
$moduleTitle .= '/';
+9 -17
View File
@@ -66,29 +66,22 @@ class buildModel extends model
*/
public function getProjectBuildPairs($projectID, $productID, $branch = 0, $params = '')
{
$builds = array();
$sysBuilds = array();
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk');
$projectBuilds = $this->dao->select('t1.id, t1.name, t3.status as releaseStatus')->from(TABLE_BUILD)->alias('t1')
$builds = $this->dao->select('t1.id, t1.name')->from(TABLE_BUILD)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->where('t1.project')->eq((int)$projectID)
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF(strpos($params, 'nodone') !== false)->andWhere('t2.status')->ne('done')->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
foreach($projectBuilds as $buildID => $build)
{
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
$builds[$buildID] = $build->name;
}
->orderBy('t1.date desc, t1.id desc')->fetchPairs();
if(!$builds) return $sysBuilds;
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)
->where('build')->in(array_keys($builds))
->beginIF(strpos($params, 'noterminate') !== false)->andWhere('status')->ne('terminate')->fi()
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->andWhere('deleted')->eq(0)
->fetchPairs();
@@ -110,23 +103,22 @@ class buildModel extends model
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => 'Trunk');
$productBuilds = $this->dao->select('t1.id, t1.name, t1.project, t2.status as projectStatus, t3.status as releaseStatus')->from(TABLE_BUILD)->alias('t1')
$productBuilds = $this->dao->select('t1.id, t1.name, t1.project')->from(TABLE_BUILD)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->where('t1.product')->in($products)
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF(strpos($params, 'nodone') !== false)->andWhere('t2.status')->ne('done')->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
$releases = $this->dao->select('build,name,deleted')->from(TABLE_RELEASE)
->where('product')->in($products)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->fetchAll('build');
->where('product')->in($products)
->beginIF(strpos($params, 'noterminate') !== false)->andWhere('status')->ne('terminate')->fi()
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->fetchAll('build');
$builds = array();
foreach($productBuilds as $key => $build)
{
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
if((strpos($params, 'nodone') !== false) and ($build->projectStatus === 'done')) continue;
if($build->project)
{
$builds[$key] = $build->name;
+2 -2
View File
@@ -66,7 +66,7 @@
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'iframe');
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', 'flag-checkered', '', 'iframe');
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list', 'pencil');
common::printIcon('testcase', 'create', "productID=$case->product&moduleID=$case->module&from=testcase&param=$case->id", $case, 'list', 'copy');
common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'list', 'copy');
if(common::hasPriv('testcase', 'delete'))
{
@@ -74,7 +74,7 @@
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '<i class="icon-remove"></i>', '', "class='btn-icon' title='{$lang->testcase->delete}'");
}
common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug');
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug');
?>
</td>
</tr>
-1
View File
@@ -1548,7 +1548,6 @@ class project extends control
}
else
{
$branches = array(0 => 0);
foreach($products as $product) $branches[$product->branch] = $product->branch;
$allStories = $this->story->getProductStories(array_keys($products), $branches, $moduleID = '0', $status = 'active');
}
+1 -1
View File
@@ -59,7 +59,7 @@
common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'edit', $params, $bug, 'list');
common::printIcon('bug', 'create', "product=$bug->product&extra=bugID=$bug->id", $bug, 'list', 'copy');
common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy');
?>
</td>
</tr>
+1 -1
View File
@@ -101,7 +101,7 @@
common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", '', 'list', 'stack');
$lang->testcase->batchCreate = $lang->testcase->create;
if($productID) common::printIcon('testcase', 'batchCreate', "productID=$story->product&moduleID=$story->module&storyID=$story->id", '', 'list', 'sitemap');
if($productID) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', 'list', 'sitemap');
if(common::hasPriv('project', 'unlinkStory'))
{
+7 -2
View File
@@ -971,11 +971,16 @@ class storyModel extends model
*/
public function getProductStories($productID = 0, $branch = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null)
{
if(is_array($branch))
{
unset($branch[0]);
$branch = join(',', $branch);
}
return $this->dao->select('t1.*, t2.title as planTitle')
->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->where('t1.product')->in($productID)
->beginIF(!empty($branch))->andWhere("t1.branch")->in($branch)->fi()
->beginIF($branch)->andWhere("t1.branch")->in("0,$branch")->fi()
->beginIF(!empty($moduleIds))->andWhere('t1.module')->in($moduleIds)->fi()
->beginIF($status and $status != 'all')->andWhere('t1.status')->in($status)->fi()
->andWhere('t1.deleted')->eq(0)
@@ -1282,7 +1287,7 @@ class storyModel extends model
->where('t1.project')->eq((int)$projectID)
->andWhere('t2.deleted')->eq(0)
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($branch)->andWhere('t2.branch')->eq((int)$branch)->fi()
->beginIF($branch)->andWhere('t2.branch')->in("0,$branch")->fi()
->beginIF($moduleIds)->andWhere('t2.module')->in($moduleIds)->fi()
->fetchAll();
if(!$stories) return array();
+1 -1
View File
@@ -38,7 +38,7 @@
if(count($moduleOptionMenu) == 1)
{
echo "<span class='input-group-addon'>";
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=story"), $lang->tree->manage, '_blank');
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=story&currentModuleID=0&branch=$branch"), $lang->tree->manage, '_blank');
echo '&nbsp; ';
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
echo '</span>';
+1 -1
View File
@@ -71,7 +71,7 @@
if(count($moduleOptionMenu) == 1)
{
echo "<span class='inpug-group-addon'>";
echo html::a($this->createLink('tree', 'browse', "rootID=$story->product&view=story"), $lang->tree->manage, '_blank');
echo html::a($this->createLink('tree', 'browse', "rootID=$story->product&view=story&branch=$story->branch"), $lang->tree->manage, '_blank');
echo html::a("javascript:loadProductModules($story->product)", $lang->refresh);
echo '</span>';
}
+1 -1
View File
@@ -90,7 +90,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '<i class="icon-remove"></i>', '', "title='{$lang->testcase->delete}' class='btn-icon'");
}
common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe');
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe');
?>
</td>
<?php endif;?>
+1 -1
View File
@@ -39,7 +39,7 @@
if(count($moduleOptionMenu) == 1)
{
echo "<span class='input-group-addon'>";
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=case"), $lang->tree->manage, '_blank');
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=case&currentModuleID=0&branch=$branch"), $lang->tree->manage, '_blank');
echo '&nbsp; ';
echo html::a("javascript:loadProductModules($productID)", $lang->refresh);
echo '</span>';
+3 -3
View File
@@ -46,13 +46,13 @@
common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", '', 'button', '', '', 'runCase');
common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", '', 'button', '', '', 'results');
if($case->lastRunResult == 'fail') common::printIcon('testcase', 'createBug', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe');
if($case->lastRunResult == 'fail') common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe');
echo '</div>';
echo "<div class='btn-group'>";
common::printIcon('testcase', 'edit',"caseID=$case->id");
common::printCommentIcon('testcase');
common::printIcon('testcase', 'create', "productID=$case->product&moduleID=$case->module&from=testcase&param=$case->id", '', 'button', 'copy');
common::printIcon('testcase', 'create', "productID=$case->product&branch=$branch&moduleID=$case->module&from=testcase&param=$case->id", '', 'button', 'copy');
common::printIcon('testcase', 'delete', "caseID=$case->id", '', 'button', '', 'hiddenwin');
echo '</div>';
@@ -140,7 +140,7 @@
{
foreach($modulePath as $key => $module)
{
if(!common::printLink('testcase', 'browse', "productID=$case->product&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
if(!common::printLink('testcase', 'browse', "productID=$case->product&branch=$module->branch&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
if(isset($modulePath[$key + 1])) echo $lang->arrow;
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ function loadProjectBuilds(projectID)
{
selectedBuild = $('#openedBuild').val();
if(!selectedBuild) selectedBuild = 0;
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=testTaskBuild&builds=' + selectedBuild);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=testTaskBuild&build=' + selectedBuild);
$('#buildBox').load(link, function(){$('#build').chosen(defaultChosenOptions);});
}
+1 -1
View File
@@ -21,6 +21,6 @@ function loadProjectBuilds(projectID)
{
selectedBuild = $('#build').val();
if(!selectedBuild) selectedBuild = 0;
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=testTaskBuild&builds=' + selectedBuild);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=testTaskBuild&build=' + selectedBuild);
$('#buildBox').load(link, function(){$('#build').chosen(defaultChosenOptions);});
}
+1 -1
View File
@@ -60,7 +60,7 @@ var currentRoot = <?php echo $module->root;?>;
var currentParent = <?php echo $module->parent;?>;
function getProductModules(productID)
{
$.get(createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + productID + '&viewType=story&rootModuleID=0&returnType=json'), function(data)
$.get(createLink('tree', 'ajaxGetOptionMenu', 'rootID=' + productID + '&viewType=story&branch=0&rootModuleID=0&returnType=json'), function(data)
{
var newOption = '';
for(i in data) newOption += '<option value="' + i + '">' + data[i] + '</option>';