* Finisht task #8497.
This commit is contained in:
@@ -408,7 +408,7 @@ class bug extends control
|
||||
/* If projectID is setted, get builds and stories of this project. */
|
||||
if($projectID)
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone');
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone');
|
||||
$stories = $this->story->getProjectStoryPairs($projectID);
|
||||
}
|
||||
else
|
||||
@@ -509,7 +509,7 @@ class bug extends control
|
||||
/* If projectID is setted, get builds and stories of this project. */
|
||||
if($projectID)
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch, 'noempty');
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty');
|
||||
$stories = $this->story->getProjectStoryPairs($projectID);
|
||||
}
|
||||
else
|
||||
@@ -701,7 +701,7 @@ class bug extends control
|
||||
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, 'noempty');
|
||||
if($projectID)
|
||||
{
|
||||
$openedBuilds = $this->build->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$openedBuilds = $this->build->getExecutionBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1715,7 +1715,7 @@ class bug extends control
|
||||
public function ajaxGetBugFieldOptions($productID, $projectID = 0)
|
||||
{
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'bug');
|
||||
$builds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID);
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($projectID, $productID);
|
||||
$type = $this->lang->bug->typeList;
|
||||
$pri = $this->lang->bug->priList;
|
||||
$severity = $this->lang->bug->severityList;
|
||||
|
||||
@@ -212,7 +212,7 @@ class build extends control
|
||||
$this->view->canBeChanged = common::canBeChanged('build', $build); // Determines whether an object is editable.
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->build = $build;
|
||||
$this->view->buildPairs = $this->build->getProjectBuildPairs($build->project, 0, 0, 'noempty,notrunk');
|
||||
$this->view->buildPairs = $this->build->getExecutionBuildPairs($build->project, 0, 0, 'noempty,notrunk');
|
||||
$this->view->actions = $this->loadModel('action')->getList('build', $buildID);
|
||||
$this->view->link = $link;
|
||||
$this->view->param = $param;
|
||||
@@ -323,26 +323,26 @@ class build extends control
|
||||
if($varName == 'openedBuild')
|
||||
{
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
$builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . '[]', $builds , '', 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'openedBuilds')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty');
|
||||
$builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . "[$index][]", $builds , $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'resolvedBuild')
|
||||
{
|
||||
$params = ($type == 'all') ? '' : 'noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
$builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName, $builds, $build, "class='form-control'"));
|
||||
}
|
||||
if($varName == 'testTaskBuild')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,notrunk');
|
||||
$builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,notrunk');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else
|
||||
{
|
||||
@@ -357,7 +357,7 @@ class build extends control
|
||||
}
|
||||
if($varName == 'dropdownList')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,notrunk');
|
||||
$builds = $this->build->getExecutionBuildPairs($projectID, $productID, $branch, 'noempty,notrunk');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
|
||||
$list = "<div class='list-group'>";
|
||||
|
||||
+59
-9
@@ -50,22 +50,22 @@ class buildModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a project.
|
||||
* Get builds of a execution.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @param string $type all|product|bysearch
|
||||
* @param int|string $param productID|buildQuery
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuilds($projectID, $type = '', $param = '')
|
||||
public function getExecutionBuilds($executionID, $type = '', $param = '')
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as projectName, t3.name as productName, t4.name as branchName')
|
||||
->from(TABLE_BUILD)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->beginIF($type == 'product' and $param)->andWhere('t1.product')->eq($param)->fi()
|
||||
->beginIF($type == 'bysearch')->andWhere($param)->fi()
|
||||
@@ -74,14 +74,14 @@ class buildModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a project by search.
|
||||
* Get builds of a execution by search.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @param int $queryID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuildsBySearch($projectID, $queryID)
|
||||
public function getExecutionBuildsBySearch($executionID, $queryID)
|
||||
{
|
||||
/* If there are saved query conditions, reset the session. */
|
||||
if($queryID)
|
||||
@@ -104,7 +104,7 @@ class buildModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getProjectBuilds($projectID, 'bysearch', $buildQuery);
|
||||
return $this->getExecutionBuilds($executionID, 'bysearch', $buildQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,9 @@ class buildModel extends model
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $params noempty|notrunk, can be a set of them
|
||||
* @param int $buildID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -128,7 +130,55 @@ class buildModel extends model
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->where('t1.PRJ')->eq((int)$projectID)
|
||||
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
|
||||
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
|
||||
|
||||
/* Set builds and filter terminate releases. */
|
||||
$builds = array();
|
||||
foreach($projectBuilds as $buildID => $build)
|
||||
{
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->projectStatus === 'done')) continue;
|
||||
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
|
||||
$builds[$buildID] = $build->name;
|
||||
}
|
||||
if(!$builds) return $sysBuilds + $selectedBuilds;
|
||||
|
||||
/* if the build has been released, replace build name with release name. */
|
||||
$releases = $this->dao->select('build, name')->from(TABLE_RELEASE)
|
||||
->where('build')->in(array_keys($builds))
|
||||
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
|
||||
|
||||
return $sysBuilds + $builds + $selectedBuilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a execution in pairs.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $productID
|
||||
* @param string $params noempty|notrunk, can be a set of them
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildID = 0)
|
||||
{
|
||||
$sysBuilds = array();
|
||||
$selectedBuilds = array();
|
||||
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
|
||||
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
|
||||
if($buildID != 0) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchPairs();
|
||||
|
||||
$projectBuilds = $this->dao->select('t1.id, t1.name, t1.project, t2.status as projectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->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')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
|
||||
->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
|
||||
@@ -882,7 +882,7 @@ $lang->menu->waterfall->projectstory = array('link' => '需求|projectstory|requ
|
||||
$lang->menu->waterfall->design = '设计|design|browse|product={PRODUCT}';
|
||||
$lang->menu->waterfall->ci = '代码|repo|browse|';
|
||||
$lang->menu->waterfall->qa = array('link' => '测试|bug|browse|product={PRODUCT}', 'subModule' => ',testcase,testtask,testsuite,testreport,caselib,');
|
||||
$lang->menu->waterfall->projectrelease = array('link' => '发布|projectrelease|browse|product={PRODUCT}');
|
||||
$lang->menu->waterfall->projectrelease = array('link' => '发布|projectrelease|browse');
|
||||
//$lang->menu->waterfall->release = array('link' => '发布|release|browse|product={PRODUCT}', 'subModule' => 'release');
|
||||
$lang->menu->waterfall->issue = '问题|issue|browse|';
|
||||
$lang->menu->waterfall->risk = '风险|risk|browse|';
|
||||
|
||||
@@ -890,11 +890,11 @@ class project extends control
|
||||
/* Get builds. */
|
||||
if($type == 'bysearch')
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProjectBuildsBySearch((int)$projectID, $param);
|
||||
$builds = $this->loadModel('build')->getExecutionBuildsBySearch((int)$projectID, $param);
|
||||
}
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProjectBuilds((int)$projectID, $type, $param);
|
||||
$builds = $this->loadModel('build')->getExecutionBuilds((int)$projectID, $type, $param);
|
||||
}
|
||||
|
||||
/* Set project builds. */
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
$config->release = new stdclass();
|
||||
$config->release->create = new stdclass();
|
||||
$config->release->edit = new stdclass();
|
||||
$config->release->create->requiredFields = 'name,date';
|
||||
$config->release->edit->requiredFields = 'name,date,build';
|
||||
$config->projectrelease = new stdclass();
|
||||
$config->projectrelease->create = new stdclass();
|
||||
$config->projectrelease->edit = new stdclass();
|
||||
$config->projectrelease->create->requiredFields = 'name,date';
|
||||
$config->projectrelease->edit->requiredFields = 'name,date,build';
|
||||
|
||||
$config->release->editor = new stdclass();
|
||||
$config->release->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->release->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->projectrelease->editor = new stdclass();
|
||||
$config->projectrelease->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
$config->projectrelease->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools');
|
||||
|
||||
@@ -44,13 +44,17 @@ class projectrelease extends control
|
||||
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID);
|
||||
|
||||
$this->loadModel('product');
|
||||
$this->loadModel('project');
|
||||
$products = $this->product->getProductPairsByProject($this->session->PRJ);
|
||||
if(empty($products)) $this->locate($this->createLink('product', 'create'));
|
||||
|
||||
$product = $this->product->getById($productID);
|
||||
if(empty($product)) $this->locate($this->createLink('product', 'create'));
|
||||
$this->view->product = $product;
|
||||
$this->view->branches = (isset($product->type) and $product->type) == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name);
|
||||
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
|
||||
$this->view->project = $this->loadModel('project')->getById($this->session->PRJ);
|
||||
$this->view->products = $products;
|
||||
$this->product->setMenu($this->product->getPairs(), $productID ? $productID : key($products), $branch);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,14 +66,15 @@ class projectrelease extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($productID, $branch = 0, $type = 'all')
|
||||
public function browse($productID = 0, $branch = 0, $type = 'all')
|
||||
{
|
||||
$this->commonAction($productID, $branch);
|
||||
$this->session->set('releaseList', $this->app->getURI(true));
|
||||
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse;
|
||||
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->browse;
|
||||
$this->view->position[] = $this->lang->release->browse;
|
||||
$this->view->releases = $this->projectrelease->getList($productID, $branch, $type);
|
||||
$this->view->releases = $this->projectrelease->getList($productID, $branch, $type, $this->session->PRJ);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->type = $type;
|
||||
$this->display();
|
||||
}
|
||||
@@ -86,7 +91,7 @@ class projectrelease extends control
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$releaseID = $this->projectrelease->create($productID, $branch);
|
||||
$releaseID = $this->projectrelease->create();
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
$this->loadModel('action')->create('release', $releaseID, 'opened');
|
||||
|
||||
@@ -96,16 +101,20 @@ class projectrelease extends control
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
|
||||
}
|
||||
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false);
|
||||
$builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $productID, $branch, 'notrunk|withbranch');
|
||||
$releaseBuilds = $this->projectrelease->getReleaseBuilds($productID, $branch);
|
||||
foreach($releaseBuilds as $build) unset($builds[$build]);
|
||||
unset($builds['trunk']);
|
||||
|
||||
$this->commonAction($productID, $branch);
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->create;
|
||||
$productID = !empty($productID) ? $productID : key($this->view->products);
|
||||
|
||||
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->create;
|
||||
$this->view->position[] = $this->lang->release->create;
|
||||
$this->view->builds = $builds;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->product = $this->product->getById($productID);
|
||||
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->lastRelease = $this->projectrelease->getLast($productID, $branch);
|
||||
$this->display();
|
||||
}
|
||||
@@ -147,7 +156,7 @@ class projectrelease extends control
|
||||
$this->view->position[] = $this->lang->release->edit;
|
||||
$this->view->release = $release;
|
||||
$this->view->build = $build;
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($release->product, $release->branch, 'notrunk|withbranch', false);
|
||||
$this->view->builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $release->product, $release->branch, 'notrunk|withbranch');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -418,7 +427,7 @@ class projectrelease extends control
|
||||
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
|
||||
unset($this->config->product->search['fields']['product']);
|
||||
unset($this->config->product->search['fields']['project']);
|
||||
$this->config->product->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
|
||||
$this->config->product->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
|
||||
$this->config->product->search['queryID'] = $queryID;
|
||||
$this->config->product->search['style'] = 'simple';
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
|
||||
@@ -535,7 +544,7 @@ class projectrelease extends control
|
||||
$this->loadModel('bug');
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
unset($this->config->bug->search['fields']['product']);
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
|
||||
$this->config->bug->search['queryID'] = $queryID;
|
||||
$this->config->bug->search['style'] = 'simple';
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
|
||||
|
||||
@@ -2,3 +2,55 @@ $(document).ready(function()
|
||||
{
|
||||
$("a.preview").modalTrigger({width:1000, type:'iframe'});
|
||||
})
|
||||
|
||||
function loadProduct(productID)
|
||||
{
|
||||
if(typeof parentStory != 'undefined' && parentStory)
|
||||
{
|
||||
confirmLoadProduct = confirm(moveChildrenTips);
|
||||
if(!confirmLoadProduct)
|
||||
{
|
||||
$('#product').val(oldProductID);
|
||||
$('#product').trigger("chosen:updated");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof hasSR != 'undefined' && hasSR)
|
||||
{
|
||||
confirmLoadProduct = confirm(moveSRTips);//Set hasSR variable in pro and biz.
|
||||
if(!confirmLoadProduct)
|
||||
{
|
||||
$('#product').val(oldProductID);
|
||||
$('#product').trigger("chosen:updated");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
oldProductID = $('#product').val();
|
||||
loadProductBranches(productID)
|
||||
}
|
||||
|
||||
function loadBranch()
|
||||
{
|
||||
var branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
}
|
||||
|
||||
function loadProductBranches(productID)
|
||||
{
|
||||
$('#branch').remove();
|
||||
$('#branch_chosen').remove();
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
|
||||
{
|
||||
var $product = $('#product');
|
||||
var $inputGroup = $product.closest('.input-group');
|
||||
$inputGroup.find('.input-group-addon').toggleClass('hidden', !data);
|
||||
if(data)
|
||||
{
|
||||
$inputGroup.append(data);
|
||||
$('#branch').css('width', config.currentMethod == 'create' ? '120px' : '65px').chosen();
|
||||
}
|
||||
$inputGroup.fixInputGroup();
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ function showLink(releaseID, type, param)
|
||||
var method = type == 'story' ? 'linkStory' : 'linkBug';
|
||||
if(typeof(param) == 'undefined') param = '&browseType=' + type + '¶m=0';
|
||||
if(type == 'leftBug') param += '&type=leftBug';
|
||||
loadURL(createLink('release', method, 'releaseID=' + releaseID + param), type);
|
||||
loadURL(createLink('projectrelease', method, 'releaseID=' + releaseID + param), type);
|
||||
|
||||
$('.actions').find("a[href*='" + type + "']").addClass('hidden');
|
||||
}
|
||||
|
||||
@@ -42,23 +42,25 @@ class projectreleaseModel extends model
|
||||
|
||||
/**
|
||||
* Get list of releases.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($productID, $branch = 0, $type = 'all')
|
||||
public function getList($productID, $branch = 0, $type = 'all', $projectID = 0)
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.project')
|
||||
->from(TABLE_RELEASE)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
||||
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id')
|
||||
->where('t1.product')->eq((int)$productID)
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF($projectID)->andWhere('t1.PRJ')->eq((int)$projectID)->fi()
|
||||
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
|
||||
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date DESC')
|
||||
->fetchAll();
|
||||
}
|
||||
@@ -102,15 +104,11 @@ class projectreleaseModel extends model
|
||||
/**
|
||||
* Create a release.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function create($productID, $branch = 0)
|
||||
public function create()
|
||||
{
|
||||
$productID = (int)$productID;
|
||||
$branch = (int)$branch;
|
||||
$buildID = 0;
|
||||
|
||||
/* Check build if build is required. */
|
||||
@@ -121,8 +119,6 @@ class projectreleaseModel extends model
|
||||
|
||||
$release = fixer::input('post')
|
||||
->add('PRJ', $this->session->PRJ)
|
||||
->add('product', (int)$productID)
|
||||
->add('branch', (int)$branch)
|
||||
->setDefault('stories', '')
|
||||
->join('stories', ',')
|
||||
->join('bugs', ',')
|
||||
@@ -134,10 +130,11 @@ class projectreleaseModel extends model
|
||||
/* Auto create build when release is not link build. */
|
||||
if(empty($release->build) and $release->name)
|
||||
{
|
||||
$build = $this->dao->select('*')->from(TABLE_BUILD)
|
||||
$branch = isset($release->branch) ? $release->branch : 0;
|
||||
$build = $this->dao->select('*')->from(TABLE_BUILD)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('name')->eq($release->name)
|
||||
->andWhere('product')->eq($productID)
|
||||
->andWhere('product')->eq($release->product)
|
||||
->andWhere('branch')->eq($branch)
|
||||
->fetch();
|
||||
if($build)
|
||||
@@ -148,8 +145,8 @@ class projectreleaseModel extends model
|
||||
{
|
||||
$build = new stdclass();
|
||||
$build->PRJ = $this->session->PRJ;
|
||||
$build->product = (int)$productID;
|
||||
$build->branch = (int)$branch;
|
||||
$build->product = $release->product;
|
||||
$build->branch = $branch;
|
||||
$build->name = $release->name;
|
||||
$build->date = $release->date;
|
||||
$build->builder = $this->app->user->account;
|
||||
@@ -159,7 +156,7 @@ class projectreleaseModel extends model
|
||||
$build = $this->loadModel('file')->processImgURL($build, $this->config->release->editor->create['id']);
|
||||
$this->dao->insert(TABLE_BUILD)->data($build)
|
||||
->autoCheck()
|
||||
->check('name', 'unique', "product = {$productID} AND branch = {$branch} AND deleted = '0'")
|
||||
->check('name', 'unique', "product = {$release->product} AND branch = {$branch} AND deleted = '0'")
|
||||
->batchCheck($this->config->release->create->requiredFields, 'notempty')
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php
|
||||
echo html::a(inlink('browse', "productID={$product->id}&branch=$branch&type=all"), "<span class='text'>{$lang->release->all}</span>" . ($type == 'all' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('browse', "productID={$product->id}&branch=$branch&type=normal"), "<span class='text'>{$lang->release->statusList['normal']}</span>" . ($type == 'normal' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='normalTab' class='btn btn-link" . ('normal' == $type ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('browse', "productID={$product->id}&branch=$branch&type=terminate"), "<span class='text'>{$lang->release->statusList['terminate']}</span>" . ($type == 'terminate' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='terminateTab' class='btn btn-link" . ('terminate' == $type ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('browse', "productID={$productID}&branch=$branch&type=all"), "<span class='text'>{$lang->release->all}</span>" . ($type == 'all' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('browse', "productID={$productID}&branch=$branch&type=normal"), "<span class='text'>{$lang->release->statusList['normal']}</span>" . ($type == 'normal' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='normalTab' class='btn btn-link" . ('normal' == $type ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('browse', "productID={$productID}&branch=$branch&type=terminate"), "<span class='text'>{$lang->release->statusList['terminate']}</span>" . ($type == 'terminate' ? ' <span class="label label-light label-badge">' . count($releases) . '</span>' : ''), '', "id='terminateTab' class='btn btn-link" . ('terminate' == $type ? ' btn-active-text' : '') . "'");
|
||||
?>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if(common::canModify('product', $product)):?>
|
||||
<?php common::printLink('projectrelease', 'create', "productID=$product->id&branch=$branch", "<i class='icon icon-plus'></i> {$lang->release->create}", '', "class='btn btn-primary'");?>
|
||||
<?php if(common::canModify('project', $project)):?>
|
||||
<?php common::printLink('projectrelease', 'create', "productID=$productID&branch=$branch", "<i class='icon icon-plus'></i> {$lang->release->create}", '', "class='btn btn-primary'");?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,8 +32,8 @@
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->release->noRelease;?></span>
|
||||
<?php if(common::canModify('product', $product) and common::hasPriv('projectrelease', 'create')):?>
|
||||
<?php echo html::a($this->createLink('projectrelease', 'create', "productID=$product->id&branch=$branch"), "<i class='icon icon-plus'></i> " . $lang->release->create, '', "class='btn btn-info'");?>
|
||||
<?php if(common::canModify('project', $project) and common::hasPriv('projectrelease', 'create')):?>
|
||||
<?php echo html::a($this->createLink('projectrelease', 'create', "productID=$productID&branch=$branch"), "<i class='icon icon-plus'></i> " . $lang->release->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@
|
||||
<th class='w-id'><?php echo $lang->release->id;?></th>
|
||||
<th><?php echo $lang->release->name;?></th>
|
||||
<th><?php echo $lang->release->build;?></th>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<?php if(isset($product->type) and $product->type != 'normal'):?>
|
||||
<th class='text-center w-100px'><?php echo $lang->product->branch;?></th>
|
||||
<?php endif;?>
|
||||
<th class='c-date text-center'><?php echo $lang->release->date;?></th>
|
||||
@@ -68,7 +68,7 @@
|
||||
?>
|
||||
</td>
|
||||
<td title='<?php echo $release->buildName?>'><?php echo empty($release->project) ? $release->buildName : html::a($this->createLink('build', 'view', "buildID=$release->buildID"), $release->buildName);?></td>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<?php if(isset($product->type) and $product->type != 'normal'):?>
|
||||
<td class='text-center' title='<?php echo zget($branches, $release->branch, '');?>'><?php echo $branches[$release->branch];?></td>
|
||||
<?php endif;?>
|
||||
<td class='text-center'><?php echo $release->date;?></td>
|
||||
|
||||
@@ -20,6 +20,21 @@
|
||||
<form class='load-indicator main-form form-ajax' id='dataform' method='post' enctype='multipart/form-data'>
|
||||
<table class='table table-form'>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo $lang->release->product;?></th>
|
||||
<td>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<div class='input-group'>
|
||||
<?php endif;?>
|
||||
<?php echo html::select('product', $products, $productID, "onchange='loadProduct(this.value);' class='form-control chosen control-product'");?>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<span class='input-group-addon fix-border fix-padding'></span>
|
||||
<?php echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->release->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control' required");?></td>
|
||||
|
||||
Reference in New Issue
Block a user