From 970763b0c5ecef28e42fa214e94b11e2d491dde3 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Mon, 1 Nov 2021 11:32:21 +0800 Subject: [PATCH] * Adjust create object in kanban. --- module/bug/control.php | 3 +++ module/execution/control.php | 18 +++++++++++++----- module/execution/js/kanban.js | 24 ++++++++++++------------ module/execution/view/kanban.html.php | 14 +++++++------- module/task/control.php | 4 ++-- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 9a34399db4..e53565f090 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -649,6 +649,9 @@ class bug extends control } setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); + + /* If link from no head then reload. */ + if(isonlybody()) die(js::reload('parent.parent')); die(js::locate($this->createLink('bug', 'browse', "productID={$productID}&branch=$branch&browseType=unclosed¶m=0&orderBy=id_desc"), 'parent')); } diff --git a/module/execution/control.php b/module/execution/control.php index 054bb6656f..195b1621b4 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1838,6 +1838,11 @@ class execution extends control $this->app->session->set('taskList', $uri, 'execution'); $this->app->session->set('bugList', $uri, 'qa'); + /* Load language. */ + $this->app->loadLang('story'); + $this->app->loadLang('task'); + $this->app->loadLang('bug'); + /* Compatibility IE8. */ if(strpos($this->server->http_user_agent, 'MSIE 8.0') !== false) header("X-UA-Compatible: IE=EmulateIE7"); @@ -2404,6 +2409,8 @@ class execution extends control { $this->execution->linkStory($objectID); if($object->type != 'project' and $object->project != 0) $this->execution->linkStory($object->project); + + if(isonlybody()) die(js::reload('parent')); die(js::locate($browseLink)); } @@ -3120,13 +3127,14 @@ class execution extends control /** * Import stories by plan. * - * @param int $executionID - * @param int $planID - * @param int $productID + * @param int $executionID + * @param int $planID + * @param int $productID + * @param string $fromMethod * @access public * @return void */ - public function importPlanStories($executionID, $planID, $productID = 0) + public function importPlanStories($executionID, $planID, $productID = 0, $fromMethod = 'story') { $planStories = $planProducts = array(); $planStory = $this->loadModel('story')->getPlanStories($planID); @@ -3161,7 +3169,7 @@ class execution extends control $param = "projectID=$executionID"; } if($count != 0) echo js::alert(sprintf($this->lang->execution->haveDraft, $count)) . js::locate($this->createLink($moduleName, 'story', $param)); - die(js::locate(helper::createLink($moduleName, 'story', $param), 'parent')); + die(js::locate(helper::createLink($moduleName, $fromMethod, $param))); } /** diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 6a08704864..b04ff9f886 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -491,8 +491,8 @@ function createColumnMenu(options) var kanbanID = options.kanban; var items = []; - if(priv.hasEditName) items.push({label: executionLang.editName, url: $.createLink('kanban', 'setColumn', 'col=' + col.columnID + '&executionID=' + executionID), className: 'iframe'}) - if(priv.hasSetWIP) items.push({label: executionLang.setWIP, url: $.createLink('kanban', 'setWIP', 'col=' + col.columnID + '&executionID=' + executionID), className: 'iframe'}) + if(priv.hasEditName) items.push({label: executionLang.editName, url: $.createLink('kanban', 'setColumn', 'col=' + col.columnID + '&executionID=' + executionID), className: 'iframe', attrs: {'data-width': '500px'}}) + if(priv.hasSetWIP) items.push({label: executionLang.setWIP, url: $.createLink('kanban', 'setWIP', 'col=' + col.columnID + '&executionID=' + executionID), className: 'iframe', attrs: {'data-width': '500px'}}) items.push({label: executionLang.sortColumn, items: ['按ID倒序', '按ID顺序'], className: 'iframe', onClick: handleSortColCards}) return items; } @@ -509,20 +509,20 @@ function createColumnCreateMenu(options) if(col.laneType == 'story') { - if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID)}); - if(priv.canBatchCreateStory) items.push({label: storyLang.batchCreate, url: $.createLink('story', 'batchcreate', 'productID=' + productID)}); - if(priv.canLinkStory) items.push({label: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID)}); + if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID, '', true), className: 'iframe'}); + if(priv.canBatchCreateStory) items.push({label: storyLang.batchCreate, url: $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID, '', true), className: 'iframe'}); + if(priv.canLinkStory) items.push({label: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '85%'}}); if(priv.canLinkStoryByPlane) items.push({label: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'attrs' : {'data-toggle': 'modal'}}); } else if(col.laneType == 'bug') { - if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID)}); - if(priv.canBatchCreateBug) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID)}); + if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID, '', true), className: 'iframe'}); + if(priv.canBatchCreateBug) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID, '', true), className: 'iframe'}); } else { - if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID)}); - if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID)}); + if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID, '', true), className: 'iframe'}); + if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID, '', true), className: 'iframe'}); } return items; } @@ -673,9 +673,9 @@ $(function() if(browseType == 'all' || browseType == 'task') createKanban('task', kanbanGroup.task, commonOptions); /* Init iframe modals */ - $(document).on('click', '.iframe', function(event) + $(document).on('click', '#kanbans .iframe,.contextmenu-menu .iframe', function(event) { - $(this).modalTrigger({show: true, width: '500px'}); + $(this).modalTrigger({show: true}); event.preventDefault(); }); @@ -706,7 +706,7 @@ $(function() var planID = $('#plan').val(); if(planID) { - parent.location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID); + location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID + '&productID=0&fromMethod=kanban'); } }) }); diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 39f516e3aa..9dc2a8709c 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -68,16 +68,16 @@ diff --git a/module/task/control.php b/module/task/control.php index 06a407a729..a6890a14d0 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -302,8 +302,8 @@ class task extends control /* Return task id list when call the API. */ if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $taskIDList)); - /* Locate the browser. */ - if(!empty($iframe)) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + /* If link from no head then reload. */ + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $taskLink)); }