commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/settings/func.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
f11541
|
8 |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Provide functionality for user's settings & preferences | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
681969
|
22 |
if (!$OUTPUT->ajax_call) |
A |
23 |
$OUTPUT->set_pagetitle(rcube_label('preferences')); |
4e17e6
|
24 |
|
b19097
|
25 |
|
f05834
|
26 |
// similar function as /steps/settings/identities.inc::rcmail_identity_frame() |
A |
27 |
function rcmail_preferences_frame($attrib) |
35c31e
|
28 |
{ |
f05834
|
29 |
global $OUTPUT; |
cb3538
|
30 |
|
f05834
|
31 |
if (!$attrib['id']) |
A |
32 |
$attrib['id'] = 'rcmprefsframe'; |
35c31e
|
33 |
|
f05834
|
34 |
$attrib['name'] = $attrib['id']; |
35c31e
|
35 |
|
f05834
|
36 |
$OUTPUT->set_env('contentframe', $attrib['name']); |
A |
37 |
$OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); |
9b3d7f
|
38 |
|
f05834
|
39 |
return html::iframe($attrib); |
A |
40 |
} |
|
41 |
|
|
42 |
|
|
43 |
function rcmail_sections_list($attrib) |
|
44 |
{ |
49771b
|
45 |
global $RCMAIL; |
f05834
|
46 |
|
A |
47 |
// add id to message list table if not specified |
|
48 |
if (!strlen($attrib['id'])) |
|
49 |
$attrib['id'] = 'rcmsectionslist'; |
|
50 |
|
49771b
|
51 |
list($list, $cols) = rcmail_user_prefs(); |
f05834
|
52 |
|
A |
53 |
// create XHTML table |
49771b
|
54 |
$out = rcube_table_output($attrib, $list, $cols, 'id'); |
f05834
|
55 |
|
A |
56 |
// set client env |
|
57 |
$RCMAIL->output->add_gui_object('sectionslist', $attrib['id']); |
|
58 |
$RCMAIL->output->include_script('list.js'); |
|
59 |
|
35c31e
|
60 |
return $out; |
f05834
|
61 |
} |
4e17e6
|
62 |
|
T |
63 |
|
|
64 |
function rcmail_identities_list($attrib) |
|
65 |
{ |
3ca3bd
|
66 |
global $OUTPUT, $USER, $RCMAIL; |
4e17e6
|
67 |
|
T |
68 |
// add id to message list table if not specified |
|
69 |
if (!strlen($attrib['id'])) |
|
70 |
$attrib['id'] = 'rcmIdentitiesList'; |
|
71 |
|
3ca3bd
|
72 |
// get all identites from DB and define list of cols to be displayed |
T |
73 |
$plugin = $RCMAIL->plugins->exec_hook('list_identities', array( |
|
74 |
'list' => $USER->list_identities(), |
|
75 |
'cols' => array('name', 'email'))); |
4e17e6
|
76 |
|
T |
77 |
// create XHTML table |
3ca3bd
|
78 |
$out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id'); |
4e17e6
|
79 |
|
T |
80 |
// set client env |
f11541
|
81 |
$OUTPUT->add_gui_object('identitieslist', $attrib['id']); |
4e17e6
|
82 |
|
T |
83 |
return $out; |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
// similar function as in /steps/addressbook/edit.inc |
57f0c8
|
88 |
function get_form_tags($attrib, $action, $id = null, $hidden = null) |
4e17e6
|
89 |
{ |
197601
|
90 |
global $EDIT_FORM, $RCMAIL; |
4e17e6
|
91 |
|
57f0c8
|
92 |
$form_start = $form_end = ''; |
T |
93 |
|
|
94 |
if (empty($EDIT_FORM)) { |
|
95 |
$request_key = $action . (isset($id) ? '.'.$id : ''); |
f05834
|
96 |
$form_start = $RCMAIL->output->request_form(array( |
A |
97 |
'name' => 'form', 'method' => 'post', |
|
98 |
'task' => $RCMAIL->task, 'action' => $action, |
|
99 |
'request' => $request_key, 'noclose' => true) + $attrib); |
4e17e6
|
100 |
|
57f0c8
|
101 |
if (is_array($hidden)) { |
T |
102 |
$hiddenfields = new html_hiddenfield($hidden); |
|
103 |
$form_start .= $hiddenfields->show(); |
4e17e6
|
104 |
} |
T |
105 |
|
57f0c8
|
106 |
$form_end = !strlen($attrib['form']) ? '</form>' : ''; |
4e17e6
|
107 |
|
57f0c8
|
108 |
$EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
T |
109 |
$RCMAIL->output->add_gui_object('editform', $EDIT_FORM); |
|
110 |
} |
4e17e6
|
111 |
|
197601
|
112 |
return array($form_start, $form_end); |
4e17e6
|
113 |
} |
T |
114 |
|
ec0171
|
115 |
|
49771b
|
116 |
function rcmail_user_prefs($current=null) |
A |
117 |
{ |
|
118 |
global $RCMAIL; |
|
119 |
|
|
120 |
$sections['general'] = array('id' => 'general', 'section' => rcube_label('uisettings')); |
|
121 |
$sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview')); |
|
122 |
$sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition')); |
|
123 |
$sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying')); |
|
124 |
$sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders')); |
|
125 |
$sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings')); |
|
126 |
|
|
127 |
// hook + define list cols |
|
128 |
$plugin = $RCMAIL->plugins->exec_hook('list_prefs_sections', |
|
129 |
array('list' => $sections, 'cols' => array('section'))); |
|
130 |
|
|
131 |
$sections = $plugin['list']; |
|
132 |
|
|
133 |
$config = $RCMAIL->config->all(); |
|
134 |
$no_override = array_flip($RCMAIL->config->get('dont_override', array())); |
|
135 |
|
|
136 |
foreach ($sections as $idx => $sect) { |
|
137 |
|
|
138 |
if ($current && $sect['id'] != $current) |
|
139 |
continue; |
|
140 |
|
|
141 |
$blocks = array(); |
|
142 |
|
|
143 |
switch ($sect['id']) { |
|
144 |
// general |
|
145 |
case 'general': |
|
146 |
|
|
147 |
$blocks = array( |
|
148 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
149 |
'list' => array('name' => Q(rcube_label('listoptions'))), |
|
150 |
); |
|
151 |
|
|
152 |
// language selection |
|
153 |
if (!isset($no_override['language'])) { |
|
154 |
$a_lang = $RCMAIL->list_languages(); |
|
155 |
asort($a_lang); |
|
156 |
|
|
157 |
$field_id = 'rcmfd_lang'; |
|
158 |
$select_lang = new html_select(array('name' => '_language', 'id' => $field_id)); |
|
159 |
$select_lang->add(array_values($a_lang), array_keys($a_lang)); |
|
160 |
|
|
161 |
$blocks['main']['options']['language'] = array( |
|
162 |
'title' => html::label($field_id, Q(rcube_label('language'))), |
|
163 |
'content' => $select_lang->show($RCMAIL->user->language), |
|
164 |
); |
|
165 |
} |
|
166 |
|
|
167 |
// show page size selection |
|
168 |
if (!isset($no_override['timezone'])) { |
|
169 |
$field_id = 'rcmfd_timezone'; |
|
170 |
$select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0")); |
|
171 |
$select_timezone->add(rcube_label('autodetect'), 'auto'); |
|
172 |
$select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); |
|
173 |
$select_timezone->add('(GMT -10:00) Hawaii', '-10'); |
|
174 |
$select_timezone->add('(GMT -9:30) Marquesas Islands', '-9.5'); |
|
175 |
$select_timezone->add('(GMT -9:00) Alaska', '-9'); |
|
176 |
$select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); |
|
177 |
$select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); |
|
178 |
$select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); |
|
179 |
$select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); |
|
180 |
$select_timezone->add('(GMT -4:30) Caracas', '-4.5'); |
|
181 |
$select_timezone->add('(GMT -4:00) Atlantic Time (Canada), La Paz', '-4'); |
|
182 |
$select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5'); |
|
183 |
$select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); |
|
184 |
$select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); |
|
185 |
$select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); |
|
186 |
$select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); |
|
187 |
$select_timezone->add('(GMT +1:00) Central European Time', '1'); |
|
188 |
$select_timezone->add('(GMT +2:00) EET: Tallinn, Helsinki, Kaliningrad, South Africa', '2'); |
|
189 |
$select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); |
|
190 |
$select_timezone->add('(GMT +3:30) Tehran', '3.5'); |
|
191 |
$select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); |
|
192 |
$select_timezone->add('(GMT +4:30) Kabul', '4.5'); |
|
193 |
$select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); |
|
194 |
$select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5'); |
|
195 |
$select_timezone->add('(GMT +5:45) Kathmandu', '5.75'); |
|
196 |
$select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); |
|
197 |
$select_timezone->add('(GMT +6:30) Cocos Islands, Myanmar', '6.5'); |
|
198 |
$select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); |
|
199 |
$select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); |
|
200 |
$select_timezone->add('(GMT +8:45) Caiguna, Eucla, Border Village', '8.75'); |
|
201 |
$select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); |
|
202 |
$select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5'); |
|
203 |
$select_timezone->add('(GMT +10:00) EAST/AEST: Sydney, Guam, Vladivostok', '10'); |
|
204 |
$select_timezone->add('(GMT +10:30) New South Wales', '10.5'); |
|
205 |
$select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); |
|
206 |
$select_timezone->add('(GMT +11:30) Norfolk Island', '11.5'); |
|
207 |
$select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); |
|
208 |
$select_timezone->add('(GMT +12:45) Chatham Islands', '12.75'); |
|
209 |
$select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); |
|
210 |
$select_timezone->add('(GMT +14:00) Kiribati', '14'); |
|
211 |
|
|
212 |
$blocks['main']['options']['timezone'] = array( |
|
213 |
'title' => html::label($field_id, Q(rcube_label('timezone'))), |
|
214 |
'content' => $select_timezone->show((string)$config['timezone']), |
|
215 |
); |
|
216 |
} |
|
217 |
|
|
218 |
// daylight savings |
|
219 |
if (!isset($no_override['dst_active'])) { |
|
220 |
$field_id = 'rcmfd_dst'; |
|
221 |
$input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1, 'disabled' => ($config['timezone'] === 'auto'))); |
|
222 |
|
|
223 |
$blocks['main']['options']['dstactive'] = array( |
|
224 |
'title' => html::label($field_id, Q(rcube_label('dstactive'))), |
|
225 |
'content' => $input_dst->show($config['dst_active']), |
|
226 |
); |
|
227 |
} |
|
228 |
|
|
229 |
// MM: Show checkbox for toggling 'pretty dates' |
|
230 |
if (!isset($no_override['prettydate'])) { |
|
231 |
$field_id = 'rcmfd_prettydate'; |
|
232 |
$input_prettydate = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); |
|
233 |
|
|
234 |
$blocks['main']['options']['prettydate'] = array( |
|
235 |
'title' => html::label($field_id, Q(rcube_label('prettydate'))), |
|
236 |
'content' => $input_prettydate->show($config['prettydate']?1:0), |
|
237 |
); |
|
238 |
} |
|
239 |
|
|
240 |
// show page size selection |
|
241 |
if (!isset($no_override['pagesize'])) { |
|
242 |
$field_id = 'rcmfd_pgsize'; |
|
243 |
$input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); |
|
244 |
|
|
245 |
$blocks['list']['options']['pagesize'] = array( |
|
246 |
'title' => html::label($field_id, Q(rcube_label('pagesize'))), |
|
247 |
'content' => $input_pagesize->show($config['pagesize']), |
|
248 |
); |
|
249 |
} |
|
250 |
|
|
251 |
// Show checkbox for toggling 'index_sort' |
|
252 |
if (!isset($no_override['index_sort'])) { |
|
253 |
$field_id = 'rcmfd_indexsort'; |
|
254 |
$input_indexsort = new html_checkbox(array('name' => '_index_sort', 'id' => $field_id, 'value' => 1)); |
|
255 |
|
|
256 |
$blocks['list']['options']['index_sort'] = array( |
|
257 |
'title' => html::label($field_id, Q(rcube_label('indexsort'))), |
|
258 |
'content' => $input_indexsort->show($config['index_sort']?1:0), |
|
259 |
); |
|
260 |
} |
|
261 |
|
|
262 |
// show drop-down for available skins |
|
263 |
if (!isset($no_override['skin'])) { |
|
264 |
$skins = rcmail_get_skins(); |
|
265 |
|
|
266 |
if (count($skins) > 1) { |
|
267 |
$field_id = 'rcmfd_skin'; |
|
268 |
$input_skin = new html_select(array('name'=>'_skin', 'id'=>$field_id)); |
|
269 |
|
|
270 |
foreach($skins as $skin) |
|
271 |
$input_skin->add($skin, $skin); |
|
272 |
|
|
273 |
$blocks['main']['options']['skin'] = array( |
|
274 |
'title' => html::label($field_id, Q(rcube_label('skin'))), |
|
275 |
'content' => $input_skin->show($config['skin']), |
|
276 |
); |
|
277 |
} |
|
278 |
} |
|
279 |
|
|
280 |
break; |
|
281 |
|
|
282 |
// Mailbox view (mail screen) |
|
283 |
case 'mailbox': |
|
284 |
|
|
285 |
$blocks = array( |
|
286 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
287 |
'new_message' => array('name' => Q(rcube_label('newmessage'))), |
|
288 |
); |
|
289 |
|
|
290 |
// show config parameter for preview pane |
|
291 |
if (!isset($no_override['preview_pane'])) { |
|
292 |
$field_id = 'rcmfd_preview'; |
|
293 |
$input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1)); |
|
294 |
|
|
295 |
$blocks['main']['options']['preview_pane'] = array( |
|
296 |
'title' => html::label($field_id, Q(rcube_label('previewpane'))), |
|
297 |
'content' => $input_preview->show($config['preview_pane']?1:0), |
|
298 |
); |
|
299 |
} |
|
300 |
|
|
301 |
if (!isset($no_override['mdn_requests'])) { |
|
302 |
$field_id = 'rcmfd_mdn_requests'; |
|
303 |
$select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id)); |
|
304 |
$select_mdn_requests->add(rcube_label('askuser'), 0); |
|
305 |
$select_mdn_requests->add(rcube_label('autosend'), 1); |
|
306 |
$select_mdn_requests->add(rcube_label('ignore'), 2); |
|
307 |
|
|
308 |
$blocks['main']['options']['mdn_requests'] = array( |
|
309 |
'title' => html::label($field_id, Q(rcube_label('mdnrequests'))), |
|
310 |
'content' => $select_mdn_requests->show($config['mdn_requests']), |
|
311 |
); |
|
312 |
} |
|
313 |
|
|
314 |
if (!isset($no_override['focus_on_new_message'])) { |
|
315 |
$field_id = 'rcmfd_focus_on_new_message'; |
|
316 |
$input_focus_on_new_message = new html_checkbox(array('name' => '_focus_on_new_message', 'id' => $field_id, 'value' => 1)); |
|
317 |
|
|
318 |
$blocks['new_message']['options']['focus_on_new_message'] = array( |
|
319 |
'title' => html::label($field_id, Q(rcube_label('focusonnewmessage'))), |
|
320 |
'content' => $input_focus_on_new_message->show($config['focus_on_new_message']?1:0), |
|
321 |
); |
|
322 |
} |
|
323 |
|
|
324 |
if (!isset($no_override['keep_alive'])) { |
|
325 |
$field_id = 'rcmfd_keep_alive'; |
|
326 |
$select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); |
|
327 |
|
|
328 |
foreach(array(1, 3, 5, 10, 15, 30, 60) as $min) |
|
329 |
if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) |
|
330 |
&& (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) { |
|
331 |
$select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min); |
|
332 |
} |
|
333 |
|
|
334 |
$blocks['new_message']['options']['keep_alive'] = array( |
|
335 |
'title' => html::label($field_id, Q(rcube_label('keepalive'))), |
|
336 |
'content' => $select_keep_alive->show($config['keep_alive']/60), |
|
337 |
); |
|
338 |
} |
|
339 |
|
|
340 |
if (!isset($no_override['check_all_folders'])) { |
|
341 |
$field_id = 'rcmfd_check_all_folders'; |
|
342 |
$input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); |
|
343 |
|
|
344 |
$blocks['new_message']['options']['check_all_folders'] = array( |
|
345 |
'title' => html::label($field_id, Q(rcube_label('checkallfolders'))), |
|
346 |
'content' => $input_check_all->show($config['check_all_folders']?1:0), |
|
347 |
); |
|
348 |
} |
|
349 |
|
|
350 |
break; |
|
351 |
|
|
352 |
// Message viewing |
|
353 |
case 'mailview': |
|
354 |
|
|
355 |
$blocks = array( |
|
356 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
357 |
); |
|
358 |
|
|
359 |
// show checkbox for HTML/plaintext messages |
|
360 |
if (!isset($no_override['prefer_html'])) { |
|
361 |
$field_id = 'rcmfd_htmlmsg'; |
|
362 |
$input_preferhtml = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1, |
|
363 |
'onchange' => JS_OBJECT_NAME.'.toggle_prefer_html(this)')); |
|
364 |
|
|
365 |
$blocks['main']['options']['prefer_html'] = array( |
|
366 |
'title' => html::label($field_id, Q(rcube_label('preferhtml'))), |
|
367 |
'content' => $input_preferhtml->show($config['prefer_html']?1:0), |
|
368 |
); |
|
369 |
} |
|
370 |
|
|
371 |
if (!isset($no_override['show_images'])) { |
|
372 |
$field_id = 'rcmfd_show_images'; |
|
373 |
$input_show_images = new html_select(array('name' => '_show_images', 'id' => $field_id)); |
|
374 |
$input_show_images->add(rcube_label('never'), 0); |
|
375 |
$input_show_images->add(rcube_label('fromknownsenders'), 1); |
|
376 |
$input_show_images->add(rcube_label('always'), 2); |
|
377 |
|
|
378 |
$blocks['main']['options']['show_images'] = array( |
|
379 |
'title' => html::label($field_id, Q(rcube_label('showremoteimages'))), |
|
380 |
'content' => $input_show_images->show($config['show_images']), |
|
381 |
); |
|
382 |
} |
|
383 |
|
|
384 |
if (!isset($no_override['inline_images'])) { |
|
385 |
$field_id = 'rcmfd_inline_images'; |
|
386 |
$input_inline_images = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1)); |
|
387 |
|
|
388 |
$blocks['main']['options']['inline_images'] = array( |
|
389 |
'title' => html::label($field_id, Q(rcube_label('showinlineimages'))), |
|
390 |
'content' => $input_inline_images->show($config['inline_images']?1:0), |
|
391 |
); |
|
392 |
} |
|
393 |
|
|
394 |
// "display after delete" checkbox |
|
395 |
if (!isset($no_override['display_next'])) { |
|
396 |
$field_id = 'rcmfd_displaynext'; |
|
397 |
$input_displaynext = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); |
|
398 |
|
|
399 |
$blocks['main']['options']['display_next'] = array( |
|
400 |
'title' => html::label($field_id, Q(rcube_label('displaynext'))), |
|
401 |
'content' => $input_displaynext->show($config['display_next']?1:0), |
|
402 |
); |
|
403 |
} |
|
404 |
|
|
405 |
break; |
|
406 |
|
|
407 |
// Mail composition |
|
408 |
case 'compose': |
|
409 |
|
|
410 |
$blocks = array( |
|
411 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
412 |
); |
|
413 |
|
|
414 |
// Show checkbox for HTML Editor |
|
415 |
if (!isset($no_override['htmleditor'])) { |
|
416 |
$field_id = 'rcmfd_htmleditor'; |
|
417 |
$input_htmleditor = new html_checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); |
|
418 |
|
|
419 |
$blocks['main']['options']['htmleditor'] = array( |
|
420 |
'title' => html::label($field_id, Q(rcube_label('htmleditor'))), |
|
421 |
'content' => $input_htmleditor->show($config['htmleditor']?1:0), |
|
422 |
); |
|
423 |
} |
|
424 |
|
|
425 |
if (!isset($no_override['draft_autosave'])) { |
|
426 |
$field_id = 'rcmfd_autosave'; |
|
427 |
$select_autosave = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox']))); |
|
428 |
$select_autosave->add(rcube_label('never'), 0); |
|
429 |
foreach (array(1, 3, 5, 10) as $i => $min) |
|
430 |
$select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60); |
|
431 |
|
|
432 |
$blocks['main']['options']['draft_autosave'] = array( |
|
433 |
'title' => html::label($field_id, Q(rcube_label('autosavedraft'))), |
|
434 |
'content' => $select_autosave->show($config['draft_autosave']), |
|
435 |
); |
|
436 |
} |
|
437 |
|
|
438 |
if (!isset($no_override['mime_param_folding'])) { |
|
439 |
$field_id = 'rcmfd_param_folding'; |
|
440 |
$select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id)); |
|
441 |
$select_param_folding->add(rcube_label('2231folding'), 0); |
|
442 |
$select_param_folding->add(rcube_label('miscfolding'), 1); |
|
443 |
$select_param_folding->add(rcube_label('2047folding'), 2); |
|
444 |
|
|
445 |
$blocks['main']['options']['mime_param_folding'] = array( |
|
446 |
'advanced' => true, |
|
447 |
'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), |
|
448 |
'content' => $select_param_folding->show($config['mime_param_folding']), |
|
449 |
); |
|
450 |
} |
|
451 |
|
|
452 |
break; |
|
453 |
|
|
454 |
// Special IMAP folders |
|
455 |
case 'folders': |
|
456 |
|
|
457 |
$blocks = array( |
|
458 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
459 |
); |
|
460 |
|
|
461 |
// Configure special folders |
|
462 |
if (!isset($no_override['default_imap_folders'])) { |
|
463 |
$RCMAIL->imap_init(true); |
|
464 |
$select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, |
|
465 |
'maxlength' => 30, 'exceptions' => array('INBOX'))); |
|
466 |
|
|
467 |
if (!isset($no_override['drafts_mbox'])) |
|
468 |
$blocks['main']['options']['drafts_mbox'] = array( |
|
469 |
'title' => Q(rcube_label('drafts')), |
|
470 |
'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox")), |
|
471 |
); |
|
472 |
|
|
473 |
if (!isset($no_override['sent_mbox'])) |
|
474 |
$blocks['main']['options']['sent_mbox'] = array( |
|
475 |
'title' => Q(rcube_label('sent')), |
|
476 |
'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox")), |
|
477 |
); |
|
478 |
|
|
479 |
if (!isset($no_override['junk_mbox'])) |
|
480 |
$blocks['main']['options']['junk_mbox'] = array( |
|
481 |
'title' => Q(rcube_label('junk')), |
|
482 |
'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox")), |
|
483 |
); |
|
484 |
|
|
485 |
if (!isset($no_override['trash_mbox'])) |
|
486 |
$blocks['main']['options']['trash_mbox'] = array( |
|
487 |
'title' => Q(rcube_label('trash')), |
|
488 |
'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox")), |
|
489 |
); |
|
490 |
} |
|
491 |
|
|
492 |
break; |
|
493 |
|
|
494 |
// Server settings |
|
495 |
case 'server': |
|
496 |
|
|
497 |
$blocks = array( |
|
498 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
499 |
'maintenance' => array('name' => Q(rcube_label('maintenance'))), |
|
500 |
); |
|
501 |
|
|
502 |
if (!isset($no_override['read_when_deleted'])) { |
|
503 |
$field_id = 'rcmfd_read_deleted'; |
|
504 |
$input_readdeleted = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1)); |
|
505 |
|
|
506 |
$blocks['main']['options']['read_when_deleted'] = array( |
|
507 |
'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))), |
|
508 |
'content' => $input_readdeleted->show($config['read_when_deleted']?1:0), |
|
509 |
); |
|
510 |
} |
|
511 |
|
|
512 |
if (!isset($no_override['flag_for_deletion'])) { |
|
513 |
$field_id = 'rcmfd_flag_for_deletion'; |
|
514 |
$input_flagfordeletion = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1)); |
|
515 |
|
|
516 |
$blocks['main']['options']['flag_for_deletion'] = array( |
|
517 |
'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))), |
|
518 |
'content' => $input_flagfordeletion->show($config['flag_for_deletion']?1:0), |
|
519 |
); |
|
520 |
} |
|
521 |
|
|
522 |
// don't show deleted messages |
|
523 |
if (!isset($no_override['skip_deleted'])) { |
|
524 |
$field_id = 'rcmfd_skip_deleted'; |
|
525 |
$input_purge = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1)); |
|
526 |
|
|
527 |
$blocks['main']['options']['skip_deleted'] = array( |
|
528 |
'title' => html::label($field_id, Q(rcube_label('skipdeleted'))), |
|
529 |
'content' => $input_purge->show($config['skip_deleted']?1:0), |
|
530 |
); |
|
531 |
} |
|
532 |
|
|
533 |
// Trash purging on logout |
|
534 |
if (!isset($no_override['logout_purge'])) { |
|
535 |
$field_id = 'rcmfd_logout_purge'; |
|
536 |
$input_purge = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); |
|
537 |
|
|
538 |
$blocks['maintenance']['options']['logout_purge'] = array( |
|
539 |
'title' => html::label($field_id, Q(rcube_label('logoutclear'))), |
|
540 |
'content' => $input_purge->show($config['logout_purge']?1:0), |
|
541 |
); |
|
542 |
} |
|
543 |
|
|
544 |
// INBOX compacting on logout |
|
545 |
if (!isset($no_override['logout_expunge'])) { |
|
546 |
$field_id = 'rcmfd_logout_expunge'; |
|
547 |
$input_expunge = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1)); |
|
548 |
|
|
549 |
$blocks['maintenance']['options']['logout_expunge'] = array( |
|
550 |
'title' => html::label($field_id, Q(rcube_label('logoutcompact'))), |
|
551 |
'content' => $input_expunge->show($config['logout_expunge']?1:0), |
|
552 |
); |
|
553 |
} |
|
554 |
|
|
555 |
break; |
|
556 |
} |
|
557 |
|
|
558 |
$data = $RCMAIL->plugins->exec_hook('user_preferences', array('section' => $sect['id'], 'blocks' => $blocks)); |
|
559 |
$found = false; |
|
560 |
|
|
561 |
// create output |
|
562 |
foreach ($data['blocks'] as $block) { |
|
563 |
if ($block['options']) { |
|
564 |
foreach ($block['options'] as $option) { |
|
565 |
$found = true; |
|
566 |
break 2; |
|
567 |
} |
|
568 |
} |
|
569 |
} |
|
570 |
|
|
571 |
if (!$found) |
|
572 |
unset($sections[$idx]); |
|
573 |
else |
|
574 |
$sections[$idx]['blocks'] = $data['blocks']; |
|
575 |
} |
|
576 |
|
|
577 |
return array($sections, $plugin['cols']); |
|
578 |
} |
|
579 |
|
|
580 |
|
|
581 |
function rcmail_get_skins() |
|
582 |
{ |
|
583 |
$path = 'skins'; |
|
584 |
$skins = array(); |
|
585 |
|
|
586 |
$dir = opendir($path); |
|
587 |
|
|
588 |
if (!$dir) |
|
589 |
return false; |
|
590 |
|
|
591 |
while (($file = readdir($dir)) !== false) |
|
592 |
{ |
|
593 |
$filename = $path.'/'.$file; |
|
594 |
if (is_dir($filename) && is_readable($filename) |
|
595 |
&& !in_array($file, array('.', '..', '.svn'))) |
|
596 |
$skins[] = $file; |
|
597 |
} |
|
598 |
|
|
599 |
closedir($dir); |
|
600 |
|
|
601 |
return $skins; |
|
602 |
} |
|
603 |
|
|
604 |
|
f11541
|
605 |
// register UI objects |
T |
606 |
$OUTPUT->add_handlers(array( |
f05834
|
607 |
'prefsframe' => 'rcmail_preferences_frame', |
A |
608 |
'sectionslist' => 'rcmail_sections_list', |
b89d5a
|
609 |
'identitieslist' => 'rcmail_identities_list', |
f11541
|
610 |
)); |
T |
611 |
|
2ad77d
|
612 |
?> |