Merge branch 'sprint/170_xieqiyu_43920' into 'sprint/170'
Sprint/170 xieqiyu 43920 See merge request easycorp/zentaopms!378
This commit is contained in:
@@ -279,6 +279,7 @@ $lang->action->label->reviewrejected = 'Reject';
|
||||
$lang->action->label->reviewclarified = 'Clarify';
|
||||
$lang->action->label->commitsummary = 'Commit Summary';
|
||||
$lang->action->label->updatetrainee = 'Update Trainee';
|
||||
$lang->action->label->setdefaultbranch = 'Set default branch';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
@@ -312,10 +313,11 @@ $lang->action->dynamicAction->product['closed'] = 'Close ' . $lang->productCo
|
||||
$lang->action->dynamicAction->product['undeleted'] = 'Restore ' . $lang->productCommon;
|
||||
$lang->action->dynamicAction->product['hidden'] = 'Hide ' . $lang->productCommon;
|
||||
|
||||
$lang->action->dynamicAction->branch['opened'] = 'Create Branch';
|
||||
$lang->action->dynamicAction->branch['edited'] = 'Edit Branch';
|
||||
$lang->action->dynamicAction->branch['closed'] = 'Close Branch';
|
||||
$lang->action->dynamicAction->branch['activated'] = 'Activate Branch';
|
||||
$lang->action->dynamicAction->branch['opened'] = 'Create Branch';
|
||||
$lang->action->dynamicAction->branch['edited'] = 'Edit Branch';
|
||||
$lang->action->dynamicAction->branch['closed'] = 'Close Branch';
|
||||
$lang->action->dynamicAction->branch['activated'] = 'Activate Branch';
|
||||
$lang->action->dynamicAction->branch['setdefaultbranch'] = 'Set Default Branch';
|
||||
|
||||
$lang->action->dynamicAction->productplan['opened'] = 'Create Plan';
|
||||
$lang->action->dynamicAction->productplan['edited'] = 'Edit Plan';
|
||||
|
||||
@@ -279,6 +279,7 @@ $lang->action->label->reviewrejected = '拒绝';
|
||||
$lang->action->label->reviewclarified = '有待明确';
|
||||
$lang->action->label->commitsummary = '提交培训总结';
|
||||
$lang->action->label->updatetrainee = '更新培训人员';
|
||||
$lang->action->label->setdefaultbranch = '设置了默认分支';
|
||||
|
||||
/* 动态信息按照对象分组 */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
@@ -312,10 +313,11 @@ $lang->action->dynamicAction->product['closed'] = '关闭' . $lang->productCo
|
||||
$lang->action->dynamicAction->product['undeleted'] = '还原' . $lang->productCommon;
|
||||
$lang->action->dynamicAction->product['hidden'] = '隐藏' . $lang->productCommon;
|
||||
|
||||
$lang->action->dynamicAction->branch['opened'] = '创建分支';
|
||||
$lang->action->dynamicAction->branch['edited'] = '编辑分支';
|
||||
$lang->action->dynamicAction->branch['closed'] = '关闭分支';
|
||||
$lang->action->dynamicAction->branch['activated'] = '激活分支';
|
||||
$lang->action->dynamicAction->branch['opened'] = '创建分支';
|
||||
$lang->action->dynamicAction->branch['edited'] = '编辑分支';
|
||||
$lang->action->dynamicAction->branch['closed'] = '关闭分支';
|
||||
$lang->action->dynamicAction->branch['activated'] = '激活分支';
|
||||
$lang->action->dynamicAction->branch['setdefaultbranch'] = '设置默认分支';
|
||||
|
||||
$lang->action->dynamicAction->productplan['opened'] = "创建计划";
|
||||
$lang->action->dynamicAction->productplan['edited'] = "编辑计划";
|
||||
|
||||
+13
-2
@@ -240,6 +240,12 @@ class actionModel extends model
|
||||
$record->execution = $testtask->execution;
|
||||
}
|
||||
|
||||
if($objectType == 'branch' and $objectID == 0)
|
||||
{
|
||||
$record = new stdclass();
|
||||
$record->product = $extra;
|
||||
}
|
||||
|
||||
if($objectType == 'whitelist' and $extra == 'product') $record->product = $objectID;
|
||||
if($objectType == 'whitelist' and $extra == 'project') $record->project = $objectID;
|
||||
if($objectType == 'whitelist' and ($extra == 'sprint' or $extra == 'stage')) $record->execution = $objectID;
|
||||
@@ -1059,6 +1065,12 @@ class actionModel extends model
|
||||
->where('t1.id')->in($objectIdList)
|
||||
->fetchPairs();
|
||||
}
|
||||
elseif($objectType == 'branch')
|
||||
{
|
||||
$this->app->loadLang('branch');
|
||||
$objectName = $this->dao->select("id,name")->from(TABLE_BRANCH)->where('id')->in($objectIdList)->fetchPairs();
|
||||
if(in_array(BRANCH_MAIN, $objectIdList)) $objectName[BRANCH_MAIN] = $this->lang->branch->main;
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectName = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIdList)->fetchPairs();
|
||||
@@ -1179,8 +1191,7 @@ class actionModel extends model
|
||||
}
|
||||
elseif($action->objectType == 'branch')
|
||||
{
|
||||
$productID = $this->dao->select('product')->from(TABLE_BRANCH)->where('id')->eq($action->objectID)->fetch('product');
|
||||
$params = sprintf($vars, $productID);
|
||||
$params = sprintf($vars, trim($action->product, ','));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,9 +23,10 @@ class branch extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function manage($productID, $browseType = 'active', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function manage($productID, $browseType = 'active', $orderBy = 'order', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->loadModel('product')->setMenu($productID);
|
||||
$this->session->set('branchManage', $this->app->getURI(true), 'product');
|
||||
|
||||
$branchList = $this->branch->getList($productID, $browseType, $orderBy);
|
||||
|
||||
@@ -89,6 +90,43 @@ class branch extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch edit branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchEdit($productID)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$this->loadModel('product')->setMenu($productID);
|
||||
|
||||
if($this->post->IDList)
|
||||
{
|
||||
$changes = $this->branch->batchUpdate($productID);
|
||||
foreach($changes as $branchID => $change)
|
||||
{
|
||||
$extra = $branchID == BRANCH_MAIN ? $productID : '';
|
||||
if($change) $this->action->create('branch', $branchID, 'Edited', '', $extra);
|
||||
}
|
||||
|
||||
die(js::locate($this->session->branchManage, 'parent'));
|
||||
}
|
||||
|
||||
$branchList = $this->branch->getList($productID, 'all');
|
||||
$branchIDList = $this->post->branchIDList;
|
||||
if(empty($branchIDList)) die(js::locate($this->session->branchManage, 'parent'));
|
||||
|
||||
foreach($branchList as $branch)
|
||||
{
|
||||
if(!in_array($branch->id, $branchIDList)) unset($branchList[$branch->id]);
|
||||
}
|
||||
|
||||
$this->view->branchList = $branchList;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a branch.
|
||||
*
|
||||
@@ -231,4 +269,29 @@ class branch extends control
|
||||
if($oldBranch) $branches = array($oldBranch => $branches[$oldBranch]);
|
||||
die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch(this)'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branchID
|
||||
* @param string $confirm yes|no
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setDefault($productID, $branchID, $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
$this->app->loadLang('product');
|
||||
$productType = $this->branch->getProductType($branchID);
|
||||
die(js::confirm(str_replace('@branch@', $this->lang->product->branchName[$productType], $this->lang->branch->confirmSetDefault), inlink('setDefault', "productID=$productID&branchID=$branchID&confirm=yes")));
|
||||
}
|
||||
|
||||
$this->branch->setDefault($productID, $branchID);
|
||||
|
||||
$this->loadModel('action')->create('branch', $branchID, 'SetDefaultBranch', '', $productID);
|
||||
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
.c-desc {width : 600px;}
|
||||
.c-defult {width: 100px;}
|
||||
@@ -1,3 +1,7 @@
|
||||
.c-desc {width: 500px;}
|
||||
.c-order {width: 70px;}
|
||||
.c-check {width: 40px}
|
||||
|
||||
td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;}
|
||||
td.flex .label-primary {min-width: 40px;}
|
||||
td.flex .setDefault {min-width: 120px;}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Can set default branch.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function canSetDefaultBranch(obj)
|
||||
{
|
||||
if(obj.value == 'active')
|
||||
{
|
||||
$(obj).closest('tr').find("input[name^='default']").removeAttr('disabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(obj).closest('tr').find("input[name^='default']").removeAttr('checked').attr('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,35 @@ function deleteItem(obj)
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#branches').sortable(
|
||||
$('#branchTableList').addClass('sortable').sortable(
|
||||
{
|
||||
selector: '.input-group',
|
||||
reverse: orderBy === 'order_desc',
|
||||
selector: 'tr',
|
||||
dragCssClass: 'drag-row',
|
||||
trigger: $('#branches').find('.sort-handler').length ? '.sort-handler' : null,
|
||||
trigger: $('#branchTableList').find('.sort-handler').length ? '.sort-handler' : null,
|
||||
|
||||
canMoveHere: function($ele, $target)
|
||||
{
|
||||
return $target.data('id') != 0;
|
||||
},
|
||||
|
||||
finish: function(e)
|
||||
{
|
||||
var list = '';
|
||||
$('#branches').find('.input-group').each(function(){list += $(this).attr('data-id') + ',';});
|
||||
$.post(createLink('branch', 'sort'), {'branches' : list});
|
||||
var branches = '';
|
||||
e.list.each(function()
|
||||
{
|
||||
branches += $(this.item).data('id') + ',';
|
||||
});
|
||||
|
||||
$.post(createLink('branch', 'sort'), {'branches': branches, 'orderBy': orderBy});
|
||||
}
|
||||
});
|
||||
|
||||
$('td.c-name.flex').mouseenter(function()
|
||||
{
|
||||
$(this).find('.setDefault').removeClass('hidden');
|
||||
}).mouseleave(function()
|
||||
{
|
||||
$(this).find('.setDefault').addClass('hidden');
|
||||
})
|
||||
});
|
||||
|
||||
+19
-13
@@ -9,14 +9,18 @@ $lang->branch->manageTitle = '%s Management';
|
||||
$lang->branch->all = 'All ';
|
||||
$lang->branch->main = 'Main';
|
||||
|
||||
$lang->branch->edit = 'Edit';
|
||||
$lang->branch->editAction = 'Edit Branch';
|
||||
$lang->branch->activate = 'Activate';
|
||||
$lang->branch->activateAction = 'Activate Branch';
|
||||
$lang->branch->close = 'Close';
|
||||
$lang->branch->closeAction = 'Close Branch';
|
||||
$lang->branch->create = 'Create Branch';
|
||||
$lang->branch->merge = 'Merge';
|
||||
$lang->branch->edit = 'Edit';
|
||||
$lang->branch->editAction = 'Edit Branch';
|
||||
$lang->branch->activate = 'Activate';
|
||||
$lang->branch->activateAction = 'Activate Branch';
|
||||
$lang->branch->close = 'Close';
|
||||
$lang->branch->closeAction = 'Close Branch';
|
||||
$lang->branch->create = 'Create Branch';
|
||||
$lang->branch->merge = 'Merge';
|
||||
$lang->branch->batchEdit = 'Batch Edit';
|
||||
$lang->branch->defaultBranch = 'Default Branch';
|
||||
$lang->branch->setDefault = 'Set Default';
|
||||
$lang->branch->setDefaultAction = 'Set Default';
|
||||
|
||||
$lang->branch->id = 'ID';
|
||||
$lang->branch->product = 'Product';
|
||||
@@ -28,12 +32,14 @@ $lang->branch->desc = 'Desc';
|
||||
$lang->branch->order = 'Order';
|
||||
$lang->branch->deleted = 'Delete';
|
||||
$lang->branch->closed = 'Closed';
|
||||
$lang->branch->default = 'Default';
|
||||
|
||||
$lang->branch->confirmDelete = 'Do you want to delete this @branch@?';
|
||||
$lang->branch->canNotDelete = 'There is data in @branch@. It cannot be deleted.';
|
||||
$lang->branch->nameNotEmpty = 'Name must not be empty!';
|
||||
$lang->branch->confirmClose = 'Do you want to close this @branch@?';
|
||||
$lang->branch->confirmActivate = 'Do you want to activate this @branch@?';
|
||||
$lang->branch->confirmDelete = 'Do you want to delete this @branch@?';
|
||||
$lang->branch->confirmSetDefault = 'Do you want to set @branch@ as default @branch@? After your setting, the default @branch@ will be selected and shown in its Plan/Release list.';
|
||||
$lang->branch->canNotDelete = 'There is data in @branch@. It cannot be deleted.';
|
||||
$lang->branch->nameNotEmpty = 'Name must not be empty!';
|
||||
$lang->branch->confirmClose = 'Do you want to close this @branch@?';
|
||||
$lang->branch->confirmActivate = 'Do you want to activate this @branch@?';
|
||||
|
||||
$lang->branch->noData = 'No branches.';
|
||||
$lang->branch->mainBranch = 'The default main branch of the product.';
|
||||
|
||||
@@ -9,14 +9,18 @@ $lang->branch->manageTitle = '%s管理';
|
||||
$lang->branch->all = '所有';
|
||||
$lang->branch->main = '主干';
|
||||
|
||||
$lang->branch->edit = '编辑';
|
||||
$lang->branch->editAction = '编辑分支';
|
||||
$lang->branch->activate = '激活';
|
||||
$lang->branch->activateAction = '激活分支';
|
||||
$lang->branch->close = '关闭';
|
||||
$lang->branch->closeAction = '关闭分支';
|
||||
$lang->branch->create = '新增分支';
|
||||
$lang->branch->merge = '合并';
|
||||
$lang->branch->edit = '编辑';
|
||||
$lang->branch->editAction = '编辑分支';
|
||||
$lang->branch->activate = '激活';
|
||||
$lang->branch->activateAction = '激活分支';
|
||||
$lang->branch->close = '关闭';
|
||||
$lang->branch->closeAction = '关闭分支';
|
||||
$lang->branch->create = '新增分支';
|
||||
$lang->branch->merge = '合并';
|
||||
$lang->branch->batchEdit = '批量编辑';
|
||||
$lang->branch->defaultBranch = '默认分支';
|
||||
$lang->branch->setDefault = '设为默认分支';
|
||||
$lang->branch->setDefaultAction = '设置默认分支';
|
||||
|
||||
$lang->branch->id = 'ID';
|
||||
$lang->branch->product = '所属产品';
|
||||
@@ -28,12 +32,14 @@ $lang->branch->desc = '分支描述';
|
||||
$lang->branch->order = '排序';
|
||||
$lang->branch->deleted = '已删除';
|
||||
$lang->branch->closed = '已关闭';
|
||||
$lang->branch->default = '默认';
|
||||
|
||||
$lang->branch->confirmDelete = '是否删除该@branch@?';
|
||||
$lang->branch->canNotDelete = '该@branch@下已经有数据,不能删除!';
|
||||
$lang->branch->nameNotEmpty = '名称不能为空!';
|
||||
$lang->branch->confirmClose = '是否关闭该@branch@?';
|
||||
$lang->branch->confirmActivate = '是否激活该@branch@?';
|
||||
$lang->branch->confirmDelete = '是否删除该@branch@?';
|
||||
$lang->branch->confirmSetDefault = '请确认是否需要将该@branch@设置为默认@branch@,设置成功后计划和发布列表将默认选中默认@branch@。';
|
||||
$lang->branch->canNotDelete = '该@branch@下已经有数据,不能删除!';
|
||||
$lang->branch->nameNotEmpty = '名称不能为空!';
|
||||
$lang->branch->confirmClose = '是否关闭该@branch@?';
|
||||
$lang->branch->confirmActivate = '是否激活该@branch@?';
|
||||
|
||||
$lang->branch->noData = '暂时没有分支。';
|
||||
$lang->branch->mainBranch = '产品默认主干分支。';
|
||||
|
||||
+83
-6
@@ -45,7 +45,7 @@ class branchModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($productID, $browseType = 'active', $orderBy = 'order_desc', $pager = null)
|
||||
public function getList($productID, $browseType = 'active', $orderBy = 'order', $pager = null)
|
||||
{
|
||||
$branchList = $this->dao->select('*')->from(TABLE_BRANCH)
|
||||
->where('deleted')->eq(0)
|
||||
@@ -57,12 +57,15 @@ class branchModel extends model
|
||||
|
||||
if($browseType == 'closed') return $branchList;
|
||||
|
||||
$defaultBranch = BRANCH_MAIN;
|
||||
foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch;
|
||||
|
||||
/* Display the main branch under all and active page. */
|
||||
$mainBranch = new stdclass();
|
||||
$mainBranch->id = BRANCH_MAIN;
|
||||
$mainBranch->product = $productID;
|
||||
$mainBranch->name = $this->lang->branch->main;
|
||||
$mainBranch->default = 1;
|
||||
$mainBranch->default = $defaultBranch ? 0 : 1;
|
||||
$mainBranch->status = 'active';
|
||||
$mainBranch->createdDate = '';
|
||||
$mainBranch->closedDate = '';
|
||||
@@ -181,6 +184,52 @@ class branchModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update branch.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchUpdate($productID)
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
$oldBranchList = $this->getList($productID, 'all');
|
||||
$branchIDList = array_keys($this->post->IDList);
|
||||
|
||||
foreach($branchIDList as $branchID)
|
||||
{
|
||||
if($branchID == BRANCH_MAIN)
|
||||
{
|
||||
$newMainBranch = new stdClass();
|
||||
$newMainBranch->default = (isset($data->default) and $data->default == BRANCH_MAIN) ? 1 : 0;
|
||||
|
||||
$changes[$branchID] = common::createChanges($oldBranchList[BRANCH_MAIN], $newMainBranch);
|
||||
}
|
||||
else
|
||||
{
|
||||
$branch = new stdclass();
|
||||
$branch->name = $data->name[$branchID];
|
||||
$branch->desc = $data->desc[$branchID];
|
||||
$branch->status = $data->status[$branchID];
|
||||
$branch->default = (isset($data->default) and $branchID == $data->default) ? 1 : 0;
|
||||
$branch->closedDate = $branch->status == 'closed' ? helper::today() : '';
|
||||
|
||||
$this->dao->update(TABLE_BRANCH)->data($branch, 'default')
|
||||
->batchCheck($this->config->branch->create->requiredFields, 'notempty')
|
||||
->where('id')->eq($branchID)
|
||||
->exec();
|
||||
|
||||
if(dao::isError()) die(js::error('branch#' . $branchID . dao::getError(true)));
|
||||
|
||||
$changes[$branchID] = common::createChanges($oldBranchList[$branchID], $branch);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->default)) $this->setDefault($productID, $data->default);
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a branch.
|
||||
*
|
||||
@@ -193,6 +242,7 @@ class branchModel extends model
|
||||
$this->dao->update(TABLE_BRANCH)
|
||||
->set('status')->eq('closed')
|
||||
->set('closedDate')->eq(helper::today())
|
||||
->set('`default`')->eq('0')
|
||||
->where('id')->eq($branchID)
|
||||
->exec();
|
||||
}
|
||||
@@ -314,11 +364,18 @@ class branchModel extends model
|
||||
*/
|
||||
public function sort()
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
$branches = trim($data->branches, ',');
|
||||
foreach(explode(',', $branches) as $order => $branchID)
|
||||
$orderBy = $this->post->orderBy;
|
||||
$branchIDList = explode(',', trim($this->post->branches, ','));
|
||||
|
||||
if(strpos($orderBy, 'order') === false) return false;
|
||||
if(in_array(BRANCH_MAIN, $branchIDList)) unset($branchIDList[array_search(BRANCH_MAIN, $branchIDList)]);
|
||||
|
||||
$branches = $this->dao->select('id,`order`')->from(TABLE_BRANCH)->where('id')->in($branchIDList)->orderBy($orderBy)->fetchPairs('order', 'id');
|
||||
foreach($branches as $order => $id)
|
||||
{
|
||||
$this->dao->update(TABLE_BRANCH)->set('`order`')->eq($order)->where('id')->eq($branchID)->exec();
|
||||
$newID = array_shift($branchIDList);
|
||||
if($id == $newID) continue;
|
||||
$this->dao->update(TABLE_BRANCH)->set('`order`')->eq($order)->where('id')->eq($newID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,4 +419,24 @@ class branchModel extends model
|
||||
$linkHtml = strpos('programplan', $module) !== false ? sprintf($link, $projectID, $productID, $branch) : sprintf($link, $productID, $branch);
|
||||
return $linkHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default branch.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branchID
|
||||
* @accesss public
|
||||
* @return void
|
||||
*/
|
||||
public function setDefault($productID, $branchID)
|
||||
{
|
||||
$defaultBranch = $this->dao->select('id')->from(TABLE_BRANCH)
|
||||
->where('product')->eq($productID)
|
||||
->andWhere('`default`')->eq('1')
|
||||
->fetch('id');
|
||||
|
||||
if(!empty($defaultBranch)) $this->dao->update(TABLE_BRANCH)->set('`default`')->eq('0')->where('id')->eq($defaultBranch)->exec();
|
||||
|
||||
$this->dao->update(TABLE_BRANCH)->set('`default`')->eq('1')->where('id')->eq($branchID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* The batchedit of branch module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Qiyu Xie <xieqiyu@easycorp.ltd>
|
||||
* @package branch
|
||||
* @version $Id: batchedit.html.php 4903 2021-11-09 13:14:59Z hfz $
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainContent" class="main-content fade">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->branch->common . '-' . $lang->branch->batchEdit;?></h2>
|
||||
</div>
|
||||
<form class="load-indicator main-form" method='post' target='hiddenwin' enctype='multipart/form-data' id='dataform'>
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-id'><?php echo $lang->branch->id;?></th>
|
||||
<th class='required c-name'><?php echo $lang->branch->name;?></th>
|
||||
<th class='c-desc'><?php echo $lang->branch->desc;?></th>
|
||||
<th class='c-status'><?php echo $lang->branch->status;?></th>
|
||||
<th class='c-default text-center'><?php echo $lang->branch->defaultBranch;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($branchList as $branch):?>
|
||||
<?php $disabled = $branch->id == BRANCH_MAIN ? 'disabled' : '';?>
|
||||
<tr>
|
||||
<td><?php echo ($branch->id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch);?></td>
|
||||
<td><?php echo html::input("name[$branch->id]", $branch->name, "class='form-control chosen' $disabled");?></td>
|
||||
<td><?php echo html::input("desc[$branch->id]", $branch->desc, "class='form-control' $disabled");?></td>
|
||||
<td><?php echo html::select("status[$branch->id]", $lang->branch->statusList, $branch->status, "class='form-control' chosen $disabled onchange='canSetDefaultBranch(this)'");?></td>
|
||||
<td class='text-center'><input type='radio' name='default' value='<?php echo $branch->id;?>' <?php if($branch->default) echo 'checked';?> <?php if($branch->status == 'closed') echo 'disabled';?>></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td colspan='6' class='form-actions text-center'>
|
||||
<?php echo html::submitButton() . html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -12,7 +12,9 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php js::set('orderBy', $orderBy)?>
|
||||
<?php $canCreate = common::hasPriv('branch', 'create');?>
|
||||
<?php $canOrder = common::hasPriv('branch', 'sort');?>
|
||||
<?php $canBatchEdit = common::hasPriv('branch', 'batchEdit');?>
|
||||
<?php $canMergeBranch = common::hasPriv('branch', 'mergeBranch');?>
|
||||
<?php $canBatchAction = ($canBatchEdit or $canMergeBranch);?>
|
||||
@@ -39,7 +41,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<form class='main-table table-branch' data-ride='table' method='post' id='branchForm'>
|
||||
<form class='main-table' data-ride='table' method='post' id='branchForm'>
|
||||
<table id="branchList" class="table has-sort-head">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -49,7 +51,9 @@
|
||||
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>"><label></label></div>
|
||||
</th>
|
||||
<?php endif;?>
|
||||
<?php if($canOrder):?>
|
||||
<th class='c-order sort-default'><?php echo $lang->branch->order;?></th>
|
||||
<?php endif;?>
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->branch->name);?></th>
|
||||
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->branch->status);?></th>
|
||||
<th class='c-date'><?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->branch->createdDate);?></th>
|
||||
@@ -58,23 +62,43 @@
|
||||
<th class='c-actions-2'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable">
|
||||
<tbody id='branchTableList'>
|
||||
<?php foreach($branchList as $branch):?>
|
||||
<tr>
|
||||
<?php $isMain = $branch->id == BRANCH_MAIN;?>
|
||||
<tr data-id='<?php echo $branch->id;?>'>
|
||||
<?php if($canBatchAction):?>
|
||||
<td class='cell-id'>
|
||||
<?php echo html::checkbox('branchIDList', array($branch->id => ''));?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class='c-actions sort-handler'><i class="icon icon-move"></i></td>
|
||||
<td class='c-name' title='<?php echo $branch->name;?>'><?php echo $branch->name;?></td>
|
||||
<?php if($canOrder):?>
|
||||
<td class='c-actions <?php echo $isMain ? '' : 'sort-handler';?>'>
|
||||
<?php echo $isMain ? '' : '<i class="icon icon-move"></i>';?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class='c-name flex' title='<?php echo $branch->name;?>'>
|
||||
<span class="text-ellipsis"><?php echo $branch->name;?></span>
|
||||
<?php
|
||||
if($branch->default)
|
||||
{
|
||||
echo ' <span class="label label-primary label-badge">' . $lang->branch->default . '</span>';
|
||||
}
|
||||
elseif($branch->status == 'active')
|
||||
{
|
||||
$setDefaultLink = helper::createLink('branch', 'setDefault', "productID=$productID&branchID=$branch->id", '', true);
|
||||
$setDefaultHtml = html::a($setDefaultLink, "<i class='icon icon-hand-right'></i> <span>{$lang->branch->setDefault}</span>", '', "class='iframe btn btn-icon-left btn-sm setDefault hidden'");
|
||||
|
||||
echo common::hasPriv('branch', 'setDefault') ? $setDefaultHtml : '';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo zget($lang->branch->statusList, $branch->status);?></td>
|
||||
<td><?php echo helper::isZeroDate($branch->createdDate) ? '' : $branch->createdDate;?></td>
|
||||
<td><?php echo helper::isZeroDate($branch->closedDate) ? '' : $branch->closedDate;?></td>
|
||||
<td class='c-name' title='<?php echo $branch->desc;?>'><?php echo $branch->desc;?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$disabled = $branch->id == BRANCH_MAIN ? 'disabled' : '';
|
||||
$disabled = $isMain ? 'disabled' : '';
|
||||
common::printIcon('branch', 'edit', "branchID=$branch->id", $branch, 'list', '', '', "$disabled iframe", true);
|
||||
if($branch->status == 'active')
|
||||
{
|
||||
@@ -95,13 +119,15 @@
|
||||
<div class="checkbox-primary check-all">
|
||||
<label><?php echo $lang->selectAll?></label>
|
||||
</div>
|
||||
<?php if($canBatchEdit):?>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php echo html::submitButton($lang->edit, '', 'btn');?>
|
||||
</div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php echo html::submitButton($lang->branch->merge, '', 'btn');?>
|
||||
<?php
|
||||
$batchEditLink = $this->createLink('branch', 'batchEdit', "productID=$productID");
|
||||
echo html::submitButton($lang->edit, "data-form-action='$batchEditLink'", 'btn');
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -420,13 +420,15 @@ $lang->product->methodOrder[105] = 'unbindWhitelist';
|
||||
|
||||
/* Branch. */
|
||||
$lang->resource->branch = new stdclass();
|
||||
$lang->resource->branch->manage = 'manage';
|
||||
$lang->resource->branch->create = 'create';
|
||||
$lang->resource->branch->edit = 'editAction';
|
||||
$lang->resource->branch->close = 'closeAction';
|
||||
$lang->resource->branch->activate = 'activateAction';
|
||||
$lang->resource->branch->sort = 'sort';
|
||||
$lang->resource->branch->delete = 'delete';
|
||||
$lang->resource->branch->manage = 'manage';
|
||||
$lang->resource->branch->create = 'create';
|
||||
$lang->resource->branch->edit = 'editAction';
|
||||
$lang->resource->branch->close = 'closeAction';
|
||||
$lang->resource->branch->activate = 'activateAction';
|
||||
$lang->resource->branch->sort = 'sort';
|
||||
$lang->resource->branch->delete = 'delete';
|
||||
$lang->resource->branch->batchEdit = 'batchEdit';
|
||||
$lang->resource->branch->setDefault = 'setDefaultAction';
|
||||
|
||||
$lang->branch->methodOrder[0] = 'manage';
|
||||
$lang->branch->methodOrder[5] = 'create';
|
||||
@@ -435,6 +437,7 @@ $lang->branch->methodOrder[15] = 'close';
|
||||
$lang->branch->methodOrder[20] = 'activate';
|
||||
$lang->branch->methodOrder[25] = 'sort';
|
||||
$lang->branch->methodOrder[30] = 'delete';
|
||||
$lang->branch->methodOrder[35] = 'batchEdit';
|
||||
|
||||
/* Story. */
|
||||
$lang->resource->story = new stdclass();
|
||||
|
||||
Reference in New Issue
Block a user