added automagically sanitizing for foo_once into the conf.pl script
[squirrelmail.git] / src / options_display.php
CommitLineData
c36ed9cf 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 **
245a6892 10 ** $Id$
c36ed9cf 11 **/
12
ff8a98e7 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');
45cfc124 18 require_once('../functions/options.php');
19
e8e0acdf 20 displayPageHeader($color, 'None');
ce393174 21 $language = getPref($data_dir, $username, 'language');
c36ed9cf 22?>
e9f8ea4e 23 <br>
e7db48af 24<table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
25<tr><td bgcolor="<?php echo $color[0] ?>" align="center">
c36ed9cf 26
cd41fc8d 27 <b><?php echo _("Options") . ' - ' . _("Display Preferences"); ?></b><br>
e7db48af 28
cd41fc8d 29 <table width="100%" border="0" cellpadding="1" cellspacing="1">
30 <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
e7db48af 31
32 <form name="f" action="options.php" method="post"><br>
33 <table width="100%" cellpadding="2" cellspacing="0" border="0">
8442ac08 34<?php
a3ec3c91 35
ce393174 36 /* Build a simple array into which we will build options. */
37 $optvals = array();
a3ec3c91 38
ce393174 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 );
a3ec3c91 73
74 /* Set values for the "use javascript" option. */
75 $optvals[] = array(
76 'name' => 'javascript_setting',
ce393174 77 'caption' => _("Use Javascript"),
a3ec3c91 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
a3ec3c91 114 $optvals[] = array(
115 'name' => 'location_of_buttons',
ce393174 116 'caption' => _("Location of Buttons when Composing"),
a3ec3c91 117 'type' => SMOPT_TYPE_STRLIST,
118 'refresh' => SMOPT_REFRESH_NONE,
ce393174 119 'posvals' => array(SMPREF_LOC_TOP => _("Before headers"),
120 SMPREF_LOC_BETWEEN => _("Between headers and message body"),
121 SMPREF_LOC_BOTTOM => _("After message body"))
a3ec3c91 122 );
123
124 $optvals[] = array(
125 'name' => 'location_of_bar',
ce393174 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"),
a3ec3c91 140 'type' => SMOPT_TYPE_STRLIST,
141 'refresh' => SMOPT_REFRESH_ALL,
ce393174 142 'posvals' => $left_size_values
a3ec3c91 143 );
144
ce393174 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
fd87494d 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' => _("Include Self in 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
ce393174 199 /* Build all these values into an array of SquirrelOptions objects. */
a3ec3c91 200 $options = createOptionArray($optvals);
201
202 /* Print the row for each option. */
203 foreach ($options as $option) {
204 if ($option->type != SMOPT_TYPE_HIDDEN) {
205 echo "<TR>\n";
206 echo ' <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP><font color=red><b>'
207 . $option->caption . "</b></font>:</TD>\n";
208 echo ' <TD>' . $option->createHTMLWidget() . "</TD>\n";
209 echo "</TR>\n";
210 } else {
211 echo $option->createHTMLWidget();
212 }
213 }
214
ce393174 215 /*** NOT YET CONVERTED TO OPTION OBJECTS ***/
216
2016e645 217 echo '<tr><td colspan=2><hr noshade></td></tr>';
218 do_hook('options_display_inside');
84c18709 219 OptionSubmit( 'submit_display' );
2016e645 220?>
f1e6f580 221
e7db48af 222 </table>
c36ed9cf 223 </form>
e7db48af 224
e8e0acdf 225 <?php do_hook('options_display_bottom'); ?>
e7db48af 226
227 </td></tr>
228 </table>
229
23d6bd09 230<SCRIPT LANGUAGE="JavaScript"><!--
a3ec3c91 231 document.forms[0].new_js_autodetect_results.value = '<?php echo SMPREF_JS_ON; ?>';
23d6bd09 232// --></SCRIPT>
233
e7db48af 234</td></tr>
235</table>
23d6bd09 236</body></html>