From 0a17f9dd8eb6605ad63bfc216b0b3efd5d7b425c Mon Sep 17 00:00:00 2001 From: fallas Date: Sun, 28 Oct 2001 11:15:56 +0000 Subject: [PATCH] Added functionality to save an email as draft. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1634 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 52 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/src/compose.php b/src/compose.php index ae21388e..4569883f 100644 --- a/src/compose.php +++ b/src/compose.php @@ -33,7 +33,8 @@ // This function is used when not sending or adding attachments function newMail () { global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body, - $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size; + $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size, + $draft_id, $use_signature; $send_to = decodeHeader($send_to); $send_to_cc = decodeHeader($send_to_cc); @@ -44,6 +45,10 @@ elseif ($reply_id) $id = $reply_id; + if ($draft_id){ + $id = $draft_id; + $use_signature = FALSE; + } if (isset($id)) { sqimap_mailbox_select($imapConnection, $mailbox); @@ -73,7 +78,7 @@ } $body = ""; for ($i=0; isset($body_ary[$i]); $i++) { - if (! $forward_id) + if ($reply_id) { if (ereg('^[ >]+', $body_ary[$i])) { @@ -147,11 +152,16 @@ function getAttachments($message) { global $mailbox, $attachments, $attachment_dir, $imapConnection, - $ent_num, $forward_id; + $ent_num, $forward_id, $draft_id; + + if (isset($draft_id)) + $id = $draft_id; + else + $id = $forward_id; if (!$message) { sqimap_mailbox_select($imapConnection, $mailbox); - $message = sqimap_get_message($imapConnection, $forward_id, + $message = sqimap_get_message($imapConnection, $id, $mailbox); } @@ -175,7 +185,7 @@ // Write Attachment to file $fp = fopen ($attachment_dir.$localfilename, 'w'); fputs ($fp, decodeBody(mime_fetch_body($imapConnection, - $forward_id, $message->header->entity_id), + $id, $message->header->entity_id), $message->header->encoding)); fclose ($fp); @@ -195,7 +205,7 @@ $editor_size, $attachments, $subject, $newmail, $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox, $from_htmladdr_search, $location_of_buttons, $attachment_dir, - $username, $data_dir, $identity; + $username, $data_dir, $identity, $draft_id; $subject = decodeHeader($subject); $reply_subj = decodeHeader($reply_subj); @@ -216,6 +226,9 @@ do_hook("compose_form"); echo ">\n"; + if ( isset($draft_id)) + echo "\n"; + echo "\n"; if ($location_of_buttons == 'top') showComposeButtonRow(); @@ -355,7 +368,7 @@ } function showComposeButtonRow() { - global $use_javascript_addr_book; + global $use_javascript_addr_book, $save_as_draft; echo " \n"; @@ -419,6 +436,17 @@ if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None")) $mailbox = "INBOX"; + if (isset($draft)) { + require_once ('../src/draft_actions.php'); + if(! saveMessagetoDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $$reply_id)) { + showInputForm(); + exit(); + } else { + Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort&startMessage=1¬e=Draft%20Email%20Saved"); + exit(); + } + } + if (isset($send)) { if (isset($HTTP_POST_FILES['attachfile']) && $HTTP_POST_FILES['attachfile']['tmp_name'] && @@ -461,6 +489,11 @@ showInputForm(); exit(); } + if ( isset($delete_draft)) { + Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1"$ + exit(); + } + Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1"); } else { //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); @@ -541,6 +574,9 @@ if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num) getAttachments(0); + if (isset($draft_id) && $draft_id && isset($ent_num) && $ent_num) + getAttachments(0); + newMail(); showInputForm(); sqimap_logout($imapConnection); @@ -586,4 +622,4 @@ /* Build and return the citation string. */ return ($start . $orig_from . $end . "\n"); } -?> \ No newline at end of file +?> -- 2.25.1
\n \n"; if ($use_javascript_addr_book) { @@ -369,6 +382,10 @@ } echo "\n \n"; + if ($save_as_draft == true) + echo "\n"; + + do_hook("compose_button_row"); echo "