From fb4e586acfcb491c8acbc53f636228adb2617ca3 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 17 May 2022 14:50:31 +0800 Subject: [PATCH] * Finish task #54349. --- module/common/lang/menu.php | 2 +- module/custom/control.php | 21 +++++++++++++++++++ module/custom/lang/en.php | 7 +++++++ module/custom/lang/zh-cn.php | 7 +++++++ module/custom/view/header.html.php | 4 ++-- module/kanban/control.php | 3 +++ module/kanban/js/view.js | 10 +++++++++ module/kanban/model.php | 20 ++++++++++-------- module/kanban/view/view.html.php | 1 + module/kanban/view/viewarchivedcard.html.php | 5 +++-- .../kanban/view/viewarchivedcolumn.html.php | 4 ++-- 11 files changed, 68 insertions(+), 16 deletions(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 6899c593d3..0929eaccff 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -476,7 +476,7 @@ $lang->company->menuOrder[30] = 'addUser'; $lang->admin->menu = new stdclass(); $lang->admin->menu->index = array('link' => "$lang->indexPage|admin|index", 'alias' => 'register,certifytemail,certifyztmobile,ztcompany'); $lang->admin->menu->company = array('link' => "{$lang->personnel->common}|company|browse|", 'subModule' => ',user,dept,group,'); -$lang->admin->menu->model = array('link' => "$lang->model|custom|browsestoryconcept|", 'class' => 'dropdown dropdown-hover', 'exclude' => 'custom-index,custom-set,custom-product,custom-execution,custom-required,custom-flow,custom-score,custom-feedback,custom-timezone,custom-mode'); +$lang->admin->menu->model = array('link' => "$lang->model|custom|browsestoryconcept|", 'class' => 'dropdown dropdown-hover', 'exclude' => 'custom-index,custom-set,custom-product,custom-execution,custom-kanban,custom-required,custom-flow,custom-score,custom-feedback,custom-timezone,custom-mode'); $lang->admin->menu->custom = array('link' => "{$lang->custom->common}|custom|index", 'exclude' => 'custom-browsestoryconcept,custom-timezone,custom-estimate'); $lang->admin->menu->extension = array('link' => "{$lang->extension->common}|extension|browse", 'subModule' => 'extension'); $lang->admin->menu->dev = array('link' => "$lang->redev|dev|api", 'alias' => 'db', 'subModule' => 'dev,editor,entry'); diff --git a/module/custom/control.php b/module/custom/control.php index 62ad339866..d46597c491 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -518,6 +518,27 @@ class custom extends control $this->display(); } + /** + * Set whether the kanban is read-only. + * + * @access public + * @return void + */ + public function kanban() + { + if($_POST) + { + $this->loadModel('setting')->setItem("system.common.CRKanban@{$this->config->vision}", $this->post->kanban); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload')); + } + + $this->view->title = $this->lang->custom->kanban; + $this->view->position[] = $this->lang->custom->common; + $this->view->position[] = $this->view->title; + + $this->display(); + } + /** * Set flow. * diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 84ffb3fb62..d2161714d5 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -49,6 +49,7 @@ $lang->custom->switch = "Switch"; $lang->custom->oneUnit = "One {$lang->hourCommon}"; $lang->custom->convertRelationTitle = "Please firstly set the conversion factor from {$lang->hourCommon} to %s"; $lang->custom->superReviewers = "Super Reviewer"; +$lang->custom->kanban = "Kanban"; if($config->systemMode == 'new') $lang->custom->execution = 'Execution'; if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon; @@ -79,11 +80,13 @@ $lang->custom->saveTips = 'After clicking save, the current %s will b $lang->custom->numberError = 'The interval must be greater than zero!'; $lang->custom->closedExecution = 'Closed ' . $lang->executionCommon; +$lang->custom->closedKanban = 'Closed ' . $lang->custom->kanban; $lang->custom->closedProduct = 'Closed ' . $lang->productCommon; if($config->systemMode == 'new') $lang->custom->object['project'] = 'Project'; $lang->custom->object['product'] = $lang->productCommon; $lang->custom->object['execution'] = $lang->custom->execution; +$lang->custom->object['kanban'] = $lang->custom->kanban; $lang->custom->object['story'] = 'Story'; $lang->custom->object['task'] = 'Task'; $lang->custom->object['bug'] = 'Bug'; @@ -174,6 +177,7 @@ $lang->custom->notice->conceptResult = 'According to your preference, $lang->custom->notice->conceptPath = 'Go to Admin -> Custom -> Concept to set it.'; $lang->custom->notice->readOnlyOfProduct = 'If Change Forbidden, any change on stories, bugs, cases, efforts, releases and plans of the closed product is also forbidden.'; $lang->custom->notice->readOnlyOfExecution = "If Change Forbidden, any change on tasks, builds, efforts and stories of the closed {$lang->executionCommon} is also forbidden."; +$lang->custom->notice->readOnlyOfKanban = "If Change Forbidden, any change on kanban card and related operations of {$lang->custom->kanban} is also forbidden."; $lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!'; $lang->custom->notice->confirmDelete = 'Are you sure you want to delete it?'; $lang->custom->notice->confirmReviewCase = 'Set the case in Wait to Normal?'; @@ -232,6 +236,9 @@ $lang->custom->CRProduct[0] = 'Change Forbidden'; $lang->custom->CRExecution[1] = 'Change Allowed'; $lang->custom->CRExecution[0] = 'Change Forbidden'; +$lang->custom->CRKanban[1] = 'Change Allowed'; +$lang->custom->CRKanban[0] = 'Change Forbidden'; + $lang->custom->moduleName['product'] = $lang->productCommon; $lang->custom->moduleName['productplan'] = 'Plan'; $lang->custom->moduleName['execution'] = $lang->custom->execution; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 991319a060..747d231c88 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -49,6 +49,7 @@ $lang->custom->switch = "切换"; $lang->custom->oneUnit = "一个{$lang->hourCommon}"; $lang->custom->convertRelationTitle = "请先设置{$lang->hourCommon}转换为%s的换算系数"; $lang->custom->superReviewers = "超级评审人"; +$lang->custom->kanban = "看板"; if($config->systemMode == 'new') $lang->custom->execution = '执行'; if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon; @@ -79,11 +80,13 @@ $lang->custom->saveTips = '点击保存后,则以当前%s为默认 $lang->custom->numberError = '区间必须大于零'; $lang->custom->closedExecution = '已关闭' . $lang->custom->execution; +$lang->custom->closedKanban = '已关闭' . $lang->custom->kanban; $lang->custom->closedProduct = '已关闭' . $lang->productCommon; if($config->systemMode == 'new') $lang->custom->object['project'] = '项目'; $lang->custom->object['product'] = $lang->productCommon; $lang->custom->object['execution'] = $lang->custom->execution; +$lang->custom->object['kanban'] = $lang->custom->kanban; $lang->custom->object['story'] = $lang->SRCommon; $lang->custom->object['task'] = '任务'; $lang->custom->object['bug'] = 'Bug'; @@ -174,6 +177,7 @@ $lang->custom->notice->conceptResult = '我们已经根据您的选择为 $lang->custom->notice->conceptPath = '您可以在:后台 -> 自定义 -> 流程页面修改。'; $lang->custom->notice->readOnlyOfProduct = '禁止修改后,已关闭' . $lang->productCommon . '下的' . $lang->SRCommon . '、Bug、用例、日志、发布、计划都禁止修改。'; $lang->custom->notice->readOnlyOfExecution = "禁止修改后,已关闭{$lang->custom->execution}下的任务、版本、日志以及关联需求都禁止修改。"; +$lang->custom->notice->readOnlyOfKanban = "禁止修改后,已关闭{$lang->custom->kanban}下的卡片以及相关设置都禁止修改。"; $lang->custom->notice->URSREmpty = '自定义需求名称不能为空!'; $lang->custom->notice->confirmDelete = '您确定要删除吗?'; $lang->custom->notice->confirmReviewCase = '是否将待评审的用例修改为正常状态?'; @@ -232,6 +236,9 @@ $lang->custom->CRProduct[0] = '禁止修改'; $lang->custom->CRExecution[1] = '允许修改'; $lang->custom->CRExecution[0] = '禁止修改'; +$lang->custom->CRKanban[1] = '允许修改'; +$lang->custom->CRKanban[0] = '禁止修改'; + $lang->custom->moduleName['product'] = $lang->productCommon; $lang->custom->moduleName['productplan'] = '计划'; $lang->custom->moduleName['execution'] = $lang->custom->execution; diff --git a/module/custom/view/header.html.php b/module/custom/view/header.html.php index a74dcd2e93..26b58c1e3f 100644 --- a/module/custom/view/header.html.php +++ b/module/custom/view/header.html.php @@ -5,8 +5,8 @@ foreach($lang->custom->object as $object => $name) { if(strpos('story|todo|block', $object) !== false) echo ""; - if(strpos('execution|product', $object) !== false) common::printLink('custom', $object, "", "{$lang->custom->$object}", '', "class='btn btn-link' id='{$object}Tab'"); - if(strpos('execution|product', $object) === false) common::printLink('custom', 'set', "module=$object&field=" . key($lang->custom->{$object}->fields), "{$name}", '', "class='btn btn-link' id='{$object}Tab'"); + if(strpos('execution|product|kanban', $object) !== false) common::printLink('custom', $object, "", "{$lang->custom->$object}", '', "class='btn btn-link' id='{$object}Tab'"); + if(strpos('execution|product|kanban', $object) === false) common::printLink('custom', 'set', "module=$object&field=" . key($lang->custom->{$object}->fields), "{$name}", '', "class='btn btn-link' id='{$object}Tab'"); if($object == 'user') common::printLink('custom', 'required', "", "{$lang->custom->required}", '', "class='btn btn-link' id='requiredTab'"); } diff --git a/module/kanban/control.php b/module/kanban/control.php index 72fc0b3a02..3436377707 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -741,6 +741,9 @@ class kanban extends control } } + $region = $this->kanban->getRegionByID($regionID); + + $this->view->kanban = $this->kanban->getByID($region->kanban); $this->view->columns = $columnsData; $this->display(); diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index 7ac9f595fd..c3d5ff4403 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -40,6 +40,7 @@ function fullScreen() $('.action').hide(); $('.kanban-group-header').hide(); $(".title").attr("disabled", true).css("pointer-events", "none"); + $('.kanban-col.kanban-header-col').css('padding', '0px 0px 0px 0px'); window.sortableDisabled = true; $.cookie('isFullScreen', 1); }; @@ -76,12 +77,15 @@ function fullScreen() */ function exitFullScreen() { + $('.region-actions > div > .action').show(); + if(kanban.status == 'closed') return; $('#kanbanContainer').removeClass('fullscreen') .off('scroll', tryUpdateKanbanAffix); $('.actions').show(); $('.action').show(); $('.kanban-group-header').show(); $(".title").attr("disabled", false).css("pointer-events", "auto"); + $('.kanban-col.kanban-header-col').css('padding', '0px 30px'); window.sortableDisabled = false; $.cookie('isFullScreen', 0); } @@ -1408,6 +1412,12 @@ $(function() initSortable(); resetRegionHeight('open'); + + if(!CRKanban && kanban.status == "closed") + { + fullScreen(); + $('.region-actions > div > .action').show(); + } }); function initSortable() diff --git a/module/kanban/model.php b/module/kanban/model.php index 68e3c05c69..a9e6e2dc40 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -2940,24 +2940,26 @@ class kanbanModel extends model $actions .= "
"; $actions .= " {$this->lang->kanban->fullScreen}"; - $printSettingBtn = (common::hasPriv('kanban', 'createRegion') or $printSetHeightBtn or common::hasPriv('kanban', 'performable') or common::hasPriv('kanban', 'edit') or common::hasPriv('kanban', 'close') or common::hasPriv('kanban', 'enableArchived') or common::hasPriv('kanban', 'delete')); + $CRKanban = ($this->config->CRKanban or $kanban->status != 'closed'); + $printRegionBtn = ($CRKanban and (common::hasPriv('kanban', 'createRegion') or $printSetHeightBtn or common::hasPriv('kanban', 'performable') or common::hasPriv('kanban', 'enableArchived') or common::hasPriv('kanban', 'import') or common::hasPriv('kanban', 'setColumnWidth'))); + $printKanbanBtn = (common::hasPriv('kanban', 'edit') or common::hasPriv('kanban', 'close') or common::hasPriv('kanban', 'delete')); - if($printSettingBtn) + if($printRegionBtn or $printKanbanBtn) { $actions .= "" . ' ' . $this->lang->kanban->setting . ''; $actions .= ""; } diff --git a/module/kanban/view/view.html.php b/module/kanban/view/view.html.php index 9f960fc8e2..455d9aa99b 100644 --- a/module/kanban/view/view.html.php +++ b/module/kanban/view/view.html.php @@ -21,6 +21,7 @@ $laneCount = 0; foreach($regions as $region) $laneCount += $region->laneCount; js::set('vision', $this->config->vision); +js::set('CRKanban', $this->config->CRKanban); js::set('regions', $regions); js::set('kanban', $kanban); js::set('kanbanLang', $lang->kanban); diff --git a/module/kanban/view/viewarchivedcard.html.php b/module/kanban/view/viewarchivedcard.html.php index 1a18aed718..ebe2f900fc 100644 --- a/module/kanban/view/viewarchivedcard.html.php +++ b/module/kanban/view/viewarchivedcard.html.php @@ -172,8 +172,9 @@ $app->loadLang('productplan');
performable) echo "id='performable'";?>> config->CRKanban or $kanban->status != 'closed'); + $canRestore = (commonModel::hasPriv('kanban', 'restoreCard') and $CRKanban); + $canDelete = (commonModel::hasPriv('kanban', 'deleteCard') and $CRKanban); if($canRestore) echo html::a(inlink('restoreCard', "cardID={$card->id}"), $lang->kanban->restore, '', "class='btn btn-xs btn-primary' target='hiddenwin'"); diff --git a/module/kanban/view/viewarchivedcolumn.html.php b/module/kanban/view/viewarchivedcolumn.html.php index 5db11bd570..ee70925597 100644 --- a/module/kanban/view/viewarchivedcolumn.html.php +++ b/module/kanban/view/viewarchivedcolumn.html.php @@ -35,7 +35,7 @@
name;?>
- archived == '1') echo html::a(inlink('restoreColumn', "columnID={$column->id}"), $lang->kanban->restore, '', "class='btn btn-primary' target='hiddenwin'");?> + archived == '1' && ($this->config->CRKanban or $kanban->status != 'closed')) echo html::a(inlink('restoreColumn', "columnID={$column->id}"), $lang->kanban->restore, '', "class='btn btn-primary' target='hiddenwin'");?>
child) && $column->archived == '0'):?> @@ -43,7 +43,7 @@ child) ? 'hr' : '';?>
name;?>
- archived == '1') echo html::a(inlink('restoreColumn', "columnID={$childColumn->id}"), $lang->kanban->restore, '', "class='btn btn-primary' target='hiddenwin'");?> + archived == '1' && ($this->config->CRKanban or $kanban->status != 'closed')) echo html::a(inlink('restoreColumn', "columnID={$childColumn->id}"), $lang->kanban->restore, '', "class='btn btn-primary' target='hiddenwin'");?>