X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions_highlight.php;h=c6512c65a6fd3aa16f1db1bf8ecaf82a2457df8c;hb=6c359ab4303ce67243fbaa8b3eeb3cf3ba61ae83;hp=e50a54fedc00bf6d5ebeb2a79669cadc7d5255f8;hpb=d79e01f57042179bb540361915780eaeb0064e87;p=squirrelmail.git
diff --git a/src/options_highlight.php b/src/options_highlight.php
index e50a54fe..c6512c65 100644
--- a/src/options_highlight.php
+++ b/src/options_highlight.php
@@ -11,16 +11,22 @@
* $Id$
*/
-require_once('../src/validate.php');
-require_once('../functions/display_messages.php');
-require_once('../functions/imap.php');
-require_once('../functions/array.php');
-require_once('../functions/plugin.php');
+/* Path for SquirrelMail required files. */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/display_messages.php');
+require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/array.php');
+require_once(SM_PATH . 'functions/plugin.php');
+require_once(SM_PATH . 'functions/strings.php');
+require_once(SM_PATH . 'functions/html.php');
function oh_opt( $val, $sel, $tit ) {
echo "\n";
}
@@ -33,20 +39,20 @@ if (! isset($message_highlight_list)) {
if ($action == 'delete' && isset($theid)) {
removePref($data_dir, $username, "highlight$theid");
- header( "Location: $PHP_SELF" );
+ header( "Location: $SCRIPT_NAME" );
exit;
} else if ($action == 'save') {
if (!$theid) $theid = 0;
- $identname = ereg_replace(',', ' ', $identname);
+ $identname = str_replace(',', ' ', $identname);
if ($color_type == 1) $newcolor = $newcolor_choose;
elseif ($color_type == 2) $newcolor = $newcolor_input;
else $newcolor = $color_type;
- $newcolor = ereg_replace(',', '', $newcolor);
- $newcolor = ereg_replace('#', '', $newcolor);
- $newcolor = ereg_replace('"', '', $newcolor);
- $newcolor = ereg_replace('\'', '', $newcolor);
- $value = ereg_replace(',', ' ', $value);
+ $newcolor = str_replace(',', '', $newcolor);
+ $newcolor = str_replace('#', '', $newcolor);
+ $newcolor = str_replace('"', '', $newcolor);
+ $newcolor = str_replace('\'', '', $newcolor);
+ $value = str_replace(',', ' ', $value);
setPref($data_dir, $username, "highlight$theid", $identname.','.$newcolor.','.$value.','.$match_type);
$message_highlight_list[$theid]['name'] = $identname;
@@ -55,30 +61,56 @@ if ($action == 'delete' && isset($theid)) {
$message_highlight_list[$theid]['match_type'] = $match_type;
}
displayPageHeader($color, 'None');
-?>
-
-
-[' . _("New") . ']'.
+echo
+html_tag( 'table', "\n" .
+ html_tag( 'tr', "\n" .
+ html_tag( 'td', '' . _("Options") . ' - ' . _("Message Highlighting") . '', 'left')
+ ),
+ 'center', $color[9], 'width="95% border="0" cellpadding="1" cellspacing="0"' ) . "
\n" .
+html_tag( 'table', '', '', '', 'width="100% border="0" cellpadding="1" cellspacing="0"' ) .
+ html_tag( 'tr' ) . "\n" .
+ html_tag( 'td', '', 'left' );
+
+echo '[' . _("New") . ']'.
' - ['._("Done").']
'."\n";
if (count($message_highlight_list) >= 1) {
- echo ''."\n";
+ echo html_tag( 'table', '', 'center', '', 'width="80% border="0" cellpadding="3" cellspacing="0"' ) . "\n";
for ($i=0; $i < count($message_highlight_list); $i++) {
- echo ''.
- "".
- "[".
- _("Edit") .
- '] [' . _("Delete") . ']'.
- ' | '.
- htmlspecialchars($message_highlight_list[$i]['name']) .
- ' | '.
- $message_highlight_list[$i]['match_type'] . ' = ' .
- htmlspecialchars($message_highlight_list[$i]['value']).
- ' |
';
+ $match_type = '';
+ switch ($message_highlight_list[$i]['match_type'] ) {
+ case 'from' :
+ $match_type = _("From");
+ break;
+ case 'to' :
+ $match_type = _("To");
+ break;
+ case 'cc' :
+ $match_type = _("Cc");
+ break;
+ case 'to_cc' :
+ $match_type = _("To or Cc");
+ break;
+ case 'subject' :
+ $match_type = _("subject");
+ break;
+ }
+
+ echo html_tag( 'tr',
+ html_tag( 'td',
+ '[' .
+ _("Edit") .
+ '] [' . _("Delete") . ']' ,
+ 'left', $color[4], 'width="20%" nowrap' ) .
+ html_tag( 'td',
+ htmlspecialchars($message_highlight_list[$i]['name']) ,
+ 'left' ) .
+ html_tag( 'td',
+ $match_type . ' = ' .
+ htmlspecialchars($message_highlight_list[$i]['value']) ,
+ 'left' ) ,
+ '', $message_highlight_list[$i]['color'] ) . "\n";
}
echo "
\n".
"
\n";
@@ -244,20 +276,41 @@ if ($action == 'edit' || $action == 'add') {
}
}
}
+
+ if (isset($message_highlight_list[$theid]['color'])) {
+ $current_color = $message_highlight_list[$theid]['color'];
+ }
+ else {
+ $current_color = '63aa7f';
+ }
+
+ for($x = 0; $x < 5; $x++) {
+ for($y = 0; $y < 19; $y++) {
+ $gridindex = "$y,$x";
+ $gridcolor = $new_color_list[$gridindex];
+ if ($gridcolor == $current_color) {
+ $pre_defined_color = 1;
+ break;
+ }
+ }
+ }
+
if (!isset($message_highlight_list[$theid]['color']))
$selected_choose = ' checked';
+ else if ($pre_defined_color)
+ $selected_predefined = ' checked';
else if ($selected_choose == '')
$selected_input = ' checked';
echo '