diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index 627fb63b7f..e2c713bd1e 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -412,6 +412,7 @@ $lang->execution->storyDragError = "The {$lang->SRCommon} is still $lang->execution->countTip = ' (%s member)'; $lang->execution->pleaseInput = "Enter"; $lang->execution->week = 'week'; +$lang->execution->checkedExecutions = 'Seleted %s items'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index b230ea3f39..ee0fd4982f 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -412,6 +412,7 @@ $lang->execution->storyDragError = "The {$lang->SRCommon} is still $lang->execution->countTip = ' (%s member)'; $lang->execution->pleaseInput = "Enter"; $lang->execution->week = 'week'; +$lang->execution->checkedExecutions = 'Seleted %s items'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index bb12d7782a..9915245c72 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -412,6 +412,7 @@ $lang->execution->storyDragError = "The {$lang->SRCommon} is still $lang->execution->countTip = ' (%s member)'; $lang->execution->pleaseInput = "Enter"; $lang->execution->week = 'week'; +$lang->execution->checkedExecutions = "Pour s électionner l'élément%s"; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 12477116d0..ea81fd5260 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -412,6 +412,7 @@ $lang->execution->storyDragError = "该{$lang->SRCommon}还是草 $lang->execution->countTip = '(%s人)'; $lang->execution->pleaseInput = "请输入"; $lang->execution->week = '周'; +$lang->execution->checkedExecutions = '已选择%s项'; /* 统计。*/ $lang->execution->charts = new stdclass(); diff --git a/module/execution/model.php b/module/execution/model.php index 1ed5863619..7ad77afc90 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -670,6 +670,7 @@ class executionModel extends model } } + $this->lang->error->unique = $this->lang->error->repeat; $extendFields = $this->getFlowExtendFields(); foreach($data->executionIDList as $executionID) { @@ -788,8 +789,8 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) - ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID") - ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") + ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage','kanban') and `project` = $projectID and `deleted` = '0'") + ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage','kanban') and `deleted` = '0'") ->checkFlow() ->where('id')->eq($executionID) ->limit(1) diff --git a/module/product/model.php b/module/product/model.php index 546770dae9..1986d788de 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -833,6 +833,7 @@ class productModel extends model $unlinkProducts = array(); $linkProducts = array(); + $this->lang->error->unique = $this->lang->error->repeat; foreach($products as $productID => $product) { $oldProduct = $oldProducts[$productID]; @@ -842,7 +843,7 @@ class productModel extends model ->data($product) ->autoCheck() ->batchCheck($this->config->product->edit->requiredFields , 'notempty') - ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID") + ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID and `deleted` = '0'") ->checkFlow() ->where('id')->eq($productID) ->exec(); diff --git a/module/project/control.php b/module/project/control.php index ea1903944f..927989522f 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -964,6 +964,7 @@ class project extends control $this->loadModel('execution'); $this->loadModel('task'); $this->loadModel('programplan'); + $this->session->set('executionList', $this->app->getURI(true), 'project'); if($this->cookie->showTask) $this->session->set('taskList', $this->app->getURI(true), 'project'); diff --git a/module/project/css/execution.css b/module/project/css/execution.css index 5c581d47fc..e2f4655b73 100644 --- a/module/project/css/execution.css +++ b/module/project/css/execution.css @@ -1,4 +1,5 @@ #executionList > thead > tr > th .table-nest-toggle-global {top: 6px} #executionList > thead > tr > th .table-nest-toggle-global:before {color: #a6aab8;} +#executionsSummary {padding-left: 10px;} #mainMenu .pull-left .checkbox-primary {margin-top: 5px;} .main-table tbody>tr>td:first-child, .main-table thead>tr>th:first-child { padding-left: 8px; } diff --git a/module/project/js/execution.js b/module/project/js/execution.js index 1209f65a01..467545751a 100644 --- a/module/project/js/execution.js +++ b/module/project/js/execution.js @@ -4,8 +4,92 @@ $(function() { var show = $(this).is(':checked') ? 1 : 0; $.cookie('showTask', show, {expires:config.cookieLife, path:config.webRoot}); + if(show == 1) $('input#editExecution1').prop('disabled', true); + if(show == 0) $('input#editExecution1').prop('disabled', false); window.location.reload(); }); + if($.cookie('showTask') == 1) $('input#editExecution1').prop('disabled', true); + + $('input#editExecution1').click(function() + { + var editExecution = $(this).is(':checked') ? 1 : 0; + $.cookie('editExecution', editExecution, {expires:config.cookieLife, path:config.webRoot}); + if(editExecution == 1) $('input[name^="showTask"]').prop('disabled', true); + if(editExecution == 0) $('input[name^="showTask"]').prop('disabled', false); + + showEditCheckbox(editExecution); + }); + if($.cookie('editExecution') == 1) + { + $('input#editExecution1').prop('checked', 'true'); + showEditCheckbox(true); + $('input[name^="showTask"]').prop('disabled', true); + } + + $(document).on('click', ":checkbox[name^='executionIDList']", function() + { + var notCheckedLength = $(":checkbox[name^='executionIDList']:not(:checked)").length; + var checkedLength = $(":checkbox[name^='executionIDList']:checked").length; + + if(checkedLength > 0) $('#executionForm').addClass('has-row-checked'); + if(notCheckedLength == 0) $('.table-footer #checkAll').prop('checked', true); + if(checkedLength == 0) + { + $('.table-footer #checkAll').prop('checked', false); + $('#executionForm').removeClass('has-row-checked'); + } + + var summary = checkedExecutions.replace('%s', checkedLength); + if(cilentLang == "en" && checkedLength < 2) summary = summary.replace('items', 'item'); + var statistic = "
" + summary + "
"; + if(checkedLength > 0) + { + $('#executionSummary').addClass('hidden'); + $('#executionsSummary').remove(); + $('.editCheckbox').after(statistic); + } + else + { + $('#executionSummary').removeClass('hidden'); + $('#executionsSummary').addClass('hidden'); + } + + }); + + $(document).on('click', ".table-footer #checkAll", function() + { + if($(this).prop('checked')) + { + $(":checkbox[name^='executionIDList']").prop('checked', true); + $('#executionForm').addClass('has-row-checked'); + var checkedLength = $(":checkbox[name^='executionIDList']:checked").length; + var summary = checkedExecutions.replace('%s', checkedLength); + if(cilentLang == "en" && checkedLength < 2) summary = summary.replace('items', 'item'); + var statistic = "
" + summary + "
"; + $('#executionSummary').addClass('hidden'); + $('#executionsSummary').remove(); + $('.editCheckbox').after(statistic); + $(this).next('label').addClass('hover'); + } + else + { + $(":checkbox[name^='executionIDList']").prop('checked', false); + $('#executionForm').removeClass('has-row-checked'); + $('#executionSummary').removeClass('hidden'); + $('#executionsSummary').addClass('hidden'); + $(this).next('label').removeClass('hover'); + } + }); + + /* Solve the problem that clicking the browser back button causes the checkbox to be selected by default. */ + setTimeout(function() + { + $(":checkbox[name^='executionIDList']").each(function() + { + $(this).prop('checked', false); + }); + $('.table-footer #checkAll').prop('checked', false); + }, 10); }) window.addEventListener('scroll', this.handleScroll) @@ -81,3 +165,40 @@ function getWindowHeight() { return document.compatMode == "CSS1Compat" ? windowHeight = document.documentElement.clientHeight : windowHeight = document.body.clientHeight } + +function showEditCheckbox(show) +{ + $('.project-type-label').each(function() + { + $this = $(this); + $tr = $(this).closest('tr'); + executionID = $tr.attr('data-id'); + if(show) + { + var marginLeft = $tr.find('td:first').find('span.table-nest-icon').css('margin-left'); + + $tr.find('td:first').prepend("
"); + $tr.find('td:first').find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14'); + $tr.find('td:first').find('span.table-nest-icon').css('margin-left', '0'); + } + else + { + var marginLeft = $tr.find('td:first').find('.checkbox-primary').css('margin-left'); + $tr.find('td:first').find('span.table-nest-icon').css('margin-left', marginLeft); + $tr.find('td:first').find('[name^="executionIDList"]').parent().remove(); + } + }); + if(show) + { + var tableFooter = "
"; + $('#executionForm').attr('action', createLink('execution', 'batchEdit')); + $('.table-footer').prepend(tableFooter).show(); + $('body').scroll(); + } + else + { + $('#executionForm').find('.editCheckbox').remove(); + if($('#executionForm .pager').length == 0) $('.table-footer').hide(); + $('#executionForm').removeAttr('action'); + } +} diff --git a/module/project/model.php b/module/project/model.php index fff3a0fe4a..ae369657db 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1583,6 +1583,7 @@ class projectModel extends model } if(dao::isError()) return false; + $this->lang->error->unique = $this->lang->error->repeat; foreach($projects as $projectID => $project) { $oldProject = $oldProjects[$projectID]; @@ -1594,8 +1595,8 @@ class projectModel extends model ->checkIF($project->begin != '', 'begin', 'date') ->checkIF($project->end != '', 'end', 'date') ->checkIF($project->end != '', 'end', 'gt', $project->begin) - ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID and `model` = '{$project->model}'") - ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project' and `model` = '{$project->model}'") + ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID and `model` = '{$project->model}' and `deleted` = '0'") + ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project' and `model` = '{$project->model}' and `deleted` = '0'") ->checkFlow() ->where('id')->eq($projectID) ->exec(); diff --git a/module/project/view/execution.html.php b/module/project/view/execution.html.php index 59fa5c2cc1..9172f9bd4b 100644 --- a/module/project/view/execution.html.php +++ b/module/project/view/execution.html.php @@ -1,5 +1,9 @@ +edit);?> +selectAll);?> +execution->checkedExecutions);?> +app->getClientLang());?>