- initial revision of a template for options output
[squirrelmail.git] / templates / default / options.tpl
CommitLineData
4a644734 1<?php
2/**
3 * options.tpl
4 *
5 * Template for rendering the options page
6 *
7 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
8 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 * @version $Id$
10 * @package squirrelmail
11 * @subpackage templates
12 */
13
14/** add required includes */
15
16
17/** extract variables */
18extract($t);
19
20
21$optpage_title = _("Options");
22if (isset($optpage_name) && ($optpage_name != '')) {
23 $optpage_title .= " - $optpage_name";
24}
25
26/***************************************************************/
27/* Finally, display whatever page we are supposed to show now. */
28/***************************************************************/
29
30displayPageHeader($color, 'None', (isset($optpage_data['xtra']) ? $optpage_data['xtra'] : ''));
31
32echo 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";
39
40/*
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.
43 */
44if ($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)) {
50 $frame_top = '_top';
51 }
52
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";
55 echo "<ul>\n";
56 foreach ($optpage_save_error as $error_message) {
57 echo '<li><small>' . $error_message . "</small></li>\n";
58 }
59 echo "</ul>\n";
60 echo '<b>' . _("Some of your preference changes were not applied.") . "</b><br />\n";
61 } else {
62 /* Display a message indicating a successful save. */
63 echo '<b>' . _("Successfully Saved Options") . ": $optpage_name</b><br />\n";
64 }
65
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 />';
72 }
73 }
74 /******************************************/
75 /* Build our array of Option Page Blocks. */
76 /******************************************/
77 $optpage_blocks = array();
78
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."),
84 'js' => false
85 );
86
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."),
92 'js' => false
93 );
94
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."),
100 'js' => false
101 );
102
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."),
108 'js' => false
109 );
110
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."),
116 'js' => false
117 );
118
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."),
124 'js' => false
125 );
126
127 /* Build a section for plugins wanting to register an optionpage. */
128 do_hook('optpage_register_block');
129
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;
140 }
141 }
142 $optpage_blocks = array_merge($reg_optpage_blocks, $js_optpage_blocks);
143
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;
157 } else {
158 print_optionpages_row($first_optpage, $next_optpage);
159 $first_optpage = false;
160 }
161 }
162
163 if ($first_optpage != false) {
164 print_optionpages_row($first_optpage);
165 }
166
167 echo "</td></tr></table></td></tr></table>\n";
168
169 do_hook('options_link_and_description');
170
171
172/*************************************************************************/
173/* If we are not looking at the main option page, display the page here. */
174/*************************************************************************/
175} else {
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";
180
181 /* Output the option groups for this page. */
182 print_option_groups($optpage_data['options']);
183
184 /* Set the inside_hook_name and submit_name. */
185 switch ($optpage) {
186 case SMOPT_PAGE_PERSONAL:
187 $inside_hook_name = 'options_personal_inside';
188 $bottom_hook_name = 'options_personal_bottom';
189 $submit_name = 'submit_personal';
190 break;
191 case SMOPT_PAGE_DISPLAY:
192 $inside_hook_name = 'options_display_inside';
193 $bottom_hook_name = 'options_display_bottom';
194 $submit_name = 'submit_display';
195 break;
196 case SMOPT_PAGE_COMPOSE:
197 $inside_hook_name = 'options_compose_inside';
198 $bottom_hook_name = 'options_compose_bottom';
199 $submit_name = 'submit_compose';
200 break;
201 case SMOPT_PAGE_HIGHLIGHT:
202 $inside_hook_name = 'options_highlight_inside';
203 $bottom_hook_name = 'options_highlight_bottom';
204 $submit_name = 'submit_highlight';
205 break;
206 case SMOPT_PAGE_FOLDER:
207 $inside_hook_name = 'options_folder_inside';
208 $bottom_hook_name = 'options_folder_bottom';
209 $submit_name = 'submit_folder';
210 break;
211 case SMOPT_PAGE_ORDER:
212 $inside_hook_name = 'options_order_inside';
213 $bottom_hook_name = 'options_order_bottom';
214 $submit_name = 'submit_order';
215 break;
216 default:
217 $inside_hook_name = '';
218 $bottom_hook_name = '';
219 $submit_name = 'submit';
220 }
221
222 /* If it is not empty, trigger the inside hook. */
223 if ($inside_hook_name != '') {
224 do_hook($inside_hook_name);
225 }
226
227 /* Spit out a submit button. */
228 OptionSubmit($submit_name);
229 echo '</table></form>';
230
231 /* If it is not empty, trigger the bottom hook. */
232 if ($bottom_hook_name != '') {
233 do_hook($bottom_hook_name);
234 }
235}
236
237?>
238</td></tr>
239</table>
240</td></tr>
241</table>
242<?php
243
244
245
246
247
248
249
250
251
252
253
254/**
255 * This function prints out an option page row.
256 */
257function print_optionpages_row($leftopt, $rightopt = false) {
258 global $color;
259
260 if ($rightopt) {
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%"' );
263 } else {
264 $rightopt_name = html_tag( 'td', '&nbsp;', 'left', $color[4], 'valign="top" width="49%"' );
265 $rightopt_desc = html_tag( 'td', '&nbsp;', 'left', $color[4], 'valign="top" width="49%"' );
266 }
267
268 echo
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" .
274 html_tag( 'td',
275 '<a href="' . $leftopt['url'] . '">' . $leftopt['name'] . '</a>' ,
276 'left', $color[9], 'valign="top" width="49%"' ) .
277 html_tag( 'td',
278 '&nbsp;' ,
279 'left', $color[4], 'valign="top" width="2%"' ) . "\n" .
280 $rightopt_name
281 ) . "\n" .
282 html_tag( 'tr', "\n" .
283 html_tag( 'td',
284 $leftopt['desc'] ,
285 'left', $color[0], 'valign="top" width="49%"' ) .
286 html_tag( 'td',
287 '&nbsp;' ,
288 'left', $color[4], 'valign="top" width="2%"' ) . "\n" .
289 $rightopt_desc
290 ) ,
291 '', '', 'width="100%" cellpadding="2" cellspacing="0" border="0"' ) ,
292 'left', '', 'valign="top"' )
293 ) ,
294 '', $color[4], 'width="100%" cellpadding="0" cellspacing="5" border="0"' );
295}
296
297
298/**
299 * $Log$
300 * Revision 1.1 2006/07/09 22:22:31 vanmer
301 * - initial revision of a template for options output
302 *
303 *
304**/
305?>