Ok, this is as far as I go. "Good enough" for me
This code will add four presets on the task list:
"My To-do List" | Assigned to: Me, Status: Pending, Group by: Workspace, Order by: Due date
"Tasks for Grabs" | Assigned to: Nobody, Status: Pending, Group by: Workspace, Order by: Due Date
"All Pending Tasks" | Assigned to: Everyone, Status: Pendings, Group by: Nothing, Order by: Due Date
"My Completed Tasks" | Assigned to: Me, Status: Complete, Group by: Nothing, Order by: Completed on
this.add(new Ext.Action({
text: 'My To-Do List',
tooltip: 'Assigned to: Me | Status: Pending | Group by: Worskpace| Order by: Due Date',
handler: function() {
this.statusCombo.setValue(0);
this.filtercombo.setValue('assigned_to');
var mycurrentUser = '';
var usersArray = Ext.util.JSON.decode(document.getElementById(config.usersHfId).value);
var companiesArray = Ext.util.JSON.decode(document.getElementById(config.companiesHfId).value);
for (i in usersArray){
if (usersArray[i].isCurrent)
mycurrentUser = usersArray[i].cid + ':' + usersArray[i].id;
}
this.filterNamesCompaniesCombo.setValue(mycurrentUser);
Ext.extend(og.TasksBottomToolbar, Ext.Toolbar, {
getDisplayCriteria : function(){
return {
group_by : this.groupcombo.setValue('workspace'),
order_by : this.ordercombo.setValue('due_date')
}
},
getDrawOptions : function(){
return {
show_workspaces : this.items.item('btnShowWorkspaces').pressed,
show_time : this.items.item('btnShowTime').pressed,
show_tags : this.items.item('btnShowTags').pressed,
show_dates : this.items.item('btnShowDates').pressed
}
}
});
Ext.reg("TasksBottomToolbar", og.TasksBottomToolbar);
this.load();
},
scope: this
}));
this.add(new Ext.Action({
text: 'Tasks for Grabs',
tooltip: 'Assigned to: Nobody| Status: Pending | Group by: Workspace | Order by: Due Date',
handler: function() {
this.statusCombo.setValue(0);
this.filtercombo.setValue('assigned_to');
this.filterNamesCompaniesCombo.setValue('-1:-1');
Ext.extend(og.TasksBottomToolbar, Ext.Toolbar, {
getDisplayCriteria : function(){
this.groupcombo.setValue('workspace');
this.ordercombo.setValue('due_date');
return {
group_by : this.groupcombo.getValue(),
order_by : this.ordercombo.getValue()
}
},
getDrawOptions : function(){
return {
show_workspaces : this.items.item('btnShowWorkspaces').pressed,
show_time : this.items.item('btnShowTime').pressed,
show_tags : this.items.item('btnShowTags').pressed,
show_dates : this.items.item('btnShowDates').pressed
}
}
});
Ext.reg("TasksBottomToolbar", og.TasksBottomToolbar);
this.load();
},
scope: this
}));
this.add(new Ext.Action({
text: 'All Pending Tasks',
tooltip: 'Assigned to: Everyone | Status: Pending | Group by: Nothing | Order by: Due Date',
handler: function() {
this.statusCombo.setValue(0);
this.filtercombo.setValue('assigned_to');
this.filterNamesCompaniesCombo.setValue('0:0');
Ext.extend(og.TasksBottomToolbar, Ext.Toolbar, {
getDisplayCriteria : function(){
this.groupcombo.setValue('nothing');
this.ordercombo.setValue('due_date');
return {
group_by : this.groupcombo.getValue(),
order_by : this.ordercombo.getValue()
}
},
getDrawOptions : function(){
return {
show_workspaces : this.items.item('btnShowWorkspaces').pressed,
show_time : this.items.item('btnShowTime').pressed,
show_tags : this.items.item('btnShowTags').pressed,
show_dates : this.items.item('btnShowDates').pressed
}
}
});
Ext.reg("TasksBottomToolbar", og.TasksBottomToolbar);
this.load();
},
scope: this
}));
this.add(new Ext.Action({
text: 'My Completed Tasks',
tooltip: 'Assigned to: Me | Status: Complete | Group by: Nothing | Order by: Completed on',
handler: function() {
this.statusCombo.setValue(1);
this.filtercombo.setValue('assigned_to');
var mycurrentUser = '';
var usersArray = Ext.util.JSON.decode(document.getElementById(config.usersHfId).value);
var companiesArray = Ext.util.JSON.decode(document.getElementById(config.companiesHfId).value);
for (i in usersArray){
if (usersArray[i].isCurrent)
mycurrentUser = usersArray[i].cid + ':' + usersArray[i].id;
}
this.filterNamesCompaniesCombo.setValue(mycurrentUser);
Ext.extend(og.TasksBottomToolbar, Ext.Toolbar, {
getDisplayCriteria : function(){
this.groupcombo.setValue('nothing');
this.ordercombo.setValue('completed_on');
return {
group_by : this.groupcombo.getValue(),
order_by : this.ordercombo.getValue()
}
},
getDrawOptions : function(){
return {
show_workspaces : this.items.item('btnShowWorkspaces').pressed,
show_time : this.items.item('btnShowTime').pressed,
show_tags : this.items.item('btnShowTags').pressed,
show_dates : this.items.item('btnShowDates').pressed
}
}
});
Ext.reg("TasksBottomToolbar", og.TasksBottomToolbar);
this.load();
},
scope: this
}));
(enter anywhere after "//Add stuff to the toolbar" on TasksTopToolbar.js)
See the screenshot attached.
Note; With this hack I ran into a little issue and I have not found a fix for it yet. Once you click on any of these presets, the bottom filters (group by and order by) cannot be changed until the page is refreshed or another preset is selected. If anyone cares to fix it, please share. Me and my team will use the presets solely so its not an issue for us.
Tested in IE and Firefox.
Have fun!