* finish task #2341.
This commit is contained in:
@@ -47,5 +47,14 @@ class branch extends control
|
||||
$this->view->keywords = $keywords;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function ajaxGetBranches($productID)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
if($product->type == 'normal') die();
|
||||
|
||||
$branches = $this->branch->getPairs($productID);
|
||||
die(html::select('branch[]', $branches, '', "class='form-control'"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-6
@@ -216,7 +216,7 @@ class bug extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($productID, $extras = '')
|
||||
public function create($productID, $branch = 0, $extras = '')
|
||||
{
|
||||
$this->view->users = $this->user->getPairs('nodeleted|devfirst|noclosed');
|
||||
if(empty($this->products)) $this->locate($this->createLink('product', 'create'));
|
||||
@@ -253,7 +253,9 @@ class bug extends control
|
||||
|
||||
/* Get product, then set menu. */
|
||||
$productID = $this->product->saveState($productID, $this->products);
|
||||
$this->bug->setMenu($this->products, $productID);
|
||||
$product = $this->product->getById($productID);
|
||||
$branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
|
||||
$this->bug->setMenu($this->products, $productID, $branch);
|
||||
|
||||
/* Init vars. */
|
||||
$moduleID = 0;
|
||||
@@ -314,7 +316,7 @@ class bug extends control
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty,release');
|
||||
$stories = $this->story->getProductStoryPairs($productID);
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch);
|
||||
}
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->create;
|
||||
@@ -346,6 +348,9 @@ class bug extends control
|
||||
$this->view->keywords = $keywords;
|
||||
$this->view->severity = $severity;
|
||||
$this->view->type = $type;
|
||||
$this->view->product = $product;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $branches;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -359,7 +364,7 @@ class bug extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreate($productID, $projectID = 0, $moduleID = 0)
|
||||
public function batchCreate($productID, $branch = 0, $projectID = 0, $moduleID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -381,7 +386,7 @@ class bug extends control
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty');
|
||||
$stories = $this->story->getProductStoryPairs($productID);
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch);
|
||||
}
|
||||
|
||||
if($this->session->bugImagesFile)
|
||||
@@ -538,7 +543,7 @@ class bug extends control
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->projects = $this->product->getProjectPairs($bug->product);
|
||||
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product);
|
||||
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product, $bug->branch);
|
||||
$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->resolvedBuilds = array('' => '') + $this->view->openedBuilds;
|
||||
|
||||
@@ -73,7 +73,7 @@ function loadProductModules(productID)
|
||||
*/
|
||||
function loadProductStories(productID)
|
||||
{
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleId=0&storyID=' + oldStoryID);
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=0&moduleId=0&storyID=' + oldStoryID);
|
||||
$('#storyIdBox').load(link, function(){$('#story').chosen(defaultChosenOptions);});
|
||||
}
|
||||
|
||||
@@ -213,7 +213,8 @@ function loadProjectBuilds(projectID)
|
||||
*/
|
||||
function setStories(moduleID, productID)
|
||||
{
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID);
|
||||
branch = $('#branch').val();
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID);
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
if(!stories) stories = '<select id="story" name="story" class="form-control"></select>';
|
||||
|
||||
@@ -245,6 +245,7 @@ class build extends control
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Build search form. */
|
||||
$product = $this->product->getByID($build->product);
|
||||
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
|
||||
unset($this->config->product->search['fields']['product']);
|
||||
unset($this->config->product->search['fields']['project']);
|
||||
@@ -254,6 +255,15 @@ class build extends control
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($build->product => $build->product));
|
||||
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($build->product, $viewType = 'story', $startModuleID = 0);
|
||||
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
|
||||
if($product->type == 'normal')
|
||||
{
|
||||
unset($this->config->product->search['fields']['branch']);
|
||||
unset($this->config->product->search['params']['branch']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->config->product->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($product->id, 'noempty');
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
|
||||
@@ -13,6 +13,7 @@ $config->product->search['fields']['status'] = $lang->story->status;
|
||||
$config->product->search['fields']['pri'] = $lang->story->pri;
|
||||
|
||||
$config->product->search['fields']['product'] = $lang->story->product;
|
||||
$config->product->search['fields']['branch'] = $lang->story->branch;
|
||||
$config->product->search['fields']['module'] = $lang->story->module;
|
||||
$config->product->search['fields']['plan'] = $lang->story->plan;
|
||||
$config->product->search['fields']['estimate'] = $lang->story->estimate;
|
||||
@@ -44,6 +45,7 @@ $config->product->search['params']['stage'] = array('operator' => '=',
|
||||
$config->product->search['params']['pri'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->story->priList);
|
||||
|
||||
$config->product->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->product->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->product->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
|
||||
$config->product->search['params']['plan'] = array('operator' => '=', 'control' => 'select', 'values' => '');
|
||||
$config->product->search['params']['estimate'] = array('operator' => '=', 'control' => 'input', 'values' => '');
|
||||
|
||||
@@ -106,7 +106,7 @@ class product extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($productID = 0, $branch = 0, $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($productID = 0, $branch = '', $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* Lower browse type. */
|
||||
$browseType = strtolower($browseType);
|
||||
@@ -117,7 +117,8 @@ class product extends control
|
||||
|
||||
/* Set product, module and query. */
|
||||
$productID = $this->product->saveState($productID, $this->products);
|
||||
if(empty($branch)) $branch = $this->session->branch;
|
||||
$product = $this->product->getById($productID);
|
||||
if($branch === '') $branch = $this->session->branch;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
@@ -171,13 +172,22 @@ class product extends control
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
|
||||
$this->config->product->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->product->allProduct);
|
||||
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'story', $startModuleID = 0);
|
||||
if($product->type == 'normal')
|
||||
{
|
||||
unset($this->config->product->search['fields']['branch']);
|
||||
unset($this->config->product->search['params']['branch']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->config->product->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty');
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$this->view->summary = $this->product->summary($stories);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'story', $startModuleID = 0, array('treeModel', 'createStoryLink'));
|
||||
$this->view->parentModules = $this->tree->getParents($moduleID);
|
||||
@@ -507,9 +517,9 @@ class product extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetPlans($productID, $planID = 0, $needCreate = false)
|
||||
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $needCreate = false)
|
||||
{
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID);
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$output = html::select('plan', $plans, $planID, "class='form-control chosen'");
|
||||
if(count($plans) == 1 and $needCreate)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ class productModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setMenu($products, $productID, $branch = '', $extra = '')
|
||||
public function setMenu($products, $productID, $branch = 0, $extra = '')
|
||||
{
|
||||
/* Has access privilege?. */
|
||||
if($products and !isset($products[$productID]) and !$this->checkPriv($this->getById($productID)))
|
||||
@@ -57,12 +57,12 @@ class productModel extends model
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = '')
|
||||
public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = 0)
|
||||
{
|
||||
if(!$productID) return;
|
||||
|
||||
setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot);
|
||||
setCookie("lastBranch", $branch, $this->config->cookieLife, $this->config->webRoot);
|
||||
setCookie("lastBranch", "$productID-$branch", $this->config->cookieLife, $this->config->webRoot);
|
||||
$currentProduct = $this->getById($productID);
|
||||
$output = "<a id='currentItem' href=\"javascript:showDropMenu('product', '$productID', '$currentModule', '$currentMethod', '$extra')\">{$currentProduct->name} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
|
||||
if($currentProduct->type != 'normal')
|
||||
@@ -88,8 +88,15 @@ class productModel extends model
|
||||
if($productID > 0) $this->session->set('product', (int)$productID);
|
||||
if($productID == 0 and $this->cookie->lastProduct) $this->session->set('product', (int)$this->cookie->lastProduct);
|
||||
if($productID == 0 and $this->session->product == '') $this->session->set('product', key($products));
|
||||
if($this->cookie->lastBranch) $this->session->set('branch', (int)$this->cookie->lastBranch);
|
||||
if(!isset($products[$this->session->product])) $this->session->set('product', key($products));
|
||||
|
||||
if($this->cookie->lastBranch)
|
||||
{
|
||||
list($lastProduct, $branch) = explode('-', $this->cookie->lastBranch);
|
||||
$branch = $lastProduct == $this->session->product ? $branch : 0;
|
||||
$this->session->set('branch', (int)$branch);
|
||||
}
|
||||
|
||||
return $this->session->product;
|
||||
}
|
||||
|
||||
@@ -690,7 +697,7 @@ class productModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
$link = helper::createLink($module, $method, "productID=%s");
|
||||
$link = helper::createLink($module, $method, "productID=%s&branch=%s");
|
||||
}
|
||||
}
|
||||
else if($module == 'productplan' || $module == 'release')
|
||||
@@ -700,7 +707,7 @@ class productModel extends model
|
||||
}
|
||||
else if($module == 'tree')
|
||||
{
|
||||
$link = helper::createLink($module, $method, "productID=%s&type=$extra" . ($branch ? "&branch=%s" : ''));
|
||||
$link = helper::createLink($module, $method, "productID=%s&type=$extra");
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
</div>
|
||||
<div class='btn-group'>
|
||||
<?php
|
||||
common::printIcon('story', 'batchCreate', "productID=$productID&moduleID=$moduleID", '', 'button', 'plus-sign');
|
||||
common::printIcon('story', 'create', "productID=$productID&moduleID=$moduleID", '', 'button', 'plus');
|
||||
common::printIcon('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID", '', 'button', 'plus-sign');
|
||||
common::printIcon('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID", '', 'button', 'plus');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,7 +130,7 @@
|
||||
<?php
|
||||
$canBatchEdit = common::hasPriv('story', 'batchEdit');
|
||||
$disabled = $canBatchEdit ? '' : "disabled='disabled'";
|
||||
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0");
|
||||
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0&branch=$branch");
|
||||
?>
|
||||
<div class='btn-group dropup'>
|
||||
<?php echo html::commonButton($lang->edit, "onclick=\"setFormAction('$actionLink')\" $disabled");?>
|
||||
|
||||
@@ -1516,6 +1516,8 @@ class project extends control
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts($products);
|
||||
unset($this->lang->story->statusList['draft']);
|
||||
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
|
||||
unset($this->config->product->search['fields']['branch']);
|
||||
unset($this->config->product->search['params']['branch']);
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
$title = $project->name . $this->lang->colon . $this->lang->project->linkStory;
|
||||
@@ -1528,7 +1530,7 @@ class project extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$allStories = $this->story->getProductStories(array_keys($products), $moduleID = '0', $status = 'active');
|
||||
$allStories = $this->story->getProductStories(array_keys($products), 0, $moduleID = '0', $status = 'active');
|
||||
}
|
||||
$prjStories = $this->story->getProjectStoryPairs($projectID);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<?php echo html::a($storyLink, sprintf('%03d', $story->id));?>
|
||||
</td>
|
||||
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $story->pri, $story->pri)?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri);?></span></td>
|
||||
<td><?php echo html::a($this->createLink('product', 'browse', "productID=$story->product"), $products[$story->product], '_blank');?></td>
|
||||
<td><?php echo html::a($this->createLink('product', 'browse', "productID=$story->product&branch=$story->branch"), $products[$story->product], '_blank');?></td>
|
||||
<td class='text-left nobr' title="<?php echo $story->title?>"><?php echo html::a($storyLink, $story->title);?></td>
|
||||
<td><?php echo $story->planTitle;?></td>
|
||||
<td><?php echo $users[$story->openedBy];?></td>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
common::printIcon('story', 'export', "productID=$productID&orderBy=id_desc", '', 'button', '', '', 'export');
|
||||
|
||||
$this->lang->story->create = $this->lang->project->createStory;
|
||||
if($productID) common::printIcon('story', 'create', "productID=$productID&moduleID=0&story=0&project=$project->id");
|
||||
if($productID) common::printIcon('story', 'create', "productID=$productID&branch=&moduleID=0&story=0&project=$project->id");
|
||||
|
||||
common::printIcon('project', 'linkStory', "project=$project->id", '', 'button', 'link');
|
||||
?>
|
||||
|
||||
@@ -18,11 +18,14 @@ class release extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function commonAction($productID)
|
||||
public function commonAction($productID, $branch = 0)
|
||||
{
|
||||
$this->loadModel('product');
|
||||
$this->view->product = $this->product->getById($productID);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}"), $this->view->product->name);
|
||||
$product = $this->product->getById($productID);
|
||||
$this->view->product = $product;
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -332,6 +335,7 @@ class release extends control
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Build search form. */
|
||||
$product = $this->product->getByID($release->product);
|
||||
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
|
||||
unset($this->config->product->search['fields']['product']);
|
||||
unset($this->config->product->search['fields']['project']);
|
||||
@@ -341,6 +345,15 @@ class release extends control
|
||||
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
|
||||
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($release->product, $viewType = 'story', $startModuleID = 0);
|
||||
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
|
||||
if($product->type == 'normal')
|
||||
{
|
||||
unset($this->config->product->search['fields']['branch']);
|
||||
unset($this->config->product->search['params']['branch']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->config->product->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($product->id, 'noempty');
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
|
||||
+38
-29
@@ -35,7 +35,7 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($productID = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0)
|
||||
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -77,7 +77,7 @@ class story extends control
|
||||
if($this->post->newStory)
|
||||
{
|
||||
$response['message'] = $this->lang->story->successSaved . $this->lang->story->newStory;
|
||||
$response['locate'] = $this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID&story=0&projectID=$projectID&bugID=$bugID");
|
||||
$response['locate'] = $this->createLink('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID&story=0&projectID=$projectID&bugID=$bugID");
|
||||
$this->send($response);
|
||||
}
|
||||
if($projectID == 0)
|
||||
@@ -106,7 +106,7 @@ class story extends control
|
||||
}
|
||||
|
||||
$users = $this->user->getPairs('nodeleted|pdfirst|noclosed');
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story');
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
|
||||
|
||||
/* Set menu. */
|
||||
$this->product->setMenu($products, $product->id);
|
||||
@@ -158,7 +158,7 @@ class story extends control
|
||||
}
|
||||
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->create;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID&branch=$branch"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->create;
|
||||
$this->view->products = $products;
|
||||
@@ -170,6 +170,8 @@ class story extends control
|
||||
$this->view->planID = $planID;
|
||||
$this->view->source = $source;
|
||||
$this->view->pri = $pri;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID) : array();
|
||||
$this->view->productID = $productID;
|
||||
$this->view->product = $product;
|
||||
$this->view->projectID = $projectID;
|
||||
@@ -192,27 +194,27 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreate($productID = 0, $moduleID = 0)
|
||||
public function batchCreate($productID = 0, $branch = 0, $moduleID = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$mails = $this->story->batchCreate($productID);
|
||||
$mails = $this->story->batchCreate($productID, $branch);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
foreach($mails as $mail)
|
||||
{
|
||||
$this->sendmail($mail->storyID, $mail->actionID);
|
||||
}
|
||||
die(js::locate($this->createLink('product', 'browse', "productID=$productID"), 'parent'));
|
||||
die(js::locate($this->createLink('product', 'browse', "productID=$productID&branch=$branch"), 'parent'));
|
||||
}
|
||||
|
||||
/* Set products and module. */
|
||||
$product = $this->product->getById($productID);
|
||||
$products = $this->product->getPairs();
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story');
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
|
||||
|
||||
/* Set menu. */
|
||||
$this->product->setMenu($products, $product->id);
|
||||
$this->product->setMenu($products, $product->id, $branch);
|
||||
|
||||
/* Init vars. */
|
||||
$planID = 0;
|
||||
@@ -241,13 +243,14 @@ class story extends control
|
||||
|
||||
$moduleOptionMenu['same'] = $this->lang->story->same;
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, 'unexpired');
|
||||
$plans['same'] = $this->lang->story->same;
|
||||
$priList = (array)$this->lang->story->priList;
|
||||
$priList['same'] = $this->lang->story->same;
|
||||
$plans['same'] = $this->lang->story->same;
|
||||
$priList = (array)$this->lang->story->priList;
|
||||
$priList['same'] = $this->lang->story->same;
|
||||
$branches['same'] = $this->lang->story->same;
|
||||
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchCreate;
|
||||
$this->view->productName = $product->name;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$productID&branch=$branch"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->batchCreate;
|
||||
$this->view->products = $products;
|
||||
@@ -261,6 +264,8 @@ class story extends control
|
||||
$this->view->estimate = $estimate;
|
||||
$this->view->storyTitle = $title;
|
||||
$this->view->spec = $spec;
|
||||
$this->view->branches = $branches;
|
||||
$this->view->branch = $branch;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -278,13 +283,13 @@ class story extends control
|
||||
$story = $this->story->getById($storyID);
|
||||
$product = $this->product->getById($story->product);
|
||||
$products = $this->product->getPairs();
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($product->id, $viewType = 'story');
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($product->id, $viewType = 'story', 0, $story->branch);
|
||||
|
||||
/* Set menu. */
|
||||
$this->product->setMenu($products, $product->id);
|
||||
|
||||
/* Assign. */
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->product = $product;
|
||||
$this->view->products = $products;
|
||||
@@ -320,11 +325,14 @@ class story extends control
|
||||
$this->commonAction($storyID);
|
||||
|
||||
/* Assign. */
|
||||
$story = $this->story->getById($storyID, 0, true);
|
||||
$story = $this->story->getById($storyID, 0, true);
|
||||
$product = $this->loadModel('product')->getById($story->product);
|
||||
$this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title;
|
||||
$this->view->position[] = $this->lang->story->edit;
|
||||
$this->view->story = $story;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|pofirst', "$story->assignedTo,$story->openedBy,$story->closedBy");
|
||||
$this->view->product = $product;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($story->product);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -336,7 +344,7 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchEdit($productID = 0, $projectID = 0)
|
||||
public function batchEdit($productID = 0, $projectID = 0, $branch = 0)
|
||||
{
|
||||
if($this->post->titles)
|
||||
{
|
||||
@@ -365,9 +373,9 @@ class story extends control
|
||||
/* The stories of a product. */
|
||||
if($productID)
|
||||
{
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID);
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID, $branch);
|
||||
$product = $this->product->getByID($productID);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name);
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit;
|
||||
|
||||
}
|
||||
@@ -399,8 +407,8 @@ class story extends control
|
||||
$this->loadModel('productplan');
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$moduleOptionMenus[$story->product] = $this->tree->getOptionMenu($story->product, $viewType = 'story');
|
||||
$productPlans[$story->product] = $this->productplan->getPairs($story->product);
|
||||
$moduleOptionMenus[$story->product] = $this->tree->getOptionMenu($story->product, $viewType = 'story', 0, $branch);
|
||||
$productPlans[$story->product] = $this->productplan->getPairs($story->product, $branch);
|
||||
}
|
||||
|
||||
/* Judge whether the editedStories is too large and set session. */
|
||||
@@ -507,7 +515,7 @@ class story extends control
|
||||
if(!$story) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
|
||||
$story->files = $this->loadModel('file')->getByObject('story', $storyID);
|
||||
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch();
|
||||
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id, type')->fetch();
|
||||
$plan = $this->dao->findById($story->plan)->from(TABLE_PRODUCTPLAN)->fetch('title');
|
||||
$bugs = $this->dao->select('id,title')->from(TABLE_BUG)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll();
|
||||
$fromBug = $this->dao->select('id,title')->from(TABLE_BUG)->where('toStory')->eq($storyID)->fetch();
|
||||
@@ -525,13 +533,14 @@ class story extends control
|
||||
}
|
||||
|
||||
$title = "STORY #$story->id $story->title - $product->name";
|
||||
$position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
|
||||
$position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
|
||||
$position[] = $this->lang->story->common;
|
||||
$position[] = $this->lang->story->view;
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->product = $product;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
|
||||
$this->view->plan = $plan;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->fromBug = $fromBug;
|
||||
@@ -607,7 +616,7 @@ class story extends control
|
||||
if($story->status == 'changed') unset($this->lang->story->reviewResultList['reject']);
|
||||
|
||||
$this->view->title = $this->lang->story->review . "STORY" . $this->lang->colon . $story->title;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->review;
|
||||
|
||||
@@ -675,7 +684,7 @@ class story extends control
|
||||
if($story->status == 'draft') unset($this->lang->story->reasonList['cancel']);
|
||||
|
||||
$this->view->title = $this->lang->story->close . "STORY" . $this->lang->colon . $story->title;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
|
||||
$this->view->position[] = $this->lang->story->common;
|
||||
$this->view->position[] = $this->lang->story->close;
|
||||
|
||||
@@ -911,7 +920,7 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetProductStories($productID, $moduleID = 0, $storyID = 0, $onlyOption = 'false', $status = '', $limit = 0)
|
||||
public function ajaxGetProductStories($productID, $branch = 0, $moduleID = 0, $storyID = 0, $onlyOption = 'false', $status = '', $limit = 0)
|
||||
{
|
||||
if($moduleID)
|
||||
{
|
||||
@@ -927,7 +936,7 @@ class story extends control
|
||||
$storyStatus = array_keys($storyStatus);
|
||||
}
|
||||
|
||||
$stories = $this->story->getProductStoryPairs($productID, $moduleID, $storyStatus, 'id_desc', $limit);
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, $storyStatus, 'id_desc', $limit);
|
||||
$select = html::select('story', empty($stories) ? array('' => '') : $stories, $storyID, "class='form-control'");
|
||||
|
||||
/* If only need options, remove select wrap. */
|
||||
@@ -947,7 +956,7 @@ class story extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSearchProductStories($key, $productID, $moduleID = 0, $storyID = 0, $status = 'noclosed', $limit = 50)
|
||||
public function ajaxSearchProductStories($key, $productID, $branch = 0, $moduleID = 0, $storyID = 0, $status = 'noclosed', $limit = 50)
|
||||
{
|
||||
if($moduleID)
|
||||
{
|
||||
@@ -963,7 +972,7 @@ class story extends control
|
||||
$storyStatus = array_keys($storyStatus);
|
||||
}
|
||||
|
||||
$stories = $this->story->getProductStoryPairs($productID, $moduleID, $storyStatus, 'id_desc');
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, $storyStatus, 'id_desc');
|
||||
$result = array();
|
||||
$i = 0;
|
||||
foreach ($stories as $id => $story)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#mailto {width:90.3%}
|
||||
select {border:1px solid #ccc}
|
||||
#module_chosen.chosen-container .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important}
|
||||
#branch_chosen.chosen-container .chosen-choices{width:100px;}
|
||||
|
||||
.row .col-sm-8{width:76%}
|
||||
.row .col-sm-2{padding-left:0px; padding-right:0px; width:12%}
|
||||
|
||||
@@ -2,7 +2,7 @@ $(function()
|
||||
{
|
||||
if(canCreate)
|
||||
{
|
||||
link = createLink('story', 'create', 'productID=' + productID + '&moduleID=' + moduleID);
|
||||
link = createLink('story', 'create', 'productID=' + productID + "&branch=" + branch + '&moduleID=' + moduleID);
|
||||
$('#modulemenu ul.nav li.right:first').before("<li class='right'><a href='" + link + "'><i class='icon-story-create icon-plus'></i> " + createStory + "</a></li>");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -39,6 +39,7 @@ $lang->story->batchAssignTo = "批量指派";
|
||||
$lang->story->common = '需求';
|
||||
$lang->story->id = '编号';
|
||||
$lang->story->product = "所属{$lang->productCommon}";
|
||||
$lang->story->branch = "所属分支";
|
||||
$lang->story->module = '所属模块';
|
||||
$lang->story->source = '来源';
|
||||
$lang->story->fromBug = '来源Bug';
|
||||
|
||||
+10
-4
@@ -209,7 +209,7 @@ class storyModel extends model
|
||||
* @access public
|
||||
* @return int|bool the id of the created story or false when error.
|
||||
*/
|
||||
public function batchCreate($productID = 0)
|
||||
public function batchCreate($productID = 0, $branch = 0)
|
||||
{
|
||||
$now = helper::now();
|
||||
$stories = fixer::input('post')->get();
|
||||
@@ -221,14 +221,17 @@ class storyModel extends model
|
||||
$module = 0;
|
||||
$plan = 0;
|
||||
$pri = 0;
|
||||
$branch = 0;
|
||||
for($i = 0; $i < $batchNum; $i++)
|
||||
{
|
||||
$module = $stories->module[$i] == 'same' ? $module : $stories->module[$i];
|
||||
$plan = $stories->plan[$i] == 'same' ? $plan : $stories->plan[$i];
|
||||
$pri = $stories->pri[$i] == 'same' ? $pri : $stories->pri[$i];
|
||||
$branch = $stories->pri[$i] == 'same' ? $branch : $stories->branch[$i];
|
||||
$stories->module[$i] = (int)$module;
|
||||
$stories->plan[$i] = (int)$plan;
|
||||
$stories->pri[$i] = (int)$pri;
|
||||
$stories->branch[$i] = (int)$branch;
|
||||
}
|
||||
|
||||
if(isset($stories->uploadImage)) $this->loadModel('file');
|
||||
@@ -241,9 +244,11 @@ class storyModel extends model
|
||||
$data->plan = $stories->plan[$i];
|
||||
$data->title = $stories->title[$i];
|
||||
$data->pri = $stories->pri[$i] != '' ? $stories->pri[$i] : 0;
|
||||
$data->branch = $stories->branch[$i];
|
||||
$data->estimate = $stories->estimate[$i] != '' ? $stories->estimate[$i] : 0;
|
||||
$data->status = $stories->needReview[$i] == 0 ? 'active' : 'draft';
|
||||
$data->product = $productID;
|
||||
$data->branch = $branch;
|
||||
$data->openedBy = $this->app->user->account;
|
||||
$data->openedDate = $now;
|
||||
$data->version = 1;
|
||||
@@ -932,7 +937,7 @@ class storyModel extends model
|
||||
->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
|
||||
->where('t1.product')->in($productID)
|
||||
->beginIF(!empty($branch))->andWhere("CONCAT(',', t1.branch, ',')")->like("%,$branch,%")->fi()
|
||||
->beginIF(!empty($branch))->andWhere("t1.branch")->eq($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)
|
||||
@@ -950,13 +955,14 @@ class storyModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductStoryPairs($productID = 0, $moduleIds = 0, $status = 'all', $order = 'id_desc', $limit = 0)
|
||||
public function getProductStoryPairs($productID = 0, $branch = 0, $moduleIds = 0, $status = 'all', $order = 'id_desc', $limit = 0)
|
||||
{
|
||||
$stories = $this->dao->select('t1.id, t1.title, t1.module, t1.pri, t1.estimate, t2.name AS product')
|
||||
->from(TABLE_STORY)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
||||
->where('1=1')
|
||||
->beginIF($productID)->andWhere('t1.product')->in($productID)->fi()
|
||||
->beginIF($moduleIds)->andWhere('t1.module')->in($moduleIds)->fi()
|
||||
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->beginIF($status and $status != 'all')->andWhere('t1.status')->in($status)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy($order)
|
||||
@@ -1101,7 +1107,7 @@ class storyModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBySearch($productID, $branch, $queryID, $orderBy, $pager = null, $projectID = '')
|
||||
public function getBySearch($productID, $queryID, $orderBy, $pager = null, $projectID = '')
|
||||
{
|
||||
if($projectID != '')
|
||||
{
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->story->product;?></th>
|
||||
<td class='w-p25-f'>
|
||||
<?php echo html::select('product', $products, $productID, "onchange='loadProduct(this.value);' class='form-control chosen'");?>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('product', $products, $productID, "onchange='loadProduct(this.value);' class='form-control chosen'");?>
|
||||
<?php if($product->type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-p25-f'>
|
||||
<div class='input-group' id='moduleIdBox'>
|
||||
|
||||
@@ -55,7 +55,12 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo $lang->story->product;?></th>
|
||||
<td><?php echo html::select('product', $products, $story->product, 'class="form-control chosen" onchange="loadProduct(this.value)";');?></td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('product', $products, $story->product, "onchange='loadProduct(this.value);' class='form-control chosen'");?>
|
||||
<?php if($product->type != 'normal') echo html::select('branch', $branches, $story->branch, "onchange='loadBranch();' class='form-control' style='width:65px'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->story->module;?></th>
|
||||
|
||||
@@ -3,13 +3,35 @@
|
||||
<script language='Javascript'>
|
||||
function loadProduct(productID)
|
||||
{
|
||||
loadProductBranches(productID)
|
||||
loadProductModules(productID);
|
||||
loadProductPlans(productID);
|
||||
}
|
||||
|
||||
function loadProductModules(productID)
|
||||
function loadBranch()
|
||||
{
|
||||
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&rootModuleID=0&returnType=html&needManage=true');
|
||||
loadProductModules($('#product').val(), $('#branch').val());
|
||||
loadProductPlans($('#product').val(), $('#branch').val());
|
||||
}
|
||||
|
||||
function loadProductBranches(productID)
|
||||
{
|
||||
$('#branch').remove();
|
||||
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
$('#product').closest('.input-group').append(data);
|
||||
$('#branch').css('width', '65px');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function loadProductModules(productID, branch)
|
||||
{
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true');
|
||||
$('#moduleIdBox').load(moduleLink, function()
|
||||
{
|
||||
$('#moduleIdBox #module').chosen(defaultChosenOptions);
|
||||
@@ -17,9 +39,11 @@ function loadProductModules(productID)
|
||||
});
|
||||
}
|
||||
|
||||
function loadProductPlans(productID)
|
||||
function loadProductPlans(productID, branch)
|
||||
{
|
||||
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&planID=' + $('#plan').val() + '&needCreate=true');
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&needCreate=true');
|
||||
$('#planIdBox').load(planLink, function(){$('#planIdBox #plan').chosen(defaultChosenOptions);});
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class='actions'>
|
||||
<?php
|
||||
$browseLink = $app->session->storyList != false ? $app->session->storyList : $this->createLink('product', 'browse', "productID=$story->product&moduleID=$story->module");
|
||||
$browseLink = $app->session->storyList != false ? $app->session->storyList : $this->createLink('product', 'browse', "productID=$story->product&branch=$story->branch&moduleID=$story->module");
|
||||
$actionLinks = '';
|
||||
|
||||
if(!$story->deleted)
|
||||
@@ -45,14 +45,14 @@
|
||||
common::printIcon('story', 'review', "storyID=$story->id", $story);
|
||||
common::printIcon('story', 'close', "storyID=$story->id", $story, 'button', '', '', 'iframe text-danger', true);
|
||||
common::printIcon('story', 'activate', "storyID=$story->id", $story, 'button', '', '', 'iframe text-success', true);
|
||||
common::printIcon('story', 'createCase', "productID=$story->product&moduleID=0&from=¶m=0&storyID=$story->id", '', 'button', 'sitemap');
|
||||
common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&moduleID=0&from=¶m=0&storyID=$story->id", '', 'button', 'sitemap');
|
||||
if($from == 'project') common::printIcon('task', 'create', "project=$param&storyID=$story->id", '', 'button', 'smile');
|
||||
echo '</div>';
|
||||
|
||||
echo "<div class='btn-group'>";
|
||||
common::printIcon('story', 'edit', "storyID=$story->id");
|
||||
common::printCommentIcon('story');
|
||||
common::printIcon('story', 'create', "productID=$story->product&moduleID=$story->module&storyID=$story->id", '', 'button', 'copy');
|
||||
common::printIcon('story', 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', 'button', 'copy');
|
||||
common::printIcon('story', 'delete', "storyID=$story->id", '', 'button', '', 'hiddenwin');
|
||||
echo '</div>';
|
||||
|
||||
@@ -111,6 +111,12 @@
|
||||
<th class='w-70px'><?php echo $lang->story->product;?></th>
|
||||
<td><?php common::printLink('product', 'view', "productID=$story->product", $product->name);?></td>
|
||||
</tr>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->story->branch;?></th>
|
||||
<td><?php common::printLink('product', 'browse', "productID=$story->product&branch=$story->branch", $branches[$story->branch]);?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->story->module;?></th>
|
||||
<?php
|
||||
@@ -126,7 +132,7 @@
|
||||
foreach($modulePath as $key => $module)
|
||||
{
|
||||
$moduleTitle .= $module->name;
|
||||
if(!common::printLink('product', 'browse', "productID=$story->product&browseType=byModule¶m=$module->id", $module->name)) echo $module->name;
|
||||
if(!common::printLink('product', 'browse', "productID=$story->product&branch=$story->branch&browseType=byModule¶m=$module->id", $module->name)) echo $module->name;
|
||||
if(isset($modulePath[$key + 1]))
|
||||
{
|
||||
$moduleTitle .= '/';
|
||||
@@ -300,6 +306,7 @@
|
||||
js::set('canCreate', common::hasPriv('story', 'story'));
|
||||
js::set('createStory', $lang->story->create);
|
||||
js::set('productID', $story->product);
|
||||
js::set('branch', $story->branch);
|
||||
js::set('moduleID', $story->module);
|
||||
?>
|
||||
<?php include '../../common/view/syntaxhighlighter.html.php';?>
|
||||
|
||||
@@ -219,7 +219,7 @@ class testcase extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($productID, $moduleID = 0, $from = '', $param = 0, $storyID = 0)
|
||||
public function create($productID, $branch = 0, $moduleID = 0, $from = '', $param = 0, $storyID = 0)
|
||||
{
|
||||
$testcaseID = $from == 'testcase' ? $param : 0;
|
||||
$bugID = $from == 'bug' ? $param : 0;
|
||||
@@ -325,7 +325,7 @@ class testcase extends control
|
||||
$modules = $this->loadModel('tree')->getStoryModule($currentModuleID);
|
||||
$modules = $this->tree->getAllChildID($modules);
|
||||
}
|
||||
$stories = $this->story->getProductStoryPairs($productID, $modules, array_keys($storyStatus), 'id_desc', 50);
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, array_keys($storyStatus), 'id_desc', 50);
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->caseTitle = $caseTitle;
|
||||
@@ -357,7 +357,7 @@ class testcase extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchCreate($productID, $moduleID = 0, $storyID = 0)
|
||||
public function batchCreate($productID, $branch = 0, $moduleID = 0, $storyID = 0)
|
||||
{
|
||||
$this->loadModel('story');
|
||||
if(!empty($_POST))
|
||||
@@ -398,10 +398,11 @@ class testcase extends control
|
||||
$this->view->story = $story;
|
||||
$this->view->storyList = $storyList;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->type = $type;
|
||||
$this->view->title = $title;
|
||||
$this->view->branch = $branch;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -538,7 +539,7 @@ class testcase extends control
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->stories = $this->story->getProductStoryPairs($productID);
|
||||
$this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch);
|
||||
$this->view->case = $case;
|
||||
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
|
||||
|
||||
@@ -969,7 +970,7 @@ class testcase extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function showImport($productID)
|
||||
public function showImport($productID, $branch = 0)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -977,13 +978,13 @@ class testcase extends control
|
||||
die(js::locate(inlink('browse', "productID=$productID"), 'parent'));
|
||||
}
|
||||
|
||||
$this->testcase->setMenu($this->products, $productID);
|
||||
$this->testcase->setMenu($this->products, $productID, $branch);
|
||||
|
||||
$file = $this->session->importFile;
|
||||
$caseLang = $this->lang->testcase;
|
||||
$caseConfig = $this->config->testcase;
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case');
|
||||
$stories = $this->loadModel('story')->getProductStoryPairs($productID);
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
|
||||
$stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch);
|
||||
$fields = $this->testcase->getImportFields();
|
||||
|
||||
$rows = $this->loadModel('file')->parseCSV($file);
|
||||
|
||||
@@ -5,11 +5,6 @@ $(document).ready(function()
|
||||
var select = $(this).prev('select');
|
||||
var id = $(select).attr('id');
|
||||
if(id.indexOf('story') != -1)
|
||||
{
|
||||
index = id.substring(5);
|
||||
module = $('#module' + index).val();
|
||||
if(module == 'same')
|
||||
{
|
||||
for(var i = index - 1; i >=0; i--)
|
||||
{
|
||||
if($('#module' + i).val() != 'same')
|
||||
@@ -19,7 +14,7 @@ $(document).ready(function()
|
||||
}
|
||||
}
|
||||
}
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + module + '&storyID='+ $(select).val() + '&onlyOption=true&status=noclosed');
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + module + '&storyID='+ $(select).val() + '&onlyOption=true&status=noclosed');
|
||||
$('#story' + index).load(link, function(){$(this).trigger("chosen:updated");});
|
||||
}
|
||||
if($(select).val() == 'same')
|
||||
|
||||
@@ -47,7 +47,8 @@ function setStories()
|
||||
{
|
||||
moduleID = $('#module').val();
|
||||
productID = $('#product').val();
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50');
|
||||
branch = $('#branch').val();
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50');
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
var value = $('#story').val();
|
||||
|
||||
@@ -97,7 +97,7 @@ $(function()
|
||||
if(key && key != $searchInput.data('lastkey'))
|
||||
{
|
||||
$searchResult.empty().append('<li class="loading"><i class="icon-spin icon-spinner icon-2x"></i></li>');
|
||||
var link = createLink('story', 'ajaxSearchProductStories', 'key=' + key + '&productID=' + $('#product').val() + '&moduleID=' + $('#module').val() + '&storyID=0&status=noclosed&limit=50');
|
||||
var link = createLink('story', 'ajaxSearchProductStories', 'key=' + key + '&productID=' + $('#product').val() + '&branch=' + $('#branch').val() + '&moduleID=' + $('#module').val() + '&storyID=0&status=noclosed&limit=50');
|
||||
$.getJSON(link, function(result)
|
||||
{
|
||||
$searchResult.empty();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('testcaseBatchCreateNum', $config->testcase->batchCreate);?>
|
||||
<?php js::set('productID', $productID);?>
|
||||
<?php js::set('branch', $branch);?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['testcase']);?></span>
|
||||
|
||||
+11
-2
@@ -87,10 +87,19 @@ class treeModel extends model
|
||||
public function getOptionMenu($rootID, $type = 'story', $startModule = 0, $branch = 0)
|
||||
{
|
||||
$branches = array($branch => '');
|
||||
if(strpos('story|bug|case', $type) !== false and empty($branch))
|
||||
if(strpos('story|bug|case', $type) !== false)
|
||||
{
|
||||
$product = $this->loadModel('product')->getById($rootID);
|
||||
if($product->type != 'normal') $branches = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'noempty');
|
||||
if($product->type != 'normal')
|
||||
{
|
||||
$branches = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'noempty');
|
||||
if($branch)
|
||||
{
|
||||
$newBranches['null'] = '';
|
||||
$newBranches[$branch] = $branches[$branch];
|
||||
$branches = $newBranches;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$treeMenu = array();
|
||||
|
||||
Reference in New Issue
Block a user