<?php
-
/**
* options_order.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>
+$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('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
--- /dev/null
+<?php
+/**
+ * options_order.tpl
+ *
+ * Template for changing message list field ordering.
+ *
+ * The following variables are available in this template:
+ * $fields - array containing all translated field names available
+ * for ordering. Array key is an integer, value is the field name
+ * $current_order - array containing the current ordering of fields
+ * $not_used - array containing fields not currently used. Array
+ * key is the same as in $fields, value is the translated
+ * field name.
+ * $always_show - array containing field indexes that should always be shown
+ * to maintain SquirrelMail functionality, e.g. Subject
+ * $move_up - URL foundation to move a field up in the ordering
+ * $move_down - URL foundation to move a field down in the ordering
+ * $remove - URL foundation to remove a field from the ordering.
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+/** add required includes **/
+
+/** extract template variables **/
+extract($t);
+
+/** Begin template **/
+?>
+<div id="optionHighlight">
+<table cellspacing="0">
+ <tr>
+ <td class="header1">
+ <?php echo _("Options") .' - '. _("Index Order"); ?>
+ </td>
+ </tr>
+ <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>
+ <tr>
+ <td>
+ <table cellspacing="0" class="moveFields">
+ <?php
+ foreach ($current_order as $order=>$index) {
+ echo " <tr>\n";
+
+ echo " <td class=\"moveLink\">\n" .($order > 0 ? '<a href="'. $move_up.$index .'">' ._("up") .'</a>' : ' '). "\n </td>\n";
+ echo " <td class=\"moveLink\">\n" .($order < count($current_order)-1 ? '<a href="'. $move_down.$index .'">' ._("down") .'</a>' : ' '). "\n </td>\n";
+ echo " <td class=\"moveLink\">\n" .(!in_array($index, $always_show) ? '<a href="'. $remove.$index .'">' ._("remove") .'</a>' : ' '). "\n </td>\n";
+ echo " <td class=\"fieldName\">\n" .$fields[$index]. "\n </td>\n";
+
+ echo " </tr>\n";
+ }
+ ?>
+ </table>
+ </td>
+ </tr>
+ <?php
+ if (count($not_used) > 0) {
+ ?>
+ <tr>
+ <td>
+ <form action=<?php echo '"'.$addField_action.'"'; ?> method="GET">
+ <input type="hidden" name="method" value="add">
+ <select name="num">
+ <?php
+ foreach ($not_used as $field_id=>$name) {
+ echo '<option value="'.$field_id.'">'.htmlspecialchars($name).'</option>'."\n";
+ }
+ ?>
+ </select>
+ <input type="submit" value=<?php echo '"'._("Add").'"'; ?> name="submit" />
+ </form>
+ </td>
+ </tr>
+ <?php
+ }
+ ?>
+ <tr>
+ <td>
+ <a href="../src/options.php"><?php echo _("Return to options page");?></a>
+ </td>
+ </tr>
+</table>
+</div>
\ No newline at end of file