From 8caf79e1b0db4ea1a46aa14034901f571d30f742 Mon Sep 17 00:00:00 2001 From: richs Date: Mon, 24 Jul 2006 18:41:27 +0000 Subject: Improvements to Draft handling git-svn-id: https://svn.roundcube.net/trunk@281 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/steps/mail/compose.inc | 39 ++++++++++++---------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'roundcubemail/program/steps/mail/compose.inc') diff --git a/roundcubemail/program/steps/mail/compose.inc b/roundcubemail/program/steps/mail/compose.inc index 7e6d306bd..877948c53 100644 --- a/roundcubemail/program/steps/mail/compose.inc +++ b/roundcubemail/program/steps/mail/compose.inc @@ -22,16 +22,6 @@ require_once('Mail/mimeDecode.php'); - -$MESSAGE_FORM = NULL; -$REPLY_MESSAGE = NULL; -$FORWARD_MESSAGE = NULL; -$DRAFT_MESSAGE = NULL; - - -if (!is_array($_SESSION['compose'])) - $_SESSION['compose'] = array('id' => uniqid(rand())); - // remove an attachment if ($_action=='remove-attachment' && !empty($_GET['_filename'])) { @@ -47,6 +37,18 @@ if ($_action=='remove-attachment' && !empty($_GET['_filename'])) } } +$MESSAGE_FORM = NULL; +$REPLY_MESSAGE = NULL; +$FORWARD_MESSAGE = NULL; +$DRAFT_MESSAGE = NULL; + +// nothing below is called during message composition, only at "new/forward/reply/draft" initialization +// since there are many ways to leave the compose page improperly, it seems necessary to clean-up an old +// compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear + +rcmail_compose_cleanup(); +$_SESSION['compose'] = array('id' => uniqid(rand())); + // add some labels to client rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'savingmessage', 'messagesaved'); @@ -376,18 +378,9 @@ function rcmail_compose_body($attrib) $out = $form_start ? "$form_start\n" : ''; - // Check if a previous save was done so we can delete it upon the next save - if (!empty($_POST['_draft_newsaveid'])) - $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $_POST['_draft_newsaveid'])); - else if (strlen($DRAFT_MESSAGE['headers']->messageID) > 6) - $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); + $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); + $out .= $saveid->show(); - if ($saveid) - $out .= $saveid->show(); - - $newsaveid = new hiddenfield(array('name' => '_draft_newsaveid', 'value' => sprintf('%s@%s', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']) )); - $out .= $newsaveid->show(); - $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes')); $out .= $drafttoggle->show(); @@ -417,7 +410,9 @@ function rcmail_compose_body($attrib) rcube_add_label('checking'); } - + + $out .= ''; + return $out; } -- cgit v1.2.3