From 4500687de6e5fae737280437560b70fd7879b953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 25 Aug 2021 20:10:03 +0800 Subject: [PATCH] * finish task #41923. --- module/program/control.php | 2 +- module/program/js/browse.js | 64 +++++++++++++++++++++++++++++ module/program/view/browse.html.php | 3 ++ module/project/control.php | 2 + 4 files changed, 70 insertions(+), 1 deletion(-) diff --git a/module/program/control.php b/module/program/control.php index 7a4c5f17ce..29da70e777 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -31,7 +31,7 @@ class program extends control if(common::hasPriv('program', 'create')) $this->lang->pageActions = html::a($this->createLink('program', 'create'), " " . $this->lang->program->create, '', "class='btn btn-primary'"); $this->session->set('programList', $this->app->getURI(true), 'program'); - $this->session->set('projectList', $this->app->getURI(true), 'project'); + $this->session->set('projectList', $this->app->getURI(true), 'program'); $programType = $this->cookie->programType ? $this->cookie->programType : 'bylist'; diff --git a/module/program/js/browse.js b/module/program/js/browse.js index 8189da11db..d98b66dfe4 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -6,4 +6,68 @@ $(function() $.cookie('showClosed', showClosed, {expires:config.cookieLife, path:config.webRoot}); window.location.reload(); }); + + $('input#editProject1').click(function() + { + var editProject = $(this).is(':checked') ? 1 : 0; + showEditCheckbox(editProject); + }); + if($('input#editProject1').prop('checked')) showEditCheckbox(true); + + $(document).on('click', ":checkbox[name^='projectIdList']", function() + { + var notCheckedLength = $(":checkbox[name^='projectIdList']:not(:checked)").length; + var checkedLength = $(":checkbox[name^='projectIdList']:checked").length; + + if(checkedLength > 0) $('#programForm').addClass('has-row-checked'); + if(notCheckedLength == 0) $('.table-footer #checkAll').prop('checked', true); + if(checkedLength == 0) + { + $('.table-footer #checkAll').prop('checked', false); + $('#programForm').removeClass('has-row-checked'); + } + }); + + $(document).on('click', ".table-footer #checkAll", function() + { + if($(this).prop('checked')) + { + $(":checkbox[name^='projectIdList']").prop('checked', true); + $('#programForm').addClass('has-row-checked'); + } + else + { + $(":checkbox[name^='projectIdList']").prop('checked', false); + $('#programForm').removeClass('has-row-checked'); + } + }); }); + +function showEditCheckbox(show) +{ + $('.icon-project,.icon-waterfall,.icon-scrum').each(function() + { + $this = $(this); + $tr = $(this).closest('tr'); + projectID = $tr.attr('data-id'); + if(show) + { + $tr.find('td:first').prepend("
"); + } + else + { + $tr.find('td:first').find('[name^="projectIdList"]').parent().remove(); + } + }); + if(show) + { + var tableFooter = ""; + $('#programForm').attr('action', createLink('project', 'batchEdit', 'from=program')).append(tableFooter); + $('body').scroll(); + } + else + { + $('#programForm').find('.table-footer').remove(); + $('#programForm').removeAttr('action'); + } +} diff --git a/module/program/view/browse.html.php b/module/program/view/browse.html.php index 1003efc783..a3b4489819 100644 --- a/module/program/view/browse.html.php +++ b/module/program/view/browse.html.php @@ -13,6 +13,8 @@ +edit);?> +selectAll);?> @@ -24,6 +26,7 @@ $lang->program->showClosed), '', $this->cookie->showClosed ? 'checked=checked' : '');?> + $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '');?>
config->maxVersion)):?> diff --git a/module/project/control.php b/module/project/control.php index 52e11d0094..0da87b7076 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -579,6 +579,8 @@ class project extends control die(js::locate($this->session->projectList, 'parent')); } + if($this->app->openApp == 'program') $this->loadModel('program')->setMenu(0); + $projectIdList = $this->post->projectIdList ? $this->post->projectIdList : die(js::locate($this->session->projectList, 'parent')); $projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id');