diff --git a/module/bug/control.php b/module/bug/control.php index b8dc031971..a21a6a0898 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1835,15 +1835,16 @@ class bug extends control * * @param int $bugID * @param string $confirm yes|no + * @param string $from taskkanban * @access public * @return void */ - public function delete($bugID, $confirm = 'no') + public function delete($bugID, $confirm = 'no', $from = '') { $bug = $this->bug->getById($bugID); if($confirm == 'no') { - return print(js::confirm($this->lang->bug->confirmDelete, inlink('delete', "bugID=$bugID&confirm=yes"))); + return print(js::confirm($this->lang->bug->confirmDelete, inlink('delete', "bugID=$bugID&confirm=yes&from=$from"))); } else { @@ -1864,15 +1865,8 @@ 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') - { - $locateLink = $this->createLink("execution", "kanban", "executionID={$bug->execution}"); - return print(js::locate($locateLink, 'parent.parent')); - } - } + if(isonlybody()) return print(js::reload('parent.parent')); + if($from == 'taskkanban') return print(js::reload('parent')); $locateLink = $this->session->bugList ? $this->session->bugList : inlink('browse', "productID={$bug->product}"); return print(js::locate($locateLink, 'parent')); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 7c6e707a2c..5387fc1f5a 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -969,6 +969,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car modalTrigger.show(); } } + /** * Delete a card. * diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index d10800f92b..21333ef2ec 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -859,6 +859,7 @@ function createStoryMenu(options) if(this.size) item.attrs['data-width'] = this.size; if(this.icon == 'unlink') item = {label: this.label, icon: this.icon, url: this.url, attrs: {'target': 'hiddenwin'}}; + if(this.icon == 'trash') item = {label: this.label, icon: this.icon, url: this.url, attrs: {'target': 'hiddenwin'}}; items.push(item); }); diff --git a/module/kanban/model.php b/module/kanban/model.php index d11fc61feb..65072b4b6f 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -3448,6 +3448,7 @@ class kanbanModel extends model if(common::hasPriv('task', 'batchCreate') and $toTaskPriv) $menu[] = array('label' => $this->lang->execution->batchWBS, 'icon' => 'pluses', 'url' => helper::createLink('task', 'batchCreate', "executionID=$executionID&storyID=$story->id&moduleID=0&taskID=0&iframe=true", '', true), 'size' => '95%'); if(common::hasPriv('story', 'activate') and $this->story->isClickable($story, 'activate')) $menu[] = array('label' => $this->lang->story->activate, 'icon' => 'magic', 'url' => helper::createLink('story', 'activate', "storyID=$story->id", '', true)); if(common::hasPriv('execution', 'unlinkStory')) $menu[] = array('label' => $this->lang->execution->unlinkStory, 'icon' => 'unlink', 'url' => helper::createLink('execution', 'unlinkStory', "executionID=$executionID&storyID=$story->story&confirm=no", '', true)); + if(common::hasPriv('story', 'delete')) $menu[] = array('label' => $this->lang->story->delete, 'icon' => 'trash', 'url' => helper::createLink('story', 'delete', "storyID=$story->id&confirm=no&from=taskkanban")); $menus[$story->id] = $menu; } @@ -3466,6 +3467,7 @@ class kanbanModel extends model if(common::hasPriv('bug', 'create') and $this->bug->isClickable($bug, 'create')) $menu[] = array('label' => $this->lang->bug->copy, 'icon' => 'copy', 'url' => helper::createLink('bug', 'create', "productID=$bug->product&branch=$bug->branch&extras=bugID=$bug->id", '', true), 'size' => '95%'); if(common::hasPriv('bug', 'activate') and $this->bug->isClickable($bug, 'activate')) $menu[] = array('label' => $this->lang->bug->activate, 'icon' => 'magic', 'url' => helper::createLink('bug', 'activate', "bugID=$bug->id", '', true)); if(common::hasPriv('story', 'create') and $bug->status != 'closed') $menu[] = array('label' => $this->lang->bug->toStory, 'icon' => 'lightbulb', 'url' => helper::createLink('story', 'create', "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id", '', true), 'size' => '95%'); + if(common::hasPriv('bug', 'delete')) $menu[] = array('label' => $this->lang->bug->delete, 'icon' => 'trash', 'url' => helper::createLink('bug', 'delete', "bugID=$bug->id&confirm=no&from=taskkanban")); $menus[$bug->id] = $menu; } @@ -3485,6 +3487,7 @@ class kanbanModel extends model if(common::hasPriv('task', 'batchCreate') and $this->task->isClickable($task, 'batchCreate')) $menu[] = array('label' => $this->lang->task->children, 'icon' => 'split', 'url' => helper::createLink('task', 'batchCreate', "execution=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%'); if(common::hasPriv('task', 'create') and $this->task->isClickable($task, 'create')) $menu[] = array('label' => $this->lang->task->copy, 'icon' => 'copy', 'url' => helper::createLink('task', 'create', "projctID=$task->execution&storyID=$task->story&moduleID=$task->module&taskID=$task->id", '', true), 'size' => '95%'); if(common::hasPriv('task', 'cancel') and $this->task->isClickable($task, 'cancel')) $menu[] = array('label' => $this->lang->task->cancel, 'icon' => 'ban-circle', 'url' => helper::createLink('task', 'cancel', "taskID=$task->id", '', true)); + if(common::hasPriv('task', 'delete')) $menu[] = array('label' => $this->lang->task->delete, 'icon' => 'trash', 'url' => helper::createLink('task', 'delete', "executionID=$task->execution&taskID=$task->id&confirm=no&from=taskkanban")); $menus[$task->id] = $menu; } diff --git a/module/story/control.php b/module/story/control.php index 36c3037388..5565e779ad 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1153,17 +1153,18 @@ class story extends control * * @param int $storyID * @param string $confirm yes|no + * @param string $from taskkanban * @access public * @return void */ - public function delete($storyID, $confirm = 'no') + public function delete($storyID, $confirm = 'no', $from = '') { $story = $this->story->getById($storyID); if($story->parent < 0) return print(js::alert($this->lang->story->cannotDeleteParent)); if($confirm == 'no') { - return print(js::confirm($this->lang->story->confirmDelete, $this->createLink('story', 'delete', "story=$storyID&confirm=yes"), '')); + return print(js::confirm($this->lang->story->confirmDelete, $this->createLink('story', 'delete', "story=$storyID&confirm=yes&from=$from"), '')); } else { @@ -1177,14 +1178,10 @@ 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')); - } - } + + if($this->app->tab == 'execution' and $from == 'taskkanban') return print(js::reload('parent')); + + if(isonlybody()) 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/task/control.php b/module/task/control.php index 6aaa7d46bf..77806ca7e0 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1559,17 +1559,18 @@ class task extends control * @param int $executionID * @param int $taskID * @param string $confirm yes|no + * @param string $from taskkanban * @access public * @return void */ - public function delete($executionID, $taskID, $confirm = 'no') + public function delete($executionID, $taskID, $confirm = 'no', $from = '') { $task = $this->task->getById($taskID); if($task->parent < 0) return print(js::alert($this->lang->task->cannotDeleteParent)); if($confirm == 'no') { - return print(js::confirm($this->lang->task->confirmDelete, inlink('delete', "executionID=$executionID&taskID=$taskID&confirm=yes"))); + return print(js::confirm($this->lang->task->confirmDelete, inlink('delete', "executionID=$executionID&taskID=$taskID&confirm=yes&from=$from"))); } else { @@ -1583,14 +1584,9 @@ 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')); - } - } + + if(isonlybody()) return print(js::reload('parent.parent')); + if($from == 'taskkanban') return print(js::reload('parent')); $locateLink = $this->session->taskList ? $this->session->taskList : $this->createLink('execution', 'task', "executionID={$task->execution}"); return print(js::locate($locateLink, 'parent'));