Changeset View
Changeset View
Standalone View
Standalone View
plugins/tasklist/tasklist.js
Show First 20 Lines • Show All 814 Lines • ▼ Show 20 Lines | function remove_tasks(list_id) | ||||
listindex = newindex; | listindex = newindex; | ||||
render_tasklist(); | render_tasklist(); | ||||
// avoid reloading | // avoid reloading | ||||
me.tasklists[list_id].active = false; | me.tasklists[list_id].active = false; | ||||
loadstate.lists = active_lists(); | loadstate.lists = active_lists(); | ||||
} | } | ||||
// open a tasks export dialog | |||||
this.export_tasks = function() | |||||
{ | |||||
// close show dialog first | |||||
var $dialog = $("#tasksexport"), | |||||
form = rcmail.gui_objects.exportform, | |||||
buttons = {}; | |||||
if (!form) | |||||
return; | |||||
if ($dialog.is(':ui-dialog')) | |||||
$dialog.dialog('close'); | |||||
$("#task-export-list").val(''); | |||||
buttons[rcmail.gettext('export', 'tasklist')] = function() { | |||||
var source = $('#task-export-list option:selected').val(); | |||||
// "current view" export, use hidden form to POST task IDs | |||||
if (source === '') { | |||||
var cache = {}, tasks = [], inputs = [], | |||||
postform = $('#tasks-export-form-post'); | |||||
$.each(listindex || [], function() { | |||||
var rec = listdata[this]; | |||||
if (match_filter(rec, cache)) { | |||||
tasks.push(rec.id); | |||||
} | |||||
}); | |||||
// copy form inputs, there may be controls added by other plugins | |||||
$('#tasksexport select, #tasksexport input').each(function() { | |||||
if (this.type != 'checkbox' || this.checked) | |||||
inputs.push($('<input>').attr({type: 'hidden', name: this.name, value: this.value})); | |||||
}); | |||||
inputs.push($('<input>').attr({type: 'hidden', name: '_token', value: rcmail.env.request_token})); | |||||
inputs.push($('<input>').attr({type: 'hidden', name: 'id', value: tasks.join(',')})); | |||||
if (!postform.length) | |||||
postform = $('<form>') | |||||
.attr({style: 'display: none', method: 'POST', action: '?_task=tasks&_action=export'}) | |||||
.appendTo('body'); | |||||
postform.html('').append(inputs).submit(); | |||||
} | |||||
// otherwise we can use simple GET | |||||
else { | |||||
rcmail.goto_url('export', {source: source, attachments: attach}); | |||||
} | |||||
$dialog.dialog("close"); | |||||
}; | |||||
buttons[rcmail.gettext('cancel', 'tasklist')] = function() { | |||||
$dialog.dialog("close"); | |||||
}; | |||||
// open jquery UI dialog | |||||
$dialog.dialog({ | |||||
modal: true, | |||||
resizable: false, | |||||
closeOnEscape: false, | |||||
title: rcmail.gettext('exporttitle', 'tasklist'), | |||||
open: function() { | |||||
$dialog.parent().find('.ui-dialog-buttonset .ui-button').first().addClass('mainaction'); | |||||
}, | |||||
close: function() { | |||||
$('.ui-dialog-buttonpane button', $dialog.parent()).button('enable'); | |||||
$dialog.dialog("destroy").hide(); | |||||
}, | |||||
buttons: buttons, | |||||
width: 520 | |||||
}).show(); | |||||
}; | |||||
/* | |||||
// download the selected task as iCal | |||||
this.task_download = function(task) | |||||
{ | |||||
if (task && task.id) { | |||||
rcmail.goto_url('export', {source: task.list, id: task.id, attachments: 1}); | |||||
} | |||||
}; | |||||
*/ | |||||
/** | /** | ||||
* Modify query parameters for refresh requests | * Modify query parameters for refresh requests | ||||
*/ | */ | ||||
function before_refresh(query) | function before_refresh(query) | ||||
{ | { | ||||
query.filter = filtermask == FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL; | query.filter = filtermask == FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL; | ||||
query.lists = active_lists().join(','); | query.lists = active_lists().join(','); | ||||
if (search_query) | if (search_query) | ||||
▲ Show 20 Lines • Show All 2,531 Lines • ▼ Show 20 Lines | window.rcmail && rcmail.addEventListener('init', function(evt) { | ||||
rcmail.register_command('print', function(){ rctasks.print_tasks(); }, true); | rcmail.register_command('print', function(){ rctasks.print_tasks(); }, true); | ||||
rcmail.register_command('list-create', function(){ rctasks.list_edit_dialog(null); }, true); | rcmail.register_command('list-create', function(){ rctasks.list_edit_dialog(null); }, true); | ||||
rcmail.register_command('list-edit', function(){ rctasks.list_edit_dialog(rctasks.selected_list); }, false); | rcmail.register_command('list-edit', function(){ rctasks.list_edit_dialog(rctasks.selected_list); }, false); | ||||
rcmail.register_command('list-delete', function(){ rctasks.list_delete(rctasks.selected_list); }, false); | rcmail.register_command('list-delete', function(){ rctasks.list_delete(rctasks.selected_list); }, false); | ||||
rcmail.register_command('list-remove', function(){ rctasks.list_remove(rctasks.selected_list); }, false); | rcmail.register_command('list-remove', function(){ rctasks.list_remove(rctasks.selected_list); }, false); | ||||
rcmail.register_command('list-showurl', function(){ rctasks.list_showurl(rctasks.selected_list); }, false); | rcmail.register_command('list-showurl', function(){ rctasks.list_showurl(rctasks.selected_list); }, false); | ||||
rcmail.register_command('export', function(){ rctasks.export_tasks(); }, true); | |||||
rcmail.register_command('search', function(){ rctasks.quicksearch(); }, true); | rcmail.register_command('search', function(){ rctasks.quicksearch(); }, true); | ||||
rcmail.register_command('reset-search', function(){ rctasks.reset_search(); }, true); | rcmail.register_command('reset-search', function(){ rctasks.reset_search(); }, true); | ||||
rcmail.register_command('expand-all', function(){ rctasks.expand_collapse(true); }, true); | rcmail.register_command('expand-all', function(){ rctasks.expand_collapse(true); }, true); | ||||
rcmail.register_command('collapse-all', function(){ rctasks.expand_collapse(false); }, true); | rcmail.register_command('collapse-all', function(){ rctasks.expand_collapse(false); }, true); | ||||
rctasks.init(); | rctasks.init(); | ||||
}); | }); |