From 01b60cf80c6fb695ef41c52bd0c94cda8c72f5dd Mon Sep 17 00:00:00 2001 From: sunguangming Date: Mon, 13 May 2024 13:14:46 +0800 Subject: [PATCH] * Remove unused code. --- module/story/model.php | 76 ------------------------------------------ 1 file changed, 76 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index a967285d3d..0782c9e312 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3694,82 +3694,6 @@ class storyModel extends model return true; } - /** - * Build operate menu. - * - * @param object $story - * @param string $type - * @param object $execution - * @access public - * @return string - */ - public function buildOperateMenu(object $story, string $type = 'view', object|null $execution = null): array - { - $mainMenu = array(); - $dropMenus = array(); - $suffixMenu = array(); - $isInModal = isInModal(); - $params = "storyID=$story->id"; - - if($type == 'view') - { - $mainMenu[] = commonModel::buildActionItem($story->type, 'change', $params, $story, array('icon' => 'alter', 'text' => $this->lang->story->change, 'data-app' => $this->app->tab)); - if(str_contains('draft,changing', $story->status)) $mainMenu[] = commonModel::buildActionItem($story->type, 'submitReview', $params, $story, array('icon' => 'confirm', 'text' => $this->lang->story->submitReview, 'data-toggle' => 'modal')); - - $title = $story->status == 'changing' ? $this->lang->story->recallChange : $this->lang->story->recall; - $mainMenu[] = commonModel::buildActionItem($story->type, 'recall', $params . "&from=view&confirm=no", $story, array('icon' => 'undo', 'text' => $title, 'class' => 'ajax-submit', 'data-app' => $this->app->tab)); - $mainMenu[] = commonModel::buildActionItem($story->type, 'review', $params . "&from={$this->app->tab}", $story, array('icon' => 'search', 'text' => $this->lang->story->review, 'data-app' => $this->app->tab)); - - $executionID = empty($execution) ? 0 : $execution->id; - if(!helper::isAjaxRequest('modal') && $this->config->vision != 'lite') - { - $maxGradeGroup = $this->getMaxGradeGroup(); - $story->hasOtherTypeChild = $this->dao->select('id')->from(TABLE_STORY)->where('parent')->eq($story->id)->andWhere('type')->ne($story->type)->andWhere('deleted')->eq('0')->fetch('id'); - $story->hasSameTypeChild = $this->dao->select('id')->from(TABLE_STORY)->where('parent')->eq($story->id)->andWhere('type')->eq($story->type)->andWhere('deleted')->eq('0')->fetch('id'); - - $canBatchCreateStory = common::hasPriv($story->type, 'batchcreate') && $this->isClickable($story, 'batchcreate') && $story->grade < $maxGradeGroup[$story->type] && empty($story->hasOtherTypeChild); - - if($canBatchCreateStory) - { - $mainMenu[] = commonModel::buildActionItem($story->type, 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&$params&executionID=$executionID&plan=0", $story, array('icon' => 'tree', 'text' => $this->lang->story->subdivide, 'data-app' => $this->app->tab)); - } - elseif($story->type == 'epic' && common::hasPriv('requirement', 'batchCreate') && empty($story->hasSameTypeChild) && !($this->config->epic->gradeRule == 'stepwise' && $story->grade < $maxGradeGroup['epic'])) - { - $mainMenu[] = commonModel::buildActionItem('requirement', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&$params&executionID=$executionID&plan=0", $story, array('icon' => 'tree', 'text' => $this->lang->story->subdivide, 'data-app' => $this->app->tab)); - } - elseif($story->type == 'requirement' && common::hasPriv('story', 'batchCreate') && empty($story->hasSameTypeChild) && !($this->config->requirement->gradeRule == 'stepwise' && $story->grade < $maxGradeGroup['requirement'])) - { - $mainMenu[] = commonModel::buildActionItem('story', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&$params&executionID=$executionID&plan=0", $story, array('icon' => 'tree', 'text' => $this->lang->story->subdivide, 'data-app' => $this->app->tab)); - } - } - - $mainMenu[] = commonModel::buildActionItem($story->type, 'assignTo', $params . "&kanbanGroup=default&from=", $story, array('icon' => 'hand-right', 'text' => $this->lang->story->assignTo, 'data-toggle' => 'modal')); - $mainMenu[] = commonModel::buildActionItem($story->type, 'close', $params . "&from=", $story, array('icon' => 'off', 'text' => $this->lang->story->close, 'data-toggle' => 'modal')); - $mainMenu[] = commonModel::buildActionItem($story->type, 'activate', $params, $story, array('icon' => 'magic', 'text' => $this->lang->story->activate, 'data-toggle' => 'modal')); - - $disabledFeatures = ",{$this->config->disabledFeatures},"; - if(in_array($this->config->edition, array('max', 'ipd')) && $this->app->tab == 'project' && common::hasPriv($story->type, 'importToLib') && strpos($disabledFeatures, ',assetlibStorylib,') === false && strpos($disabledFeatures, ',assetlib,') === false) - { - $mainMenu[] = array('url' => '#importToLib', 'icon' => 'assets', 'text' => $this->lang->story->importToLib, 'data-toggle' => 'modal'); - } - - /* Print testcate actions. */ - if($this->config->vision != 'lite' && $story->parent >= 0 && $story->type != 'requirement' && (common::hasPriv('testcase', 'create', $story) || common::hasPriv('testcase', 'batchCreate', $story))) - { - $this->app->loadLang('testcase'); - $mainMenu[] = array('url' => '#caseActions', 'text' => $this->lang->testcase->common, 'data-toggle' => 'dropdown', 'data-placement' => 'top-end', 'caret' => 'up'); - $dropMenus['caseActions'][] = commonModel::buildActionItem('testcase', 'create', "productID=$story->product&branch=$story->branch&moduleID=0&from=¶m=0&$params", $story, array('text' => $this->lang->testcase->create, 'data-toggle' => 'modal', 'data-size' => 'lg')); - $dropMenus['caseActions'][] = commonModel::buildActionItem('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=0&$params", null, array('text' => $this->lang->testcase->batchCreate, 'data-toggle' => 'modal', 'data-size' => 'lg')); - } - - if(!$isInModal) $suffixMenu[] = commonModel::buildActionItem($story->type, 'edit', $params . "&kanbanGroup=default", $story, array('icon' => 'edit', 'data-app' => $this->app->tab)); - if(!$isInModal) $suffixMenu[] = commonModel::buildActionItem($story->type, 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&{$params}&executionID=0&bugID=0&planID=0&todoID=0&extra=", $story, array('icon' => 'copy', 'data-app' => $this->app->tab)); - if(common::hasPriv($story->type, 'delete')) $suffixMenu[] = array('url' => helper::createLink($story->type, 'delete', $params), 'class' => 'ajax-submit', 'icon' => 'trash'); - } - - return array('mainMenu' => array_values(array_filter($mainMenu)), 'suffixMenu' => array_values(array_filter($suffixMenu)), 'dropMenus' => $dropMenus); - } - /** * Merge story reviewers. *