$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');
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');
}
/* 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) {