From 5cb9787c6acfa9b1be005aeb60967bbc1bb7369a Mon Sep 17 00:00:00 2001 From: sunguangming Date: Mon, 19 Feb 2024 17:15:56 +0800 Subject: [PATCH] * Add epic. --- module/common/lang/menu.php | 2 +- module/epic/config.php | 15 ++ module/epic/control.php | 330 ++++++++++++++++++++++++++++++++++ module/epic/lang/de.php | 11 ++ module/epic/lang/en.php | 11 ++ module/epic/lang/fr.php | 11 ++ module/epic/lang/zh-cn.php | 11 ++ module/epic/model.php | 5 + module/product/control.php | 1 + module/product/model.php | 5 +- module/requirement/config.php | 2 + module/story/model.php | 80 ++++----- 12 files changed, 440 insertions(+), 44 deletions(-) create mode 100644 module/epic/config.php create mode 100644 module/epic/control.php create mode 100644 module/epic/lang/de.php create mode 100644 module/epic/lang/en.php create mode 100644 module/epic/lang/fr.php create mode 100644 module/epic/lang/zh-cn.php create mode 100644 module/epic/model.php diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 652b6c9ca2..9c6b4d4568 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -180,7 +180,7 @@ $lang->product->homeMenu->kanban = array('link' => "{$lang->product->kanban}|pro $lang->product->menu = new stdclass(); $lang->product->menu->dashboard = array('link' => "{$lang->dashboard}|product|dashboard|productID=%s"); -$lang->product->menu->epic = array('link' => "{$lang->epic->common}|epic|browse|productID=%s"); +$lang->product->menu->epic = array('link' => "{$lang->epic->common}|product|browse|productID=%s&branch=&browseType=unclosed¶m=0&storyType=epic"); $lang->product->menu->requirement = array('link' => "{$lang->URCommon}|product|browse|productID=%s&branch=&browseType=unclosed¶m=0&storyType=requirement", 'alias' => 'batchedit', 'subModule' => 'story'); $lang->product->menu->story = array('link' => "$lang->SRCommon|product|browse|productID=%s", 'alias' => 'batchedit', 'subModule' => 'story', 'exclude' => (isset($_GET['storyType']) ? ($_GET['storyType'] == 'requirement' ? 'browse,story-report,story-create,story-batchcreate' : '') : '') . ',batchtotask'); $lang->product->menu->plan = array('link' => "{$lang->productplan->shortCommon}|productplan|browse|productID=%s", 'subModule' => 'productplan,bug'); diff --git a/module/epic/config.php b/module/epic/config.php new file mode 100644 index 0000000000..77c1775fe7 --- /dev/null +++ b/module/epic/config.php @@ -0,0 +1,15 @@ +epic = new stdclass(); +$config->epic->create = new stdclass(); +$config->epic->edit = new stdclass(); +$config->epic->change = new stdclass(); +$config->epic->close = new stdclass(); +$config->epic->review = new stdclass(); + +$config->epic->create->requiredFields = 'title'; +$config->epic->edit->requiredFields = 'title'; +$config->epic->change->requiredFields = 'title'; +$config->epic->close->requiredFields = 'closedReason'; +$config->epic->review->requiredFields = ''; + +$config->epic->needReview = 1; diff --git a/module/epic/control.php b/module/epic/control.php new file mode 100644 index 0000000000..69623a3061 --- /dev/null +++ b/module/epic/control.php @@ -0,0 +1,330 @@ +fetch('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID&storyID=$storyID&objectID=$objectID&bugID=$bugID&planID=$planID&todoID=$todoID&extra=$extra&storyType=epic"); + } + + /** + * Create a batch stories. + * + * @param int $productID + * @param string $branch + * @param int $moduleID + * @param int $storyID + * @param int $executionID projectID|executionID + * @param int $plan + * @param string $storyType + * @param string $extra for example feedbackID=0 + * @access public + * @return void + */ + public function batchCreate(int $productID = 0, string $branch = '', int $moduleID = 0, int $storyID = 0, int $executionID = 0, int $plan = 0, string $storyType = 'epic', string $extra = '') + { + echo $this->fetch('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID&storyID=$storyID&executionID=$executionID&plan=$plan&storyType=epic&extra=$extra"); + } + + /** + * View a epic. + * + * @param int $storyID + * @param int $version + * @param int $param executionID|projectID + * @param string $storyType + * @access public + * @return void + */ + public function view(int $storyID, int $version = 0, int $param = 0) + { + echo $this->fetch('story', 'view', "storyID=$storyID&version=$version¶m=$param&storyType=epic"); + } + + /** + * Edit a epic. + * + * @param int $storyID + * @param string $kanbanGroup + * @access public + * @return void + */ + public function edit(int $storyID, string $kanbanGroup = 'default') + { + echo $this->fetch('story', 'edit', "storyID=$storyID&kanbanGroup=$kanbanGroup&storyType=epic"); + } + + /** + * Batch edit epic. + * + * @param int $productID + * @param int $executionID + * @param int $branch + * @param string $storyType + * @param string $from + * @access public + * @return void + */ + public function batchEdit(int $productID = 0, int $executionID = 0, string $branch = '', string $storyType = 'epic', string $from = '') + { + echo $this->fetch('story', 'batchEdit', "productID=$productID&executionID=$executionID&branch=$branch&storyType=epic&from=$from"); + } + + /** + * 用户需求详情页,关联软件需求,将用户需求关联到软件需求。 + * Link story and epic. + * + * @param int $storyID + * @param string $type linkStories|linkRelateUR|linkRelateSR + * @param int $linkedStoryID + * @param string $browseType ''|bySearch + * @param int $queryID + * @access public + * @return void + */ + public function linkStory(int $storyID, string $type = 'linkStories', int $linkedStoryID = 0, string $browseType = '', int $queryID = 0) + { + echo $this->fetch('story', 'linkStory', "storyID=$storyID&type=$type&linkedStoryID=$linkedStoryID&browseType=$browseType&queryID=$queryID&storyType=epic"); + } + + /** + * 导出需求数据。 + * Get the data of the requiremens to export. + * + * @param int $productID + * @param string $orderBy + * @param int $executionID + * @param string $browseType + * @access public + * @return void + */ + public function export(int $productID, string $orderBy, int $executionID = 0, string $browseType = '') + { + echo $this->fetch('story', 'export', "productID=$productID&orderBy=$orderBy&executionID=$executionID&browseType=$browseType&storyType=epic"); + } + + /** + * Delete a epic. + * + * @param int $storyID + * @param string $confirm yes|no + * @param string $from taskkanban + * @access public + * @return void + */ + public function delete(int $storyID, string $confirm = 'no', string $from = '') + { + echo $this->fetch('story', 'delete', "storyID=$storyID&confirm=$confirm&from=$from&storyType=epic"); + } + + /** + * Change a epic. + * + * @param int $storyID + * @param string $from + * @access public + * @return void + */ + public function change(int $storyID, string $from = '') + { + echo $this->fetch('story', 'change', "storyID=$storyID&from=$from&storyType=epic"); + } + + /** + * Review a epic. + * + * @param int $storyID + * @param string $from product|project + * @access public + * @return void + */ + public function review(int $storyID, string $from = 'product') + { + echo $this->fetch('story', 'review', "storyID=$storyID&from=$from&storyType=epic"); + } + + /** + * Submit review. + * + * @param int $storyID + * @access public + * @return void + */ + public function submitReview(int $storyID) + { + echo $this->fetch('story', 'submitReview', "storyID=$storyID&storyType=epic"); + } + + /** + * Batch review epics. + * + * @param string $result + * @param string $reason + * @access public + * @return void + */ + public function batchReview(string $result, string $reason = '') + { + echo $this->fetch('story', 'batchReview', "result=$result&reason=$reason&storyType=epic"); + } + + /** + * Recall the epic review or epic change. + * + * @param int $storyID + * @param string $from list + * @param string $confirm no|yes + * @access public + * @return void + */ + public function recall(int $storyID, string $from = 'list', string $confirm = 'no') + { + echo $this->fetch('story', 'recall', "storyID=$storyID&from=$from&confirm=$confirm&storyType=epic"); + } + + /** + * 需求的指派给页面。 + * Assign the epic to a user. + * + * @param int $storyID + * @access public + * @return void + */ + public function assignTo(int $storyID) + { + echo $this->fetch('story', 'assignTo', "storyID=$storyID"); + } + + /** + * 关闭需求。 + * Close the epic. + * + * @param int $storyID + * @param string $from taskkanban + * @access public + * @return void + */ + public function close(int $storyID, string $from = '') + { + echo $this->fetch('story', 'close', "storyID=$storyID&from=$from&storyType=epic"); + } + + /** + * 批量关闭需求。 + * Batch close the requiremens. + * + * @param int $productID + * @param int $executionID + * @param string $storyType + * @param string $from contribute|work + * @access public + * @return void + */ + public function batchClose(int $productID = 0, int $executionID = 0, string $storyType = 'epic', string $from = '') + { + echo $this->fetch('story', 'batchClose', "productID=$productID&executionID=$executionID&storyType=epic&from=$from"); + } + + /** + * 激活需求。 + * Activate a epic. + * + * @param int $storyID + * @access public + * @return void + */ + public function activate(int $storyID) + { + echo $this->fetch('story', 'activate', "storyID=$storyID&storyType=epic"); + } + + /** + * 查看需求的报告。 + * The report page. + * + * @param int $productID + * @param int $branchID + * @param string $storyType + * @param string $browseType + * @param int $moduleID + * @param string $chartType + * @param int $projectID + * @access public + * @return void + */ + public function report(int $productID, int $branchID, string $storyType = 'epic', string $browseType = 'unclosed', int $moduleID = 0, string $chartType = 'pie', int $projectID = 0) + { + echo $this->fetch('story', 'report', "productID=$productID&branchID=$branchID&storyType=epic&browseType=$browseType&moduleID=$moduleID&chartType=$chartType&projectID=$projectID"); + } + + /** + * Batch change branch. + * + * @param int $branchID + * @param string $confirm yes|no + * @param string $storyIdList + * @access public + * @return void + */ + public function batchChangeBranch(int $branchID, string $confirm = '', string $storyIdList = '') + { + echo $this->fetch('story', 'batchChangeBranch', "branchID=$branchID&confirm=$confirm&storyIdList=$storyIdList&storyType=epic"); + } + + /** + * Batch assign to. + * + * @param string $storyType story|epic + * @access public + * @return void + */ + public function batchAssignTo(string $storyType = 'epic', string $assignedTo = '') + { + echo $this->fetch('story', 'batchAssignTo', "storyType=epic&assignedTo=$assignedTo"); + } + + /** + * Batch change the module of story. + * + * @param int $moduleID + * @access public + * @return void + */ + public function batchChangeModule(int $moduleID) + { + echo $this->fetch('story', 'batchChangeModule', "moduleID=$moduleID&storyType=epic"); + } + + /** + * 关联用户需求。 + * Link related epics. + * + * @param int $storyID + * @param string $browseType + * @param string $excludeStories + * @param int $param + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ + public function linkepics(int $storyID, string $browseType = '', string $excludeStories = '', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1) + { + echo $this->fetch('story', 'linkepics', "storyID=$storyID&browseType=$browseType&excludeStories=$excludeStories¶m=$param&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"); + } +} diff --git a/module/epic/lang/de.php b/module/epic/lang/de.php new file mode 100644 index 0000000000..ad39271d70 --- /dev/null +++ b/module/epic/lang/de.php @@ -0,0 +1,11 @@ +loadLang('story'); +$lang->requirement = clone $lang->story; +$lang->requirement->common = $lang->URCommon; + +foreach($lang->requirement as $key => $value) +{ + if(!is_string($value)) continue; + if(strpos($value, $lang->SRCommon) !== false) $lang->requirement->$key = str_replace($lang->SRCommon, $lang->URCommon, $value); +} diff --git a/module/epic/lang/en.php b/module/epic/lang/en.php new file mode 100644 index 0000000000..ad39271d70 --- /dev/null +++ b/module/epic/lang/en.php @@ -0,0 +1,11 @@ +loadLang('story'); +$lang->requirement = clone $lang->story; +$lang->requirement->common = $lang->URCommon; + +foreach($lang->requirement as $key => $value) +{ + if(!is_string($value)) continue; + if(strpos($value, $lang->SRCommon) !== false) $lang->requirement->$key = str_replace($lang->SRCommon, $lang->URCommon, $value); +} diff --git a/module/epic/lang/fr.php b/module/epic/lang/fr.php new file mode 100644 index 0000000000..ad39271d70 --- /dev/null +++ b/module/epic/lang/fr.php @@ -0,0 +1,11 @@ +loadLang('story'); +$lang->requirement = clone $lang->story; +$lang->requirement->common = $lang->URCommon; + +foreach($lang->requirement as $key => $value) +{ + if(!is_string($value)) continue; + if(strpos($value, $lang->SRCommon) !== false) $lang->requirement->$key = str_replace($lang->SRCommon, $lang->URCommon, $value); +} diff --git a/module/epic/lang/zh-cn.php b/module/epic/lang/zh-cn.php new file mode 100644 index 0000000000..63bc23e39b --- /dev/null +++ b/module/epic/lang/zh-cn.php @@ -0,0 +1,11 @@ +loadLang('story'); +$lang->epic = clone $lang->story; +$lang->epic->common = '业务需求'; + +foreach($lang->epic as $key => $value) +{ + if(!is_string($value)) continue; + if(strpos($value, $lang->SRCommon) !== false) $lang->epic->$key = str_replace($lang->SRCommon, $lang->URCommon, $value); +} diff --git a/module/epic/model.php b/module/epic/model.php new file mode 100644 index 0000000000..31e8492ec2 --- /dev/null +++ b/module/epic/model.php @@ -0,0 +1,5 @@ +loadModel('requirement'); + $this->loadModel('epic'); $this->loadModel('tree'); $isProjectStory = $this->app->rawModule == 'projectstory'; $cookieOrderBy = $this->cookie->productStoryOrder ? $this->cookie->productStoryOrder : 'id_desc'; diff --git a/module/product/model.php b/module/product/model.php index 4e5074f423..a66327d4af 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -722,11 +722,12 @@ class productModel extends model $projectID = ($this->app->tab == 'project' && empty($projectID)) ? $this->session->project : $projectID; $searchConfig['params']['module']['values'] = $this->productTao->getModulesForSearchForm($productID, $products, $branch, $projectID); + $replacement = $storyType == 'requirement' ? $this->lang->URCommon : $this->lang->epic->common; + $this->lang->story->title = str_replace($this->lang->SRCommon, $replacement, $this->lang->story->title); + $this->lang->story->create = str_replace($this->lang->SRCommon, $replacement, $this->lang->story->create); if($storyType == 'requirement') { /* Change for requirement story title. */ - $this->lang->story->title = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->title); - $this->lang->story->create = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->create); $searchConfig['fields']['title'] = $this->lang->story->title; unset($searchConfig['fields']['plan']); unset($searchConfig['params']['plan']); diff --git a/module/requirement/config.php b/module/requirement/config.php index 7e4255108a..b7a68a9b4f 100644 --- a/module/requirement/config.php +++ b/module/requirement/config.php @@ -11,3 +11,5 @@ $config->requirement->edit->requiredFields = 'title'; $config->requirement->change->requiredFields = 'title'; $config->requirement->close->requiredFields = 'closedReason'; $config->requirement->review->requiredFields = ''; + +$config->requirement->needReview = 1; diff --git a/module/story/model.php b/module/story/model.php index 788222daab..10e992d8f0 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3753,50 +3753,48 @@ class storyModel extends model */ public function replaceURLang(string $type): void { - if($type != 'requirement') return; + $storyLang = $this->lang->story; + $SRCommon = $this->lang->SRCommon; + $replacement = $type == 'requirement' ? $this->lang->URCommon : $this->lang->epic->common; - $storyLang = $this->lang->story; - $SRCommon = $this->lang->SRCommon; - $URCommon = $this->lang->URCommon; + $storyLang->create = str_replace($SRCommon, $replacement, $storyLang->create); + $storyLang->changeAction = str_replace($SRCommon, $replacement, $storyLang->changeAction); + $storyLang->changed = str_replace($SRCommon, $replacement, $storyLang->changed); + $storyLang->assignAction = str_replace($SRCommon, $replacement, $storyLang->assignAction); + $storyLang->reviewAction = str_replace($SRCommon, $replacement, $storyLang->reviewAction); + $storyLang->subdivideAction = str_replace($SRCommon, $replacement, $storyLang->subdivideAction); + $storyLang->closeAction = str_replace($SRCommon, $replacement, $storyLang->closeAction); + $storyLang->activateAction = str_replace($SRCommon, $replacement, $storyLang->activateAction); + $storyLang->deleteAction = str_replace($SRCommon, $replacement, $storyLang->deleteAction); + $storyLang->view = str_replace($SRCommon, $replacement, $storyLang->view); + $storyLang->linkStory = str_replace($SRCommon, $replacement, $storyLang->linkStory); + $storyLang->exportAction = str_replace($SRCommon, $replacement, $storyLang->exportAction); + $storyLang->zeroCase = str_replace($SRCommon, $replacement, $storyLang->zeroCase); + $storyLang->zeroTask = str_replace($SRCommon, $replacement, $storyLang->zeroTask); + $storyLang->copyTitle = str_replace($SRCommon, $replacement, $storyLang->copyTitle); + $storyLang->common = str_replace($SRCommon, $replacement, $storyLang->common); + $storyLang->title = str_replace($SRCommon, $replacement, $storyLang->title); + $storyLang->spec = str_replace($SRCommon, $replacement, $storyLang->spec); + $storyLang->children = str_replace($SRCommon, $replacement, $storyLang->children); + $storyLang->linkStories = str_replace($SRCommon, $replacement, $storyLang->linkStories); + $storyLang->childStories = str_replace($SRCommon, $replacement, $storyLang->childStories); + $storyLang->duplicateStory = str_replace($SRCommon, $replacement, $storyLang->duplicateStory); + $storyLang->newStory = str_replace($SRCommon, $replacement, $storyLang->newStory); + $storyLang->copy = str_replace($SRCommon, $replacement, $storyLang->copy); + $storyLang->total = str_replace($SRCommon, $replacement, $storyLang->total); + $storyLang->released = str_replace($SRCommon, $replacement, $storyLang->released); + $storyLang->legendLifeTime = str_replace($SRCommon, $replacement, $storyLang->legendLifeTime); + $storyLang->legendLinkStories = str_replace($SRCommon, $replacement, $storyLang->legendLinkStories); + $storyLang->legendChildStories = str_replace($SRCommon, $replacement, $storyLang->legendChildStories); + $storyLang->legendSpec = str_replace($SRCommon, $replacement, $storyLang->legendSpec); + $storyLang->unlinkStory = str_replace($SRCommon, $replacement, $storyLang->unlinkStory); - $storyLang->create = str_replace($SRCommon, $URCommon, $storyLang->create); - $storyLang->changeAction = str_replace($SRCommon, $URCommon, $storyLang->changeAction); - $storyLang->changed = str_replace($SRCommon, $URCommon, $storyLang->changed); - $storyLang->assignAction = str_replace($SRCommon, $URCommon, $storyLang->assignAction); - $storyLang->reviewAction = str_replace($SRCommon, $URCommon, $storyLang->reviewAction); - $storyLang->subdivideAction = str_replace($SRCommon, $URCommon, $storyLang->subdivideAction); - $storyLang->closeAction = str_replace($SRCommon, $URCommon, $storyLang->closeAction); - $storyLang->activateAction = str_replace($SRCommon, $URCommon, $storyLang->activateAction); - $storyLang->deleteAction = str_replace($SRCommon, $URCommon, $storyLang->deleteAction); - $storyLang->view = str_replace($SRCommon, $URCommon, $storyLang->view); - $storyLang->linkStory = str_replace($SRCommon, $URCommon, $storyLang->linkStory); - $storyLang->exportAction = str_replace($SRCommon, $URCommon, $storyLang->exportAction); - $storyLang->zeroCase = str_replace($SRCommon, $URCommon, $storyLang->zeroCase); - $storyLang->zeroTask = str_replace($SRCommon, $URCommon, $storyLang->zeroTask); - $storyLang->copyTitle = str_replace($SRCommon, $URCommon, $storyLang->copyTitle); - $storyLang->common = str_replace($SRCommon, $URCommon, $storyLang->common); - $storyLang->title = str_replace($SRCommon, $URCommon, $storyLang->title); - $storyLang->spec = str_replace($SRCommon, $URCommon, $storyLang->spec); - $storyLang->children = str_replace($SRCommon, $URCommon, $storyLang->children); - $storyLang->linkStories = str_replace($SRCommon, $URCommon, $storyLang->linkStories); - $storyLang->childStories = str_replace($SRCommon, $URCommon, $storyLang->childStories); - $storyLang->duplicateStory = str_replace($SRCommon, $URCommon, $storyLang->duplicateStory); - $storyLang->newStory = str_replace($SRCommon, $URCommon, $storyLang->newStory); - $storyLang->copy = str_replace($SRCommon, $URCommon, $storyLang->copy); - $storyLang->total = str_replace($SRCommon, $URCommon, $storyLang->total); - $storyLang->released = str_replace($SRCommon, $URCommon, $storyLang->released); - $storyLang->legendLifeTime = str_replace($SRCommon, $URCommon, $storyLang->legendLifeTime); - $storyLang->legendLinkStories = str_replace($SRCommon, $URCommon, $storyLang->legendLinkStories); - $storyLang->legendChildStories = str_replace($SRCommon, $URCommon, $storyLang->legendChildStories); - $storyLang->legendSpec = str_replace($SRCommon, $URCommon, $storyLang->legendSpec); - $storyLang->unlinkStory = str_replace($SRCommon, $URCommon, $storyLang->unlinkStory); + $storyLang->notice->closed = str_replace($SRCommon, $replacement, $storyLang->notice->closed); + $storyLang->notice->reviewerNotEmpty = str_replace($SRCommon, $replacement, $storyLang->notice->reviewerNotEmpty); - $storyLang->notice->closed = str_replace($SRCommon, $URCommon, $storyLang->notice->closed); - $storyLang->notice->reviewerNotEmpty = str_replace($SRCommon, $URCommon, $storyLang->notice->reviewerNotEmpty); - - $storyLang->report->charts['storiesPerProduct'] = str_replace($SRCommon, $URCommon, $storyLang->report->charts['storiesPerProduct']); - $storyLang->report->charts['storiesPerModule'] = str_replace($SRCommon, $URCommon, $storyLang->report->charts['storiesPerModule']); - $storyLang->report->charts['storiesPerSource'] = str_replace($SRCommon, $URCommon, $storyLang->report->charts['storiesPerSource']); + $storyLang->report->charts['storiesPerProduct'] = str_replace($SRCommon, $replacement, $storyLang->report->charts['storiesPerProduct']); + $storyLang->report->charts['storiesPerModule'] = str_replace($SRCommon, $replacement, $storyLang->report->charts['storiesPerModule']); + $storyLang->report->charts['storiesPerSource'] = str_replace($SRCommon, $replacement, $storyLang->report->charts['storiesPerSource']); } /**