From 97ac6f0b9c0770f42a4c7fd39061785cff806bf3 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 24 Nov 2020 14:45:52 +0800 Subject: [PATCH] * Merge code. --- module/custom/control.php | 8 +++- module/custom/js/configurescrum.js | 13 ++++- module/custom/js/configurewaterfall.js | 12 +++++ module/custom/lang/de.php | 26 ++++++++-- module/custom/lang/en.php | 32 ++++++++++--- module/custom/lang/fr.php | 24 +++++++++- module/custom/lang/vi.php | 20 ++++++++ module/custom/lang/zh-cn.php | 28 +++++++++-- module/custom/model.php | 32 +++++++++++-- module/custom/view/configurescrum.html.php | 47 ++++++++++--------- .../custom/view/configurewaterfall.html.php | 38 ++++++++------- 11 files changed, 218 insertions(+), 62 deletions(-) diff --git a/module/custom/control.php b/module/custom/control.php index 3d5db82efe..ba819e2221 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -400,6 +400,7 @@ class custom extends control */ public function configureWaterfall($type = 'concept') { + $this->app->loadLang('custom'); $this->lang->custom->menu = new stdclass(); $this->lang->navGroup->custom = 'system'; @@ -407,7 +408,8 @@ class custom extends control { if($type == 'concept') { - $this->custom->setURAndSR(); + $result = $this->custom->setURAndSR(); + if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty)); } if($type == 'user' and isset($_POST['keys'])) @@ -486,6 +488,7 @@ class custom extends control */ public function configureScrum($type = 'concept') { + $this->app->loadLang('custom'); $this->lang->custom->menu = new stdclass(); $this->lang->navGroup->custom = 'system'; @@ -494,7 +497,8 @@ class custom extends control if($type == 'concept') { $this->custom->setConcept(); - $this->custom->setURAndSR(); + $result = $this->custom->setURAndSR(); + if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty)); } if($type == 'user' && isset($_POST['keys'])) diff --git a/module/custom/js/configurescrum.js b/module/custom/js/configurescrum.js index 8e0742888e..ff6b6463fd 100644 --- a/module/custom/js/configurescrum.js +++ b/module/custom/js/configurescrum.js @@ -11,5 +11,16 @@ $(function() $('#URSRName').removeClass('hidden'); } }); -}) + $('[name^="URSRCustom"]').change(function() + { + if($(this).attr('checked')) + { + $('#customURSR').removeClass('hidden'); + } + else + { + $('#customURSR').addClass('hidden'); + } + }) +}) diff --git a/module/custom/js/configurewaterfall.js b/module/custom/js/configurewaterfall.js index 8e0742888e..c68b418bd9 100644 --- a/module/custom/js/configurewaterfall.js +++ b/module/custom/js/configurewaterfall.js @@ -11,5 +11,17 @@ $(function() $('#URSRName').removeClass('hidden'); } }); + + $('[name^="URSRCustom"]').change(function() + { + if($(this).attr('checked')) + { + $('#customURSR').removeClass('hidden'); + } + else + { + $('#customURSR').addClass('hidden'); + } + }) }) diff --git a/module/custom/lang/de.php b/module/custom/lang/de.php index 7930c84e47..d260d0e377 100644 --- a/module/custom/lang/de.php +++ b/module/custom/lang/de.php @@ -154,6 +154,7 @@ $lang->custom->notice->conceptResult = 'According to your preference, %s $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->readOnlyOfProject = 'If Change Forbidden, any change on tasks, builds, efforts and stories of the closed project is also forbidden.'; +$lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!'; $lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Homepage. Do you want to go to Product Homepage?"; $lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Homepage. Do you want to go to Project Homepage?"; @@ -221,11 +222,30 @@ $lang->custom->conceptOptions->hourPoint['2'] = 'Code Line'; $lang->custom->waterfall = new stdclass(); $lang->custom->waterfall->URAndSR = 'Are requirements and stories concepts enabled?'; -$lang->custom->waterfall->URSRName = 'A conceptual definition of requirements and stories?'; +$lang->custom->waterfall->URSRName = 'Combination of default requirements concepts'; $lang->custom->scrum = new stdclass(); -$lang->custom->scrum->URAndSR = 'Is it going to be epic?'; -$lang->custom->scrum->URSRName = 'A conceptual definition of requirements?'; +$lang->custom->scrum->setConcept = 'Set concept'; +$lang->custom->scrum->URAndSR = 'Are epic concept enabled?'; +$lang->custom->scrum->URSRName = 'A conceptual definition of epic?'; + +$lang->custom->URList[1] = 'User Requirement'; +$lang->custom->URList[2] = 'UR'; +$lang->custom->URList[3] = 'Requirement'; +$lang->custom->URList[4] = 'Epic'; + +$lang->custom->SRList[1] = 'Software Requirement'; +$lang->custom->SRList[2] = 'SR'; +$lang->custom->SRList[3] = 'Story'; +$lang->custom->SRList[4] = 'Story'; + +$lang->custom->URSRList[1] = 'User Requirement/Software Requirement'; +$lang->custom->URSRList[2] = 'UR/SR'; +$lang->custom->URSRList[3] = 'Requirement/Story'; +$lang->custom->URSRList[4] = 'Epic/Story'; + +$lang->custom->URTips = 'Type like:Requirement'; +$lang->custom->SRTips = 'Type like:Story'; $lang->custom->waterfallOptions = new stdclass(); $lang->custom->waterfallOptions->URAndSR = array(); diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 7bae1a8219..a28d447810 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -154,6 +154,7 @@ $lang->custom->notice->conceptResult = 'According to your preference, %s $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->readOnlyOfProject = 'If Change Forbidden, any change on tasks, builds, efforts and stories of the closed project is also forbidden.'; +$lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!'; $lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Home. Do you want to go to Product Home?"; $lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Home. Do you want to go to Project Home?"; @@ -205,8 +206,8 @@ $lang->custom->moduleName['project'] = $lang->projectCommon; $lang->custom->conceptQuestions['overview'] = "1. Which combination of management fits your company?"; $lang->custom->conceptQuestions['story'] = "2. Do you use the concept of requirement or user story in your company?"; -$lang->custom->conceptQuestions['requirementpoint'] = "2. Do you use hours or function points to make estimations in your company?"; -$lang->custom->conceptQuestions['storypoint'] = "2. Do you use hours or story points to make estimations in your company?"; +$lang->custom->conceptQuestions['requirementpoint'] = "3. Do you use hours or function points to make estimations in your company?"; +$lang->custom->conceptQuestions['storypoint'] = "3. Do you use hours or story points to make estimations in your company?"; $lang->custom->conceptOptions = new stdclass; @@ -220,12 +221,31 @@ $lang->custom->conceptOptions->hourPoint['1'] = 'Function Ponit'; $lang->custom->conceptOptions->hourPoint['2'] = 'Code Line'; $lang->custom->waterfall = new stdclass(); -$lang->custom->waterfall->URAndSR = 'Are requirements and stories concepts enabled?'; -$lang->custom->waterfall->URSRName = 'A conceptual definition of requirements and stories?'; +$lang->custom->waterfall->URAndSR = 'Are requirements and stories concepts enabled'; +$lang->custom->waterfall->URSRName = 'Combination of default requirements concepts'; $lang->custom->scrum = new stdclass(); -$lang->custom->scrum->URAndSR = 'Are epic concept enabled?'; -$lang->custom->scrum->URSRName = 'A conceptual definition of epic?'; +$lang->custom->scrum->setConcept = 'Set concept'; +$lang->custom->scrum->URAndSR = 'Are epic concept enabled?'; +$lang->custom->scrum->URSRName = 'A conceptual definition of epic?'; + +$lang->custom->URList[1] = 'User Requirement'; +$lang->custom->URList[2] = 'UR'; +$lang->custom->URList[3] = 'Requirement'; +$lang->custom->URList[4] = 'Epic'; + +$lang->custom->SRList[1] = 'Software Requirement'; +$lang->custom->SRList[2] = 'SR'; +$lang->custom->SRList[3] = 'Story'; +$lang->custom->SRList[4] = 'Story'; + +$lang->custom->URSRList[1] = 'User Requirement/Software Requirement'; +$lang->custom->URSRList[2] = 'UR/SR'; +$lang->custom->URSRList[3] = 'Requirement/Story'; +$lang->custom->URSRList[4] = 'Epic/Story'; + +$lang->custom->URTips = 'Type like:Requirement'; +$lang->custom->SRTips = 'Type like:Story'; $lang->custom->waterfallOptions = new stdclass(); $lang->custom->waterfallOptions->URAndSR = array(); diff --git a/module/custom/lang/fr.php b/module/custom/lang/fr.php index 117c60877e..c42e9ad4f9 100644 --- a/module/custom/lang/fr.php +++ b/module/custom/lang/fr.php @@ -154,6 +154,7 @@ $lang->custom->notice->conceptResult = 'Selon votre préférence, %s-%s $lang->custom->notice->conceptPath = 'Allez à Admin -> Custom -> Concept pour le paramétrer.'; $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->readOnlyOfProject = 'If Change Forbidden, any change on tasks, builds, efforts and stories of the closed project is also forbidden.'; +$lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!'; $lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ possède une page d'accueil. Voulez-vous consulter la page d'accueil du produit ?"; $lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ possède une page d'accueil. Voulez-vous consulter la page d'accueil du produit ?"; @@ -224,8 +225,27 @@ $lang->custom->waterfall->URAndSR = 'Are requirements and stories concepts enab $lang->custom->waterfall->URSRName = 'A conceptual definition of requirements and stories?'; $lang->custom->scrum = new stdclass(); -$lang->custom->scrum->URAndSR = 'Is it going to be epic?'; -$lang->custom->scrum->URSRName = 'A conceptual definition of requirements?'; +$lang->custom->scrum->setConcept = 'Set concept'; +$lang->custom->scrum->URAndSR = 'Is it going to be epic?'; +$lang->custom->scrum->URSRName = 'A conceptual definition of requirements?'; + +$lang->custom->URList[1] = 'User Requirement'; +$lang->custom->URList[2] = 'UR'; +$lang->custom->URList[3] = 'Requirement'; +$lang->custom->URList[4] = 'Epic'; + +$lang->custom->SRList[1] = 'Software Requirement'; +$lang->custom->SRList[2] = 'SR'; +$lang->custom->SRList[3] = 'Story'; +$lang->custom->SRList[4] = 'Story'; + +$lang->custom->URSRList[1] = 'User Requirement/Software Requirement'; +$lang->custom->URSRList[2] = 'UR/SR'; +$lang->custom->URSRList[3] = 'Requirement/Story'; +$lang->custom->URSRList[4] = 'Epic/Story'; + +$lang->custom->URTips = 'Type like:Requirement'; +$lang->custom->SRTips = 'Type like:Story'; $lang->custom->waterfallOptions = new stdclass(); $lang->custom->waterfallOptions->URAndSR = array(); diff --git a/module/custom/lang/vi.php b/module/custom/lang/vi.php index dc0f3aab4f..396f44ad99 100644 --- a/module/custom/lang/vi.php +++ b/module/custom/lang/vi.php @@ -154,6 +154,7 @@ $lang->custom->notice->conceptResult = 'According to your preference, %s $lang->custom->notice->conceptPath = 'Vào Quản trị -> Tùy biến -> Mô hình để thiết lập nó.'; $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->readOnlyOfProject = 'If Change Forbidden, any change on tasks, builds, efforts and stories of the closed project is also forbidden.'; +$lang->custom->notice->URSREmpty = 'Custom requirement name can not be empty!'; $lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ đã có trang Sản phẩm. Bạn có muốn tới trang Sản phẩm?"; $lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Home. Bạn có muốn go to Project Home?"; @@ -224,9 +225,28 @@ $lang->custom->waterfall->URAndSR = 'Are requirements and stories concepts enab $lang->custom->waterfall->URSRName = 'A conceptual definition of requirements and stories?'; $lang->custom->scrum = new stdclass(); +$lang->custom->scrum->setConcept = 'Set concept'; $lang->custom->scrum->URAndSR = 'Is it going to be epic?'; $lang->custom->scrum->URSRName = 'A conceptual definition of requirements?'; +$lang->custom->URList[1] = 'User Requirement'; +$lang->custom->URList[2] = 'UR'; +$lang->custom->URList[3] = 'Requirement'; +$lang->custom->URList[4] = 'Epic'; + +$lang->custom->SRList[1] = 'Software Requirement'; +$lang->custom->SRList[2] = 'SR'; +$lang->custom->SRList[3] = 'Story'; +$lang->custom->SRList[4] = 'Story'; + +$lang->custom->URSRList[1] = 'User Requirement/Software Requirement'; +$lang->custom->URSRList[2] = 'UR/SR'; +$lang->custom->URSRList[3] = 'Requirement/Story'; +$lang->custom->URSRList[4] = 'Epic/Story'; + +$lang->custom->URTips = 'Type like:Requirement'; +$lang->custom->SRTips = 'Type like:Story'; + $lang->custom->waterfallOptions = new stdclass(); $lang->custom->waterfallOptions->URAndSR = array(); $lang->custom->waterfallOptions->URAndSR[0] = 'No'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 8973bce94c..b06e07ab56 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -154,6 +154,7 @@ $lang->custom->notice->conceptResult = '我们已经根据您的 $lang->custom->notice->conceptPath = '您可以在:后台 -> 自定义 -> 流程页面修改。'; $lang->custom->notice->readOnlyOfProduct = '禁止修改后,已关闭' . $lang->productCommon . '下的' . $lang->storyCommon . '、Bug、用例、日志、发布、计划都禁止修改。'; $lang->custom->notice->readOnlyOfProject = '禁止修改后,已关闭' . $lang->projectCommon . '下的任务、版本、日志以及关联需求都禁止修改。'; +$lang->custom->notice->URSREmpty = '自定义需求名称不能为空!'; $lang->custom->notice->indexPage['product'] = "从8.2版本起增加了产品主页视图,是否默认进入产品主页?"; $lang->custom->notice->indexPage['project'] = "从8.2版本起增加了项目主页视图,是否默认进入项目主页?"; @@ -220,12 +221,31 @@ $lang->custom->conceptOptions->hourPoint['1'] = '功能点'; $lang->custom->conceptOptions->hourPoint['2'] = '代码行'; $lang->custom->waterfall = new stdclass(); -$lang->custom->waterfall->URAndSR = '是否启用用户需求概念?'; -$lang->custom->waterfall->URSRName = '用户需求和软件需求的概念定义?'; +$lang->custom->waterfall->URAndSR = '是否启用用户需求概念'; +$lang->custom->waterfall->URSRName = '默认需求概念组合'; $lang->custom->scrum = new stdclass(); -$lang->custom->scrum->URAndSR = '是否启用epic概念?'; -$lang->custom->scrum->URSRName = '需求的概念定义?'; +$lang->custom->scrum->setConcept = '设置项目概念'; +$lang->custom->scrum->URAndSR = '是否启用epic概念?'; +$lang->custom->scrum->URSRName = '需求的概念定义?'; + +$lang->custom->URList[1] = '用户需求'; +$lang->custom->URList[2] = '用需'; +$lang->custom->URList[3] = '需求'; +$lang->custom->URList[4] = '史诗'; + +$lang->custom->SRList[1] = '软件需求'; +$lang->custom->SRList[2] = '软需'; +$lang->custom->SRList[3] = '故事'; +$lang->custom->SRList[4] = '故事'; + +$lang->custom->URSRList[1] = '用户需求/软件需求'; +$lang->custom->URSRList[2] = '用需/软需'; +$lang->custom->URSRList[3] = '需求/故事'; +$lang->custom->URSRList[4] = '史诗/故事'; + +$lang->custom->URTips = '请输入如:用户需求'; +$lang->custom->SRTips = '请输入如:软件需求'; $lang->custom->waterfallOptions = new stdclass(); $lang->custom->waterfallOptions->URAndSR = array(); diff --git a/module/custom/model.php b/module/custom/model.php index 359927fa5d..377264e00a 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -587,16 +587,38 @@ class customModel extends model public function setURAndSR() { $data = fixer::input('post')->get(); + $lang = $this->app->getClientLang(); $this->loadModel('setting')->setItem("system.custom.URAndSR", $data->URAndSR); if($data->URAndSR) { - $clientLang = $this->app->getClientLang(); - $URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array(); - $URSRName['URCommon'][$clientLang] = $data->URCommon[$clientLang]; - $URSRName['SRCommon'][$clientLang] = $data->SRCommon[$clientLang]; - $this->setting->setItem("system.custom.common.URSRName", json_encode($URSRName)); + /* If has custom UR and SR name. */ + $newKey = ''; + if(isset($data->URSRCustom)) + { + if(!$data->URName || !$data->SRName) return false; + + $newKey = max(array_keys($this->lang->custom->URSRList)) + 1; + $URSRName = $data->URName . '/' . $data->SRName; + + /* Delete old lang data, and add new. */ + $this->lang->custom->URSRList[$newKey] = $URSRName; + $this->lang->custom->URList[$newKey] = $data->URName; + $this->lang->custom->SRList[$newKey] = $data->SRName; + $this->deleteItems("lang=$lang&module=custom§ion=URSRList"); + $this->deleteItems("lang=$lang&module=custom§ion=URList"); + $this->deleteItems("lang=$lang&module=custom§ion=SRList"); + + foreach($this->lang->custom->URSRList as $key => $value) $this->setItem("$lang.custom.URSRList.{$key}.1", $value); + foreach($this->lang->custom->URList as $key => $value) $this->setItem("$lang.custom.URList.{$key}.1", $value); + foreach($this->lang->custom->SRList as $key => $value) $this->setItem("$lang.custom.SRList.{$key}.1", $value); + } + + $URSRName = $newKey ? $newKey : $data->URSRCommon; + $this->setting->setItem("system.custom.URSRName", $URSRName); } + + return true; } /** diff --git a/module/custom/view/configurescrum.html.php b/module/custom/view/configurescrum.html.php index c634966a20..19a0774e41 100644 --- a/module/custom/view/configurescrum.html.php +++ b/module/custom/view/configurescrum.html.php @@ -39,28 +39,31 @@ EOT;