diff --git a/module/execution/control.php b/module/execution/control.php index 5f19561985..5f5cfa6b66 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1969,6 +1969,7 @@ class execution extends control $this->app->loadLang('bug'); $this->app->loadLang('story'); if(empty($groupBy)) $groupBy = 'default'; + $this->session->set('execLaneType', $browseType); $this->lang->execution->menu = new stdclass(); $execution = $this->commonAction($executionID); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 3be5ff584c..80123e4e93 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -788,7 +788,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if(fromColType == 'developing' && priv.canPauseTask) { - var link = createLink('task', 'pause', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('task', 'pause', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -796,12 +796,12 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if((fromColType == 'pause' || fromColType == 'canceled' || fromColType == 'closed' || fromColType == 'developed') && priv.canActivateTask) { - var link = createLink('task', 'activate', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('task', 'activate', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } if(fromColType == 'wait' && priv.canStartTask) { - var link = createLink('task', 'start', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('task', 'start', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -809,7 +809,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if((fromColType == 'developing' || fromColType == 'wait' || fromColType == 'pause') && priv.canCancelTask) { - var link = createLink('task', 'cancel', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('task', 'cancel', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -817,7 +817,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if((fromColType == 'developed' || fromColType == 'canceled') && priv.canCloseTask) { - var link = createLink('task', 'close', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('task', 'close', 'taskID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -911,7 +911,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car * @access public * @return void */ -function updateKanban(kanbanData, regionID) +function updateKanban(kanbanData, regionID = 0) { setTimeout(function() { diff --git a/module/task/control.php b/module/task/control.php index 45dc885341..26d81763cd 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -146,7 +146,20 @@ class task extends control if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $taskID)); /* If link from no head then reload. */ - if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + if(isonlybody()) + { + if($execution->type == 'kanban') + { + $kanbanData = $this->kanban->getRDKanban($executionID, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.updateKanban($kanbanData, 0)")); + } + else + { + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + } /* Locate the browser. */ if($this->app->getViewType() == 'xhtml') @@ -309,7 +322,20 @@ class task extends control if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $taskIDList)); /* If link from no head then reload. */ - if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + if(isonlybody()) + { + if($execution->type == 'kanban') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.updateKanban($kanbanData, 0)")); + } + else + { + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + } return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $taskLink)); } @@ -424,7 +450,22 @@ class task extends control } } - if(isonlybody()) die(js::reload('parent.parent')); + if(isonlybody()) + { + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::reload('parent.parent')); + } + } + if(defined('RUN_MODE') && RUN_MODE == 'api') { return $this->send(array('status' => 'success', 'data' => $taskID)); @@ -622,7 +663,22 @@ class task extends control $this->executeHooks($taskID); if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success')); - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -809,6 +865,9 @@ class task extends control { $this->commonAction($taskID); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + $task = $this->task->getById($taskID); if(!empty($_POST)) @@ -848,7 +907,23 @@ class task extends control } if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success')); - if(isonlybody()) die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + + if(isonlybody()) + { + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', $regionID); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); + } + else + { + return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + } + } die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -895,8 +970,22 @@ class task extends control } } - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); - die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) + { + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } + return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } $this->session->set('estimateList', $this->app->getURI(true), 'execution'); @@ -1019,8 +1108,7 @@ class task extends control $execution = $this->execution->getByID($task->execution); if($execution->type == 'kanban') { - $regionID = isset($output['regionID']) ? $output['regionID'] : 0; - $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, 'all', 'id_desc', $regionID); + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc'); $kanbanData = json_encode($kanbanData); return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); @@ -1083,6 +1171,9 @@ class task extends control { $this->commonAction($taskID); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $this->loadModel('action'); @@ -1097,8 +1188,25 @@ class task extends control $this->executeHooks($taskID); - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); - die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', $regionID); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } + + return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } $this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->pause; @@ -1136,8 +1244,23 @@ class task extends control $this->executeHooks($taskID); - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); - die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } + return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } $this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->task->restart; @@ -1161,6 +1284,9 @@ class task extends control { $this->commonAction($taskID); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $this->loadModel('action'); @@ -1176,7 +1302,24 @@ class task extends control $this->executeHooks($taskID); - if(isonlybody()) die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', $regionID); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); + } + else + { + return print(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}")); + } + } + if(defined('RUN_MODE') && RUN_MODE == 'api') { return $this->send(array('status' => 'success', 'data' => $taskID)); @@ -1293,6 +1436,9 @@ class task extends control { $this->commonAction($taskID); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $this->loadModel('action'); @@ -1307,7 +1453,23 @@ class task extends control $this->executeHooks($taskID); - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', $regionID); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -1330,6 +1492,9 @@ class task extends control { $this->commonAction($taskID); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $this->loadModel('action'); @@ -1344,8 +1509,24 @@ class task extends control $this->executeHooks($taskID); - if(isonlybody()) die(js::closeModal('parent.parent', 'this')); - die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); + if(isonlybody()) + { + $task = $this->task->getById($taskID); + $execution = $this->execution->getByID($task->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', $regionID); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)")); + } + else + { + return print(js::closeModal('parent.parent', 'this')); + } + } + return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } if(!empty($this->view->task->team)) diff --git a/module/task/view/start.html.php b/module/task/view/start.html.php index 7067c50679..741c5e4bb2 100644 --- a/module/task/view/start.html.php +++ b/module/task/view/start.html.php @@ -37,7 +37,7 @@ -
+ rawMethod == 'start') echo "onsubmit='return checkLeft();'"?>>
task->assignedTo;?>