4df209c5b562308a8d1f5b0bbd4176aed5688b0f
[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 $optvals[] = array(
165 'name' => 'alt_index_colors',
166 'caption' => _("Use Alternating Row Colors"),
167 'type' => SMOPT_TYPE_BOOLEAN,
168 'refresh' => SMOPT_REFRESH_NONE
169 );
170
171 $optvals[] = array(
172 'name' => 'show_html_default',
173 'caption' => _("Show HTML Version by Default"),
174 'type' => SMOPT_TYPE_BOOLEAN,
175 'refresh' => SMOPT_REFRESH_NONE
176 );
177
178 $optvals[] = array(
179 'name' => 'include_self_reply_all',
180 'caption' => _("Remove Me from CC when I Reply All"),
181 'type' => SMOPT_TYPE_BOOLEAN,
182 'refresh' => SMOPT_REFRESH_NONE
183 );
184
185 $optvals[] = array(
186 'name' => 'page_selector',
187 'caption' => _("Use Page Selector"),
188 'type' => SMOPT_TYPE_BOOLEAN,
189 'refresh' => SMOPT_REFRESH_NONE
190 );
191
192 $optvals[] = array(
193 'name' => 'page_selector_max',
194 'caption' => _("Maximum Number of Pages to Show"),
195 'type' => SMOPT_TYPE_INTEGER,
196 'refresh' => SMOPT_REFRESH_NONE
197 );
198
199 $optvals[] = array(
200 'name' => 'show_xmailer_default',
201 'caption' => _("Show the Mailer of incoming messages"),
202 'type' => SMOPT_TYPE_BOOLEAN,
203 'refresh' => SMOPT_REFRESH_NONE
204 );
205
206 /* Build all these values into an array of SquirrelOptions objects. */
207 $options = createOptionArray($optvals);
208
209 /* Print the row for each option. */
210 foreach ($options as $option) {
211 if ($option->type != SMOPT_TYPE_HIDDEN) {
212 echo "<TR>\n";
213 echo ' <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP>'
214 . $option->caption . ":</TD>\n";
215 echo ' <TD>' . $option->createHTMLWidget() . "</TD>\n";
216 echo "</TR>\n";
217 } else {
218 echo $option->createHTMLWidget();
219 }
220 }
221
222 echo '<tr><td colspan=2><hr noshade></td></tr>';
223 do_hook('options_display_inside');
224 OptionSubmit( 'submit_display' );
225 ?>
226
227 </table>
228 </form>
229
230 <?php do_hook('options_display_bottom'); ?>
231
232 </td></tr>
233 </table>
234
235 <SCRIPT LANGUAGE="JavaScript"><!--
236 document.forms[0].new_js_autodetect_results.value = '<?php echo SMPREF_JS_ON; ?>';
237 // --></SCRIPT>
238
239 </td></tr>
240 </table>
241 </body></html>