<?php
+
/**
- ** compose.php
+ ** compose.php
**
- ** Copyright (c) 1999-2000 The SquirrelMail development team
+ ** Copyright (c) 1999-2001 The SquirrelMail development team
** Licensed under the GNU GPL. For full terms see the file COPYING.
**
- ** This code sends a mail.
+ ** This code sends a mail.
**
- ** There are 3 modes of operation:
- ** - Start new mail
- ** - Add an attachment
- ** - Send mail
+ ** There are 4 modes of operation:
+ ** - Start new mail
+ ** - Add an attachment
+ ** - Send mail
+ ** - Save As Draft
**
- ** $Id$
+ ** $Id$
**/
require_once('../src/validate.php');
$body_ary[$i] = '> ' . $body_ary[$i];
}
}
- sqWordWrap($body_ary[$i], $editor_size - 1);
+ if (!$draft_id) {
+ sqWordWrap($body_ary[$i], $editor_size - 1);
+ }
$body .= $body_ary[$i] . "\n";
unset($body_ary[$i]);
}
$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, $draft_id;
+ $username, $data_dir, $identity, $draft_id, $delete_draft,
+ $mailprio;
$subject = decodeHeader($subject);
$reply_subj = decodeHeader($reply_subj);
do_hook("compose_form");
echo ">\n";
- if ( isset($draft_id))
+ if (isset($draft_id)) {
echo "<input type=\"hidden\" name=\"delete_draft\" value=\"$draft_id\">\n";
+ }
+ if (isset($delete_draft)) {
+ echo "<input type=\"hidden\" name=\"delete_draft\" value=\"$delete_draft\">\n";
+ }
echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
// This code is for attachments
echo " <tr>\n";
- echo " <TD BGCOLOR=\"$color[0]\" VALIGN=TOP ALIGN=RIGHT>\n";
- echo " <SMALL><BR></SMALL>"._("Attach:");
+ echo " <TD BGCOLOR=\"$color[0]\" VALIGN=MIDDLE ALIGN=RIGHT>\n";
+ echo _("Attach:");
echo " </td><td ALIGN=left BGCOLOR=\"$color[0]\">\n";
echo " <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
echo " <input type=\"submit\" name=\"attach\"";
printf("<INPUT TYPE=hidden NAME=mailbox VALUE=\"%s\">\n", htmlspecialchars($mailbox));
echo "</FORM>";
do_hook("compose_bottom");
+ echo "</BODY></HTML>\n";
}
function showComposeButtonRow() {
- global $use_javascript_addr_book, $save_as_draft;
+ global $use_javascript_addr_book, $save_as_draft,
+ $default_use_priority, $mailprio;
echo " <TR><td>\n </td><td>\n";
if ($use_javascript_addr_book) {
}
echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
- if ($save_as_draft == true)
- echo "<input type=\"submit\" name =\"draft\" value=\"Save Draft\">\n";
-
+ if ($save_as_draft) {
+ echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n";
+ }
+ if ($default_use_priority) {
+ if(!isset($mailprio)) {
+ $mailprio = "3";
+ }
+ echo "\n\t". _("Priority") .":<select name=\"mailprio\">".
+ "\n\t\t<option value=1".($mailprio=="1"?" selected":"").">". _("High") ."</option>".
+ "\n\t\t<option value=3".($mailprio=="3"?" selected":"").">". _("Normal") ."</option>".
+ "\n\t\t<option value=5".($mailprio=="5"?" selected":"").">". _("Low")."</option>".
+ "\n\t</select>";
+ }
do_hook("compose_button_row");
// True if FAILURE
function saveAttachedFiles() {
global $HTTP_POST_FILES, $attachment_dir, $attachments;
-
+
$localfilename = GenerateRandomString(32, '', 7);
while (file_exists($attachment_dir . $localfilename))
$localfilename = GenerateRandomString(32, '', 7);
$attachments[] = $newAttachment;
}
- if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
+ 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)) {
+ if (!saveMessageAsDraft($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();
+ $draft_message = _("Draft Email Saved");
+ /* If this is a resumed draft, then delete the original */
+ if(isset($delete_draft)) {
+ Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1");
+ exit();
+ } else {
+ Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort&startMessage=1¬e=$draft_message");
+ exit();
+ }
}
}
do_hook("compose_send");
- if (! sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id)) {
+ if (! isset($mailprio))
+ $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
+ $subject, $body, $reply_id);
+ else
+ $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
+ $subject, $body, $reply_id, $mailprio);
+ if (! $Result) {
showInputForm();
exit();
}
if ( isset($delete_draft)) {
- Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1"$
+ Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1");
exit();
}