diff --git a/module/programplan/control.php b/module/programplan/control.php index fbcd25ace9..bb2530c811 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -239,7 +239,7 @@ class programplan extends control } /** - * Save task drag action. + * Save task drag position. * * @access public * @return void @@ -262,4 +262,25 @@ class programplan extends control return $this->send(array('result' => 'success')); } } + + /** + * Save task drag action. + * + * @access public + * @return void + */ + public function ajaxSaveGanttMove() + { + if($_POST) + { + $data = fixer::input('post')->get(); + $IdList = explode('-', $data->id); + $executionID = $IdList[0]; + $taskID = $IdList[1]; + + return 1231231; + } + + return $this->send(); + } } diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index d094e68cc8..b40cae7d76 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -457,6 +457,7 @@ $(function() gantt.serverList("userList", ); gantt.config.readonly = false; + gantt.config.details_on_dblclick = false; gantt.config.order_branch = true; gantt.config.details_on_dblclick = false; gantt.config.drag_progress = true; @@ -540,7 +541,7 @@ $(function() { if(module == 'review' && method == 'assess') { - gantt.config.layout = layout; + gantt.config.layout = layout; gantt.init('ganttView'); } gantt.expand(); @@ -614,6 +615,28 @@ $(function() if(!isNaN(taskID) && taskID > 0) taskModalTrigger.show({url: createLink('task', 'view', 'taskID=' + taskID, 'html', true)}); }); + gantt.attachEvent("onBeforeRowDragEnd", function(id, parent, tindex) + { + var task = gantt.getTask(id); + var link = createLink('programplan', 'ajaxSaveGanttMove'); + + //prevent moving to another position. + if(task.parent != parent || id.indexOf('-') == -1) return false; + + $.ajax({ + url: link, + dataType: "json", + data: {id: id, type: task.type, order: tindex}, + type: "post", + success: function(result) + { + var target = result; + } + }); + + return true; + }); + // Make folder can open or close by click $('#ganttView').on('click', '.gantt_close,.gantt_open', function() {