case 'ctx_vfolder_delete':
tmp = baseelt.up('LI');
if (window.confirm(DIMP.text.delete_folder.replace(/%s/, tmp.readAttribute('title')))) {
- DimpCore.doAction('DeleteMailbox', { mbox: tmp.retrieve('mbox') }, { callback: this._folderCallback.bind(this) });
+ DimpCore.doAction('DeleteMailbox', { mbox: tmp.retrieve('mbox') }, { callback: this._mailboxCallback.bind(this) });
}
break;
{
var bg, ppuid, row, search, tmp,
pm = $('previewMsg'),
- r = resp.response,
+ r = resp.response.preview,
t = $('msgHeadersContent').down('THEAD');
bg = (this.pp &&
dropbase = (drop == $('dropbase'));
if (dropbase ||
(ftype != 'special' && !this.isSubfolder(drag, drop))) {
- DimpCore.doAction('RenameMailbox', { old_name: drag.retrieve('mbox'), new_parent: dropbase ? '' : foldername, new_name: drag.retrieve('l') }, { callback: this._folderCallback.bind(this) });
+ DimpCore.doAction('RenameMailbox', { old_name: drag.retrieve('mbox'), new_parent: dropbase ? '' : foldername, new_name: drag.retrieve('l') }, { callback: this._mailboxCallback.bind(this) });
}
} else if (ftype != 'container') {
sel = this.viewport.getSelected();
}
if (action) {
- DimpCore.doAction(action, params, { callback: this._folderCallback.bind(this) });
+ DimpCore.doAction(action, params, { callback: this._mailboxCallback.bind(this) });
}
}
},
- /* Folder action callback functions. */
- _folderCallback: function(r)
+ /* Mailbox action callback functions. */
+ _mailboxCallback: function(r)
{
- r = r.response;
+ r = r.response.mailbox;
+
if (r.d) {
r.d.each(this.deleteFolder.bind(this));
}
_folderLoadCallback: function(r, callback)
{
- this._folderCallback(r);
+ this._mailboxCallback(r);
if (callback) {
callback();
* @return mixed False on failure, or an object with the following
* entries:
* <pre>
- * 'a' - (array) Mailboxes that were added.
- * 'c' - (array) Mailboxes that were changed.
- * 'd' - (array) Mailboxes that were deleted.
+ * 'mailbox' - (object) Mailboxes that were altered. Contains the
+ * following properties:
+ * 'a' - (array) Mailboxes that were added.
+ * 'c' - (array) Mailboxes that were changed.
+ * 'd' - (array) Mailboxes that were deleted.
* </pre>
*/
public function CreateMailbox($vars)
$new = Horde_String::convertCharset($vars->mbox, Horde_Nls::getCharset(), 'UTF7-IMAP');
try {
$new = $imptree->createMailboxName($vars->parent, $new);
- $result = $imp_folder->create($new, $GLOBALS['prefs']->getValue('subscribe'));
- if ($result) {
- $result = IMP_Dimp::getFolderResponse($imptree);
+ if ($result = $imp_folder->create($new, $GLOBALS['prefs']->getValue('subscribe'))) {
+ $result = new stdClass;
+ $result->mailbox = IMP_Dimp::getFolderResponse($imptree);
}
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
* @return mixed False on failure, or an object with the following
* entries:
* <pre>
- * 'a' - (array) Mailboxes that were added.
- * 'c' - (array) Mailboxes that were changed.
- * 'd' - (array) Mailboxes that were deleted.
+ * 'mailbox' - (object) Mailboxes that were altered. Contains the
+ * following properties:
+ * 'a' - (array) Mailboxes that were added.
+ * 'c' - (array) Mailboxes that were changed.
+ * 'd' - (array) Mailboxes that were deleted.
* </pre>
*/
public function DeleteMailbox($vars)
$result = $imp_folder->delete(array($vars->mbox));
}
- return $result
- ? IMP_Dimp::getFolderResponse($imptree)
- : $result;
+ if ($result) {
+ $result = new stdClass;
+ $result->mailbox = IMP_Dimp::getFolderResponse($imptree);
+ }
+
+ return $result;
}
/**
* @return mixed False on failure, or an object with the following
* entries:
* <pre>
- * 'a' - (array) Mailboxes that were added.
- * 'c' - (array) Mailboxes that were changed.
- * 'd' - (array) Mailboxes that were deleted.
+ * 'mailbox' - (object) Mailboxes that were altered. Contains the
+ * following properties:
+ * 'a' - (array) Mailboxes that were added.
+ * 'c' - (array) Mailboxes that were changed.
+ * 'd' - (array) Mailboxes that were deleted.
* </pre>
*/
public function RenameMailbox($vars)
if (($vars->old_name != $new) &&
$imp_folder->rename($vars->old_name, $new)) {
- $result = IMP_Dimp::getFolderResponse($imptree);
+
+ $result = new stdClass;
+ $result->mailbox = IMP_Dimp::getFolderResponse($imptree);
}
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
* @return mixed False on failure, or an object with the following
* entries:
* <pre>
- * 'a' - (array) Mailboxes that were added.
- * 'c' - (array) Mailboxes that were changed.
- * 'd' - (array) Mailboxes that were deleted.
+ * 'mailbox' - (object) Mailboxes that were altered. Contains the
+ * following properties:
+ * 'a' - (array) Mailboxes that were added.
+ * 'c' - (array) Mailboxes that were changed.
+ * 'd' - (array) Mailboxes that were deleted.
* 'quota' - (array) See _getQuota().
* </pre>
*/
}
}
- $result = IMP_Dimp::getFolderResponse($imptree, array(
+ $result = new stdClass;
+ $result->mailbox = IMP_Dimp::getFolderResponse($imptree, array(
'a' => array_values($folder_list),
'c' => array(),
'd' => array()
* string) - must be single index.
* </pre>
*
- * @return mixed False on failure, or an object with the keys defined
- * in IMP_View_ShowMessage::showMessage().
+ * @return mixed False on failure, or an object with the 'preview'
+ * property containing the return value from
+ * IMP_View_ShowMessage::showMessage().
*/
public function ShowPreview($vars)
{
'preview' => true,
'uid' => intval(reset($ptr['value']))
);
+ $result = new stdClass;
+ $result->preview = new stdClass;
try {
/* We know we are going to be exclusively dealing with this
* calls). Open R/W to clear the RECENT flag. */
$GLOBALS['imp_imap']->ob()->openMailbox($ptr['key'], Horde_Imap_Client::OPEN_READWRITE);
$show_msg = new IMP_Views_ShowMessage();
- $result = (object)$show_msg->showMessage($args);
- if (isset($result->error)) {
+ $result->preview = (object)$show_msg->showMessage($args);
+ if (isset($result->preview->error)) {
$result = $this->_checkUidvalidity($vars, $result);
}
} catch (Horde_Imap_Client_Exception $e) {
- $result = new stdClass;
- $result->error = $e->getMessage();
- $result->errortype = 'horde.error';
- $result->mailbox = $args['mailbox'];
- $result->uid = $args['uid'];
+ $result->preview->error = $e->getMessage();
+ $result->preview->errortype = 'horde.error';
+ $result->preview->mailbox = $args['mailbox'];
+ $result->preview->uid = $args['uid'];
}
return $result;