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"); |
9d157cec |
28 | |
9d157cec |
29 | |
44f642f5 |
30 | if ($action == "delete" && isset($id)) { |
31 | removePref($data_dir, $username, "highlight$id"); |
32 | } else if ($action == "save") { |
9d157cec |
33 | if (!$id) $id = 0; |
44f642f5 |
34 | $name = ereg_replace(",", " ", $name); |
35 | if ($color_type == 1) $newcolor = $newcolor_choose; |
36 | else $newcolor = $newcolor_input; |
c36ed9cf |
37 | |
44f642f5 |
38 | $newcolor = ereg_replace(",", "", $newcolor); |
39 | $newcolor = ereg_replace("#", "", $newcolor); |
40 | $newcolor = "$newcolor"; |
41 | $value = ereg_replace(",", " ", $value); |
3e69e88b |
42 | setPref($data_dir, $username, "highlight$id", $name.",".$newcolor.",".$value.",".$match_type); |
44f642f5 |
43 | $message_highlight_list[$id]["name"] = $name; |
44 | $message_highlight_list[$id]["color"] = $newcolor; |
45 | $message_highlight_list[$id]["value"] = $value; |
3e69e88b |
46 | $message_highlight_list[$id]["match_type"] = $match_type; |
c36ed9cf |
47 | } |
44f642f5 |
48 | include("../src/load_prefs.php"); |
49 | displayPageHeader($color, "None"); |
c36ed9cf |
50 | ?> |
e9f8ea4e |
51 | <br> |
52 | <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<? echo $color[0] ?>"> |
c36ed9cf |
53 | <center><b><? echo _("Options") . " - " . _("Message Highlighting"); ?></b></center> |
54 | </td></tr></table> |
55 | |
56 | <? |
57 | echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . _("New") . "</a>]"; |
58 | echo " - [<a href=\"options.php\">"._("Done")."</a>]</center><br>\n"; |
44f642f5 |
59 | if (count($message_highlight_list) >= 1) { |
60 | echo "<table border=0 cellpadding=3 cellspacing=0 align=center width=80%>\n"; |
61 | for ($i=0; $i < count($message_highlight_list); $i++) { |
62 | echo "<tr>\n"; |
63 | echo " <td width=1% bgcolor=" . $color[4] . ">\n"; |
c36ed9cf |
64 | echo "<nobr><small>[<a href=\"options_highlight.php?action=edit&id=$i\">" . _("Edit") . "</a>] [<a href=\"options_highlight.php?action=delete&id=$i\">"._("Delete")."</a>]</small></nobr>\n"; |
44f642f5 |
65 | echo " </td>"; |
66 | echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n"; |
67 | echo " " . $message_highlight_list[$i]["name"]; |
68 | echo " </td>\n"; |
69 | echo " <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n"; |
3e69e88b |
70 | echo " ".$message_highlight_list[$i]["match_type"]." = " . $message_highlight_list[$i]["value"]; |
44f642f5 |
71 | echo " </td>\n"; |
72 | echo "</tr>\n"; |
73 | } |
74 | echo "</table>\n"; |
75 | echo "<br>\n"; |
9d157cec |
76 | } else { |
44f642f5 |
77 | echo "<center>" . _("No highlighting is defined") . "</center><br>\n"; |
78 | echo "<br>\n"; |
79 | } |
80 | if ($action == "edit" || $action == "add") { |
9d157cec |
81 | if (!isset($id)) $id = count($message_highlight_list); |
c36ed9cf |
82 | |
44f642f5 |
83 | $color_list[0] = "4444aa"; |
84 | $color_list[1] = "44aa44"; |
85 | $color_list[2] = "aaaa44"; |
86 | $color_list[3] = "44aaaa"; |
87 | $color_list[4] = "aa44aa"; |
88 | $color_list[5] = "aaaaff"; |
89 | $color_list[6] = "aaffaa"; |
90 | $color_list[7] = "ffffaa"; |
91 | $color_list[8] = "aaffff"; |
92 | $color_list[9] = "ffaaff"; |
93 | $color_list[10] = "aaaaaa"; |
94 | $color_list[11] = "bfbfbf"; |
95 | $color_list[12] = "dfdfdf"; |
c36ed9cf |
96 | $color_list[13] = "ffffff"; |
44f642f5 |
97 | for ($i=0; $i < 14; $i++) { |
98 | if ($color_list[$i] == $message_highlight_list[$id]["color"]) { |
99 | $selected_choose = " checked"; |
100 | ${"selected".$i} = " selected"; |
101 | continue; |
102 | } |
103 | } |
3e69e88b |
104 | if (!$message_highlight_list[$id]["color"]) |
105 | $selected_choose = " checked"; |
c36ed9cf |
106 | else if (!$selected_choose) |
44f642f5 |
107 | $selected_input = " checked"; |
c36ed9cf |
108 | |
109 | echo "<form action=\"options_highlight.php\">\n"; |
9d157cec |
110 | echo "<input type=\"hidden\" value=\"save\" name=\"action\">\n"; |
111 | echo "<input type=\"hidden\" value=\"$id\" name=\"id\">\n"; |
e9f8ea4e |
112 | echo "<table width=80% align=center cellpadding=3 cellspacing=0 border=0>\n"; |
113 | echo " <tr bgcolor=\"$color[0]\">\n"; |
114 | echo " <td align=right width=25%><b>\n"; |
9d157cec |
115 | echo _("Identifying name") . ":"; |
e9f8ea4e |
116 | echo " </b></td>\n"; |
429f8906 |
117 | echo " <td width=75%>\n"; |
9d157cec |
118 | echo " <input type=\"text\" value=\"".$message_highlight_list[$id]["name"]."\" name=\"name\">"; |
119 | echo " </td>\n"; |
120 | echo " </tr>\n"; |
e9f8ea4e |
121 | echo " <tr><td><small><small> </small></small></td></tr>\n"; |
122 | echo " <tr bgcolor=\"$color[0]\">\n"; |
123 | echo " <td align=right width=25%><b>\n"; |
9d157cec |
124 | echo _("Color") . ":"; |
e9f8ea4e |
125 | echo " </b></td>\n"; |
429f8906 |
126 | echo " <td width=75%>\n"; |
44f642f5 |
127 | echo " <input type=\"radio\" name=color_type value=1$selected_choose> <select name=newcolor_choose>\n"; |
128 | echo " <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n"; |
129 | echo " <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n"; |
130 | echo " <option value=\"$color_list[2]\"$selected2>" . _("Dark Yellow") . "\n"; |
131 | echo " <option value=\"$color_list[3]\"$selected3>" . _("Dark Cyan") . "\n"; |
132 | echo " <option value=\"$color_list[4]\"$selected4>" . _("Dark Magenta") . "\n"; |
133 | echo " <option value=\"$color_list[5]\"$selected5>" . _("Light Blue") . "\n"; |
134 | echo " <option value=\"$color_list[6]\"$selected6>" . _("Light Green") . "\n"; |
135 | echo " <option value=\"$color_list[7]\"$selected7>" . _("Light Yellow") . "\n"; |
136 | echo " <option value=\"$color_list[8]\"$selected8>" . _("Light Cyan") . "\n"; |
137 | echo " <option value=\"$color_list[9]\"$selected9>" . _("Light Magenta") . "\n"; |
138 | echo " <option value=\"$color_list[10]\"$selected10>" . _("Dark Gray") . "\n"; |
139 | echo " <option value=\"$color_list[11]\"$selected11>" . _("Medium Gray") . "\n"; |
140 | echo " <option value=\"$color_list[12]\"$selected12>" . _("Light Gray") . "\n"; |
141 | echo " <option value=\"$color_list[13]\"$selected13>" . _("White") . "\n"; |
142 | echo " </select><br>\n"; |
c36ed9cf |
143 | echo " <input type=\"radio\" name=color_type value=2$selected_input> ". _("Other:") ."<input type=\"text\" value=\""; |
44f642f5 |
144 | if ($selected_input) echo $message_highlight_list[$id]["color"]; |
145 | echo "\" name=\"newcolor_input\" size=7> "._("Ex: 63aa7f")."<br>\n"; |
9d157cec |
146 | echo " </td>\n"; |
147 | echo " </tr>\n"; |
e9f8ea4e |
148 | echo " <tr><td><small><small> </small></small></td></tr>\n"; |
149 | echo " <tr bgcolor=\"$color[0]\">\n"; |
150 | echo " <td align=right width=25%><b>\n"; |
9d157cec |
151 | echo _("Match") . ":"; |
e9f8ea4e |
152 | echo " </b></td>\n"; |
429f8906 |
153 | echo " <td width=75%>\n"; |
3e69e88b |
154 | echo " <select name=match_type>\n"; |
c36ed9cf |
155 | if ($message_highlight_list[$id]["match_type"] == "from") echo " <option value=\"from\" selected>From\n"; |
156 | else echo " <option value=\"from\">From\n"; |
157 | if ($message_highlight_list[$id]["match_type"] == "to") echo " <option value=\"to\" selected>To\n"; |
158 | else echo " <option value=\"to\">To\n"; |
1195c340 |
159 | if ($message_highlight_list[$id]["match_type"] == "cc") echo " <option value=\"cc\" selected>Cc\n"; |
160 | else echo " <option value=\"cc\">Cc\n"; |
161 | if ($message_highlight_list[$id]["match_type"] == "to_cc") echo " <option value=\"to_cc\" selected>To or Cc\n"; |
162 | else echo " <option value=\"to_cc\">To or Cc\n"; |
c36ed9cf |
163 | if ($message_highlight_list[$id]["match_type"] == "subject") echo " <option value=\"subject\" selected>Subject\n"; |
164 | else echo " <option value=\"subject\">Subject\n"; |
3e69e88b |
165 | echo " </select>\n"; |
429f8906 |
166 | echo " <nobr><input type=\"text\" value=\"".$message_highlight_list[$id]["value"]."\" name=\"value\"> ("; |
167 | echo _("Regular Expression"); |
168 | echo ")\n <nobr></td>\n"; |
9d157cec |
169 | echo " </tr>\n"; |
170 | echo "</table>\n"; |
171 | echo "<center><input type=\"submit\" value=\"" . _("Submit") . "\"></center>\n"; |
172 | echo "</form>\n"; |
c36ed9cf |
173 | } |
9d157cec |
174 | ?> |
c36ed9cf |
175 | </body></html> |