From 9d157cec2821461fe4d348a47e2312db5e84c052 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sun, 18 Jun 2000 05:25:12 +0000 Subject: [PATCH] Added basic support for message highlighting. Note that this needs quite a bit of work yet, because there is no error correction in the data entry under the options menu. But it works. :) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@545 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + doc/sqimap.php3 | 2 ++ functions/mailbox_display.php | 23 +++++++++---- src/load_prefs.php | 7 ++++ src/msg_highlight.php | 61 +++++++++++++++++++++++++++++++++++ src/options.php | 23 +++++++++++++ 6 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 src/msg_highlight.php diff --git a/ChangeLog b/ChangeLog index 292ec2d8..8a19bc9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Version 0.5pre1 -- DEVELOPMENT ------------------------------ +- Added support for message highlighting - Moved Address and Send buttons on Compose form for easier access - Added Polish translation from Lukasz Klimek diff --git a/doc/sqimap.php3 b/doc/sqimap.php3 index 59afe6ef..bb0e2918 100644 --- a/doc/sqimap.php3 +++ b/doc/sqimap.php3 @@ -1,3 +1,4 @@ +

SquirrelMail IMAP functions

+ diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index e52c4f9b..afdbdb5c 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -13,6 +13,7 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) { global $color, $msgs, $msort; global $sent_folder; + global $message_highlight_list; $msg = $msgs[$key]; @@ -25,12 +26,21 @@ if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; } if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } - echo " \n"; - echo " $italic$bold$flag$senderName$flag_end$bold_end$italic_end\n"; - echo "
$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end
\n"; - if ($msg["FLAG_ANSWERED"] == true) echo " A"; - else echo "  "; - echo " $bold$flag$subject$flag_end$bold_end\n"; + for ($i=0; $i < count($message_highlight_list); $i++) { + if (eregi($message_highlight_list[$i]["value"],$msg["FROM"])) { + $hlt_color = $message_highlight_list[$i]["color"]; + continue; + } + } + if (!$hlt_color) + $hlt_color = $color[4]; + + echo " \n"; + echo " $italic$bold$flag$senderName$flag_end$bold_end$italic_end\n"; + echo "
$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end
\n"; + if ($msg["FLAG_ANSWERED"] == true) echo " A"; + else echo "  "; + echo " $bold$flag$subject$flag_end$bold_end\n"; echo "\n"; } @@ -41,6 +51,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) { global $msgs, $msort; global $sent_folder; + global $message_highlight_list; if (!$use_cache) { if ($numMessages >= 1) { diff --git a/src/load_prefs.php b/src/load_prefs.php index c562f1ba..2a24938c 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -101,4 +101,11 @@ $user_language = en; } + // highlightX comes in with the form: name,color,header,value + for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) { + $ary = explode(",", $hlt); + $message_highlight_list[$i]["name"] = $ary[0]; + $message_highlight_list[$i]["color"] = $ary[1]; + $message_highlight_list[$i]["value"] = $ary[2]; + } ?> diff --git a/src/msg_highlight.php b/src/msg_highlight.php new file mode 100644 index 00000000..bbcff874 --- /dev/null +++ b/src/msg_highlight.php @@ -0,0 +1,61 @@ +\n"; + echo "
" . _("Message Highlighting") . "

\n"; + + + if ($action == "save") { + if (!$id) $id = 0; + setPref($data_dir, $username, "highlight$id", $name.",".$newcolor.",".$value); + echo "saved"; + } else { + if (!isset($id)) $id = count($message_highlight_list); + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo _("Identifying name") . ":"; + echo " \n"; + echo " "; + echo "
\n"; + echo _("Color") . ":"; + echo " \n"; + echo " "; + echo "
\n"; + echo _("Match") . ":"; + echo " \n"; + echo " "; + echo "
\n"; + echo "
\n"; + echo "
\n"; + } + echo ""; +?> diff --git a/src/options.php b/src/options.php index 58ff03e3..b8acd1e8 100644 --- a/src/options.php +++ b/src/options.php @@ -403,6 +403,29 @@ echo "
Signature:

"; echo ""; + // MESSAGE HIGHLIGHTING + echo "
\n"; + echo "
" . _("Message Highlighting") . " - [" . _("New") . "]

\n"; + if (count($message_highlight_list) >= 1) { + echo "\n"; + for ($i=0; $i < count($message_highlight_list); $i++) { + echo "\n"; + echo " "; + echo " \n"; + echo " \n"; + echo "\n"; + } + echo "
\n"; + echo "[" . _("Edit") . "] ["._("Delete")."]\n"; + echo " \n"; + echo " " . $message_highlight_list[$i]["name"]; + echo " \n"; + echo " " . $message_highlight_list[$i]["value"]; + echo "
\n"; + } else { + echo "
" . _("No highlighting is defined") . "

\n"; + } + echo "
\n"; // SUBMIT BUTTON echo "