5 * Template for rendering the options page
7 * @copyright © 1999-2006 The SquirrelMail Project Team
8 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @package squirrelmail
11 * @subpackage templates
14 /** add required includes */
17 /** extract variables */
21 $optpage_title = _("Options");
22 if (isset($optpage_name) && ($optpage_name != '')) {
23 $optpage_title .= " - $optpage_name";
26 /***************************************************************/
27 /* Finally, display whatever page we are supposed to show now. */
28 /***************************************************************/
30 displayPageHeader($color, 'None', (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : ''));
32 echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
33 html_tag( 'tr' ) . "\n" .
34 html_tag( 'td', '', 'center' ) .
35 "<b>$optpage_title</b><br />\n".
36 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
37 html_tag( 'tr' ) . "\n" .
38 html_tag( 'td', '', 'center', $color[4] ) . "\n";
41 * The main option page has a different layout then the rest of the option
42 * pages. Therefore, we create it here first, then the others below.
44 if ($optpage == SMOPT_PAGE_MAIN) {
45 /**********************************************************/
46 /* First, display the results of a submission, if needed. */
47 /**********************************************************/
48 if ($optmode == SMOPT_MODE_SUBMIT) {
49 if (!isset($frame_top)) {
53 if (isset($optpage_save_error) && $optpage_save_error!=array()) {
54 echo "<font color=\"$color[2]\"><b>" . _("Error(s) occurred while saving your options") . "</b></font><br />\n";
56 foreach ($optpage_save_error as $error_message) {
57 echo '<li><small>' . $error_message . "</small></li>\n";
60 echo '<b>' . _("Some of your preference changes were not applied.") . "</b><br />\n";
62 /* Display a message indicating a successful save. */
63 echo '<b>' . _("Successfully Saved Options") . ": $optpage_name</b><br />\n";
66 /* If $max_refresh != SMOPT_REFRESH_NONE, provide a refresh link. */
67 if ( !isset( $max_refresh ) ) {
68 } else if ($max_refresh == SMOPT_REFRESH_FOLDERLIST) {
69 echo '<a href="../src/left_main.php" target="left">' . _("Refresh Folder List") . '</a><br />';
70 } else if ($max_refresh) {
71 echo '<a href="../src/webmail.php?right_frame=options.php" target="' . $frame_top . '">' . _("Refresh Page") . '</a><br />';
74 /******************************************/
75 /* Build our array of Option Page Blocks. */
76 /******************************************/
77 $optpage_blocks = array();
79 /* Build a section for Personal Options. */
80 $optpage_blocks[] = array(
81 'name' => _("Personal Information"),
82 'url' => 'options.php?optpage=' . SMOPT_PAGE_PERSONAL,
83 'desc' => _("This contains personal information about yourself such as your name, your email address, etc."),
87 /* Build a section for Display Options. */
88 $optpage_blocks[] = array(
89 'name' => _("Display Preferences"),
90 'url' => 'options.php?optpage=' . SMOPT_PAGE_DISPLAY,
91 'desc' => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."),
95 /* Build a section for Message Highlighting Options. */
96 $optpage_blocks[] = array(
97 'name' =>_("Message Highlighting"),
98 'url' => 'options_highlight.php',
99 'desc' =>_("Based upon given criteria, incoming messages can have different background colors in the message list. This helps to easily distinguish who the messages are from, especially for mailing lists."),
103 /* Build a section for Folder Options. */
104 $optpage_blocks[] = array(
105 'name' => _("Folder Preferences"),
106 'url' => 'options.php?optpage=' . SMOPT_PAGE_FOLDER,
107 'desc' => _("These settings change the way your folders are displayed and manipulated."),
111 /* Build a section for Index Order Options. */
112 $optpage_blocks[] = array(
113 'name' => _("Index Order"),
114 'url' => 'options_order.php',
115 'desc' => _("The order of the message index can be rearranged and changed to contain the headers in any order you want."),
119 /* Build a section for Compose Options. */
120 $optpage_blocks[] = array(
121 'name' => _("Compose Preferences"),
122 'url' => 'options.php?optpage=' . SMOPT_PAGE_COMPOSE,
123 'desc' => _("Control the behaviour and layout of writing new mail messages, replying to and forwarding messages."),
127 /* Build a section for plugins wanting to register an optionpage. */
128 do_hook('optpage_register_block');
130 /*****************************************************/
131 /* Let's sort Javascript Option Pages to the bottom. */
132 /*****************************************************/
133 $js_optpage_blocks = array();
134 $reg_optpage_blocks = array();
135 foreach ($optpage_blocks as $cur_optpage) {
136 if (!isset($cur_optpage['js']) || !$cur_optpage['js']) {
137 $reg_optpage_blocks[] = $cur_optpage;
138 } else if ($javascript_on == SMPREF_JS_ON) {
139 $js_optpage_blocks[] = $cur_optpage;
142 $optpage_blocks = array_merge($reg_optpage_blocks, $js_optpage_blocks);
144 /********************************************/
145 /* Now, print out each option page section. */
146 /********************************************/
147 $first_optpage = false;
148 echo html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' ) . "\n" .
149 html_tag( 'tr' ) . "\n" .
150 html_tag( 'td', '', 'left', '', 'valign="top"' ) .
151 html_tag( 'table', '', '', $color[4], 'width="100%" cellpadding="3" cellspacing="0" border="0"' ) . "\n" .
152 html_tag( 'tr' ) . "\n" .
153 html_tag( 'td', '', 'left' );
154 foreach ($optpage_blocks as $next_optpage) {
155 if ($first_optpage == false) {
156 $first_optpage = $next_optpage;
158 print_optionpages_row($first_optpage, $next_optpage);
159 $first_optpage = false;
163 if ($first_optpage != false) {
164 print_optionpages_row($first_optpage);
167 echo "</td></tr></table></td></tr></table>\n";
169 do_hook('options_link_and_description');
172 /*************************************************************************/
173 /* If we are not looking at the main option page, display the page here. */
174 /*************************************************************************/
176 echo addForm('options.php', 'post', 'f')
177 . create_optpage_element($optpage)
178 . create_optmode_element(SMOPT_MODE_SUBMIT)
179 . html_tag( 'table', '', '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) . "\n";
181 /* Output the option groups for this page. */
182 print_option_groups($optpage_data['options']);
184 /* Set the inside_hook_name and submit_name. */
186 case SMOPT_PAGE_PERSONAL:
187 $inside_hook_name = 'options_personal_inside';
188 $bottom_hook_name = 'options_personal_bottom';
189 $submit_name = 'submit_personal';
191 case SMOPT_PAGE_DISPLAY:
192 $inside_hook_name = 'options_display_inside';
193 $bottom_hook_name = 'options_display_bottom';
194 $submit_name = 'submit_display';
196 case SMOPT_PAGE_COMPOSE:
197 $inside_hook_name = 'options_compose_inside';
198 $bottom_hook_name = 'options_compose_bottom';
199 $submit_name = 'submit_compose';
201 case SMOPT_PAGE_HIGHLIGHT:
202 $inside_hook_name = 'options_highlight_inside';
203 $bottom_hook_name = 'options_highlight_bottom';
204 $submit_name = 'submit_highlight';
206 case SMOPT_PAGE_FOLDER:
207 $inside_hook_name = 'options_folder_inside';
208 $bottom_hook_name = 'options_folder_bottom';
209 $submit_name = 'submit_folder';
211 case SMOPT_PAGE_ORDER:
212 $inside_hook_name = 'options_order_inside';
213 $bottom_hook_name = 'options_order_bottom';
214 $submit_name = 'submit_order';
217 $inside_hook_name = '';
218 $bottom_hook_name = '';
219 $submit_name = 'submit';
222 /* If it is not empty, trigger the inside hook. */
223 if ($inside_hook_name != '') {
224 do_hook($inside_hook_name);
227 /* Spit out a submit button. */
228 OptionSubmit($submit_name);
229 echo '</table></form>';
231 /* If it is not empty, trigger the bottom hook. */
232 if ($bottom_hook_name != '') {
233 do_hook($bottom_hook_name);
255 * This function prints out an option page row.
257 function print_optionpages_row($leftopt, $rightopt = false) {
261 $rightopt_name = html_tag( 'td', '<a href="' . $rightopt['url'] . '">' . $rightopt['name'] . '</a>', 'left', $color[9], 'valign="top" width="49%"' );
262 $rightopt_desc = html_tag( 'td', $rightopt['desc'], 'left', $color[0], 'valign="top" width="49%"' );
264 $rightopt_name = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' );
265 $rightopt_desc = html_tag( 'td', ' ', 'left', $color[4], 'valign="top" width="49%"' );
269 html_tag( 'table', "\n" .
270 html_tag( 'tr', "\n" .
271 html_tag( 'td', "\n" .
272 html_tag( 'table', "\n" .
273 html_tag( 'tr', "\n" .
275 '<a href="' . $leftopt['url'] . '">' . $leftopt['name'] . '</a>' ,
276 'left', $color[9], 'valign="top" width="49%"' ) .
279 'left', $color[4], 'valign="top" width="2%"' ) . "\n" .
282 html_tag( 'tr', "\n" .
285 'left', $color[0], 'valign="top" width="49%"' ) .
288 'left', $color[4], 'valign="top" width="2%"' ) . "\n" .
291 '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) ,
292 'left', '', 'valign="top"' )
294 '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' );
300 * Revision 1.1 2006/07/09 22:22:31 vanmer
301 * - initial revision of a template for options output