function displayPageHeader($color, $mailbox) {
- global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top;
+ global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win, $username, $datadir;
displayHtmlHeader ();
"if( pos >= 0 ) {\n".
"document.forms[i-1].elements[pos].focus();\n".
"}\n".
- "}\n".
- "// -->\n".
- "</script>\n";
+ "}\n";
+ if ($compose_new_win == '1') {
+ $width= getPref($username, $datadir, 'editor_size', 76);
+ if ($width < 65) {
+ $pix_width = 560;
+ }
+ else {
+ $width = (.9*$width);
+ $pix_width = intval($width).'0';
+ }
+ echo "function comp_in_new() {\n".
+ " var newwin = window.open(\"".$base_uri."src/compose.php\"".
+ ", \"compose_window\", \"width=".$pix_width.",height=650".
+ ",scrollbars=yes,resizable=yes\");\n".
+ "}\n";
+ }
+ echo "// -->\n".
+ "</script>\n";
$onload = "onLoad=\"checkForm();\"";
break;
}
echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
-
/** Here is the header and wrapping table **/
$shortBoxName = readShortMailboxName($mailbox, $delimiter);
if ( $shortBoxName == 'INBOX' ) {
. " <TR BGCOLOR=\"$color[4]\">\n"
. " <TD ALIGN=left>\n";
$urlMailbox = urlencode($mailbox);
- displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
+ if ($compose_new_win == '1') {
+ echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
+ '"compose_window" onClick="comp_in_new()">Compose</a>';
+ }
+ else {
+ displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
+ }
echo " \n";
displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
echo " \n";
"</TABLE>\n\n";
}
+/* blatently copied/truncated/modified from the above function */
+function compose_Header($color, $mailbox) {
+
+ global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
+
+ displayHtmlHeader ('Compose');
+
+ $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
+ if (!isset($frame_top)) {
+ $frame_top = '_top';
+ }
+
+ /*
+ Locate the first displayable form element
+ */
+ switch ( $module ) {
+ case 'src/search.php':
+ $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
+ $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
+ break;
+ default:
+ echo '<script language="JavaScript">' .
+ "\n<!--\n" .
+ "function checkForm() {\n".
+ "var f = document.forms.length;\n".
+ "var i = 0;\n".
+ "var pos = -1;\n".
+ "while( pos == -1 && i < f ) {\n".
+ "var e = document.forms[i].elements.length;\n".
+ "var j = 0;\n".
+ "while( pos == -1 && j < e ) {\n".
+ "if ( document.forms[i].elements[j].type == 'text' ) {\n".
+ "pos = j;\n".
+ "}\n".
+ "j++;\n".
+ "}\n".
+ "i++;\n".
+ "}\n".
+ "if( pos >= 0 ) {\n".
+ "document.forms[i-1].elements[pos].focus();\n".
+ "}\n".
+ "}\n";
+ if ($compose_new_win == '1') {
+ $width= getPref($username, $datadir, 'editor_size', 76);
+ if ($width < 65) {
+ $pix_width = 560;
+ }
+ else {
+ $width = (.9*$width);
+ $pix_width = intval($width).'0';
+ }
+ echo "function comp_in_new() {\n".
+ " var newwin = window.open(\"".$base_uri."src/compose.php\"".
+ ", \"compose_window\", \"width=".$pix_width.",height=650".
+ ",scrollbars=yes,resizable=yes\");\n".
+ "}\n";
+ }
+ echo "// -->\n".
+ "</script>\n";
+ $onload = "onLoad=\"checkForm();\"";
+ break;
+
+ }
+
+ echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
+}
?>
')?@' . $Host_RegExp_Match;
function parseEmail (&$body) {
- global $color, $Email_RegExp_Match;
+ global $color, $Email_RegExp_Match, $compose_new_win;
$Size = strlen($body);
/*
*/
if( eregi($Email_RegExp_Match, $body, $regs) ) {
- $body = str_replace($regs[0], '<a href="../src/compose.php?send_to='.
+ if ($compose_new_win == '1') {
+ $body = str_replace($regs[0], '<a href="../src/compose.php?send_to='.urlencode($regs[0]).'" target="compose_window" onClick="comp_in_new()">'.$regs[0].'</a>', $body);
+ }
+ else {
+ $body = str_replace($regs[0], '<a href="../src/compose.php?send_to='.
urlencode($regs[0]).'">'.$regs[0].'</a>', $body);
+ }
}
/* If there are any changes, it'll just get bigger. */
function plugin_listcommands_menu() {
global $imapConnection, $passed_id, $color, $mailbox,
- $subject, $ent_num, $priority_level;
+ $subject, $ent_num, $priority_level, $compose_new_win;
/**
* Array of commands we can deal with from the header. The Reply option
if (isset($purl['query'])) {
$url .= '&' . $purl['query'];
}
-
- $output[] = '<A HREF="' . $url . '">' . $fieldsdescr[$cmd] . '</A>';
-
+ if ($compose_new_win == '1') {
+ $output[] = '<A HREF="' . $url . '" target="compose_window" onClick="comp_in_new()">' . $fieldsdescr[$cmd] . '</A>';
+ }
+ else {
+ $output[] = '<A HREF="' . $url . '">' . $fieldsdescr[$cmd] . '</A>';
+ }
if ($cmd == 'Post') {
$url .= '&reply_subj=' . urlencode($subject)
. '&reply_id=' . $passed_id
. '&ent_num=' . $ent_num
. '&mailprio=' . $priority_level;
+ if ($compose_new_win == '1') {
+ $output[] = '<A HREF="' . $url . '" target="compose_window" onClick="comp_in_new()">' . $fieldsdescr['Reply'] . '</A>';
+ }
+ else {
$output[] = '<A HREF="' . $url . '">' . $fieldsdescr['Reply'] . '</A>';
}
+ }
} else if (eregi('^(http|ftp)', $url)) {
$output[] = '<A HREF="' . $url . '" TARGET="_blank">'
. $fieldsdescr[$cmd] . '</A>';
/* --- End functions --- */
global $mailbox;
-displayPageHeader($color, $mailbox);
-
+if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+}
+else {
+ displayPageHeader($color, $mailbox);
+}
/* Initialize addressbook */
$abook = addressbook_init();
'<TD VALIGN=top NOWRAP WIDTH="1%"> ' . $row['name'] .
' </TD>',
'<TD VALIGN=top NOWRAP WIDTH="1%"> ' .
- '<A HREF="compose.php?send_to=' . rawurlencode($row['email']) .
- '">' . $row['email'] . '</A> </TD>'."\n",
+ '<A HREF="compose.php?send_to=' . rawurlencode($row['email']);
+ if ($compose_new_win == '1') {
+ echo '" TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '">' . $row['email'] . '</A> </TD>'."\n",
'<TD VALIGN=top WIDTH="1%"> ' . $row['label'] . ' </TD>' .
"</TR>\n";
$line++;
/* 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");
+ "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes");
exit();
- } else {
+ }
+ else {
+ if ($compose_new_win == '1') {
+ Header("Location: compose.php?saved_draft=yes");
+ exit();
+ }
+ else {
Header("Location: right_main.php?mailbox=$draft_folder&sort=$sort".
"&startMessage=1¬e=$draft_message");
exit();
+ }
}
}
}
}
if ( isset($delete_draft)) {
Header("Location: delete_message.php?mailbox=$draft_folder".
- "&message=$delete_draft&sort=$sort&startMessage=1");
+ "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
exit();
}
-
- Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
- "&startMessage=1");
+ if ($compose_new_win == '1') {
+ Header("Location: compose.php?mail_sent=yes");
+ }
+ else {
+ Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort".
+ "&startMessage=1");
+ }
} else {
/*
*$imapConnection = sqimap_login($username, $key, $imapServerAddress,
* $imapPort, 0);
*/
- displayPageHeader($color, $mailbox);
-
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
if (isset($AttachFailure)) {
plain_error_message(_("Could not move/copy file. File not attached"),
$color);
}
}
elseif (isset($html_addr_search_done)) {
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
if (isset($send_to_search) && is_array($send_to_search)) {
foreach ($send_to_search as $k => $v) {
if (saveAttachedFiles()) {
plain_error_message(_("Could not move/copy file. File not attached"), $color);
}
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
showInputForm();
}
elseif (isset($do_delete)) {
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
if (isset($delete) && is_array($delete)) {
*/
$imapConnection = sqimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
- displayPageHeader($color, $mailbox);
+ if ($compose_new_win == '1') {
+ compose_Header($color, $mailbox);
+ }
+ else {
+ displayPageHeader($color, $mailbox);
+ }
$newmail = true;
$use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
$from_htmladdr_search, $location_of_buttons, $attachment_dir,
$username, $data_dir, $identity, $draft_id, $delete_draft,
- $mailprio, $default_use_mdn, $mdn_user_support;
+ $mailprio, $default_use_mdn, $mdn_user_support, $compose_new_win,
+ $saved_draft, $mail_sent;
$subject = decodeHeader($subject, false);
$reply_subj = decodeHeader($reply_subj, false);
if (isset($delete_draft)) {
echo '<input type="hidden" name="delete_draft" value="' . $delete_draft. "\">\n";
}
-
+ if ($saved_draft == 'yes') {
+ echo '<BR><CENTER><B>'. _("Draft Saved").'</CENTER></B>';
+ }
+ if ($mail_sent == 'yes') {
+ echo '<BR><CENTER><B>'. _("Your Message has been sent").'</CENTER></B>';
+ }
echo '<TABLE WIDTH="100%" ALIGN=center CELLSPACING=0 BORDER=0>' . "\n";
-
+ if ($compose_new_win == '1') {
+ echo ' <TR><TD></TD><TD ALIGN="RIGHT"><INPUT TYPE="BUTTON" NAME="Close" onClick="return self.close()" VALUE="Close"></TD></TR>'."\n";
+ }
if ($location_of_buttons == 'top') {
showComposeButtonRow();
}
if ($auto_expunge) {
sqimap_mailbox_expunge($imapConnection, $mailbox, true);
}
+if (!isset($saved_draft)) {
+ $saved_draft = '';
+}
$location = get_location();
if (isset($where) && isset($what)) {
header("Location: $location/search.php?where=" . urlencode($where) .
'&what=' . urlencode($what) . '&mailbox=' . urlencode($mailbox));
} else {
+ if ($compose_new_win == '1') {
+ header("Location: $location/compose.php?mail_sent=$mail_sent&saved_draft=$saved_draft");
+ }
+ else {
header("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=" .
urlencode($mailbox));
+ }
}
sqimap_logout($imapConnection);
$date_format = getPref($data_dir, $username, 'date_format', 3);
$hour_format = getPref($data_dir, $username, 'hour_format', 2);
+/* compose in new window setting */
+$compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
+
/* Load the javascript settings. */
$javascript_setting =
getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT);
do_hook('loading_prefs');
-?>
\ No newline at end of file
+?>
'refresh' => SMOPT_REFRESH_NONE
);
}
-
+ $optvals[SMOPT_GRP_MESSAGE][] = array(
+ 'name' => 'compose_new_win',
+ 'caption' => _("Always compose in a new window"),
+ 'type' => SMOPT_TYPE_BOOLEAN,
+ 'refresh' => SMOPT_REFRESH_ALL
+ );
/* Assemble all this together and return it as our result. */
$result = array(
'grps' => $optgrps,
}
}
}
+else {
+ $cc_string = '';
+}
/** FORMAT THE BCC STRING **/
$i = 0;
}
}
}
+else {
+ $bcc_string = '';
+}
if ($default_use_priority) {
$priority_level = substr($message->header->priority,0,1);
echo _("Delete") . '</A> ';
if (($mailbox == $draft_folder) && ($save_as_draft)) {
echo '| <A HREF="' . $base_uri .
- "src/compose.php?mailbox=$mailbox&send_to=$to_string&send_to_cc=$cc_string&send_to_bcc=$bcc_string&subject=$url_subj&draft_id=$passed_id&ent_num=$ent_num\">".
+ "src/compose.php?mailbox=$mailbox&send_to=$to_string&send_to_cc=$cc_string&send_to_bcc=$bcc_string&subject=$url_subj&draft_id=$passed_id&ent_num=$ent_num\"";
+ if ($compose_new_win == '1') {
+ echo 'TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '>'.
_("Resume Draft") . '</a>';
}
'<SMALL>' .
'<A HREF="' . $base_uri . "src/compose.php?forward_id=$passed_id&forward_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"")
- ."mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ ."mailbox=$urlMailbox&ent_num=$ent_num\"";
+ if ($compose_new_win == '1') {
+ echo 'TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '>'.
_("Forward") .
'</A> | ' .
'<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replyto&reply_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"").
- "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\"";
+ if ($compose_new_win == '1') {
+ echo 'TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '>'.
_("Reply") .
'</A> | ' .
'<A HREF="' . $base_uri . "src/compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&".
($default_use_priority?"mailprio=$priority_level&":"").
- "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">" .
+ "reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\"";
+ if ($compose_new_win == '1') {
+ echo 'TARGET="compose_window" onClick="comp_in_new()"';
+ }
+ echo '>'.
_("Reply All") .
'</A> ' .
'</SMALL>' .