From 473733dc5137c985b846cfa1b8535be2da60a02a Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 10 Dec 2009 14:04:38 -0700 Subject: [PATCH] Correctly handle close_draft preference in all views --- imp/compose-dimp.php | 5 +++-- imp/compose-mimp.php | 8 +++++--- imp/compose.php | 12 +++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 2fce2fd3f..6c7db2810 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -98,12 +98,13 @@ if (count($_POST)) { $res = $imp_compose->saveDraft($header, Horde_Util::getFormData('message', ''), Horde_Nls::getCharset(), Horde_Util::getFormData('html')); $result->success = 1; - $imp_compose->destroy(); - if ($action == 'auto_save_draft') { $notification->push(_("Draft automatically saved."), 'horde.message'); } else { $notification->push($res); + if ($prefs->getValue('close_draft')) { + $imp_compose->destroy(); + } } } catch (IMP_Compose_Exception $e) { $notification->push($e, 'horde.error'); diff --git a/imp/compose-mimp.php b/imp/compose-mimp.php index 6f9248aa2..60943d1ff 100644 --- a/imp/compose-mimp.php +++ b/imp/compose-mimp.php @@ -245,9 +245,11 @@ case _("Send"): case _("Save Draft"): try { $notification->push($imp_compose->saveDraft($header, $message, Horde_Nls::getCharset(), false), 'horde.success'); - $imp_compose->destroy(); - require IMP_BASE . '/mailbox-mimp.php'; - exit; + if ($prefs->getValue('close_draft')) { + $imp_compose->destroy(); + require IMP_BASE . '/mailbox-mimp.php'; + exit; + } } catch (IMP_Compose_Exception $e) { $notification->push($e, 'horde.error'); } diff --git a/imp/compose.php b/imp/compose.php index 41c0686c3..7914783d9 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -404,19 +404,21 @@ case 'send_message': /* Closing draft if requested by preferences. */ if ($actionID == 'save_draft') { - $imp_compose->destroy(); - if ($isPopup) { if ($prefs->getValue('close_draft')) { + $imp_compose->destroy(); Horde_Util::closeWindowJS(); exit; } else { $notification->push($result, 'horde.success'); } } else { - $notification->push($result); - header('Location: ' . _mailboxReturnURL(false)); - exit; + $notification->push($result, 'horde.success'); + if ($prefs->getValue('close_draft')) { + $imp_compose->destroy(); + header('Location: ' . _mailboxReturnURL(false)); + exit; + } } } } catch (IMP_Compose_Exception $e) { -- 2.11.0