added part of new index ordering options
[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
89 for ($i=1; $i <= count($index_order); $i++) {
90 $tmp = $index_order[$i];
91 echo "<small><a href=\"options_order.php?method=up&num=$i\">up</a> | ";
92 echo "<a href=\"options_order.php?method=down&num=$i\">down</a> | ";
93 echo "<a href=\"options_order.php?method=remove&num=$i\">remove</a></small> - ";
94 echo $available[$tmp] . "<br>";
95 }
96
97 if (count($index_order) != count($available)) {
98 echo "<form name=f method=post action=options_order.php>";
99 echo "<select name=add>";
100 for ($i=1; $i <= count($available); $i++) {
101 $found = false;
102 for ($j=1; $j <= count($index_order); $j++) {
103 if ($index_order[$j] == $i) {
104 $found = true;
105 }
106 }
107 if (!$found) {
108 echo "<option value=$i>$available[$i]</option>";
109 }
110 }
111 echo "</select>";
112 echo "<input type=hidden value=add name=method>";
113 echo "<input type=submit value=\""._("Add")."\" name=submit>";
114 echo "</form>";
115 }
116
117 ?>
118 </td></tr></table>
119 </body></html>