From: Michael M Slusarz Date: Fri, 26 Jun 2009 17:19:43 +0000 (-0600) Subject: Update drafts mailbox in base screen if drafts have been added/removed X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d95a13e04b62aa286a1a8d6f7da280309adf1461;p=horde.git Update drafts mailbox in base screen if drafts have been added/removed --- diff --git a/imp/js/src/compose-dimp.js b/imp/js/src/compose-dimp.js index 0cc3a2e55..529c9fb8f 100644 --- a/imp/js/src/compose-dimp.js +++ b/imp/js/src/compose-dimp.js @@ -10,8 +10,8 @@ var DimpCompose = { // Variables defaulting to empty/false: // auto_save_interval, button_pressed, compose_cursor, dbtext, - // editor_on, mp_padding, resizebcc, resizecc, resizeto, row_height, - // sbtext, skip_spellcheck, spellcheck, uploading + // drafts_mbox, editor_on, mp_padding, resizebcc, resizecc, resizeto, + // row_height, sbtext, skip_spellcheck, spellcheck, uploading last_msg: '', textarea_ready: true, @@ -19,10 +19,19 @@ var DimpCompose = { { if (window.confirm(DIMP.text_compose.cancel)) { DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'DeleteDraft' : 'CancelCompose', { imp_compose: $F('composeCache') }); + this.updateDraftsMailbox(); return this.closeCompose(); } }, + updateDraftsMailbox: function() + { + if (DIMP.baseWindow && + DIMP.baseWindow.DimpBase.folder == DIMP.conf_compose.drafts_mbox) { + DIMP.baseWindow.DimpBase.poll(); + } + }, + closeCompose: function() { if (DIMP.conf_compose.qreply) { @@ -216,19 +225,18 @@ var DimpCompose = { if (d.success || d.action == 'add_attachment') { switch (d.action) { case 'auto_save_draft': - this.button_pressed = false; - break; - case 'save_draft': this.button_pressed = false; - if (DIMP.baseWindow) { - DIMP.baseWindow.DimpBase.poll(); - if (!DIMP.conf_compose.qreply) { + + this.updateDraftsMailbox(); + + if (d.action == 'save_draft') { + if (DIMP.baseWindow && !DIMP.conf_compose.qreply) { DIMP.baseWindow.DimpCore.showNotifications(r.msgs); } - } - if (DIMP.conf_compose.close_draft) { - return this.closeCompose(); + if (DIMP.conf_compose.close_draft) { + return this.closeCompose(); + } } break; diff --git a/imp/templates/javascript_defs_dimp.php b/imp/templates/javascript_defs_dimp.php index 721ea051a..8cbc5612a 100644 --- a/imp/templates/javascript_defs_dimp.php +++ b/imp/templates/javascript_defs_dimp.php @@ -134,6 +134,7 @@ if ($compose_mode) { 'cc' => intval($GLOBALS['prefs']->getValue('compose_cc')), 'close_draft' => intval($GLOBALS['prefs']->getValue('close_draft')), 'compose_cursor' => ($compose_cursor ? $compose_cursor : 'top'), + 'drafts_mbox' => IMP::folderPref($GLOBALS['prefs']->getValue('drafts_folder'), true), 'rte_avail' => intval($GLOBALS['browser']->hasFeature('rte')), 'spellcheck' => intval($GLOBALS['prefs']->getValue('compose_spellcheck')), ));