More work done on the options stuff.
[squirrelmail.git] / src / options_display.php
1 <?php
2 /**
3 ** options_display.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Displays all optinos about display preferences
9 **
10 ** $Id$
11 **/
12
13 require_once('../src/validate.php');
14 require_once('../functions/display_messages.php');
15 require_once('../functions/imap.php');
16 require_once('../functions/array.php');
17 require_once('../functions/plugin.php');
18 require_once('../functions/options.php');
19
20 displayPageHeader($color, 'None');
21 $language = getPref($data_dir, $username, 'language');
22 ?>
23 <br>
24 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
25 <tr><td bgcolor="<?php echo $color[0] ?>" align="center">
26
27 <b><?php echo _("Options") . ' - ' . _("Display Preferences"); ?></b><br>
28
29 <table width="100%" border="0" cellpadding="1" cellspacing="1">
30 <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
31
32 <form name="f" action="options.php" method="post"><br>
33 <table width="100%" cellpadding="2" cellspacing="0" border="0">
34 <?php
35
36 /* Build a simple array into which we will build options. */
37 $optvals = array();
38
39 $theme_values = array();
40 foreach ($theme as $theme_key => $theme_attributes) {
41 $theme_values[$theme_attributes['PATH']] = $theme_attributes['NAME'];
42 }
43 $optvals[] = array(
44 'name' => 'chosen_theme',
45 'caption' => _("Theme"),
46 'type' => SMOPT_TYPE_STRLIST,
47 'refresh' => SMOPT_REFRESH_ALL,
48 'posvals' => $theme_values
49 );
50
51 $language_values = array();
52 foreach ($languages as $lang_key => $lang_attributes) {
53 if (isset($lang_attributes['NAME'])) {
54 $language_values[$lang_key] = $lang_attributes['NAME'];
55 }
56 }
57 $optvals[] = array(
58 'name' => 'language',
59 'caption' => _("Language"),
60 'type' => SMOPT_TYPE_STRLIST,
61 'refresh' => SMOPT_REFRESH_ALL,
62 'posvals' => $language_values
63 );
64
65 $optvals[] = array(
66 'name' => 'use_javascript_addr_book',
67 'caption' => _("Addressbook Display Format"),
68 'type' => SMOPT_TYPE_STRLIST,
69 'refresh' => SMOPT_REFRESH_NONE,
70 'posvals' => array('1' => _("Javascript"),
71 '0' => _("HTML"))
72 );
73
74 /* Set values for the "use javascript" option. */
75 $optvals[] = array(
76 'name' => 'javascript_setting',
77 'caption' => _("Use Javascript"),
78 'type' => SMOPT_TYPE_STRLIST,
79 'refresh' => SMOPT_REFRESH_ALL,
80 'posvals' => array(SMPREF_JS_AUTODETECT => _("Autodetect"),
81 SMPREF_JS_ON => _("Always"),
82 SMPREF_JS_OFF => _("Never"))
83 );
84
85 $js_autodetect_results = SMPREF_JS_OFF;
86 $optvals[] = array(
87 'name' => 'js_autodetect_results',
88 'caption' => '',
89 'type' => SMOPT_TYPE_HIDDEN,
90 'refresh' => SMOPT_REFRESH_NONE
91 );
92
93 $optvals[] = array(
94 'name' => 'show_num',
95 'caption' => _("Number of Messages to Index"),
96 'type' => SMOPT_TYPE_INTEGER,
97 'refresh' => SMOPT_REFRESH_NONE
98 );
99
100 $optvals[] = array(
101 'name' => 'wrap_at',
102 'caption' => _("Wrap Incoming Text At"),
103 'type' => SMOPT_TYPE_INTEGER,
104 'refresh' => SMOPT_REFRESH_NONE
105 );
106
107 $optvals[] = array(
108 'name' => 'editor_size',
109 'caption' => _("Size of Editor Window"),
110 'type' => SMOPT_TYPE_INTEGER,
111 'refresh' => SMOPT_REFRESH_NONE
112 );
113
114 $optvals[] = array(
115 'name' => 'location_of_buttons',
116 'caption' => _("Location of Buttons when Composing"),
117 'type' => SMOPT_TYPE_STRLIST,
118 'refresh' => SMOPT_REFRESH_NONE,
119 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"),
120 SMPREF_LOC_BETWEEN => _("Between headers and message body"),
121 SMPREF_LOC_BOTTOM => _("After message body"))
122 );
123
124 $optvals[] = array(
125 'name' => 'location_of_bar',
126 'caption' => _("Location of Folder List"),
127 'type' => SMOPT_TYPE_STRLIST,
128 'refresh' => SMOPT_REFRESH_ALL,
129 'posvals' => array(SMPREF_LOC_LEFT => _("Left"),
130 SMPREF_LOC_RIGHT => _("Right"))
131 );
132
133 $left_size_values = array();
134 for ($lsv = 100; $lsv <= 300; $lsv += 10) {
135 $left_size_values[$lsv] = "$lsv " . _("pixels");
136 }
137 $optvals[] = array(
138 'name' => 'left_size',
139 'caption' => _("Width of Folder List"),
140 'type' => SMOPT_TYPE_STRLIST,
141 'refresh' => SMOPT_REFRESH_ALL,
142 'posvals' => $left_size_values
143 );
144
145 $minute_str = _("Minutes");
146 $left_refresh_values = array(SMPREF_NONE => _("Never"));
147 foreach (array(30,60,120,180,300,600) as $lr_val) {
148 if ($lr_val < 60) {
149 $left_refresh_values[$lr_val] = "$lr_val " . _("Seconds");
150 } else if ($lr_val == 60) {
151 $left_refresh_values[$lr_val] = "1 " . _("Minute");
152 } else {
153 $left_refresh_values[$lr_val] = ($lr_val/60) . " $minute_str";
154 }
155 }
156 $optvals[] = array(
157 'name' => 'left_refresh',
158 'caption' => _("Auto Refresh Folder List"),
159 'type' => SMOPT_TYPE_STRLIST,
160 'refresh' => SMOPT_REFRESH_FOLDERLIST,
161 'posvals' => $left_refresh_values
162 );
163
164 /* Build all these values into an array of SquirrelOptions objects. */
165 $options = createOptionArray($optvals);
166
167 /* Print the row for each option. */
168 foreach ($options as $option) {
169 if ($option->type != SMOPT_TYPE_HIDDEN) {
170 echo "<TR>\n";
171 echo ' <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP><font color=red><b>'
172 . $option->caption . "</b></font>:</TD>\n";
173 echo ' <TD>' . $option->createHTMLWidget() . "</TD>\n";
174 echo "</TR>\n";
175 } else {
176 echo $option->createHTMLWidget();
177 }
178 }
179
180 /*** NOT YET CONVERTED TO OPTION OBJECTS ***/
181
182 OptionRadio( _("Use alternating row colors?"),
183 'altIndexColors',
184 array( 1 => _("Yes"),
185 0 => _("No") ),
186 $alt_index_colors );
187 OptionCheck( _("Show HTML version by default"),
188 'showhtmldefault',
189 $show_html_default,
190 _("Yes, show me the HTML version of a mail message, if it is available.") );
191 OptionCheck( _("Include Self"),
192 'includeselfreplyall',
193 getPref($data_dir, $username, 'include_self_reply_all', FALSE ),
194 _("Don't remove me from the CC addresses when I use \"Reply All\"") );
195 $psw = getPref($data_dir, $username, 'page_selector_max', 10 );
196 OptionCheck( _("Page Selector"),
197 'pageselector',
198 !getPref($data_dir, $username, 'page_selector', FALSE ),
199 _("Show page selector") .
200 " <input name=pageselectormax size=3 value=\"$psw\"> &nbsp;" .
201 _("pages max") );
202
203 echo '<tr><td colspan=2><hr noshade></td></tr>';
204 do_hook('options_display_inside');
205 OptionSubmit( 'submit_display' );
206 ?>
207
208 </table>
209 </form>
210
211 <?php do_hook('options_display_bottom'); ?>
212
213 </td></tr>
214 </table>
215
216 <SCRIPT LANGUAGE="JavaScript"><!--
217 document.forms[0].new_js_autodetect_results.value = '<?php echo SMPREF_JS_ON; ?>';
218 // --></SCRIPT>
219
220 </td></tr>
221 </table>
222 </body></html>