8088d7982cb71c1c72d5f0806971e4db4c8c6f8f
[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 **/
11
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");
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");
26 if (!isset($i18n_php))
27 include("../functions/i18n.php");
28 if (!isset($plugin_php))
29 include("../functions/plugin.php");
30
31
32 if ($action == "delete" && isset($theid)) {
33 removePref($data_dir, $username, "highlight$theid");
34 } else if ($action == "save") {
35 }
36 include("../src/load_prefs.php");
37 displayPageHeader($color, "None");
38 ?>
39 <br>
40 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
41 <center><b><?php echo _("Options") . " - " . _("Index Order"); ?></b></center>
42 </td></tr></table>
43
44 <table width=95% align=center border=0><tr><td>
45 <?php
46
47 $available[1] = _("Checkbox");
48 $available[2] = _("From");
49 $available[3] = _("Date");
50 $available[4] = _("Subject");
51 $available[5] = _("Flags");
52 $available[6] = _("Size");
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 "../src/load_prefs.php";
78 }
79 } else if ($method == "add" && $add) {
80 $index_order[count($index_order)+1] = $add;
81 }
82
83 if ($method) {
84 for ($i=1; $i <= count($index_order); $i++) {
85 setPref($data_dir, $username, "order$i", $index_order[$i]);
86 }
87 }
88 echo "<center>";
89 echo "<table cellspacing=0 cellpadding=0 border=0 width=65%><tr><td>\n";
90 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.");
91 echo "</td></tr></table></center><br>";
92
93 if (count($index_order))
94 {
95 echo "<center>";
96 echo "<table cellspacing=0 cellpadding=0 border=0>\n";
97 for ($i=1; $i <= count($index_order); $i++) {
98 $tmp = $index_order[$i];
99 echo "<tr>";
100 echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n";
101 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
102 echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n";
103 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
104 echo "<td>";
105 // Always show the subject
106 if ($tmp != 4)
107 echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . "</a></small>";
108 echo "</td>\n";
109 echo "<td><small>&nbsp;-&nbsp;</small></td>\n";
110 echo "<td>" . $available[$tmp] . "</td>\n";
111 echo "</tr>\n";
112 }
113 echo "</table>\n";
114 echo "</center>";
115 }
116
117 if (count($index_order) != count($available)) {
118 echo "<center><form name=f method=post action=options_order.php>";
119 echo "<select name=add>";
120 for ($i=1; $i <= count($available); $i++) {
121 $found = false;
122 for ($j=1; $j <= count($index_order); $j++) {
123 if ($index_order[$j] == $i) {
124 $found = true;
125 }
126 }
127 if (!$found) {
128 echo "<option value=$i>$available[$i]</option>";
129 }
130 }
131 echo "</select>";
132 echo "<input type=hidden value=add name=method>";
133 echo "<input type=submit value=\""._("Add")."\" name=submit>";
134 echo "</form></center>";
135 }
136
137 echo "<br><center><a href=\"../src/options.php\">" . _("Return to options page") . "</a></center>";
138
139 ?>
140 </td></tr></table>
141 </body></html>