X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Foptions_order.php;h=b643a0ca8fee6be18d476ce4e54b53767a98725b;hb=ffdae6e7ca11112273750f5ad80882164375a7e4;hp=c8813a701bb87115ace6f273e9176c5b83bac59a;hpb=221ca7bfa0833e250e8efad033de42e591e02340;p=squirrelmail.git diff --git a/src/options_order.php b/src/options_order.php index c8813a70..b643a0ca 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -1,119 +1,162 @@ -
-
-
-
+/** + * options_order.php + * + * Displays messagelist column order options + * + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package squirrelmail + * @subpackage prefs + */ -
- 1) { - $prev = $num-1; - $tmp = $index_order[$prev]; - $index_order[$prev] = $index_order[$num]; - $index_order[$num] = $tmp; - } else if ($method == "down" && $num < count($index_order)) { - $next = $num++; - $tmp = $index_order[$next]; - $index_order[$next] = $index_order[$num]; - $index_order[$num] = $tmp; - } else if ($method == "remove" && $num) { - for ($i=1; $i < 8; $i++) { - removePref($data_dir, $username, "order$i"); - } - for ($j=1,$i=1; $i <= count($index_order); $i++) { - if ($i != $num) { - $new_ary[$j] = $index_order[$i]; - $j++; - } - } - $index_order = array(); - $index_order = $new_ary; - if (count($index_order) < 1) { - include "../src/load_prefs.php"; - } - } else if ($method == "add" && $add) { - $index_order[count($index_order)+1] = $add; - } +/* SquirrelMail required files. */ +require_once(SM_PATH . 'functions/forms.php'); - if ($method) { - for ($i=1; $i <= count($index_order); $i++) { - setPref($data_dir, $username, "order$i", $index_order[$i]); - } - } +/* get globals */ +if (sqgetGlobalVar('num', $num, SQ_GET)) { + $num = (int) $num; +} else { + $num = false; +} +if (!sqgetGlobalVar('method', $method)) { + $method = ''; +} else { + $method = htmlspecialchars($method); +} +if (!sqgetGlobalVar('positions', $pos, SQ_GET)) { + $pos = 0; +} else { + $pos = (int) $pos; +} + +if (!sqgetGlobalVar('account', $account, SQ_GET)) { + $iAccount = 0; +} else { + $iAccount = (int) $account; +} - for ($i=1; $i <= count($index_order); $i++) { - $tmp = $index_order[$i]; - echo "up | "; - echo "down | "; - echo "remove - "; - echo $available[$tmp] . "
"; +if (sqgetGlobalVar('mailbox', $mailbox, SQ_GET)) { + $aMailboxPrefs = unserialize(getPref($data_dir, $username, "pref_".$iAccount.'_'.urldecode($mailbox))); + if (isset($aMailboxPrefs[MBX_PREF_COLUMNS])) { + $index_order = $aMailboxPrefs[MBX_PREF_COLUMNS]; } - - if (count($index_order) != count($available)) { - echo "
"; - echo ""; - echo ""; - echo ""; - echo "
"; - } + } +} + +sqgetGlobalVar('PHP_SELF', $PHP_SELF, SQ_SERVER); +$x = isset($mailbox) && $mailbox ? '&mailbox='.urlencode($mailbox) : ''; + +$oTemplate->assign('fields', $available); +$oTemplate->assign('current_order', $index_order); +$oTemplate->assign('not_used', $opts); +$oTemplate->assign('always_show', array(SQM_COL_SUBJ, SQM_COL_FLAGS)); + +$oTemplate->assign('move_up', $PHP_SELF .'?method=move&positions=-1'. $x .'&num='); +$oTemplate->assign('move_down', $PHP_SELF .'?method=move&positions=1'. $x .'&num='); +$oTemplate->assign('remove', $PHP_SELF .'?method=remove'. $x .'&num='); +$oTemplate->assign('add', $PHP_SELF.'?method=add'.$x.'&num='); +$oTemplate->assign('addField_action', $PHP_SELF); + +$oTemplate->display('options_order.tpl'); +$oTemplate->display('footer.tpl'); ?> -
-