6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays messagelist column order options
12 * @package squirrelmail
16 * Path for SquirrelMail required files.
19 define('SM_PATH','../');
21 /* SquirrelMail required files. */
22 require_once(SM_PATH
. 'include/validate.php');
23 require_once(SM_PATH
. 'functions/global.php');
24 require_once(SM_PATH
. 'functions/display_messages.php');
25 require_once(SM_PATH
. 'functions/imap.php');
26 require_once(SM_PATH
. 'functions/plugin.php');
27 require_once(SM_PATH
. 'functions/html.php');
28 require_once(SM_PATH
. 'functions/forms.php');
31 sqgetGlobalVar('num', $num, SQ_GET
);
32 sqgetGlobalVar('add', $add, SQ_POST
);
34 sqgetGlobalVar('submit', $submit);
35 sqgetGlobalVar('method', $method);
36 /* end of get globals */
38 displayPageHeader($color, 'None');
41 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
43 html_tag( 'td', '', 'center', $color[0] ) .
44 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
45 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
47 html_tag( 'td', '', 'center', $color[4] );
49 $available[1] = _("Checkbox");
50 $available[2] = _("From");
51 $available[3] = _("Date");
52 $available[4] = _("Subject");
53 $available[5] = _("Flags");
54 $available[6] = _("Size");
56 if (! isset($method)) { $method = ''; }
58 if ($method == 'up' && $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)) {
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");
72 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
74 $new_ary[$j] = $index_order[$i];
78 $index_order = array();
79 $index_order = $new_ary;
80 if (count($index_order) < 1) {
81 include_once(SM_PATH
. 'include/load_prefs.php');
83 } else if ($method == 'add' && $add) {
84 /* User should not be able to insert PHP-code here */
85 $add = str_replace ('<?', '..', $add);
86 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
87 $add = str_replace ('<%', '..', $add);
88 $index_order[count($index_order)+
1] = $add;
92 for ($i=1; $i <= count($index_order); $i++
) {
93 setPref($data_dir, $username, "order$i", $index_order[$i]);
96 echo html_tag( 'table',
99 _("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.")
102 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br />\n";
104 if (count($index_order))
106 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
107 for ($i=1; $i <= count($index_order); $i++
) {
108 $tmp = $index_order[$i];
109 echo html_tag( 'tr' );
110 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
111 echo html_tag( 'td', '<small> | </small>' );
112 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
113 echo html_tag( 'td', '<small> | </small>' );
114 echo html_tag( 'td' );
115 /* Always show the subject */
117 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
121 echo html_tag( 'td', '<small> - </small>' );
122 echo html_tag( 'td', $available[$tmp] );
125 echo '</table>' . "\n";
128 if (count($index_order) != count($available)) {
131 for ($i=1; $i <= count($available); $i++
) {
133 for ($j=1; $j <= count($index_order); $j++
) {
134 if ($index_order[$j] == $i) {
139 $opts[$i] = $available[$i];
143 echo addForm('options_order.php', 'post', 'f');
144 echo addSelect('add', $opts, '', TRUE);
145 echo addHidden('method', 'add');
146 echo addSubmit(_("Add"), 'submit');
150 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br />' );