* finish task #2342.
This commit is contained in:
@@ -539,7 +539,7 @@ class bug extends control
|
||||
$this->view->bug = $bug;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->projects = $this->product->getProjectPairs($bug->product);
|
||||
|
||||
@@ -213,7 +213,8 @@ function loadProjectBuilds(projectID)
|
||||
*/
|
||||
function setStories(moduleID, productID)
|
||||
{
|
||||
branch = $('#branch').val();
|
||||
var branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID);
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
|
||||
@@ -524,7 +524,7 @@ class product extends control
|
||||
if(count($plans) == 1 and $needCreate)
|
||||
{
|
||||
$output .= "<span class='input-group-addon'>";
|
||||
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID"), $this->lang->productplan->create, '_blank');
|
||||
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch"), $this->lang->productplan->create, '_blank');
|
||||
$output .= ' ';
|
||||
$output .= html::a("javascript:loadProductPlans($productID)", $this->lang->refresh);
|
||||
$output .= '</span>';
|
||||
|
||||
@@ -18,12 +18,15 @@ class productplan 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);
|
||||
$this->product->setMenu($this->product->getPairs(), $productID);
|
||||
$product = $this->product->getById($productID);
|
||||
$this->view->product = $product;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,17 +36,17 @@ class productplan extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($product = '')
|
||||
public function create($product = '', $branch = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$planID = $this->productplan->create();
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
$this->loadModel('action')->create('productplan', $planID, 'opened');
|
||||
die(js::locate($this->createLink('productplan', 'browse', "productID=$product"), 'parent'));
|
||||
die(js::locate($this->createLink('productplan', 'browse', "productID=$product&branch=$branch"), 'parent'));
|
||||
}
|
||||
|
||||
$this->commonAction($product);
|
||||
$this->commonAction($product, $branch);
|
||||
$lastPlan = $this->productplan->getLast($product);
|
||||
if($lastPlan)
|
||||
{
|
||||
@@ -54,7 +57,7 @@ class productplan extends control
|
||||
|
||||
$begin = date('Y-m-d', strtotime("+$delta days", $timestamp));
|
||||
}
|
||||
$this->view->begin = $lastPlan ? $begin : '';
|
||||
$this->view->begin = $lastPlan ? $begin : '';
|
||||
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create;
|
||||
$this->view->position[] = $this->lang->productplan->common;
|
||||
@@ -84,7 +87,7 @@ class productplan extends control
|
||||
}
|
||||
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
$this->commonAction($plan->product);
|
||||
$this->commonAction($plan->product, $plan->branch);
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->edit;
|
||||
$this->view->position[] = $this->lang->productplan->edit;
|
||||
$this->view->plan = $plan;
|
||||
@@ -98,13 +101,13 @@ class productplan extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchEdit($productID)
|
||||
public function batchEdit($productID, $branch = 0)
|
||||
{
|
||||
if(isset($_POST['planIDList']))
|
||||
{
|
||||
$this->commonAction($productID);
|
||||
$this->commonAction($productID, $branch);
|
||||
$this->view->title = $this->lang->productplan->batchEdit;
|
||||
$this->view->position[] = html::a(inlink('browse', "productID=$productID"), $this->lang->productplan->common);
|
||||
$this->view->position[] = html::a(inlink('browse', "productID=$productID&branch=$branch"), $this->lang->productplan->common);
|
||||
$this->view->position[] = $this->lang->productplan->batchEdit;
|
||||
|
||||
$this->view->plans = $this->productplan->getByIDList($this->post->planIDList);
|
||||
@@ -119,7 +122,7 @@ class productplan extends control
|
||||
$actionID = $this->action->create('productplan', $planID, 'Edited');
|
||||
$this->action->logHistory($actionID, $change);
|
||||
}
|
||||
die(js::locate(inlink('browse', "productID=$productID"), 'parent'));
|
||||
die(js::locate(inlink('browse', "productID=$productID&branch=$branch"), 'parent'));
|
||||
}
|
||||
die(js::locate('back'));
|
||||
}
|
||||
@@ -158,7 +161,7 @@ class productplan extends control
|
||||
}
|
||||
$this->send($response);
|
||||
}
|
||||
die(js::locate(inlink('browse', "productID=$plan->product"), 'parent'));
|
||||
die(js::locate(inlink('browse', "productID=$plan->product&branch=$plan->branch"), 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +176,7 @@ class productplan extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($productID = 0, $orderBy = 'begin_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1 )
|
||||
public function browse($productID = 0, $branch = 0, $orderBy = 'begin_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1 )
|
||||
{
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
@@ -183,13 +186,13 @@ class productplan extends control
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
|
||||
$this->session->set('productPlanList', $this->app->getURI(true));
|
||||
$this->commonAction($productID);
|
||||
$this->commonAction($productID, $branch);
|
||||
$products = $this->product->getPairs();
|
||||
$this->view->title = $products[$productID] . $this->lang->colon . $this->lang->productplan->browse;
|
||||
$this->view->position[] = $this->lang->productplan->browse;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->plans = $this->productplan->getList($productID, $pager, $sort);
|
||||
$this->view->plans = $this->productplan->getList($productID, $branch, $pager, $sort);
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
@@ -213,7 +216,7 @@ class productplan extends control
|
||||
|
||||
$plan = $this->productplan->getByID($planID, true);
|
||||
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
$this->commonAction($plan->product);
|
||||
$this->commonAction($plan->product, $plan->branch);
|
||||
$products = $this->product->getPairs();
|
||||
$this->view->title = "PLAN #$plan->id $plan->title/" . $products[$plan->product];
|
||||
$this->view->position[] = $this->lang->productplan->view;
|
||||
@@ -239,9 +242,9 @@ class productplan extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetProductplans($productID)
|
||||
public function ajaxGetProductplans($productID, $branch = 0)
|
||||
{
|
||||
$plans = $this->productplan->getPairs($productID);
|
||||
$plans = $this->productplan->getPairs($productID, $branch);
|
||||
die(html::select('plan', $plans, '', "class='form-control'"));
|
||||
}
|
||||
|
||||
@@ -263,7 +266,7 @@ class productplan extends control
|
||||
$this->loadModel('story');
|
||||
$this->loadModel('tree');
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
$this->commonAction($plan->product);
|
||||
$this->commonAction($plan->product, $plan->branch);
|
||||
$products = $this->product->getPairs();
|
||||
|
||||
/* Build search form. */
|
||||
@@ -278,6 +281,15 @@ class productplan extends control
|
||||
$storyStatusList = $this->lang->story->statusList;
|
||||
unset($storyStatusList['closed']);
|
||||
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $storyStatusList);
|
||||
if($this->view->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($this->view->product->id, 'noempty');
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->product->search);
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
@@ -377,7 +389,7 @@ class productplan extends control
|
||||
|
||||
$this->loadModel('bug');
|
||||
$plan = $this->productplan->getByID($planID);
|
||||
$this->commonAction($plan->product);
|
||||
$this->commonAction($plan->product, $plan->branch);
|
||||
$products = $this->product->getPairs('nocode');
|
||||
$productID = $plan->product;
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
@@ -39,6 +39,7 @@ $lang->productplan->confirmUnlinkBug = "您确认移除该Bug吗?";
|
||||
|
||||
$lang->productplan->id = '编号';
|
||||
$lang->productplan->product = $lang->productCommon;
|
||||
$lang->productplan->branch = '所属分支';
|
||||
$lang->productplan->title = '名称';
|
||||
$lang->productplan->desc = '描述';
|
||||
$lang->productplan->begin = '开始日期';
|
||||
|
||||
@@ -65,10 +65,11 @@ class productplanModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getList($product = 0, $pager = null, $orderBy = 'begin_desc')
|
||||
public function getList($product = 0, $branch = 0, $pager = null, $orderBy = 'begin_desc')
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('product')->eq($product)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF(!empty($branch))->andWhere('branch')->eq($branch)->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
@@ -82,15 +83,14 @@ class productplanModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPairs($product = 0, $expired = '')
|
||||
public function getPairs($product = 0, $branch = 0, $expired = '')
|
||||
{
|
||||
$date = date('Y-m-d');
|
||||
return array('' => '') + $this->dao->select('id,CONCAT(title, " [", begin, " ~ ", end, "]") as title')->from(TABLE_PRODUCTPLAN)
|
||||
->where('product')->in($product)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($expired == 'unexpired')
|
||||
->andWhere('end')->gt($date)
|
||||
->fi()
|
||||
->beginIF($branch)->andWhere("branch")->eq($branch)->fi()
|
||||
->beginIF($expired == 'unexpired')->andWhere('end')->gt($date)->fi()
|
||||
->orderBy('begin desc')->fetchPairs();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<div id='titlebar'>
|
||||
<div class='heading'><i class='icon-flag'></i> <?php echo $lang->productplan->browse;?> </div>
|
||||
<div class='actions'>
|
||||
<?php common::printIcon('productplan', 'create', "productID=$product->id", '', 'button', 'plus');?>
|
||||
<?php common::printIcon('productplan', 'create', "productID=$product->id&branch=$branch", '', 'button', 'plus');?>
|
||||
</div>
|
||||
</div>
|
||||
<form method='post' action='<?php echo inlink('batchEdit', "productID=$product->id")?>'>
|
||||
<form method='post' action='<?php echo inlink('batchEdit', "productID=$product->id&branch=$branch")?>'>
|
||||
<table class='table' id="productplan">
|
||||
<thead>
|
||||
<?php $vars = "productID=$productID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
|
||||
<?php $vars = "productID=$productID&branch=$branch&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
|
||||
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->productplan->title);?></th>
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
<th class='w-80px'><?php echo $lang->productplan->product;?></th>
|
||||
<td class='w-p25-f'><?php echo $product->name;?></td><td></td>
|
||||
</tr>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->branch;?></th>
|
||||
<td><?php echo html::select('branch', $branches, $branch, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->title;?></th>
|
||||
<td><?php echo html::input('title', '', "class='form-control'");?></td>
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
<th class='w-80px'><?php echo $lang->productplan->product;?></th>
|
||||
<td class='w-p25-f'><?php echo $product->name;?></td><td></td>
|
||||
</tr>
|
||||
<?php if($product->type != 'normal'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->branch;?></th>
|
||||
<td><?php echo html::select('branch', $branches, $plan->branch, 'class="form-control"');?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->title;?></th>
|
||||
<td><?php echo html::input('title', $plan->title, 'class="form-control"');?></td>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
if(count($plans) == 1)
|
||||
{
|
||||
echo "<span class='input-group-addon'>";
|
||||
echo html::a($this->createLink('productplan', 'create', "productID=$productID"), $lang->productplan->create, '_blank');
|
||||
echo html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch"), $lang->productplan->create, '_blank');
|
||||
echo ' ';
|
||||
echo html::a("javascript:loadProductPlans($productID)", $lang->refresh);
|
||||
echo '</span>';
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
if(count($plans) == 1)
|
||||
{
|
||||
echo "<span class='input-group-addon'>";
|
||||
echo html::a($this->createLink('productplan', 'create', "productID=$story->product"), $lang->productplan->create, '_blank');
|
||||
echo html::a($this->createLink('productplan', 'create', "productID=$story->product&branch=$story->branch"), $lang->productplan->create, '_blank');
|
||||
echo html::a("javascript:loadProductPlans($story->product)", $lang->refresh);
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ function loadProduct(productID)
|
||||
|
||||
function loadBranch()
|
||||
{
|
||||
loadProductModules($('#product').val(), $('#branch').val());
|
||||
loadProductPlans($('#product').val(), $('#branch').val());
|
||||
var branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
loadProductModules($('#product').val(), branch);
|
||||
loadProductPlans($('#product').val(), branch);
|
||||
}
|
||||
|
||||
function loadProductBranches(productID)
|
||||
|
||||
@@ -48,6 +48,7 @@ function setStories()
|
||||
moduleID = $('#module').val();
|
||||
productID = $('#product').val();
|
||||
branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50');
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,9 @@ $(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() + '&branch=' + $('#branch').val() + '&moduleID=' + $('#module').val() + '&storyID=0&status=noclosed&limit=50');
|
||||
var branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
var link = createLink('story', 'ajaxSearchProductStories', 'key=' + key + '&productID=' + $('#product').val() + '&branch=' + branch + '&moduleID=' + $('#module').val() + '&storyID=0&status=noclosed&limit=50');
|
||||
$.getJSON(link, function(result)
|
||||
{
|
||||
$searchResult.empty();
|
||||
|
||||
Reference in New Issue
Block a user