221ca7bf |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * options_order.php |
5 | * |
82d304a0 |
6 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
35586184 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
1c159927 |
9 | * Displays messagelist column order options |
35586184 |
10 | * |
11 | * $Id$ |
8f6f9ba5 |
12 | * @package squirrelmail |
35586184 |
13 | */ |
14 | |
8f6f9ba5 |
15 | /** Path for SquirrelMail required files. */ |
86725763 |
16 | define('SM_PATH','../'); |
17 | |
18 | /* SquirrelMail required files. */ |
08185f2a |
19 | require_once(SM_PATH . 'include/validate.php'); |
1e12d1ff |
20 | require_once(SM_PATH . 'functions/global.php'); |
86725763 |
21 | require_once(SM_PATH . 'functions/display_messages.php'); |
22 | require_once(SM_PATH . 'functions/imap.php'); |
86725763 |
23 | require_once(SM_PATH . 'functions/plugin.php'); |
24 | require_once(SM_PATH . 'functions/html.php'); |
221ca7bf |
25 | |
fe369c70 |
26 | /* get globals */ |
1e12d1ff |
27 | sqgetGlobalVar('num', $num, SQ_GET); |
28 | sqgetGlobalVar('add', $add, SQ_POST); |
29 | |
30 | sqgetGlobalVar('submit', $submit); |
31 | sqgetGlobalVar('method', $method); |
fe369c70 |
32 | /* end of get globals */ |
33 | |
32f4e318 |
34 | displayPageHeader($color, 'None'); |
e7db48af |
35 | |
6206f6c4 |
36 | echo |
37 | html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . |
545238b1 |
38 | html_tag( 'tr' ) . |
39 | html_tag( 'td', '', 'center', $color[0] ) . |
40 | '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' . |
6206f6c4 |
41 | html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) . |
545238b1 |
42 | html_tag( 'tr' ) . |
43 | html_tag( 'td', '', 'center', $color[4] ); |
32f4e318 |
44 | |
45 | $available[1] = _("Checkbox"); |
46 | $available[2] = _("From"); |
47 | $available[3] = _("Date"); |
48 | $available[4] = _("Subject"); |
49 | $available[5] = _("Flags"); |
50 | $available[6] = _("Size"); |
51 | |
52 | if (! isset($method)) { $method = ''; } |
53 | |
54 | if ($method == 'up' && $num > 1) { |
55 | $prev = $num-1; |
56 | $tmp = $index_order[$prev]; |
57 | $index_order[$prev] = $index_order[$num]; |
58 | $index_order[$num] = $tmp; |
59 | } else if ($method == 'down' && $num < count($index_order)) { |
60 | $next = $num++; |
61 | $tmp = $index_order[$next]; |
62 | $index_order[$next] = $index_order[$num]; |
63 | $index_order[$num] = $tmp; |
64 | } else if ($method == 'remove' && $num) { |
65 | for ($i=1; $i < 8; $i++) { |
66 | removePref($data_dir, $username, "order$i"); |
67 | } |
68 | for ($j=1,$i=1; $i <= count($index_order); $i++) { |
69 | if ($i != $num) { |
70 | $new_ary[$j] = $index_order[$i]; |
71 | $j++; |
72 | } |
73 | } |
74 | $index_order = array(); |
75 | $index_order = $new_ary; |
76 | if (count($index_order) < 1) { |
77 | include_once('../src/load_prefs.php'); |
78 | } |
79 | } else if ($method == 'add' && $add) { |
80 | /* User should not be able to insert PHP-code here */ |
81 | $add = str_replace ('<?', '..', $add); |
82 | $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add); |
83 | $add = str_replace ('<%', '..', $add); |
84 | $index_order[count($index_order)+1] = $add; |
85 | } |
86 | |
87 | if ($method) { |
88 | for ($i=1; $i <= count($index_order); $i++) { |
89 | setPref($data_dir, $username, "order$i", $index_order[$i]); |
90 | } |
91 | } |
545238b1 |
92 | echo html_tag( 'table', |
93 | html_tag( 'tr', |
94 | html_tag( 'td', |
95 | _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs.") |
96 | ) |
97 | ) , |
98 | '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n"; |
32f4e318 |
99 | |
100 | if (count($index_order)) |
101 | { |
545238b1 |
102 | echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n"; |
32f4e318 |
103 | for ($i=1; $i <= count($index_order); $i++) { |
104 | $tmp = $index_order[$i]; |
545238b1 |
105 | echo html_tag( 'tr' ); |
106 | echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' ); |
107 | echo html_tag( 'td', '<small> | </small>' ); |
108 | echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' ); |
109 | echo html_tag( 'td', '<small> | </small>' ); |
110 | echo html_tag( 'td' ); |
32f4e318 |
111 | /* Always show the subject */ |
112 | if ($tmp != 4) |
545238b1 |
113 | echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>'; |
114 | else |
115 | echo ' '; |
116 | echo '</td>'; |
117 | echo html_tag( 'td', '<small> - </small>' ); |
118 | echo html_tag( 'td', $available[$tmp] ); |
119 | echo '</tr>' . "\n"; |
32f4e318 |
120 | } |
545238b1 |
121 | echo '</table>' . "\n"; |
32f4e318 |
122 | } |
123 | |
124 | if (count($index_order) != count($available)) { |
125 | echo '<form name="f" method="post" action="options_order.php">'; |
126 | echo '<select name="add">'; |
127 | for ($i=1; $i <= count($available); $i++) { |
128 | $found = false; |
129 | for ($j=1; $j <= count($index_order); $j++) { |
130 | if ($index_order[$j] == $i) { |
131 | $found = true; |
132 | } |
e7db48af |
133 | } |
32f4e318 |
134 | if (!$found) { |
135 | echo "<option value=\"$i\">$available[$i]</option>"; |
136 | } |
137 | } |
138 | echo '</select>'; |
139 | echo '<input type="hidden" value="add" name="method">'; |
140 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
141 | echo '</form>'; |
142 | } |
143 | |
545238b1 |
144 | echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' ); |
5c54e435 |
145 | |
221ca7bf |
146 | ?> |
e7db48af |
147 | </td></tr> |
148 | </table> |
149 | |
150 | </td></tr> |
151 | </table> |
dcc1cc82 |
152 | </body></html> |