this.highlightSidebar('appportal');
this._addHistory(loc);
DimpCore.setTitle(DIMP.text.portal);
- DimpCore.doAction('ShowPortal', {}, null, this._portalCallback.bind(this));
+ DimpCore.doAction('ShowPortal', {}, { callback: this._portalCallback.bind(this) });
break;
case 'options':
case 'ctx_folder_empty':
tmp = baseelt.up('LI');
if (window.confirm(DIMP.text.empty_folder.replace(/%s/, tmp.readAttribute('title')))) {
- DimpCore.doAction('EmptyFolder', { view: tmp.retrieve('mbox') }, null, this._emptyFolderCallback.bind(this));
+ DimpCore.doAction('EmptyFolder', { view: tmp.retrieve('mbox') }, { callback: this._emptyFolderCallback.bind(this) });
}
break;
case 'ctx_vfolder_delete':
tmp = baseelt.up('LI');
if (window.confirm(DIMP.text.delete_folder.replace(/%s/, tmp.readAttribute('title')))) {
- DimpCore.doAction('DeleteFolder', { view: tmp.retrieve('mbox') }, null, this._folderCallback.bind(this));
+ DimpCore.doAction('DeleteFolder', { view: tmp.retrieve('mbox') }, { callback: this._folderCallback.bind(this) });
}
break;
this.loadingImg('msg', true);
- DimpCore.doAction('ShowPreview', params || {}, this.viewport.createSelection('dataob', this.pp), this._loadPreviewCallback.bind(this));
+ DimpCore.doAction('ShowPreview', params || {}, { uids: this.viewport.createSelection('dataob', this.pp), callback: this._loadPreviewCallback.bind(this) });
},
_loadPreviewCallback: function(resp)
args = this.viewport.addRequestParams({});
}
$('checkmaillink').down('A').update('[' + DIMP.text.check + ']');
- DimpCore.doAction('Poll', args, null, this._pollCallback.bind(this));
+ DimpCore.doAction('Poll', args, { callback: this._pollCallback.bind(this) });
},
_pollCallback: function(r)
dropbase = (drop == $('dropbase'));
if (dropbase ||
(ftype != 'special' && !this.isSubfolder(drag, drop))) {
- DimpCore.doAction('RenameFolder', { old_name: drag.retrieve('mbox'), new_parent: dropbase ? '' : foldername, new_name: drag.retrieve('l') }, null, this._folderCallback.bind(this));
+ DimpCore.doAction('RenameFolder', { old_name: drag.retrieve('mbox'), new_parent: dropbase ? '' : foldername, new_name: drag.retrieve('l') }, { callback: this._folderCallback.bind(this) });
}
} else if (ftype != 'container') {
sel = this.viewport.getSelected();
if (uids.size()) {
if (e.ctrlKey) {
- DimpCore.doAction('CopyMessage', this.viewport.addRequestParams({ tofld: foldername }), uids, this._pollCallback.bind(this));
+ DimpCore.doAction('CopyMessage', this.viewport.addRequestParams({ tofld: foldername }), { uids: uids, callback: this._pollCallback.bind(this) });
} else if (this.folder != foldername) {
// Don't allow drag/drop to the current folder.
this.updateFlag(uids, '\\deleted', true);
- DimpCore.doAction('MoveMessage', this.viewport.addRequestParams({ tofld: foldername }), uids, this._deleteCallback.bind(this));
+ DimpCore.doAction('MoveMessage', this.viewport.addRequestParams({ tofld: foldername }), { uids: uids, callback: this._deleteCallback.bind(this) });
}
}
}
}
if (action) {
- DimpCore.doAction(action, params, null, this._folderCallback.bind(this));
+ DimpCore.doAction(action, params, { callback: this._folderCallback.bind(this) });
}
}
},
this.deleteFolderElt(elt.readAttribute('id'), true);
}, this);
- DimpCore.doAction('ListFolders', { unsub: Number(this.showunsub) }, null, this._folderLoadCallback.bind(this));
+ DimpCore.doAction('ListFolders', { unsub: Number(this.showunsub) }, { callback: this._folderLoadCallback.bind(this) });
},
subscribeFolder: function(f, sub)
// This needs to be synchronous Ajax if we are calling from a
// popup window because Mozilla will not correctly call the
// callback function if the calling window has been closed.
- DimpCore.doAction(type, this.viewport.addRequestParams(args), vs, this._deleteCallback.bind(this), { asynchronous: !(opts.uid && opts.mailbox) });
+ DimpCore.doAction(type, this.viewport.addRequestParams(args), { uids: vs, callback: this._deleteCallback.bind(this), ajaxopts: { asynchronous: !(opts.uid && opts.mailbox) } });
return vs;
}
this.updateFlag(vs, flag, set);
if (!opts.noserver) {
- DimpCore.doAction('FlagMessage', { flags: flags.toJSON(), view: this.folder }, vs);
+ DimpCore.doAction('FlagMessage', { flags: flags.toJSON(), view: this.folder }, { uids: vs });
}
},
// mbox = (string) The mailbox to flag
flagAll: function(type, set, mbox)
{
- DimpCore.doAction('FlagAll', { flags: [ type ].toJSON(), set: Number(set), view: mbox }, null, this._flagAllCallback.bind(this));
+ DimpCore.doAction('FlagAll', { flags: [ type ].toJSON(), set: Number(set), view: mbox }, { callback: this._flagAllCallback.bind(this) });
},
hasFlag: function(f, r)
/* Miscellaneous folder actions. */
purgeDeleted: function()
{
- DimpCore.doAction('PurgeDeleted', this.viewport.addRequestParams({}), null, this._deleteCallback.bind(this));
+ DimpCore.doAction('PurgeDeleted', this.viewport.addRequestParams({}), { callback: this._deleteCallback.bind(this) });
},
modifyPoll: function(folder, add)
{
- DimpCore.doAction('ModifyPoll', { view: folder, add: Number(add) }, null, this._modifyPollCallback.bind(this));
+ DimpCore.doAction('ModifyPoll', { view: folder, add: Number(add) }, { callback: this._modifyPollCallback.bind(this) });
},
_modifyPollCallback: function(r)
/* Create the folder list. Any pending notifications will be caught
* via the return from this call. */
- DimpCore.doAction('ListFolders', {}, null, this._folderLoadCallback.bind(this));
+ DimpCore.doAction('ListFolders', {}, { callback: this._folderLoadCallback.bind(this) });
/* Init quicksearch. These needs to occur before loading the message
* list since it may be disabled if we are in a search mailbox. */
},
/* 'action' -> if action begins with a '*', the exact string will be used
- * instead of sending the action to the IMP handler. */
- doAction: function(action, params, uids, callback, opts)
+ * instead of sending the action to the IMP handler.
+ * 'opts' -> ajaxopts, callback, uids */
+ doAction: function(action, params, opts)
{
- var b, tmp = {};
-
- opts = Object.extend(this.doActionOpts, opts || {});
- params = $H(params);
action = action.startsWith('*')
? action.substring(1)
: DIMP.conf.URI_AJAX + '/' + action;
+ params = $H(params);
+ opts = opts || {};
- if (uids) {
- if (uids.viewport_selection) {
- b = uids.getBuffer();
+ var b,
+ ajaxopts = Object.extend(this.doActionOpts, opts.ajaxopts || {}),
+ tmp = {};
+
+ if (opts.uids) {
+ if (opts.uids.viewport_selection) {
+ b = opts.uids.getBuffer();
if (b.getMetaData('search')) {
- uids.get('dataob').each(function(r) {
+ opts.uids.get('dataob').each(function(r) {
if (!tmp[r.view]) {
tmp[r.view] = [];
}
tmp[r.view].push(r.imapuid);
});
} else {
- tmp[b.getView()] = uids.get('uid');
+ tmp[b.getView()] = opts.uids.get('uid');
}
- uids = tmp;
+ opts.uids = tmp;
}
- params.set('uid', this.toRangeString(uids));
+ params.set('uid', this.toRangeString(opts.uids));
}
- opts.parameters = this.addRequestParams(params);
- opts.onComplete = function(t, o) { this.doActionComplete(t, callback); }.bind(this);
- new Ajax.Request(action, opts);
+ ajaxopts.parameters = this.addRequestParams(params);
+ ajaxopts.onComplete = function(t, o) { this.doActionComplete(t, opts.callback); }.bind(this);
+
+ new Ajax.Request(action, ajaxopts);
},
// params - (Hash)
break;
case 'ctx_contacts_add':
- this.doAction('AddContact', { name: baseelt.retrieve('personal'), email: baseelt.retrieve('email') }, null, true);
+ this.doAction('AddContact', { name: baseelt.retrieve('personal'), email: baseelt.retrieve('email') }, {}, true);
break;
}
},
confirmCancel: function()
{
if (window.confirm(DIMP.text_compose.cancel)) {
- DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'DeleteDraft' : 'CancelCompose', { imp_compose: $F('composeCache') });
+ DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'DeleteDraft' : 'CancelCompose', { imp_compose: $F('composeCache') }, { ajaxopts: { asynchronous: DIMP.conf_compose.qreply } });
this.updateDraftsMailbox();
return this.closeCompose();
}
// Use an AJAX submit here so that we can do javascript-y stuff
// before having to close the window on success.
- DimpCore.doAction('*' + DIMP.conf.URI_COMPOSE, c.serialize(true), null, this.uniqueSubmitCallback.bind(this));
+ DimpCore.doAction('*' + DIMP.conf.URI_COMPOSE, c.serialize(true), { callback: this.uniqueSubmitCallback.bind(this) });
}
},
$('composeMessageParent').childElements().invoke('hide');
$('composeMessage').show().setStyle({ visibility: null }).focus();
- DimpCore.doAction('Html2Text', { text: text }, null, this.setMessageText.bind(this), { asynchronous: false });
+ DimpCore.doAction('Html2Text', { text: text }, { callback: this.setMessageText.bind(this), ajaxopts: { asynchronous: false } });
} else {
this.editor_on = true;
if (!noupdate) {
- DimpCore.doAction('Text2Html', { text: $F('composeMessage') }, null, this.setMessageText.bind(this), { asynchronous: false });
+ DimpCore.doAction('Text2Html', { text: $F('composeMessage') }, { callback: this.setMessageText.bind(this), ajaxopts: { asynchronous: false } });
}
// Try to reuse the old fckeditor instance.