I am trying to add a few possibilities in the task view. So far I've managed to make it possible to 'un'complete selected tasks by
In public/assets/javascript/og/tasks/taskstoptoolbar.js add
uncomplete: new Ext.Action({
text: lang('do uncomplete'),
tooltip: lang('uncomplete selected tasks'),
iconCls: 'ico-uncomplete',
disabled: true,
handler: function() {
ogTasks.executeAction('uncomplete');
},
scope: this
})
around line 130
and add
this.add(actions.uncomplete);
around line 390
and change the function updateCheckedStatus() to
updateCheckedStatus : function(){
var checked = false;
var allIncomplete = true;
var allComplete = true;
for (var i = 0; i < ogTasks.Tasks.length; i++)
if (ogTasks.Tasks.isChecked){
checked = true;
if (ogTasks.Tasks.status == 1)
allIncomplete = false;
if (ogTasks.Tasks.status == 0)
allComplete = false;
}
if (!checked){
this.actions.del.disable();
this.actions.complete.disable();
this.actions.tag.disable();
} else {
this.actions.del.enable();
this.actions.tag.enable();
if (allIncomplete)
this.actions.complete.enable();
else
this.actions.complete.disable();
if (allComplete)
this.actions.uncomplete.enable();
else
this.actions.uncomplete.disable();
}
in TaskController.class.php, add the function
function uncomplete_task() {
ajx_current("empty");
$task = ProjectTasks::findById(get_id());
if(!($task instanceof ProjectTask)) {
flash_error(lang('task dnx'));
return;
} // if
if(!$task->canChangeStatus(logged_user())) {
flash_error(lang('no access permissions'));
return;
} // if
try {
DB::beginWork();
$task->uncompleteTask();
DB::commit();
flash_success(lang('success uncomplete task'));
$redirect_to = array_var($_GET, 'redirect_to', false);
if (array_var($_GET, 'quick', false)) {
ajx_current("empty");
ajx_extra_data(array("task" => $task->getArrayInfo()));
} else {
ajx_current("reload");
}
} catch(Exception $e) {
DB::rollback();
flash_error($e->getMessage());
} // try
} // uncomplete_task
ie around line 1130
and in ProjectTask.class.php add the function
function uncompleteTask() {
$this->setCompletedOn(null);
$this->setCompletedById(0);
$this->save();
ApplicationLogs::createLog($this, $this->getWorkspaces(), ApplicationLogs::ACTION_OPEN);
} // uncompleteTask
ie around line 433