From d8bb8a903e2446f7ff4ad0c81cedfc923a4e8bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Fri, 4 Mar 2022 14:34:01 +0800 Subject: [PATCH 01/10] * --- module/bug/control.php | 9 ++++++++- module/bug/view/view.html.php | 2 +- module/execution/control.php | 7 +++++++ module/execution/js/kanban.js | 4 +++- module/execution/view/kanban.html.php | 3 +++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 3844061cd9..ac65cb9af9 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1835,10 +1835,11 @@ class bug extends control * * @param int $bugID * @param string $confirm yes|no + * @param string $extra * @access public * @return void */ - public function delete($bugID, $confirm = 'no') + public function delete($bugID, $confirm = 'no', $extra = '') { $bug = $this->bug->getById($bugID); if($confirm == 'no') @@ -1864,6 +1865,12 @@ class bug extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); + if($this->app->tab == 'execution') + { + $execution = $this->loadModel('execution')->getByID($bug->execution); + if($execution->type == 'kanban') js::console.log(isonlybody() ? '1' : '2');//return print(js::reload(isonlybody() ? 'parent.parent' : 'parent')); + } + $locateLink = $this->session->bugList ? $this->session->bugList : inlink('browse', "productID={$bug->product}"); return print(js::locate($locateLink, 'parent')); } diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 62f68d60af..45efbbbd1f 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -117,7 +117,7 @@ { common::printIcon('bug', 'create', $copyParams, $bug, 'button', 'copy'); } - common::printIcon('bug', 'delete', $params, $bug, 'button', 'trash', 'hiddenwin'); + common::printIcon('bug', 'delete', $params, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody'); ?> diff --git a/module/execution/control.php b/module/execution/control.php index ec7ffd8eab..6a3f0e2e42 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2502,6 +2502,13 @@ class execution extends control return print(js::reload('parent')); } } + //public function deleteBug($bugID, $confirm = 'no') + //{ + // if($confirm == 'no') + // { + // return print(); + // } + //} /** * Manage products. diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 9e59198ef2..b255aeb619 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -548,7 +548,7 @@ function renderBugItem(item, $item, col) if(scaleSize <= 1) { var $actions = $item.find('.actions'); - if(!$actions.length && (priv.canEditBug || priv.canResolveBug || priv.canConfirmBug || priv.canCopyBug || priv.canToStoryBug)) + if(!$actions.length && (priv.canEditBug || priv.canResolveBug || priv.canConfirmBug || priv.canCopyBug || priv.canToStoryBug || priv.canDeleteBug)) { $actions = $([ '
', @@ -1089,6 +1089,7 @@ function createTaskMenu(options) if(priv.canActivateTask && (task.$col.type == 'developed' || task.$col.type == 'canceled' || task.$col.type == 'closed')) items.push({label: executionLang.activate, icon: 'magic', url: createLink('task', 'activate', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCreateTask) items.push({label: taskLang.copy, icon: 'copy', url: createLink('task', 'create', 'executionID=' + executionID + '&storyID=' + '0' + '&moduleID=' + '0' + '&taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCancelTask && (task.$col.type == 'wait' || task.$col.type == 'developing' || task.$col.type == 'pause')) items.push({label: taskLang.cancel, icon: 'cancel', url: createLink('task', 'cancel', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canDeleteTask) items.push({label: taskLang.delete, icon: 'trash', url: createLink('task', 'delete', 'bugID=' + bug.id, '', 'true'), attrs: {'target': 'hiddenwin'}}); return items; } @@ -1108,6 +1109,7 @@ function createBugMenu(options) if(priv.canCopyBug) items.push({label: bugLang.copy, icon: 'copy', url: createLink('bug', 'create', 'productID=' + productID + '&branch=' + '' + '&extras=bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canToStoryBug && (bug.$col.type != 'closed')) items.push({label: bugLang.toStory, icon: 'lightbulb', url: createLink('story', 'create', 'product=' + productID + '&branch=' + '0' + '&module=' + '0' + '&story=' + '0' + '&execution=' + '0' + '&bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateBug && (bug.$col.type == 'fixed') || bug.$col.type == 'testing' || bug.$col.type == 'tested' || bug.$col.type == 'closed') items.push({label: bugLang.activate, icon: 'magic', url: createLink('bug', 'activate', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', url: createLink('bug', 'delete', 'bugID=' + bug.id, '', 'true'), attrs: {'target': 'hiddenwin'}}); return items; } diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 1c5e9b50ed..5c84c3267d 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -85,6 +85,7 @@ js::set('priv', 'canResolveBug' => common::hasPriv('bug', 'resolve'), 'canCopyBug' => common::hasPriv('bug', 'create'), 'canEditBug' => common::hasPriv('bug', 'edit'), + 'canDeleteBug' => common::hasPriv('bug', 'delete'), 'canActivateBug' => common::hasPriv('bug', 'activate'), 'canAssignTask' => common::hasPriv('task', 'assignto'), 'canFinishTask' => common::hasPriv('task', 'finish'), @@ -96,10 +97,12 @@ js::set('priv', 'canStartTask' => common::hasPriv('task', 'start'), 'canRestartTask' => common::hasPriv('task', 'restart'), 'canEditTask' => common::hasPriv('task', 'edit'), + 'canDeleteTask' => common::hasPriv('task', 'delete'), 'canRecordEstimateTask' => common::hasPriv('task', 'recordEstimate'), 'canToStoryBug' => common::hasPriv('story', 'create'), 'canAssignStory' => common::hasPriv('story', 'assignto'), 'canEditStory' => common::hasPriv('story', 'edit'), + 'canDeleteStory' => common::hasPriv('story', 'delete'), 'canChangeStory' => common::hasPriv('story', 'change'), 'canUnlinkStory' => common::hasPriv('execution', 'unlinkStory'), ) From f8eacb6726cc0171dd5b2ddbcd6321f1aaef902c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 09:48:18 +0800 Subject: [PATCH 02/10] *Story #31107. --- module/execution/js/kanban.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index b255aeb619..891a18a29e 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1070,6 +1070,7 @@ function createStoryMenu(options) if(priv.canBatchCreateTask && showAction) items.push({label: executionLang.batchWBS, icon: 'pluses', url: createLink('task', 'batchCreate', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateStory && story.$col.type == 'closed') items.push({label: executionLang.activate, icon: 'magic', url: createLink('story', 'activate', 'storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canUnlinkStory) items.push({label: executionLang.unlinkStory, icon: 'unlink', url: createLink('execution', 'unlinkStory', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'false'), attrs: {target: 'hiddenwin'}}); + if(priv.canDeleteStory) items.push({label: storyLang.delete, icon: 'trash', url: createLink('story','delete','storyID=' + story.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); return items; } @@ -1089,7 +1090,7 @@ function createTaskMenu(options) if(priv.canActivateTask && (task.$col.type == 'developed' || task.$col.type == 'canceled' || task.$col.type == 'closed')) items.push({label: executionLang.activate, icon: 'magic', url: createLink('task', 'activate', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCreateTask) items.push({label: taskLang.copy, icon: 'copy', url: createLink('task', 'create', 'executionID=' + executionID + '&storyID=' + '0' + '&moduleID=' + '0' + '&taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCancelTask && (task.$col.type == 'wait' || task.$col.type == 'developing' || task.$col.type == 'pause')) items.push({label: taskLang.cancel, icon: 'cancel', url: createLink('task', 'cancel', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canDeleteTask) items.push({label: taskLang.delete, icon: 'trash', url: createLink('task', 'delete', 'bugID=' + bug.id, '', 'true'), attrs: {'target': 'hiddenwin'}}); + if(priv.canDeleteTask) items.push({label: taskLang.delete, icon: 'trash', url: createLink('task', 'delete', 'executionID=' + executionID + '&bugID=' + task.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); return items; } @@ -1109,7 +1110,7 @@ function createBugMenu(options) if(priv.canCopyBug) items.push({label: bugLang.copy, icon: 'copy', url: createLink('bug', 'create', 'productID=' + productID + '&branch=' + '' + '&extras=bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canToStoryBug && (bug.$col.type != 'closed')) items.push({label: bugLang.toStory, icon: 'lightbulb', url: createLink('story', 'create', 'product=' + productID + '&branch=' + '0' + '&module=' + '0' + '&story=' + '0' + '&execution=' + '0' + '&bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateBug && (bug.$col.type == 'fixed') || bug.$col.type == 'testing' || bug.$col.type == 'tested' || bug.$col.type == 'closed') items.push({label: bugLang.activate, icon: 'magic', url: createLink('bug', 'activate', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', url: createLink('bug', 'delete', 'bugID=' + bug.id, '', 'true'), attrs: {'target': 'hiddenwin'}}); + if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', url: createLink('bug', 'delete', 'bugID=' + bug.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); return items; } From 03e3f26ad5e410408996c71ad79d504a323ac36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 10:03:06 +0800 Subject: [PATCH 03/10] * --- module/bug/control.php | 9 ++++++--- module/bug/view/view.html.php | 2 +- module/story/control.php | 8 ++++++++ module/story/view/view.html.php | 2 +- module/task/control.php | 8 ++++++++ module/task/view/view.html.php | 2 +- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index ac65cb9af9..b8dc031971 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1835,11 +1835,10 @@ class bug extends control * * @param int $bugID * @param string $confirm yes|no - * @param string $extra * @access public * @return void */ - public function delete($bugID, $confirm = 'no', $extra = '') + public function delete($bugID, $confirm = 'no') { $bug = $this->bug->getById($bugID); if($confirm == 'no') @@ -1868,7 +1867,11 @@ class bug extends control if($this->app->tab == 'execution') { $execution = $this->loadModel('execution')->getByID($bug->execution); - if($execution->type == 'kanban') js::console.log(isonlybody() ? '1' : '2');//return print(js::reload(isonlybody() ? 'parent.parent' : 'parent')); + if($execution->type == 'kanban') + { + $locateLink = $this->createLink("execution", "kanban", "executionID={$bug->execution}"); + return print(js::locate($locateLink, 'parent.parent')); + } } $locateLink = $this->session->bugList ? $this->session->bugList : inlink('browse', "productID={$bug->product}"); diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 45efbbbd1f..85dd5a4f71 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -117,7 +117,7 @@ { common::printIcon('bug', 'create', $copyParams, $bug, 'button', 'copy'); } - common::printIcon('bug', 'delete', $params, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody'); + common::printIcon('bug', 'delete', $params/*.'&refresh=parent.parent'*/, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody'); ?>
diff --git a/module/story/control.php b/module/story/control.php index 7ca1555f00..f51cf190c8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1175,6 +1175,14 @@ class story extends control $this->executeHooks($storyID); if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); + if($this->app->tab == 'execution') + { + $execution = $this->loadModel('execution')->getByID(key($story->executions)); + if($execution->type == 'kanban') + { + return print(js::reload('parent.parent')); + } + } $locateLink = $this->session->storyList ? $this->session->storyList : $this->createLink('product', 'browse', "productID={$story->product}"); return print(js::locate($locateLink, 'parent')); diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index ab0cdd413f..608e3c5b45 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -244,7 +244,7 @@ echo "
"; common::printIcon('story', 'edit', "storyID=$story->id", $story); common::printIcon('story', 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id&executionID=0&bugID=0&planID=0&todoID=0&extra=&type=$story->type", $story, 'button', 'copy', '', '', '', "data-width='1050'"); - common::printIcon('story', 'delete', "storyID=$story->id", $story, 'button', 'trash', 'hiddenwin'); + common::printIcon('story', 'delete', "storyID=$story->id", $story, 'button', 'trash', 'hiddenwin', 'showinonlybody',true); ?> diff --git a/module/task/control.php b/module/task/control.php index 3a077b1610..6aaa7d46bf 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1583,6 +1583,14 @@ class task extends control if($task->story) $this->loadModel('story')->setStage($task->story); $this->executeHooks($taskID); + if($this->app->tab == 'execution') + { + $execution = $this->loadModel('execution')->getByID($task->execution); + if($execution->type == 'kanban') + { + return print(js::reload('parent.parent')); + } + } $locateLink = $this->session->taskList ? $this->session->taskList : $this->createLink('execution', 'task', "executionID={$task->execution}"); return print(js::locate($locateLink, 'parent')); diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 495e9739f3..b3b99dd751 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -187,7 +187,7 @@ if(!isonlybody()) echo "
"; common::printIcon('task', 'edit', "taskID=$task->id", $task, 'button', '', '', 'showinonlybody'); common::printIcon('task', 'create', "projctID={$task->execution}&storyID=0&moduleID=0&taskID=$task->id", $task, 'button', 'copy'); - common::printIcon('task', 'delete', "executionID=$task->execution&taskID=$task->id", $task, 'button', 'trash', 'hiddenwin'); + common::printIcon('task', 'delete', "executionID=$task->execution&taskID=$task->id", $task, 'button', 'trash', 'hiddenwin', 'showinonlybody', true); if($task->parent > 0) echo html::a(helper::createLink('task', 'view', "taskID=$task->parent"), "", '', "class='btn btn-link' title='{$lang->task->parent}'"); ?> From 67a0272d9655441cbd40794e04e9e45219151d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 14:41:51 +0800 Subject: [PATCH 04/10] *Story #31107. --- module/execution/control.php | 7 ------- module/execution/js/kanban.js | 34 ++++++++++++++++++++++++++++++++-- module/kanban/control.php | 21 +++++++++++++++++++++ 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 6a3f0e2e42..ec7ffd8eab 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2502,13 +2502,6 @@ class execution extends control return print(js::reload('parent')); } } - //public function deleteBug($bugID, $confirm = 'no') - //{ - // if($confirm == 'no') - // { - // return print(); - // } - //} /** * Manage products. diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 891a18a29e..87157ae846 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -969,6 +969,35 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car modalTrigger.show(); } } +/** + * Delete a card. + * + * @param string objectType + * @param int objectID + * @param int regionID + * @access public + * @return void + */ +function deleteCard(objectType, objectID, regionID) +{ + var objectLang = objectType + 'Lang'; + var result = confirm(window[objectLang].confirmDelete) ? true : false; + + if(!result) return false; + if(!objectID) return false; + + var url = createLink('kanban', 'deleteObjectCard', 'objectType=' + objectType + '&objectID=' + objectID + '®ionID=' + regionID); + return $.ajax( + { + method: 'post', + dataType: 'json', + url: url, + success: function(data) + { + updateRegion(regionID, data[regionID]); + } + }); +} /** * Close modal and update kanban data. @@ -1070,7 +1099,7 @@ function createStoryMenu(options) if(priv.canBatchCreateTask && showAction) items.push({label: executionLang.batchWBS, icon: 'pluses', url: createLink('task', 'batchCreate', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateStory && story.$col.type == 'closed') items.push({label: executionLang.activate, icon: 'magic', url: createLink('story', 'activate', 'storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canUnlinkStory) items.push({label: executionLang.unlinkStory, icon: 'unlink', url: createLink('execution', 'unlinkStory', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'false'), attrs: {target: 'hiddenwin'}}); - if(priv.canDeleteStory) items.push({label: storyLang.delete, icon: 'trash', url: createLink('story','delete','storyID=' + story.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); + if(priv.canDeleteStory) items.push({label: storyLang.delete, icon: 'trash', onClick: function(){deleteCard('story', story.id, story.$lane.region)}}); return items; } @@ -1090,7 +1119,7 @@ function createTaskMenu(options) if(priv.canActivateTask && (task.$col.type == 'developed' || task.$col.type == 'canceled' || task.$col.type == 'closed')) items.push({label: executionLang.activate, icon: 'magic', url: createLink('task', 'activate', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCreateTask) items.push({label: taskLang.copy, icon: 'copy', url: createLink('task', 'create', 'executionID=' + executionID + '&storyID=' + '0' + '&moduleID=' + '0' + '&taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCancelTask && (task.$col.type == 'wait' || task.$col.type == 'developing' || task.$col.type == 'pause')) items.push({label: taskLang.cancel, icon: 'cancel', url: createLink('task', 'cancel', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canDeleteTask) items.push({label: taskLang.delete, icon: 'trash', url: createLink('task', 'delete', 'executionID=' + executionID + '&bugID=' + task.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); + if(priv.canDeleteTask) items.push({label: taskLang.delete, icon: 'trash', onClick: function(){deleteCard('task', task.id, task.$lane.region)}}); return items; } @@ -1111,6 +1140,7 @@ function createBugMenu(options) if(priv.canToStoryBug && (bug.$col.type != 'closed')) items.push({label: bugLang.toStory, icon: 'lightbulb', url: createLink('story', 'create', 'product=' + productID + '&branch=' + '0' + '&module=' + '0' + '&story=' + '0' + '&execution=' + '0' + '&bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateBug && (bug.$col.type == 'fixed') || bug.$col.type == 'testing' || bug.$col.type == 'tested' || bug.$col.type == 'closed') items.push({label: bugLang.activate, icon: 'magic', url: createLink('bug', 'activate', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', url: createLink('bug', 'delete', 'bugID=' + bug.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); + if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', onClick: function(){deleteCard('bug', bug.id, bug.$lane.region)}}); return items; } diff --git a/module/kanban/control.php b/module/kanban/control.php index b5b36d6dff..81f51cc468 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -933,6 +933,27 @@ class kanban extends control return print(json_encode($kanbanGroup)); } + /** + * Delete a card. + * + * @param string $objectType story|task|bug + * @param int $objectID + * @param int $regionID + * @access public + * @return void + */ + public function deleteObjectCard($objectType, $objectID, $regionID) + { + $table = 'TABLE_' . strtoupper($objectType); + $this->loadModel($objectType)->delete(constant($table), $objectID); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + $kanbanID = $this->dao->select('kanban')->from(TABLE_KANBANREGION)->where('id')->eq($regionID)->fetch('kanban'); + + $kanbanGroup = $this->kanban->getRDKanban($kanbanID); + return print(json_encode($kanbanGroup)); + } + /** * View a card. * From c7f5c1f25559c234c7e5c417d8b03693f95d4160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 14:43:41 +0800 Subject: [PATCH 05/10] * --- module/bug/view/view.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 85dd5a4f71..45efbbbd1f 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -117,7 +117,7 @@ { common::printIcon('bug', 'create', $copyParams, $bug, 'button', 'copy'); } - common::printIcon('bug', 'delete', $params/*.'&refresh=parent.parent'*/, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody'); + common::printIcon('bug', 'delete', $params, $bug, 'button', 'trash', 'hiddenwin', 'showinonlybody'); ?> From 98311aca911c528165d3a8c79509f144ecc32c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 14:54:10 +0800 Subject: [PATCH 06/10] * --- module/execution/js/kanban.js | 1 - 1 file changed, 1 deletion(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 87157ae846..6be6b07f69 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1139,7 +1139,6 @@ function createBugMenu(options) if(priv.canCopyBug) items.push({label: bugLang.copy, icon: 'copy', url: createLink('bug', 'create', 'productID=' + productID + '&branch=' + '' + '&extras=bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canToStoryBug && (bug.$col.type != 'closed')) items.push({label: bugLang.toStory, icon: 'lightbulb', url: createLink('story', 'create', 'product=' + productID + '&branch=' + '0' + '&module=' + '0' + '&story=' + '0' + '&execution=' + '0' + '&bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canActivateBug && (bug.$col.type == 'fixed') || bug.$col.type == 'testing' || bug.$col.type == 'tested' || bug.$col.type == 'closed') items.push({label: bugLang.activate, icon: 'magic', url: createLink('bug', 'activate', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', url: createLink('bug', 'delete', 'bugID=' + bug.id, '', 'false'), attrs: {'target': 'hiddenwin'}}); if(priv.canDeleteBug) items.push({label: bugLang.delete, icon: 'trash', onClick: function(){deleteCard('bug', bug.id, bug.$lane.region)}}); return items; } From 31df5afed48ccd71e096d351c1640d10273f940b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 8 Mar 2022 15:22:46 +0800 Subject: [PATCH 07/10] * add permissions. --- config/zentaopms.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/zentaopms.php b/config/zentaopms.php index 04b1f89ca2..5f202f3f39 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -216,6 +216,7 @@ $config->openMethods[] = 'kanban.importexecution'; $config->openMethods[] = 'kanban.importbuild'; $config->openMethods[] = 'kanban.activatecard'; $config->openMethods[] = 'kanban.finishcard'; +$config->openMethods[] = 'kanban.deleteobjectcard'; /* Define the tables. */ define('TABLE_COMPANY', '`' . $config->db->prefix . 'company`'); From 8f3dc47e67b32f147cd9aac93e3fb4fb5a617d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 9 Mar 2022 00:55:06 +0000 Subject: [PATCH 08/10] Update kanban control.php --- module/kanban/control.php | 43 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index 81f51cc468..4047edf0e4 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -933,27 +933,6 @@ class kanban extends control return print(json_encode($kanbanGroup)); } - /** - * Delete a card. - * - * @param string $objectType story|task|bug - * @param int $objectID - * @param int $regionID - * @access public - * @return void - */ - public function deleteObjectCard($objectType, $objectID, $regionID) - { - $table = 'TABLE_' . strtoupper($objectType); - $this->loadModel($objectType)->delete(constant($table), $objectID); - if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - - $kanbanID = $this->dao->select('kanban')->from(TABLE_KANBANREGION)->where('id')->eq($regionID)->fetch('kanban'); - - $kanbanGroup = $this->kanban->getRDKanban($kanbanID); - return print(json_encode($kanbanGroup)); - } - /** * View a card. * @@ -1401,6 +1380,28 @@ class kanban extends control } } + /** + * Delete a card. + * + * @param string $objectType story|task|bug + * @param int $objectID + * @param int $regionID + * @access public + * @return void + */ + public function deleteObjectCard($objectType, $objectID, $regionID) + { + if(!($objectType == 'task' or $objectType == 'story' or $objectType == 'bug')) return false; + $table = 'TABLE_' . strtoupper($objectType); + $this->loadModel($objectType)->delete(constant($table), $objectID); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + $kanbanID = $this->kanban->getKanbanIDByregion($regionID); + + $kanbanGroup = $this->kanban->getRDKanban($kanbanID); + return print(json_encode($kanbanGroup)); + } + /** * Set WIP. * From 4ac1b90743b2061deebc7e0683c4e06c3696f4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 9 Mar 2022 00:59:31 +0000 Subject: [PATCH 09/10] Update model.php --- module/kanban/model.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/module/kanban/model.php b/module/kanban/model.php index 997616157a..3a108952ee 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -889,6 +889,18 @@ class kanbanModel extends model ->fetchPairs(); } + /** + * Get kanban id by region id. + * + * @param int $regionID + * @access public + * @return int + */ + public function getKanbanIDByRegion($regionID) + { + return $this->dao->select('kanban')->from(TABLE_KANBANREGION)->where('id')->eq($regionID)->fetch('kanban'); + } + /** * Get kanban group by regions. * From 719cd91f8ed7c60cef43097284546f25513c20e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 9 Mar 2022 01:08:17 +0000 Subject: [PATCH 10/10] Update kanban control.php --- module/kanban/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index 4047edf0e4..d5d12c45f9 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1397,8 +1397,8 @@ class kanban extends control if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $kanbanID = $this->kanban->getKanbanIDByregion($regionID); - $kanbanGroup = $this->kanban->getRDKanban($kanbanID); + return print(json_encode($kanbanGroup)); }