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