I tried to do something on my own but I cannot follow source to finish it. Here is what I did.
I edited public\assets\javascript\og\tasks\drawing.js to display Assign button instead of Complete/Reopen button. Here is the code which I edited:
//Draw task actions
sb.append("<td><div id='ogTasksPanelTaskActions" + tgId + "' class='ogTaskActions'><table><tr>");
var renderTo = "ogTasksPanelTaskActions" + tgId + "Assign";
sb.append("<td style='padding-left:8px;'><a href='#' onclick='ogTasks.drawEditTaskForm(" + task.id + ", \"" + group_id + "\")'>");
sb.append("<div class='ico-edit coViewAction' title='" + lang('edit') + "' style='cursor:pointer;height:16px;padding-top:0px'>" + lang('edit') + "</div></a></td>");
// customized to show Assign button instead of Complete button: START
sb.append("<td style='padding-left:8px;'>");
if (! task.assignedToId){
sb.append("<a href='#' onclick='ogTasks.ToggleAssignStatus(" + task.id + ")'>");
sb.append("<div class='ico-complete coViewAction' title='" + lang('assign this task') + "' style='cursor:pointer;height:16px;padding-top:0px'>" + lang('do assign') + "</a></div>");
}
if (task.assignedToId){
sb.append("<a href='#' onclick='ogTasks.ToggleCompleteStatus(" + task.id + ", " + task.status + ")'>");
if (task.status > 0){
sb.append("<div class='ico-reopen coViewAction' title='" + lang('reopen this task') + "' style='cursor:pointer;height:16px;padding-top:0px'>" + lang('reopen') + "</div></a></td>");
} else {
sb.append("<div class='ico-complete coViewAction' title='" + lang('complete this task') + "' style='cursor:pointer;height:16px;padding-top:0px'>" + lang('do complete') + "</div></a></td>");
}
}
sb.append("</tr></table></div></td>");
// customized to show Assign button instead of Complete button: END
I also edited lang.js for two new strings:
'assign this task': 'Assign this task',
'do assign': 'Assign',
This works fine, I got buttons displayed as I wanted them.
I also added new function to drawing.js to handle new button action:
ogTasks.ToggleAssignStatus = function(task_id){
var action = 'assign_task';
og.openLink(og.getUrl('task', action, {id: task_id, quick: true}), {
callback: function(success, data) {
if (!success || data.errorCode) {
} else {
//Set task data
var task = ogTasks.getTask(task_id);
task.setFromTdata(data.task);
//Redraw task, or redraw whole panel
var bottomToolbar = Ext.getCmp('tasksPanelBottomToolbarObject');
var displayCriteria = bottomToolbar.getDisplayCriteria();
if (displayCriteria.group_by != 'status')
this.UpdateTask(task.id);
else
this.draw();
}
},
scope: this
});
}
Then, I edited \application\controllers\TaskController.class.php and added new funtion:
/**
* Assign task
*
* @access public
* @param void
* @return null
*/
function assign_task() {
$this->assign();
return;
}
Nw, when I click Assign button I get error message:
Error: Requested task does not exist
This seems like all I did was correct, but Assign() method cannot get correct task_id because it expects it in $_POST but action call passes that value in some other manner which I cannot figure out by examining code of other similar actions
Can anyone help me with some advice?