<?php
-
/**
* options_order.php
*
* Displays messagelist column order options
*
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2010 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
* @subpackage prefs
*/
+/** This is the options_order page */
+define('PAGE_NAME', 'options_order');
+
/**
- * Path for SquirrelMail required files.
- * @ignore
+ * Include the SquirrelMail initialization file.
*/
-define('SM_PATH','../');
+require('../include/init.php');
/* SquirrelMail required files. */
-include_once(SM_PATH . 'include/validate.php');
-include_once(SM_PATH . 'functions/global.php');
-include_once(SM_PATH . 'functions/display_messages.php');
-include_once(SM_PATH . 'functions/imap.php');
-include_once(SM_PATH . 'functions/plugin.php');
-include_once(SM_PATH . 'functions/html.php');
-include_once(SM_PATH . 'functions/forms.php');
-include_once(SM_PATH . 'functions/arrays.php');
-//require_once(SM_PATH . 'functions/options.php');
+require_once(SM_PATH . 'functions/forms.php');
/* get globals */
if (sqgetGlobalVar('num', $num, SQ_GET)) {
}
if (sqgetGlobalVar('mailbox', $mailbox, SQ_GET)) {
- $aMailboxPrefs = unserialize(getPref($data_dir, $username, "pref_".$iAccount.'_'.urldecode($mailbox)));
+ $aMailboxPrefs = unserialize(getPref($data_dir, $username, "pref_".$iAccount.'_'.$mailbox));
if (isset($aMailboxPrefs[MBX_PREF_COLUMNS])) {
$index_order = $aMailboxPrefs[MBX_PREF_COLUMNS];
}
/* Finally, display whatever page we are supposed to show now. */
/***************************************************************/
-displayPageHeader($color, 'None', (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : ''));
+displayPageHeader($color, null, (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : ''));
/**
}
}
+// FIXME: why are we using this? $PHP_SELF is already a global var processed (and therefore trustworthy) by init.php
+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));
-viewOrderForm($available, $index_order,$opts,urldecode($mailbox));
-
-
-// FOOD for html designers
-function viewOrderForm($aColumns, $aOrder, $aOpts, $mailbox) {
- global $color;
-?>
-
- <table align="center" width="95%" border="0" cellpadding="1" cellspacing="0">
- <tr>
- <td align="center" bgcolor="<?php echo $color[0];?>">
- <b> <?php echo _("Options");?> - <?php echo _("Index Order");?> </b>
- <table width="100%" border="0" cellpadding="8" cellspacing="0">
- <tr>
- <td align="center" bgcolor="<?php echo $color[4];?>">
- <table width="65%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <?php 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.");?>
- </td>
- </tr>
- </table>
- <br>
-
-<?php if (count($aOrder)) { ?>
- <table cellspacing="0" cellpadding="0" border="0">
-<?php foreach($aOrder as $i => $iCol) {
- $sQuery = "&num=$iCol";
- if (isset($mailbox) && $mailbox) {
- $sQuery .= '&mailbox='.urlencode($mailbox);
- }
-
-?>
- <tr>
-<?php if ($i) { ?>
- <td><small><a href="options_order.php?method=move&positions=-1&num=<?php echo $sQuery; ?>"> <?php echo _("up");?> </a></small></td>
-<?php } else { ?>
- <td> </td>
-<?php } // else ?>
- <td><small> | </small></td>
-<?php if ($i < count($aOrder) -1) { ?>
- <td><small><a href="options_order.php?method=move&positions=1&num=<?php echo $sQuery; ?>"> <?php echo _("down");?> </a></small></td>
-<?php } else { ?>
- <td> </td>
-<?php } // else ?>
- <td><small> | </small></td>
-<?php
- /* Always show the subject */
- if ($iCol !== SQM_COL_SUBJ && $iCol !== SQM_COL_FLAGS) {
-?>
- <td><small><a href="options_order.php?method=remove&num=<?php echo $sQuery; ?>"> <?php echo _("remove");?> </a></small></td>
-<?php } else { ?>
- <td> </td>
-<?php } // else ?>
- <td><small> | </small></td>
- <td><?php echo $aColumns[$iCol]; ?></td>
- </tr>
-<?php
- } // foreach
- } // if
-?>
- </table>
+// FIXME: (related to the above) $PHP_SELF might already have a query string... don't assume otherwise here by adding the ? sign!!
+$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);
-<?php
- if (count($aOpts)) {
- echo addForm('options_order.php', 'get', 'f');
- echo addSelect('num', $aOpts, '', TRUE);
- echo addHidden('method', 'add');
- if (isset($mailbox) && $mailbox) {
- echo addHidden('mailbox', urlencode($mailbox));
- }
- echo addSubmit(_("Add"), 'submit');
- echo '</form>';
- }
-?>
- <p><a href="../src/options.php"><?php echo _("Return to options page");?></a></p><br>
- </td></tr>
- </table>
- </td></tr>
- </table>
+$oTemplate->display('options_order.tpl');
-<?php
-}
$oTemplate->display('footer.tpl');
-?>
\ No newline at end of file