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