* finish task #3727.
This commit is contained in:
@@ -548,12 +548,13 @@ class product extends control
|
||||
* @param int $productID
|
||||
* @param int $planID
|
||||
* @param bool $needCreate
|
||||
* @param string $expired
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false)
|
||||
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '')
|
||||
{
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired);
|
||||
$field = $fieldID ? "plans[$fieldID]" : 'plan';
|
||||
$output = html::select($field, $plans, $planID, "class='form-control chosen'");
|
||||
if(count($plans) == 1 and $needCreate)
|
||||
|
||||
@@ -604,14 +604,11 @@ class project extends control
|
||||
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList, $projectID);
|
||||
$storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList);
|
||||
|
||||
$plans = $this->project->getPlans($productID);
|
||||
$plans = $this->project->getPlans($products);
|
||||
$allPlans = array('' => '');
|
||||
if(!empty($plans))
|
||||
{
|
||||
foreach($plans as $productID => $plan)
|
||||
{
|
||||
$allPlans = $allPlans + $plan;
|
||||
}
|
||||
foreach($plans as $productID => $plan) $allPlans += $plan;
|
||||
}
|
||||
|
||||
/* Assign. */
|
||||
@@ -1030,7 +1027,7 @@ class project extends control
|
||||
$this->view->qdUsers = $this->user->getPairs('noclosed|nodeleted|qdfirst', $project->QD);
|
||||
$this->view->rdUsers = $this->user->getPairs('noclosed|nodeleted|devfirst', $project->RD);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->plans = $this->project->getPlans(array_keys($linkedProducts));
|
||||
$this->view->plans = $this->project->getPlans($linkedProducts);
|
||||
$this->view->allProducts = $allProducts;
|
||||
$this->view->linkedProducts = $linkedProducts;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts));
|
||||
@@ -1294,6 +1291,7 @@ class project extends control
|
||||
$this->view->project = $project;
|
||||
$this->view->products = $products;
|
||||
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
|
||||
$this->view->planGroups = $this->project->getPlans($products);
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->actions = $this->loadModel('action')->getList('project', $projectID);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
@@ -154,23 +154,30 @@ function loadBranches(product)
|
||||
if(data)
|
||||
{
|
||||
$inputgroup.append(data);
|
||||
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).css('width', '80px');
|
||||
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).css('width', '80px').attr('onchange', "loadPlans('#products" + index + "', this.value)");
|
||||
}
|
||||
});
|
||||
|
||||
loadPlans(product);
|
||||
}
|
||||
|
||||
function loadPlans(product, branchID)
|
||||
{
|
||||
var productID = $(product).val();
|
||||
var branchID = typeof(branchID) == 'undefined' ? 0 : branchID;
|
||||
|
||||
if(productID == 0 || productID != $(product).data('last')) $("#plan" + $(product).data('last')).remove();
|
||||
|
||||
if(productID != 0 && $("#plan" + productID).length == 0)
|
||||
if(productID != 0)
|
||||
{
|
||||
if(typeof(planID) == 'undefined') planID = 0;
|
||||
planID = $("select#plans" + productID).val() != '' ? $("select#plans" + productID).val() : planID;
|
||||
$("div#plan" + productID).remove();
|
||||
$(product).data("last", productID);
|
||||
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID), function(data)
|
||||
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=' + branchID + '&planID=' + planID + '&fieldID&needCreate=&expired=' + (config.currentMethod == 'create' ? 'unexpired' : '')), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
$("#plansBox .row").append('<div class="col-sm-3" id="plan' + productID+ '">' + data + '</div>');
|
||||
$("#plan" + $(product).val()).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID);
|
||||
$("#plansBox .row").append('<div class="col-sm-3" id="plan' + productID + '">' + data + '</div>');
|
||||
$("#plan" + $(product).val()).width($(product).closest('.col-sm-3').width()).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +23,19 @@ $(function()
|
||||
{
|
||||
$("input:radio[name='delta']").attr("checked", false);
|
||||
})
|
||||
|
||||
if(typeof(currentPlanID) == 'undefined')
|
||||
{
|
||||
$('#productsBox select[id^="products"]').each(function()
|
||||
{
|
||||
var branchID = 0;
|
||||
if($(this).closest('.input-group').find('select[id^="branch"]').size() > 0)
|
||||
{
|
||||
var branchID = $(this).closest('.input-group').find('select[id^="branch"]').val();
|
||||
}
|
||||
loadPlans($(this), branchID);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showTypeTips()
|
||||
|
||||
@@ -2616,16 +2616,13 @@ class projectModel extends model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPlans($productID)
|
||||
public function getPlans($products)
|
||||
{
|
||||
$plans = $this->dao->select('id,title,product')->from(TABLE_PRODUCTPLAN)
|
||||
->where('product')->in($productID)
|
||||
->fetchAll();
|
||||
|
||||
$this->loadModel('productplan');
|
||||
$productPlans = array();
|
||||
foreach ($plans as $plan)
|
||||
foreach($products as $productID => $product)
|
||||
{
|
||||
$productPlans[$plan->product][$plan->id] = $plan->title;
|
||||
$productPlans[$productID] = $this->productplan->getPairs($product->id, $product->branch);
|
||||
}
|
||||
return $productPlans;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<?php if(isset($plan) && !empty($plan->begin)):?>
|
||||
<div class="col-sm-3" id="plan<?php echo $plan->product;?>">
|
||||
<?php echo html::select("plans[" . $plan->product . "]", $productPlan, $plan->id, "class='form-control'");?>
|
||||
<?php js::set('currentPlanID', $plan->id)?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' onchange='loadBranches(this)' data-last='" . $product->id . "'");?>
|
||||
<span class='input-group-addon fix-border' style='padding:0px'></span>
|
||||
<?php if($product->type != 'normal' and isset($branchGroups[$product->id])) echo html::select("branch[$i]", $branchGroups[$product->id], $product->branch, "class='form-control' style='width:80px'")?>
|
||||
<?php if($product->type != 'normal' and isset($branchGroups[$product->id])) echo html::select("branch[$i]", $branchGroups[$product->id], $product->branch, "class='form-control' style='width:80px' onchange=\"loadPlans('#products{$i}', this.value)\"")?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i++;?>
|
||||
|
||||
@@ -138,6 +138,21 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->linkPlan;?></th>
|
||||
<td>
|
||||
<?php
|
||||
foreach($products as $productID => $product)
|
||||
{
|
||||
if(isset($planGroups[$productID][$product->plan]))
|
||||
{
|
||||
echo html::a($this->createLink('productplan', 'view', "planID={$product->id}"), $product->name . '/' . $planGroups[$productID][$product->plan]);
|
||||
}
|
||||
echo '<br />';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->acl;?></th>
|
||||
|
||||
Reference in New Issue
Block a user