Changed language-code link.
[squirrelmail.git] / src / options_highlight.php
CommitLineData
9d157cec 1<?php
ef870322 2 /**
c36ed9cf 3 ** options_highlight.php
ef870322 4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
c36ed9cf 8 ** Displays message highlighting options
9 **
ef870322 10 **/
11
9d157cec 12 session_start();
13
14 if (!isset($config_php))
15 include("../config/config.php");
16 if (!isset($strings_php))
17 include("../functions/strings.php");
18 if (!isset($page_header_php))
19 include("../functions/page_header.php");
c36ed9cf 20 if (!isset($display_messages_php))
21 include("../functions/display_messages.php");
22 if (!isset($imap_php))
23 include("../functions/imap.php");
24 if (!isset($array_php))
25 include("../functions/array.php");
9d157cec 26 if (!isset($i18n_php))
27 include("../functions/i18n.php");
d7d3c4d4 28 if (!isset($plugin_php))
29 include("../functions/plugin.php");
9d157cec 30
9d157cec 31
e4bf514f 32 if ($action == "delete" && isset($theid)) {
33 removePref($data_dir, $username, "highlight$theid");
44f642f5 34 } else if ($action == "save") {
e4bf514f 35 if (!$theid) $theid = 0;
36 $identname = ereg_replace(",", " ", $identname);
acb61cb4 37 $identname = str_replace("\\\\", "\\", $identname);
38 $identname = str_replace("\\\"", "\"", $identname);
39 $identname = str_replace("\"", "&quot;", $identname);
44f642f5 40 if ($color_type == 1) $newcolor = $newcolor_choose;
41 else $newcolor = $newcolor_input;
c36ed9cf 42
44f642f5 43 $newcolor = ereg_replace(",", "", $newcolor);
44 $newcolor = ereg_replace("#", "", $newcolor);
45 $newcolor = "$newcolor";
46 $value = ereg_replace(",", " ", $value);
acb61cb4 47 $value = str_replace("\\\\", "\\", $value);
48 $value = str_replace("\\\"", "\"", $value);
49 $value = str_replace("\"", "&quot;", $value);
50
e4bf514f 51 setPref($data_dir, $username, "highlight$theid", $identname.",".$newcolor.",".$value.",".$match_type);
52 $message_highlight_list[$theid]["name"] = $identname;
53 $message_highlight_list[$theid]["color"] = $newcolor;
54 $message_highlight_list[$theid]["value"] = $value;
55 $message_highlight_list[$theid]["match_type"] = $match_type;
c36ed9cf 56 }
44f642f5 57 include("../src/load_prefs.php");
58 displayPageHeader($color, "None");
c36ed9cf 59?>
e9f8ea4e 60 <br>
6170c5b6 61 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
62 <center><b><?php echo _("Options") . " - " . _("Message Highlighting"); ?></b></center>
c36ed9cf 63 </td></tr></table>
64
8442ac08 65<?php
c36ed9cf 66 echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]";
67 echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n";
44f642f5 68 if (count($message_highlight_list) >= 1) {
69 echo "<table border=0 cellpadding=3 cellspacing=0 align=center width=80%>\n";
70 for ($i=0; $i < count($message_highlight_list); $i++) {
71 echo "<tr>\n";
72 echo " <td width=1% bgcolor=" . $color[4] . ">\n";
e4bf514f 73 echo "<nobr><small>[<a href=\"options_highlight.php?action=edit&theid=$i\">" . _("Edit") . "</a>]&nbsp;[<a href=\"options_highlight.php?action=delete&theid=$i\">"._("Delete")."</a>]</small></nobr>\n";
44f642f5 74 echo " </td>";
75 echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
76 echo " " . $message_highlight_list[$i]["name"];
77 echo " </td>\n";
78 echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
3e69e88b 79 echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"];
44f642f5 80 echo " </td>\n";
81 echo "</tr>\n";
82 }
83 echo "</table>\n";
84 echo "<br>\n";
9d157cec 85 } else {
44f642f5 86 echo "<center>" . _("No highlighting is defined") . "</center><br>\n";
87 echo "<br>\n";
88 }
89 if ($action == "edit" || $action == "add") {
e4bf514f 90 if (!isset($theid)) $theid = count($message_highlight_list);
c36ed9cf 91
44f642f5 92 $color_list[0] = "4444aa";
93 $color_list[1] = "44aa44";
94 $color_list[2] = "aaaa44";
95 $color_list[3] = "44aaaa";
96 $color_list[4] = "aa44aa";
97 $color_list[5] = "aaaaff";
98 $color_list[6] = "aaffaa";
99 $color_list[7] = "ffffaa";
100 $color_list[8] = "aaffff";
101 $color_list[9] = "ffaaff";
102 $color_list[10] = "aaaaaa";
103 $color_list[11] = "bfbfbf";
104 $color_list[12] = "dfdfdf";
c36ed9cf 105 $color_list[13] = "ffffff";
44f642f5 106 for ($i=0; $i < 14; $i++) {
e4bf514f 107 if ($color_list[$i] == $message_highlight_list[$theid]["color"]) {
44f642f5 108 $selected_choose = " checked";
109 ${"selected".$i} = " selected";
110 continue;
111 }
112 }
e4bf514f 113 if (!$message_highlight_list[$theid]["color"])
3e69e88b 114 $selected_choose = " checked";
c36ed9cf 115 else if (!$selected_choose)
44f642f5 116 $selected_input = " checked";
c36ed9cf 117
d7d3c4d4 118 echo "<form name=f action=\"options_highlight.php\">\n";
9d157cec 119 echo "<input type=\"hidden\" value=\"save\" name=\"action\">\n";
e4bf514f 120 echo "<input type=\"hidden\" value=\"$theid\" name=\"theid\">\n";
e9f8ea4e 121 echo "<table width=80% align=center cellpadding=3 cellspacing=0 border=0>\n";
122 echo " <tr bgcolor=\"$color[0]\">\n";
123 echo " <td align=right width=25%><b>\n";
9d157cec 124 echo _("Identifying name") . ":";
e9f8ea4e 125 echo " </b></td>\n";
429f8906 126 echo " <td width=75%>\n";
acb61cb4 127 $disp = $message_highlight_list[$theid]["name"];
128 $disp = str_replace("\\\\", "\\", $disp);
129 $disp = str_replace("\\\"", "\"", $disp);
130 $disp = str_replace("\"", "&quot;", $disp);
131 echo " <input type=\"text\" value=\"".$disp."\" name=\"identname\">";
9d157cec 132 echo " </td>\n";
133 echo " </tr>\n";
e9f8ea4e 134 echo " <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
135 echo " <tr bgcolor=\"$color[0]\">\n";
136 echo " <td align=right width=25%><b>\n";
9d157cec 137 echo _("Color") . ":";
e9f8ea4e 138 echo " </b></td>\n";
429f8906 139 echo " <td width=75%>\n";
44f642f5 140 echo " <input type=\"radio\" name=color_type value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
141 echo " <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
142 echo " <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
143 echo " <option value=\"$color_list[2]\"$selected2>" . _("Dark Yellow") . "\n";
144 echo " <option value=\"$color_list[3]\"$selected3>" . _("Dark Cyan") . "\n";
145 echo " <option value=\"$color_list[4]\"$selected4>" . _("Dark Magenta") . "\n";
146 echo " <option value=\"$color_list[5]\"$selected5>" . _("Light Blue") . "\n";
147 echo " <option value=\"$color_list[6]\"$selected6>" . _("Light Green") . "\n";
148 echo " <option value=\"$color_list[7]\"$selected7>" . _("Light Yellow") . "\n";
149 echo " <option value=\"$color_list[8]\"$selected8>" . _("Light Cyan") . "\n";
150 echo " <option value=\"$color_list[9]\"$selected9>" . _("Light Magenta") . "\n";
151 echo " <option value=\"$color_list[10]\"$selected10>" . _("Dark Gray") . "\n";
152 echo " <option value=\"$color_list[11]\"$selected11>" . _("Medium Gray") . "\n";
153 echo " <option value=\"$color_list[12]\"$selected12>" . _("Light Gray") . "\n";
154 echo " <option value=\"$color_list[13]\"$selected13>" . _("White") . "\n";
155 echo " </select><br>\n";
c36ed9cf 156 echo " <input type=\"radio\" name=color_type value=2$selected_input> &nbsp;". _("Other:") ."<input type=\"text\" value=\"";
e4bf514f 157 if ($selected_input) echo $message_highlight_list[$theid]["color"];
44f642f5 158 echo "\" name=\"newcolor_input\" size=7> "._("Ex: 63aa7f")."<br>\n";
9d157cec 159 echo " </td>\n";
160 echo " </tr>\n";
e9f8ea4e 161 echo " <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
162 echo " <tr bgcolor=\"$color[0]\">\n";
163 echo " <td align=right width=25%><b>\n";
9d157cec 164 echo _("Match") . ":";
e9f8ea4e 165 echo " </b></td>\n";
429f8906 166 echo " <td width=75%>\n";
3e69e88b 167 echo " <select name=match_type>\n";
e4bf514f 168 if ($message_highlight_list[$theid]["match_type"] == "from") echo " <option value=\"from\" selected>From\n";
c36ed9cf 169 else echo " <option value=\"from\">From\n";
e4bf514f 170 if ($message_highlight_list[$theid]["match_type"] == "to") echo " <option value=\"to\" selected>To\n";
c36ed9cf 171 else echo " <option value=\"to\">To\n";
e4bf514f 172 if ($message_highlight_list[$theid]["match_type"] == "cc") echo " <option value=\"cc\" selected>Cc\n";
1195c340 173 else echo " <option value=\"cc\">Cc\n";
e4bf514f 174 if ($message_highlight_list[$theid]["match_type"] == "to_cc") echo " <option value=\"to_cc\" selected>To or Cc\n";
1195c340 175 else echo " <option value=\"to_cc\">To or Cc\n";
e4bf514f 176 if ($message_highlight_list[$theid]["match_type"] == "subject") echo " <option value=\"subject\" selected>Subject\n";
c36ed9cf 177 else echo " <option value=\"subject\">Subject\n";
3e69e88b 178 echo " </select>\n";
acb61cb4 179 $disp = $message_highlight_list[$theid]["value"];
180 $disp = str_replace("\\\\", "\\", $disp);
181 $disp = str_replace("\\\"", "\"", $disp);
182 $disp = str_replace("\"", "&quot;", $disp);
183 echo " <nobr><input type=\"text\" value=\"".$disp."\" name=\"value\">";
e90872be 184 echo " <nobr></td>\n";
9d157cec 185 echo " </tr>\n";
186 echo "</table>\n";
187 echo "<center><input type=\"submit\" value=\"" . _("Submit") . "\"></center>\n";
188 echo "</form>\n";
d7d3c4d4 189 do_hook("options_highlight_bottom");
c36ed9cf 190 }
9d157cec 191?>
c36ed9cf 192</body></html>