From 9f37454e8f5ddf3e10ebafb95dd8c649dbc167d0 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Wed, 15 Dec 2021 14:46:10 +0800 Subject: [PATCH] *close lane and column. --- module/kanban/control.php | 42 +++++++++++++++++++++++++++++++++++++++ module/kanban/js/view.js | 4 ++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index f18d817a97..2a6dfdc438 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -267,6 +267,27 @@ class kanban extends control $this->view->lanes = $this->kanban->getLanePairsByRegion($regionID); $this->display(); } + + /** + * Delete a lane. + * + * @param int $laneID + * @param string $confirm no|yes + * @access public + * @return void + */ + public function deleteLane($laneID, $confirm = 'no') + { + if($confirm == 'no') + { + die(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'deleteLane', "laneID=$laneID&confirm=yes"), '')); + } + else + { + $this->kanban->delete(TABLE_KANBANLANE, $laneID); + die(js::reload('parent')); + } + } /** * Create a column for a kanban. @@ -296,6 +317,27 @@ class kanban extends control $this->display(); } + /** + * Delete a column. + * + * @param int $columnID + * @param string $confirm no|yes + * @access public + * @return void + */ + public function deleteColumn($columnID, $confirm = 'no') + { + if($confirm == 'no') + { + die(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'deleteColumn', "columnID=$columnID&confirm=yes"), '')); + } + else + { + $this->kanban->delete(TABLE_KANBANCOLUMN, $columnID); + die(js::reload('parent')); + } + } + /** * Create a card. * diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index dfb06f5512..8f4cf5b9f8 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -617,7 +617,7 @@ function createLaneMenu(options) var items = []; if(privs.includes('setLane')) items.push({label: kanbanLang.editLane, icon: 'edit', url: createLink('kanban', 'setLane', 'laneID=' + lane.id + '&executionID=0&from=kanban'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '635px'}}); - if(privs.includes('deleteLane')) items.push({label: kanbanLang.deleteLane, icon: 'trash', url: createLink('kanban', 'deleteLane', 'lane=' + lane.id), className: 'confirmer', attrs: {'data-confirmTitle': kanbanlaneLang.confirmDelete, 'data-confirmDetail': kanbanlaneLang.confirmDeleteDetail}}); + if(privs.includes('deleteLane')) items.push({label: kanbanLang.deleteLane, icon: 'trash', url: createLink('kanban', 'deleteLane', 'lane=' + lane.id), className: 'confirmer', attrs: {'data-confirmTitle': kanbanlaneLang.confirmDelete, 'data-confirmDetail': kanbanlaneLang.confirmDeleteDetail, 'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); items.$options = {x: bounds.right, y: bounds.top}; @@ -668,7 +668,7 @@ function createColumnMenu(options) } if(privs.includes('copyColumn')) items.push({label: kanbanLang.copyColumn, icon: 'copy', url: createLink('kanban', 'copyColumn', 'columnID=' + column.id), className: 'iframe', attrs: {'data-toggle': 'modal'}}); if(privs.includes('archiveColumn')) items.push({label: kanbanLang.archiveColumn, icon: 'card-archive', url: createLink('kanban', 'archiveColumn', 'columnID=' + column.id), className: 'confirmer', attrs: {'data-confirmTitle': kanbancolumnLang.confirmArchive, 'data-confirmDetail': kanbancolumnLang.confirmArchiveDetail, 'data-confirmButton': lang.archive, 'data-confirming': lang.archiving}}); - if(privs.includes('deleteColumn')) items.push({label: kanbanLang.deleteColumn, icon: 'trash', url: createLink('kanban', 'deleteColumn', 'columnID=' + column.id), className: 'confirmer', attrs: {'data-confirmTitle': kanbancolumnLang.confirmDelete, 'data-confirmDetail': kanbancolumnLang.confirmDeleteDetail}}); + if(privs.includes('deleteColumn')) items.push({label: kanbanLang.deleteColumn, icon: 'trash', url: createLink('kanban', 'deleteColumn', 'columnID=' + column.id), className: 'confirmer', attrs: {'data-confirmTitle': kanbancolumnLang.confirmDelete, 'data-confirmDetail': kanbancolumnLang.confirmDeleteDetail, 'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); items.$options = {x: bounds.right, y: bounds.top};