* Project related products.

This commit is contained in:
leiyong
2020-10-30 10:55:11 +08:00
parent 04c6164681
commit 055d52f45e
18 changed files with 554 additions and 20 deletions
+2
View File
@@ -197,6 +197,7 @@ $lang->resource->program->PRJDelete = 'PRJDelete';
$lang->resource->program->PRJWhitelist = 'PRJWhitelist';
$lang->resource->program->PRJAddWhitelist = 'PRJAddWhitelist';
$lang->resource->program->unbindWhielist = 'unbindWhielist';
$lang->resource->program->PRJManageProducts = 'PRJManageProducts';
$lang->program->methodOrder[0] = 'createGuide';
$lang->program->methodOrder[5] = 'PGMIndex';
@@ -236,6 +237,7 @@ $lang->program->methodOrder[165] = 'PRJDelete';
$lang->program->methodOrder[170] = 'PRJWhitelist';
$lang->program->methodOrder[175] = 'PRJAddWhitelist';
$lang->program->methodOrder[180] = 'unbindWhielist';
$lang->program->methodOrder[185] = 'PRJManageProducts';
/* Personnel . */
$lang->resource->personnel = new stdclass();
+116 -11
View File
@@ -764,13 +764,16 @@ class program extends control
$this->lang->navGroup->program = 'program';
$this->lang->program->switcherMenu = $this->program->getPGMCommonAction();
}
$this->loadModel('project');
if($_POST)
{
$projectID = $this->program->PRJCreate();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
$this->project->updateProducts($projectID);
$this->loadModel('action')->create('project', $projectID, 'opened');
if($from == 'PGM')
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('PGMBrowse')));
@@ -783,7 +786,10 @@ class program extends control
$team = '';
$whitelist = '';
$acl = 'open';
$privway = 'extend';
$auth = 'extend';
$products = array();
$productPlans = array();
if($copyProjectID)
{
@@ -792,25 +798,36 @@ class program extends control
$code = $copyProgram->code;
$team = $copyProgram->team;
$acl = $copyProgram->acl;
$privway = $copyProgram->privway;
$auth = $copyProgram->auth;
$whitelist = $copyProgram->whitelist;
if(empty($model)) $model = $copyProgram->model;
$products = $this->project->getProducts($copyProjectID);
foreach($products as $product)
{
$productPlans[$product->id] = $this->loadModel('productplan')->getPairs($product->id);
}
}
$allProducts = $this->program->getPGMProduct($programID);
$this->view->title = $this->lang->program->PRJCreate;
$this->view->position[] = $this->lang->program->PRJCreate;
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst');
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
$this->view->programs = array('' => '') + $this->program->getPRJPairsByTemplate($model, $programID);
$this->view->products = $products;
$this->view->allProducts = array('0' => '') + $allProducts;
$this->view->productPlans = array('0' => '') + $productPlans;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
$this->view->programID = $programID;
$this->view->model = $model;
$this->view->name = $name;
$this->view->code = $code;
$this->view->team = $team;
$this->view->acl = $acl;
$this->view->privway = $privway;
$this->view->auth = $auth;
$this->view->whitelist = $whitelist;
$this->view->copyProjectID = $copyProjectID;
$this->view->from = $from;
@@ -830,12 +847,17 @@ class program extends control
public function PRJEdit($projectID = 0)
{
$this->lang->navGroup->program = 'project';
$this->app->loadLang('project');
$this->loadModel('productplan');
if($_POST)
{
$changes = $this->program->PRJUpdate($projectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
$this->project->updateProducts($projectID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
if($changes)
{
$actionID = $this->loadModel('action')->create('project', $projectID, 'edited');
@@ -846,17 +868,41 @@ class program extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $url));
}
$project = $this->program->getPRJByID($projectID);
$parents = $this->program->getParentPairs();
$project = $this->program->getPRJByID($projectID);
$parents = $this->program->getParentPairs();
$programID = $this->program->getPRJProgramID($projectID);
$allProducts = $this->program->getPGMProduct($programID);
$linkedProducts = $this->project->getProducts($projectID);
$linkedBranches = array();
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if($product->branch) $linkedBranches[$product->branch] = $product->branch;
}
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if($product->branch) $linkedBranches[$product->branch] = $product->branch;
}
$productPlans = array(0 => '');
foreach($linkedProducts as $product)
{
$productPlans[$product->id] = $this->productplan->getPairs($product->id);
}
$this->view->title = $this->lang->program->PRJEdit;
$this->view->position[] = $this->lang->program->PRJEdit;
$this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM);
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
$this->view->project = $project;
$this->view->parents = $parents;
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM);
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
$this->view->project = $project;
$this->view->parents = $parents;
$this->view->allProducts = array('0' => '') + $allProducts;
$this->view->productPlans = $productPlans;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->display();
}
@@ -1388,4 +1434,63 @@ class program extends control
{
echo $this->fetch('personnel', 'unbindWhielist', "id=$id&confirm=$confirm");
}
/**
* Manage products.
*
* @param int $projectID
* @param int $programID
* @param string $from
* @access public
* @return void
*/
public function PRJManageProducts($projectID, $programID, $from = '')
{
$this->lang->navGroup->program = 'project';
$browseProjectLink = $this->createLink('program', 'PRJBrowse', "programID=$programID");
if(!empty($_POST))
{
$oldProducts = $this->project->getProducts($projectID);
$this->project->updateProducts($projectID);
if(dao::isError()) die(js::error(dao::getError()));
$oldProducts = array_keys($oldProducts);
$newProducts = $this->project->getProducts($projectID);
$newProducts = array_keys($newProducts);
$diffProducts = array_merge(array_diff($oldProducts, $newProducts), array_diff($newProducts, $oldProducts));
if($diffProducts) $this->loadModel('action')->create('project', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : '');
die(js::locate($browseProjectLink));
}
$this->loadModel('product');
$project = $this->project->getById($projectID);
$programID = $this->program->getPRJProgramID($projectID);
/* Title and position. */
$title = $this->lang->project->manageProducts . $this->lang->colon . $project->name;
$position[] = html::a($browseProjectLink, $project->name);
$position[] = $this->lang->project->manageProducts;
$allProducts = $this->product->getPairs('noclosed|nocode', $programID);
$linkedProducts = $this->project->getProducts($project->id);
$linkedBranches = array();
/* Merge allProducts and linkedProducts for closed product. */
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if(!empty($product->branch)) $linkedBranches[$product->branch] = $product->branch;
}
/* Assign. */
$this->view->title = $title;
$this->view->position = $position;
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), '', $linkedBranches);
$this->display();
}
}
+1
View File
@@ -8,3 +8,4 @@
#copyProjectModal a.active:after {position: absolute; content: '\e92f'; font-family: ZentaoIcon; font-size: 20px; right: 25px;}
#copyProjectModal a.cancel {color: #ff5d5d}
#budget {border-right:0px;}
.col-sm-4{margin-bottom: 10px;}
+1
View File
@@ -1 +1,2 @@
#budget {border-right:0px;}
.col-sm-4{margin-bottom: 10px;}
+9
View File
@@ -0,0 +1,9 @@
#productsBox .product {border: 1px solid #ddd; margin-bottom:5px; position: relative; height: 40px; border-radius: 4px;}
#productsBox .product:hover {background: #f1f1f1;}
#productsBox .product.checked,
#productsBox .product.checked:hover {background: #E5FFE6; border: 1px solid #229F24;}
#productsBox .product .checkbox-primary {padding: 9px; cursor: pointer;}
#productsBox .product.has-branch {padding-right: 40%;}
#productsBox .product.has-branch > .chosen-container {position: absolute; width: 40%!important; right: 3px; top: 3px;}
#productsBox .product.has-branch > .chosen-container > .chosen-single {background: rgba(0,0,0,.05);}
#productsBox .product.has-branch > .chosen-container > .chosen-single:hover {background: #fff;}
+100
View File
@@ -110,6 +110,106 @@ function computeEndDate(delta)
computeWorkDays();
}
/**
* Load branches.
*
* @param int $product
* @access public
* @return void
*/
function loadBranches(product)
{
$('#productsBox select').each(function()
{
var $product = $(product);
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id'))
{
alert(errorSameProducts);
$product.val(0);
$product.trigger("chosen:updated");
return false;
}
});
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen();
adjustProductBoxMargin();
}
var $inputgroup = $(product).closest('.input-group');
if($inputgroup.find('select').size() >= 2) $inputgroup.removeClass('has-branch').find('select:last').remove();
if($inputgroup.find('.chosen-container').size() >= 2) $inputgroup.find('.chosen-container:last').remove();
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
{
if(data)
{
$inputgroup.addClass('has-branch').append(data);
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).attr('onchange', "loadPlans('#products" + index + "', this.value)").chosen();
}
});
loadPlans(product);
}
function loadPlans(product, branchID)
{
if($('#plansBox').size() == 0) return false;
var productID = $(product).val();
var branchID = typeof(branchID) == 'undefined' ? 0 : branchID;
var index = $(product).attr('id').replace('products', '');
if(productID != 0)
{
if(typeof(planID) == 'undefined') planID = 0;
planID = $("select#plans" + productID).val() != '' ? $("select#plans" + productID).val() : planID;
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=' + branchID + '&planID=' + planID + '&fieldID&needCreate=&expired=' + ((config.currentMethod == 'create' || config.currentMethod == 'edit') ? 'unexpired' : '')), function(data)
{
if(data)
{
if($("div#plan" + index).size() == 0) $("#plansBox .row").append('<div class="col-sm-4" id="plan' + index + '"></div>');
$("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID).chosen();
adjustPlanBoxMargin();
}
});
}
}
function adjustProductBoxMargin()
{
var productRows = Math.ceil($('#productsBox > .row > .col-sm-4').length / 3);
if(productRows > 1)
{
for(i = 1; i <= productRows - 1; i++)
{
$('#productsBox .col-sm-4:lt(' + (i * 3) + ')').css('margin-bottom', '10px');
}
}
}
function adjustPlanBoxMargin()
{
var planRows = Math.ceil($('#plansBox > .row > .col-sm-4').length / 3);
if(planRows > 1)
{
for(j = 1; j <= planRows - 1; j++)
{
$('#plansBox .col-sm-4:lt(' + (j * 3) + ')').css('margin-bottom', '10px');
}
}
}
$(function()
{
$('#privList > tbody > tr > th input[type=checkbox]').change(function()
+113 -1
View File
@@ -13,11 +13,24 @@ $(function()
$('#end').removeAttr('disabled');
}
});
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 setCopyProject(copyProjectID)
{
location.href = createLink('program', 'PRJCreate', 'template=' + template + '&programID=' + programID + '&from=' + from + '&copyProjectID=' + copyProjectID);
location.href = createLink('program', 'PRJCreate', 'model=' + model + '&programID=' + programID + '&from=' + from + '&copyProjectID=' + copyProjectID);
}
function setAclList(programID)
@@ -31,3 +44,102 @@ function setAclList(programID)
$('.aclBox').html($('#PRJAcl').html());
}
}
/**
* Load branches.
*
* @param int $product
* @access public
* @return void
*/
function loadBranches(product)
{
$('#productsBox select').each(function()
{
var $product = $(product);
if($product.val() != 0 && $product.val() == $(this).val() && $product.attr('id') != $(this).attr('id'))
{
alert(errorSameProducts);
$product.val(0);
$product.trigger("chosen:updated");
return false;
}
});
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html() + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen();
adjustProductBoxMargin();
}
var $inputgroup = $(product).closest('.input-group');
if($inputgroup.find('select').size() >= 2) $inputgroup.removeClass('has-branch').find('select:last').remove();
if($inputgroup.find('.chosen-container').size() >= 2) $inputgroup.find('.chosen-container:last').remove();
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
{
if(data)
{
$inputgroup.addClass('has-branch').append(data);
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).attr('onchange', "loadPlans('#products" + index + "', this.value)").chosen();
}
});
loadPlans(product);
}
function loadPlans(product, branchID)
{
if($('#plansBox').size() == 0) return false;
var productID = $(product).val();
var branchID = typeof(branchID) == 'undefined' ? 0 : branchID;
var index = $(product).attr('id').replace('products', '');
if(productID != 0)
{
if(typeof(planID) == 'undefined') planID = 0;
planID = $("select#plans" + productID).val() != '' ? $("select#plans" + productID).val() : planID;
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + '&branch=' + branchID + '&planID=' + planID + '&fieldID&needCreate=&expired=' + ((config.currentMethod == 'create' || config.currentMethod == 'edit') ? 'unexpired' : '')), function(data)
{
if(data)
{
if($("div#plan" + index).size() == 0) $("#plansBox .row").append('<div class="col-sm-4" id="plan' + index + '"></div>');
$("div#plan" + index).html(data).find('select').attr('name', 'plans[' + productID + ']').attr('id', 'plans' + productID).chosen();
adjustPlanBoxMargin();
}
});
}
}
function adjustProductBoxMargin()
{
var productRows = Math.ceil($('#productsBox > .row > .col-sm-4').length / 3);
if(productRows > 1)
{
for(i = 1; i <= productRows - 1; i++)
{
$('#productsBox .col-sm-4:lt(' + (i * 3) + ')').css('margin-bottom', '10px');
}
}
}
function adjustPlanBoxMargin()
{
var planRows = Math.ceil($('#plansBox > .row > .col-sm-4').length / 3);
if(planRows > 1)
{
for(j = 1; j <= planRows - 1; j++)
{
$('#plansBox .col-sm-4:lt(' + (j * 3) + ')').css('margin-bottom', '10px');
}
}
}
+14
View File
@@ -0,0 +1,14 @@
$(function()
{
$('#productsBox input:checkbox').each(function()
{
var $cb = $(this);
if($cb.prop('checked')) $cb.closest('.product').addClass('checked');
});
$('#productsBox input:checkbox').change(function()
{
var $cb = $(this);
$cb.closest('.product').toggleClass('checked', $cb.prop('checked'));
});
});
+2 -1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = 'Order';
$lang->program->PRJWhitelist = 'Project Whitelist';
$lang->program->PRJAddWhitelist = 'Project Add Whitelist';
$lang->program->unbindWhielist = 'Project Remove Whitelist';
$lang->program->PRJManageProducts = 'Manage Products';
/* Fields. */
$lang->program->common = 'Project';
@@ -168,7 +169,7 @@ $lang->program->PGMCreateGuide = 'Select Template';
$lang->program->PGMEdit = 'Edit Program';
$lang->program->PGMBrowse = 'Programs';
$lang->program->PGMProduct = 'Products';
$lang->program->PGMProject = 'Program Project';
$lang->program->PGMProject = 'Program Project List';
$lang->program->PGMAll = 'All Programs';
$lang->program->PGMStart = 'Start';
$lang->program->PGMFinish = 'Finish';
+2 -1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = 'Order';
$lang->program->PRJWhitelist = 'Project Whitelist';
$lang->program->PRJAddWhitelist = 'Project Add Whitelist';
$lang->program->unbindWhielist = 'Project Remove Whitelist';
$lang->program->PRJManageProducts = 'Manage Products';
/* Fields. */
$lang->program->common = 'Project';
@@ -168,7 +169,7 @@ $lang->program->PGMCreateGuide = 'Select Template';
$lang->program->PGMEdit = 'Edit Program';
$lang->program->PGMBrowse = 'Programs';
$lang->program->PGMProduct = 'Products';
$lang->program->PGMProject = 'Program Project';
$lang->program->PGMProject = 'Program Project List';
$lang->program->PGMAll = 'All Programs';
$lang->program->PGMStart = 'Start';
$lang->program->PGMFinish = 'Finish';
+2 -1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = 'Order';
$lang->program->PRJWhitelist = 'Project Whitelist';
$lang->program->PRJAddWhitelist = 'Project Add Whitelist';
$lang->program->unbindWhielist = 'Project Remove Whitelist';
$lang->program->PRJManageProducts = 'Manage Products';
/* Fields. */
$lang->program->common = 'Project';
@@ -168,7 +169,7 @@ $lang->program->PGMCreateGuide = 'Select Template';
$lang->program->PGMEdit = 'Edit Program';
$lang->program->PGMBrowse = 'Programs';
$lang->program->PGMProduct = 'Products';
$lang->program->PGMProject = 'Program Project';
$lang->program->PGMProject = 'Program Project List';
$lang->program->PGMAll = 'All Programs';
$lang->program->PGMStart = 'Start';
$lang->program->PGMFinish = 'Finish';
+2 -1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = 'Order';
$lang->program->PRJWhitelist = 'Project Whitelist';
$lang->program->PRJAddWhitelist = 'Project Add Whitelist';
$lang->program->unbindWhielist = 'Project Remove Whitelist';
$lang->program->PRJManageProducts = 'Manage Products';
/* Fields. */
$lang->program->common = 'Project';
@@ -168,7 +169,7 @@ $lang->program->PGMCreateGuide = 'Select Template';
$lang->program->PGMEdit = 'Edit Program';
$lang->program->PGMBrowse = 'Programs';
$lang->program->PGMProduct = 'Products';
$lang->program->PGMProject = 'Program Project';
$lang->program->PGMProject = 'Program Project List';
$lang->program->PGMAll = 'All Programs';
$lang->program->PGMStart = 'Start';
$lang->program->PGMFinish = 'Finish';
+1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = '项目排序';
$lang->program->PRJWhitelist = '项目白名单';
$lang->program->PRJAddWhitelist = '项目添加白名单';
$lang->program->unbindWhielist = '项目删除白名单';
$lang->program->PRJManageProducts = '项目关联产品';
/* Fields. */
$lang->program->common = '项目集';
+2 -1
View File
@@ -30,6 +30,7 @@ $lang->program->PRJSort = '項目排序';
$lang->program->PRJWhitelist = '項目白名單';
$lang->program->PRJAddWhitelist = '項目添加白名單';
$lang->program->unbindWhielist = '項目刪除白名單';
$lang->program->PRJManageProducts = '項目關聯產品';
/* Fields. */
$lang->program->common = '項目集';
@@ -168,7 +169,7 @@ $lang->program->PGMCreateGuide = '選擇項目模板';
$lang->program->PGMEdit = '編輯項目集';
$lang->program->PGMBrowse = '項目集列表';
$lang->program->PGMProduct = '產品列表';
$lang->program->PGMProject = '项目集项目列表';
$lang->program->PGMProject = '項目集項目列表';
$lang->program->PGMAll = '所有項目集';
$lang->program->PGMStart = '啟動項目集';
$lang->program->PGMFinish = '完成項目集';
+38 -2
View File
@@ -172,6 +172,19 @@ class programModel extends model
->fetchPairs();
}
/**
* Get the product associated with the project.
*
* @param int $programID
* @access public
* @return array
*/
public function getPGMProduct($programID = 0)
{
if(!empty($programID)) $programID = $this->getPRJProgramID($programID);
return $this->loadModel('product')->getPairs('noclosed', $programID);
}
/**
* Get program by id.
*
@@ -915,6 +928,28 @@ class programModel extends model
return $project;
}
/**
* Get the program to which the project belongs.
*
* @param int $projectID
* @access public
* @return object
*/
public function getPRJProgramID($projectID)
{
if(empty($projectID)) return 0;
$program = $this->getPGMByID($projectID);
$programID = 0;
if($program->parent > 0)
{
$path = explode(',', $program->path);
$path = array_filter($path);
$programID = current($path);
}
return $programID;
}
/**
* Get project name.
*
@@ -1073,7 +1108,7 @@ class programModel extends model
->join('whitelist', ',')
->cleanInt('budget')
->stripTags($this->config->program->editor->prjcreate['id'], $this->config->allowedTags)
->remove('longTime')
->remove('longTime,products,branch,plans')
->get();
if($project->parent)
@@ -1161,7 +1196,7 @@ class programModel extends model
->setIF($this->post->acl == 'open', 'whitelist', '')
->join('whitelist', ',')
->stripTags($this->config->program->editor->prjedit['id'], $this->config->allowedTags)
->remove('longTime')
->remove('longTime,products,branch,plans')
->get();
if($project->parent)
@@ -1373,6 +1408,7 @@ class programModel extends model
common::printIcon('program', 'PRJGroup', "projectID=$project->id&programID=$programID", $project, 'list', 'lock');
common::printIcon('program', 'PRJManageMembers', "programID=$project->id", $project, 'list', 'persons');
common::printIcon('program', 'PRJWhitelist', "projectID=$project->id&programID=$programID", $project, 'list', 'group');
common::printIcon('program', 'PRJManageProducts', "projectID=$project->id&programID=$programID", $project, 'list', 'icon icon-menu-project');
common::printIcon('program', 'PRJStart', "programID=$project->id", $project, 'list', 'start', '', 'iframe', true);
common::printIcon('program', 'PRJActivate', "programID=$project->id", $project, 'list', 'magic', '', 'iframe', true);
common::printIcon('program', 'PRJSuspend', "programID=$project->id", $project, 'list', 'pause', '', 'iframe', true);
+44 -1
View File
@@ -17,6 +17,7 @@
<?php js::set('programID', $programID);?>
<?php js::set('from', $from);?>
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -56,6 +57,48 @@
<td><?php echo html::select('product', $lang->program->PRJCategoryList, '', "class='form-control'");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->project->manageProducts;?></th>
<td class='text-left' id='productsBox' colspan="3">
<div class='row'>
<?php $i = 0;?>
<?php foreach($products as $product):?>
<div class="col-sm-4">
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<?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'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $product->branch, "class='form-control chosen' onchange=\"loadPlans('#products{$i}', this.value)\"");?>
</div>
</div>
<?php $i++;?>
<?php endforeach;?>
<div class='col-sm-4'>
<div class='input-group'>
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->project->linkPlan;?></th>
<td colspan="3" id="plansBox">
<div class='row'>
<?php if($copyProjectID):?>
<?php $i = 0;?>
<?php foreach($products as $product):?>
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, '', "class='form-control chosen'");?></div>
<?php $i++;?>
<?php endforeach;?>
<?php else:?>
<div class="col-sm-4" id="plan0"><?php echo html::select("plans[]", '', '', "class='form-control chosen'");?></div>
<?php endif;?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->program->PRJPM;?></th>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'");?></td>
@@ -113,7 +156,7 @@
</tr>
<tr>
<th><?php echo $lang->program->auth;?></th>
<td colspan='3'><?php echo html::radio('auth', $lang->program->PRJAuthList, $privway, '', 'block');?></td>
<td colspan='3'><?php echo html::radio('auth', $lang->program->PRJAuthList, $auth, '', 'block');?></td>
</tr>
<tr>
<th><?php echo $lang->project->acl;?></th>
+39
View File
@@ -14,6 +14,7 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
<?php $aclList = $project->parent ? $lang->program->PGMPRJAclList : $lang->program->PRJAclList;?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
@@ -51,6 +52,44 @@
<td><?php echo html::select('product', $lang->program->PRJCategoryList, $project->product, "class='form-control'");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->project->manageProducts;?></th>
<td class='text-left' id='productsBox' colspan="2">
<div class='row'>
<?php $i = 0;?>
<?php foreach($linkedProducts as $product):?>
<div class='col-sm-4'>
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<?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'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $product->branch, "class='form-control chosen' onchange=\"loadPlans('#products{$i}', this.value)\"");?>
</div>
</div>
<?php $i++;?>
<?php endforeach;?>
<div class='col-sm-4'>
<div class='input-group'>
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->project->linkPlan;?></th>
<td id="plansBox" colspan="2">
<div class='row'>
<?php $i = 0;?>
<?php foreach($linkedProducts as $product):?>
<?php $plans = zget($productPlans, $product->id, array(0 => ''));?>
<div class="col-sm-4" id="plan<?php echo $i;?>"><?php echo html::select("plans[" . $product->id . "]", $plans, $product->plan, "class='form-control chosen'");?></div>
<?php $i++;?>
<?php endforeach;?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->program->PRJPM;?></th>
<td><?php echo html::select('PM', $pmUsers, $project->PM, "class='form-control chosen'");?></td>
@@ -0,0 +1,66 @@
<?php
/**
* The manage prjmanageproducts view of program module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package program
* @version $Id
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<span class='btn btn-link btn-active-text'><span class='text'><?php echo $lang->project->manageProducts;?></span></span>
</div>
</div>
<div id='mainContent'>
<div class='cell'>
<form id='productsBox' method='post'>
<div class='detail'>
<div class='detail-title'><?php echo $lang->project->linkedProducts;?></div>
<div class='detail-content row'>
<?php foreach($allProducts as $productID => $productName):?>
<?php if(isset($linkedProducts[$productID])):?>
<?php $checked = 'checked';?>
<div class='col-sm-4'>
<div class='product <?php echo $checked . (isset($branchGroups[$productID]) ? ' has-branch' : '')?>'>
<div class="checkbox-primary" title='<?php echo $productName;?>'>
<?php echo "<input type='checkbox' name='products[$productID]' value='$productID' $checked id='products{$productID}'>";?>
<label class='text-ellipsis checkbox-inline' for='<?php echo 'products' . $productID;?>' title='<?php echo $productName;?>'><?php echo $productName;?></label>
</div>
<?php if(isset($branchGroups[$productID])) echo html::select("branch[$productID]", $branchGroups[$productID], $linkedProducts[$productID]->branch, "class='form-control chosen'");?>
</div>
</div>
<?php unset($allProducts[$productID]);?>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
<div class='detail'>
<div class='detail-title'><?php echo $lang->project->unlinkedProducts;?></div>
<div class='detail-content row'>
<?php foreach($allProducts as $productID => $productName):?>
<div class='col-sm-4'>
<div class='product<?php echo isset($branchGroups[$productID]) ? ' has-branch' : ''?>'>
<div class="checkbox-primary" title='<?php echo $productName;?>'>
<?php echo "<input type='checkbox' name='products[$productID]' value='$productID' id='products{$productID}'>";?>
<label class='text-ellipsis checkbox-inline' for='<?php echo 'products' . $productID;?>'><?php echo $productName;?></label>
</div>
<?php if(isset($branchGroups[$productID])) echo html::select("branch[$productID]", $branchGroups[$productID], '', "class='form-control chosen'");?>
</div>
</div>
<?php endforeach;?>
</div>
</div>
<div class="detail text-center form-actions">
<?php echo html::hidden("post", 'post');?>
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
</div>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>