phase 1 of interface improvements -- alternating row colors (needs some work)
[squirrelmail.git] / src / options_order.php
1 <?php
2 /**
3 ** options_highlight.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Displays message highlighting options
9 **
10 ** $Id$
11 **/
12
13 session_start();
14
15 if (!isset($strings_php))
16 include('../functions/strings.php');
17 if (!isset($config_php))
18 include('../config/config.php');
19 if (!isset($page_header_php))
20 include('../functions/page_header.php');
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');
27 if (!isset($i18n_php))
28 include('../functions/i18n.php');
29 if (!isset($plugin_php))
30 include('../functions/plugin.php');
31
32
33 if (! isset($action)) { $action = ''; }
34 if ($action == 'delete' && isset($theid)) {
35 removePref($data_dir, $username, "highlight$theid");
36 } else if ($action == 'save') {
37 }
38 include('../src/load_prefs.php');
39 displayPageHeader($color, 'None');
40 ?>
41 <br>
42 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
43 <center><b><?php echo _("Options") . " - " . _("Index Order"); ?></b></center>
44 </td></tr></table>
45
46 <table width=95% align=center border=0><tr><td>
47 <?php
48
49 $available[1] = _("Checkbox");
50 $available[2] = _("From");
51 $available[3] = _("Date");
52 $available[4] = _("Subject");
53 $available[5] = _("Flags");
54 $available[6] = _("Size");
55
56 if (! isset($method)) { $method = ''; }
57
58 if ($method == 'up' && $num > 1) {
59 $prev = $num-1;
60 $tmp = $index_order[$prev];
61 $index_order[$prev] = $index_order[$num];
62 $index_order[$num] = $tmp;
63 } else if ($method == 'down' && $num < count($index_order)) {
64 $next = $num++;
65 $tmp = $index_order[$next];
66 $index_order[$next] = $index_order[$num];
67 $index_order[$num] = $tmp;
68 } else if ($method == 'remove' && $num) {
69 for ($i=1; $i < 8; $i++) {
70 removePref($data_dir, $username, "order$i");
71 }
72 for ($j=1,$i=1; $i <= count($index_order); $i++) {
73 if ($i != $num) {
74 $new_ary[$j] = $index_order[$i];
75 $j++;
76 }
77 }
78 $index_order = array();
79 $index_order = $new_ary;
80 if (count($index_order) < 1) {
81 include ('../src/load_prefs.php');
82 }
83 } else if ($method == 'add' && $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 }
92 echo '<center>';
93 echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n";
94 echo _("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.");
95 echo '</td></tr></table></center><br>';
96
97 if (count($index_order))
98 {
99 echo '<center>';
100 echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n";
101 for ($i=1; $i <= count($index_order); $i++) {
102 $tmp = $index_order[$i];
103 echo '<tr>';
104 echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n";
105 echo '<td><small>&nbsp;|&nbsp;</small></td>' . "\n";
106 echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n";
107 echo '<td><small>&nbsp;|&nbsp;</small></td>' . "\n";
108 echo '<td>';
109 // Always show the subject
110 if ($tmp != 4)
111 echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>';
112 echo "</td>\n";
113 echo '<td><small>&nbsp;-&nbsp;</small></td>' . "\n";
114 echo '<td>' . $available[$tmp] . "</td>\n";
115 echo "</tr>\n";
116 }
117 echo "</table>\n";
118 echo '</center>';
119 }
120
121 if (count($index_order) != count($available)) {
122 echo '<center><form name="f" method="post" action="options_order.php">';
123 echo '<select name="add">';
124 for ($i=1; $i <= count($available); $i++) {
125 $found = false;
126 for ($j=1; $j <= count($index_order); $j++) {
127 if ($index_order[$j] == $i) {
128 $found = true;
129 }
130 }
131 if (!$found) {
132 echo "<option value=\"$i\">$available[$i]</option>";
133 }
134 }
135 echo '</select>';
136 echo '<input type="hidden" value="add" name="method">';
137 echo '<input type="submit" value="'._("Add").'" name="submit">';
138 echo '</form></center>';
139 }
140
141 echo '<br><center><a href="../src/options.php">' . _("Return to options page") . '</a></center>';
142
143 ?>
144 </td></tr></table>
145 </body></html>