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 |
|
54759c
|
72 |
// get identities list and define 'mail' column |
A |
73 |
$list = $USER->list_identities(); |
|
74 |
foreach ($list as $idx => $row) |
|
75 |
$list[$idx]['mail'] = trim($row['name'] . ' <' . $row['email'] .'>'); |
|
76 |
|
3ca3bd
|
77 |
// get all identites from DB and define list of cols to be displayed |
T |
78 |
$plugin = $RCMAIL->plugins->exec_hook('list_identities', array( |
54759c
|
79 |
'list' => $list, |
A |
80 |
'cols' => array('mail'))); |
4e17e6
|
81 |
|
54759c
|
82 |
// @TODO: use <UL> instead of <TABLE> for identities list |
A |
83 |
// create XHTML table |
3ca3bd
|
84 |
$out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id'); |
54759c
|
85 |
|
4e17e6
|
86 |
// set client env |
f11541
|
87 |
$OUTPUT->add_gui_object('identitieslist', $attrib['id']); |
4e17e6
|
88 |
|
T |
89 |
return $out; |
|
90 |
} |
|
91 |
|
|
92 |
|
|
93 |
// similar function as in /steps/addressbook/edit.inc |
57f0c8
|
94 |
function get_form_tags($attrib, $action, $id = null, $hidden = null) |
4e17e6
|
95 |
{ |
197601
|
96 |
global $EDIT_FORM, $RCMAIL; |
4e17e6
|
97 |
|
57f0c8
|
98 |
$form_start = $form_end = ''; |
T |
99 |
|
|
100 |
if (empty($EDIT_FORM)) { |
|
101 |
$request_key = $action . (isset($id) ? '.'.$id : ''); |
f05834
|
102 |
$form_start = $RCMAIL->output->request_form(array( |
A |
103 |
'name' => 'form', 'method' => 'post', |
|
104 |
'task' => $RCMAIL->task, 'action' => $action, |
|
105 |
'request' => $request_key, 'noclose' => true) + $attrib); |
4e17e6
|
106 |
|
57f0c8
|
107 |
if (is_array($hidden)) { |
T |
108 |
$hiddenfields = new html_hiddenfield($hidden); |
|
109 |
$form_start .= $hiddenfields->show(); |
4e17e6
|
110 |
} |
T |
111 |
|
57f0c8
|
112 |
$form_end = !strlen($attrib['form']) ? '</form>' : ''; |
4e17e6
|
113 |
|
57f0c8
|
114 |
$EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
T |
115 |
$RCMAIL->output->add_gui_object('editform', $EDIT_FORM); |
|
116 |
} |
4e17e6
|
117 |
|
197601
|
118 |
return array($form_start, $form_end); |
4e17e6
|
119 |
} |
T |
120 |
|
ec0171
|
121 |
|
49771b
|
122 |
function rcmail_user_prefs($current=null) |
A |
123 |
{ |
|
124 |
global $RCMAIL; |
|
125 |
|
|
126 |
$sections['general'] = array('id' => 'general', 'section' => rcube_label('uisettings')); |
|
127 |
$sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview')); |
|
128 |
$sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition')); |
|
129 |
$sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying')); |
|
130 |
$sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders')); |
|
131 |
$sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings')); |
|
132 |
|
|
133 |
// hook + define list cols |
|
134 |
$plugin = $RCMAIL->plugins->exec_hook('list_prefs_sections', |
|
135 |
array('list' => $sections, 'cols' => array('section'))); |
|
136 |
|
|
137 |
$sections = $plugin['list']; |
|
138 |
|
|
139 |
$config = $RCMAIL->config->all(); |
|
140 |
$no_override = array_flip($RCMAIL->config->get('dont_override', array())); |
|
141 |
|
|
142 |
foreach ($sections as $idx => $sect) { |
|
143 |
|
|
144 |
if ($current && $sect['id'] != $current) |
|
145 |
continue; |
|
146 |
|
|
147 |
$blocks = array(); |
|
148 |
|
|
149 |
switch ($sect['id']) { |
|
150 |
// general |
|
151 |
case 'general': |
|
152 |
|
|
153 |
$blocks = array( |
|
154 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
155 |
'list' => array('name' => Q(rcube_label('listoptions'))), |
|
156 |
); |
|
157 |
|
|
158 |
// language selection |
|
159 |
if (!isset($no_override['language'])) { |
|
160 |
$a_lang = $RCMAIL->list_languages(); |
|
161 |
asort($a_lang); |
|
162 |
|
|
163 |
$field_id = 'rcmfd_lang'; |
|
164 |
$select_lang = new html_select(array('name' => '_language', 'id' => $field_id)); |
|
165 |
$select_lang->add(array_values($a_lang), array_keys($a_lang)); |
|
166 |
|
|
167 |
$blocks['main']['options']['language'] = array( |
|
168 |
'title' => html::label($field_id, Q(rcube_label('language'))), |
|
169 |
'content' => $select_lang->show($RCMAIL->user->language), |
|
170 |
); |
|
171 |
} |
|
172 |
|
|
173 |
// show page size selection |
|
174 |
if (!isset($no_override['timezone'])) { |
|
175 |
$field_id = 'rcmfd_timezone'; |
|
176 |
$select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0")); |
|
177 |
$select_timezone->add(rcube_label('autodetect'), 'auto'); |
|
178 |
$select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); |
|
179 |
$select_timezone->add('(GMT -10:00) Hawaii', '-10'); |
|
180 |
$select_timezone->add('(GMT -9:30) Marquesas Islands', '-9.5'); |
|
181 |
$select_timezone->add('(GMT -9:00) Alaska', '-9'); |
|
182 |
$select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); |
|
183 |
$select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); |
|
184 |
$select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); |
|
185 |
$select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); |
|
186 |
$select_timezone->add('(GMT -4:30) Caracas', '-4.5'); |
|
187 |
$select_timezone->add('(GMT -4:00) Atlantic Time (Canada), La Paz', '-4'); |
|
188 |
$select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5'); |
|
189 |
$select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); |
|
190 |
$select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); |
|
191 |
$select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); |
|
192 |
$select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); |
|
193 |
$select_timezone->add('(GMT +1:00) Central European Time', '1'); |
|
194 |
$select_timezone->add('(GMT +2:00) EET: Tallinn, Helsinki, Kaliningrad, South Africa', '2'); |
|
195 |
$select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); |
|
196 |
$select_timezone->add('(GMT +3:30) Tehran', '3.5'); |
|
197 |
$select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); |
|
198 |
$select_timezone->add('(GMT +4:30) Kabul', '4.5'); |
|
199 |
$select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); |
|
200 |
$select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5'); |
|
201 |
$select_timezone->add('(GMT +5:45) Kathmandu', '5.75'); |
|
202 |
$select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); |
|
203 |
$select_timezone->add('(GMT +6:30) Cocos Islands, Myanmar', '6.5'); |
|
204 |
$select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); |
|
205 |
$select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); |
|
206 |
$select_timezone->add('(GMT +8:45) Caiguna, Eucla, Border Village', '8.75'); |
|
207 |
$select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); |
|
208 |
$select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5'); |
|
209 |
$select_timezone->add('(GMT +10:00) EAST/AEST: Sydney, Guam, Vladivostok', '10'); |
|
210 |
$select_timezone->add('(GMT +10:30) New South Wales', '10.5'); |
|
211 |
$select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); |
|
212 |
$select_timezone->add('(GMT +11:30) Norfolk Island', '11.5'); |
|
213 |
$select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); |
|
214 |
$select_timezone->add('(GMT +12:45) Chatham Islands', '12.75'); |
|
215 |
$select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); |
|
216 |
$select_timezone->add('(GMT +14:00) Kiribati', '14'); |
|
217 |
|
|
218 |
$blocks['main']['options']['timezone'] = array( |
|
219 |
'title' => html::label($field_id, Q(rcube_label('timezone'))), |
|
220 |
'content' => $select_timezone->show((string)$config['timezone']), |
|
221 |
); |
|
222 |
} |
|
223 |
|
|
224 |
// daylight savings |
|
225 |
if (!isset($no_override['dst_active'])) { |
|
226 |
$field_id = 'rcmfd_dst'; |
|
227 |
$input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1, 'disabled' => ($config['timezone'] === 'auto'))); |
|
228 |
|
|
229 |
$blocks['main']['options']['dstactive'] = array( |
|
230 |
'title' => html::label($field_id, Q(rcube_label('dstactive'))), |
|
231 |
'content' => $input_dst->show($config['dst_active']), |
|
232 |
); |
|
233 |
} |
|
234 |
|
|
235 |
// MM: Show checkbox for toggling 'pretty dates' |
|
236 |
if (!isset($no_override['prettydate'])) { |
|
237 |
$field_id = 'rcmfd_prettydate'; |
|
238 |
$input_prettydate = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); |
|
239 |
|
|
240 |
$blocks['main']['options']['prettydate'] = array( |
|
241 |
'title' => html::label($field_id, Q(rcube_label('prettydate'))), |
|
242 |
'content' => $input_prettydate->show($config['prettydate']?1:0), |
|
243 |
); |
|
244 |
} |
|
245 |
|
|
246 |
// show page size selection |
|
247 |
if (!isset($no_override['pagesize'])) { |
|
248 |
$field_id = 'rcmfd_pgsize'; |
|
249 |
$input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); |
|
250 |
|
|
251 |
$blocks['list']['options']['pagesize'] = array( |
|
252 |
'title' => html::label($field_id, Q(rcube_label('pagesize'))), |
|
253 |
'content' => $input_pagesize->show($config['pagesize']), |
|
254 |
); |
|
255 |
} |
|
256 |
|
|
257 |
// show drop-down for available skins |
|
258 |
if (!isset($no_override['skin'])) { |
|
259 |
$skins = rcmail_get_skins(); |
|
260 |
|
|
261 |
if (count($skins) > 1) { |
|
262 |
$field_id = 'rcmfd_skin'; |
|
263 |
$input_skin = new html_select(array('name'=>'_skin', 'id'=>$field_id)); |
|
264 |
|
|
265 |
foreach($skins as $skin) |
|
266 |
$input_skin->add($skin, $skin); |
|
267 |
|
|
268 |
$blocks['main']['options']['skin'] = array( |
|
269 |
'title' => html::label($field_id, Q(rcube_label('skin'))), |
|
270 |
'content' => $input_skin->show($config['skin']), |
|
271 |
); |
|
272 |
} |
|
273 |
} |
|
274 |
|
|
275 |
break; |
|
276 |
|
|
277 |
// Mailbox view (mail screen) |
|
278 |
case 'mailbox': |
|
279 |
|
|
280 |
$blocks = array( |
|
281 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
282 |
'new_message' => array('name' => Q(rcube_label('newmessage'))), |
|
283 |
); |
|
284 |
|
|
285 |
// show config parameter for preview pane |
|
286 |
if (!isset($no_override['preview_pane'])) { |
|
287 |
$field_id = 'rcmfd_preview'; |
bc4960
|
288 |
$input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1, |
T |
289 |
'onchange' => JS_OBJECT_NAME.'.toggle_preview_pane(this)')); |
49771b
|
290 |
|
A |
291 |
$blocks['main']['options']['preview_pane'] = array( |
|
292 |
'title' => html::label($field_id, Q(rcube_label('previewpane'))), |
|
293 |
'content' => $input_preview->show($config['preview_pane']?1:0), |
|
294 |
); |
|
295 |
} |
|
296 |
|
bc4960
|
297 |
// show config parameter for preview pane auto mark as read delay |
T |
298 |
if (!isset($no_override['preview_pane_mark_read'])) { |
|
299 |
// apply default if config option is not set at all |
|
300 |
$config['preview_pane_mark_read'] = $RCMAIL->config->get('preview_pane_mark_read', 0); |
|
301 |
|
|
302 |
$field_id = 'rcmfd_preview_pane_mark_read'; |
|
303 |
$select_delay = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id, |
|
304 |
'disabled' => $config['preview_pane']?0:1)); |
|
305 |
|
|
306 |
$select_delay->add(rcube_label('never'), '-1'); |
|
307 |
$select_delay->add(rcube_label('immediately'), 0); |
|
308 |
foreach(array(5, 10, 20, 30) as $sec) |
|
309 |
$select_delay->add(rcube_label(array('name' => 'afternseconds', 'vars' => array('n' => $sec))), $sec); |
|
310 |
|
|
311 |
$blocks['main']['options']['preview_pane_mark_read'] = array( |
|
312 |
'title' => html::label($field_id, Q(rcube_label('previewpanemarkread'))), |
|
313 |
'content' => $select_delay->show(intval($config['preview_pane_mark_read'])), |
|
314 |
); |
|
315 |
} |
|
316 |
|
49771b
|
317 |
if (!isset($no_override['mdn_requests'])) { |
A |
318 |
$field_id = 'rcmfd_mdn_requests'; |
|
319 |
$select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id)); |
|
320 |
$select_mdn_requests->add(rcube_label('askuser'), 0); |
|
321 |
$select_mdn_requests->add(rcube_label('autosend'), 1); |
|
322 |
$select_mdn_requests->add(rcube_label('ignore'), 2); |
|
323 |
|
|
324 |
$blocks['main']['options']['mdn_requests'] = array( |
|
325 |
'title' => html::label($field_id, Q(rcube_label('mdnrequests'))), |
|
326 |
'content' => $select_mdn_requests->show($config['mdn_requests']), |
|
327 |
); |
|
328 |
} |
|
329 |
|
63ab02
|
330 |
$RCMAIL->imap_connect(); |
A |
331 |
$threading_supported = $RCMAIL->imap->get_capability('thread=references') |
|
332 |
|| $RCMAIL->imap->get_capability('thread=orderedsubject') |
|
333 |
|| $RCMAIL->imap->get_capability('thread=refs'); |
|
334 |
|
|
335 |
if (!isset($no_override['autoexpand_threads']) && $threading_supported) { |
f52c93
|
336 |
$field_id = 'rcmfd_autoexpand_threads'; |
T |
337 |
$select_autoexpand_threads = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id)); |
|
338 |
$select_autoexpand_threads->add(rcube_label('never'), 0); |
|
339 |
$select_autoexpand_threads->add(rcube_label('do_expand'), 1); |
|
340 |
$select_autoexpand_threads->add(rcube_label('expand_only_unread'), 2); |
|
341 |
|
|
342 |
$blocks['main']['options']['autoexpand_threads'] = array( |
|
343 |
'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))), |
|
344 |
'content' => $select_autoexpand_threads->show($config['autoexpand_threads']), |
|
345 |
); |
|
346 |
} |
|
347 |
|
49771b
|
348 |
if (!isset($no_override['focus_on_new_message'])) { |
A |
349 |
$field_id = 'rcmfd_focus_on_new_message'; |
|
350 |
$input_focus_on_new_message = new html_checkbox(array('name' => '_focus_on_new_message', 'id' => $field_id, 'value' => 1)); |
|
351 |
|
|
352 |
$blocks['new_message']['options']['focus_on_new_message'] = array( |
|
353 |
'title' => html::label($field_id, Q(rcube_label('focusonnewmessage'))), |
|
354 |
'content' => $input_focus_on_new_message->show($config['focus_on_new_message']?1:0), |
|
355 |
); |
|
356 |
} |
|
357 |
|
|
358 |
if (!isset($no_override['keep_alive'])) { |
|
359 |
$field_id = 'rcmfd_keep_alive'; |
|
360 |
$select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); |
|
361 |
|
|
362 |
foreach(array(1, 3, 5, 10, 15, 30, 60) as $min) |
|
363 |
if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) |
|
364 |
&& (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) { |
|
365 |
$select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min); |
|
366 |
} |
|
367 |
|
|
368 |
$blocks['new_message']['options']['keep_alive'] = array( |
|
369 |
'title' => html::label($field_id, Q(rcube_label('keepalive'))), |
|
370 |
'content' => $select_keep_alive->show($config['keep_alive']/60), |
|
371 |
); |
|
372 |
} |
|
373 |
|
|
374 |
if (!isset($no_override['check_all_folders'])) { |
|
375 |
$field_id = 'rcmfd_check_all_folders'; |
|
376 |
$input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); |
|
377 |
|
|
378 |
$blocks['new_message']['options']['check_all_folders'] = array( |
|
379 |
'title' => html::label($field_id, Q(rcube_label('checkallfolders'))), |
|
380 |
'content' => $input_check_all->show($config['check_all_folders']?1:0), |
|
381 |
); |
|
382 |
} |
|
383 |
|
|
384 |
break; |
|
385 |
|
|
386 |
// Message viewing |
|
387 |
case 'mailview': |
|
388 |
|
|
389 |
$blocks = array( |
|
390 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
391 |
); |
|
392 |
|
|
393 |
// show checkbox for HTML/plaintext messages |
|
394 |
if (!isset($no_override['prefer_html'])) { |
|
395 |
$field_id = 'rcmfd_htmlmsg'; |
|
396 |
$input_preferhtml = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1, |
|
397 |
'onchange' => JS_OBJECT_NAME.'.toggle_prefer_html(this)')); |
|
398 |
|
|
399 |
$blocks['main']['options']['prefer_html'] = array( |
|
400 |
'title' => html::label($field_id, Q(rcube_label('preferhtml'))), |
|
401 |
'content' => $input_preferhtml->show($config['prefer_html']?1:0), |
|
402 |
); |
|
403 |
} |
|
404 |
|
e55ab0
|
405 |
if (!isset($no_override['default_charset'])) { |
A |
406 |
$field_id = 'rcmfd_default_charset'; |
|
407 |
|
|
408 |
$blocks['main']['options']['default_charset'] = array( |
|
409 |
'title' => html::label($field_id, Q(rcube_label('defaultcharset'))), |
|
410 |
'content' => $RCMAIL->output->charset_selector(array( |
|
411 |
'name' => '_default_charset', 'selected' => $config['default_charset'] |
|
412 |
)) |
|
413 |
); |
|
414 |
} |
|
415 |
|
49771b
|
416 |
if (!isset($no_override['show_images'])) { |
A |
417 |
$field_id = 'rcmfd_show_images'; |
|
418 |
$input_show_images = new html_select(array('name' => '_show_images', 'id' => $field_id)); |
|
419 |
$input_show_images->add(rcube_label('never'), 0); |
|
420 |
$input_show_images->add(rcube_label('fromknownsenders'), 1); |
|
421 |
$input_show_images->add(rcube_label('always'), 2); |
|
422 |
|
|
423 |
$blocks['main']['options']['show_images'] = array( |
|
424 |
'title' => html::label($field_id, Q(rcube_label('showremoteimages'))), |
|
425 |
'content' => $input_show_images->show($config['show_images']), |
|
426 |
); |
|
427 |
} |
|
428 |
|
|
429 |
if (!isset($no_override['inline_images'])) { |
|
430 |
$field_id = 'rcmfd_inline_images'; |
|
431 |
$input_inline_images = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1)); |
|
432 |
|
|
433 |
$blocks['main']['options']['inline_images'] = array( |
|
434 |
'title' => html::label($field_id, Q(rcube_label('showinlineimages'))), |
|
435 |
'content' => $input_inline_images->show($config['inline_images']?1:0), |
|
436 |
); |
|
437 |
} |
|
438 |
|
|
439 |
// "display after delete" checkbox |
|
440 |
if (!isset($no_override['display_next'])) { |
|
441 |
$field_id = 'rcmfd_displaynext'; |
|
442 |
$input_displaynext = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); |
|
443 |
|
|
444 |
$blocks['main']['options']['display_next'] = array( |
|
445 |
'title' => html::label($field_id, Q(rcube_label('displaynext'))), |
|
446 |
'content' => $input_displaynext->show($config['display_next']?1:0), |
|
447 |
); |
|
448 |
} |
|
449 |
|
|
450 |
break; |
|
451 |
|
|
452 |
// Mail composition |
|
453 |
case 'compose': |
|
454 |
|
|
455 |
$blocks = array( |
|
456 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
0207c4
|
457 |
'sig' => array('name' => Q(rcube_label('signatureoptions'))), |
49771b
|
458 |
); |
A |
459 |
|
|
460 |
// Show checkbox for HTML Editor |
|
461 |
if (!isset($no_override['htmleditor'])) { |
|
462 |
$field_id = 'rcmfd_htmleditor'; |
|
463 |
$input_htmleditor = new html_checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); |
|
464 |
|
|
465 |
$blocks['main']['options']['htmleditor'] = array( |
|
466 |
'title' => html::label($field_id, Q(rcube_label('htmleditor'))), |
|
467 |
'content' => $input_htmleditor->show($config['htmleditor']?1:0), |
|
468 |
); |
|
469 |
} |
|
470 |
|
|
471 |
if (!isset($no_override['draft_autosave'])) { |
|
472 |
$field_id = 'rcmfd_autosave'; |
|
473 |
$select_autosave = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox']))); |
|
474 |
$select_autosave->add(rcube_label('never'), 0); |
|
475 |
foreach (array(1, 3, 5, 10) as $i => $min) |
|
476 |
$select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60); |
|
477 |
|
|
478 |
$blocks['main']['options']['draft_autosave'] = array( |
|
479 |
'title' => html::label($field_id, Q(rcube_label('autosavedraft'))), |
|
480 |
'content' => $select_autosave->show($config['draft_autosave']), |
|
481 |
); |
|
482 |
} |
|
483 |
|
|
484 |
if (!isset($no_override['mime_param_folding'])) { |
|
485 |
$field_id = 'rcmfd_param_folding'; |
|
486 |
$select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id)); |
|
487 |
$select_param_folding->add(rcube_label('2231folding'), 0); |
|
488 |
$select_param_folding->add(rcube_label('miscfolding'), 1); |
|
489 |
$select_param_folding->add(rcube_label('2047folding'), 2); |
|
490 |
|
|
491 |
$blocks['main']['options']['mime_param_folding'] = array( |
0207c4
|
492 |
'advanced' => true, |
49771b
|
493 |
'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), |
A |
494 |
'content' => $select_param_folding->show($config['mime_param_folding']), |
|
495 |
); |
|
496 |
} |
47ad83
|
497 |
|
A |
498 |
if (!isset($no_override['force_7bit'])) { |
|
499 |
$field_id = 'rcmfd_force_7bit'; |
|
500 |
$input_7bit = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1)); |
|
501 |
|
|
502 |
$blocks['main']['options']['force_7bit'] = array( |
|
503 |
'title' => html::label($field_id, Q(rcube_label('force7bit'))), |
|
504 |
'content' => $input_7bit->show($config['force_7bit']?1:0), |
|
505 |
); |
|
506 |
} |
|
507 |
|
50f56d
|
508 |
if (!isset($no_override['top_posting'])) { |
A |
509 |
$field_id = 'rcmfd_top_posting'; |
655bd9
|
510 |
$select_replymode = new html_select(array('name' => '_top_posting', 'id' => $field_id, 'onchange' => "\$('#rcmfd_sig_above').attr('disabled',this.selectedIndex==0)")); |
0207c4
|
511 |
$select_replymode->add(rcube_label('replybottomposting'), 0); |
T |
512 |
$select_replymode->add(rcube_label('replytopposting'), 1); |
50f56d
|
513 |
|
A |
514 |
$blocks['main']['options']['top_posting'] = array( |
0207c4
|
515 |
'title' => html::label($field_id, Q(rcube_label('whenreplying'))), |
T |
516 |
'content' => $select_replymode->show($config['top_posting']?1:0), |
50f56d
|
517 |
); |
A |
518 |
} |
|
519 |
|
|
520 |
if (!isset($no_override['show_sig'])) { |
|
521 |
$field_id = 'rcmfd_show_sig'; |
|
522 |
$select_show_sig = new html_select(array('name' => '_show_sig', 'id' => $field_id)); |
0207c4
|
523 |
$select_show_sig->add(rcube_label('never'), 0); |
T |
524 |
$select_show_sig->add(rcube_label('always'), 1); |
|
525 |
$select_show_sig->add(rcube_label('newmessageonly'), 2); |
|
526 |
$select_show_sig->add(rcube_label('replyandforwardonly'), 3); |
50f56d
|
527 |
|
0207c4
|
528 |
$blocks['sig']['options']['show_sig'] = array( |
T |
529 |
'title' => html::label($field_id, Q(rcube_label('autoaddsignature'))), |
655bd9
|
530 |
'content' => $select_show_sig->show($RCMAIL->config->get('show_sig', 1)), |
0207c4
|
531 |
); |
T |
532 |
} |
|
533 |
|
|
534 |
if (!isset($no_override['sig_above'])) { |
|
535 |
$field_id = 'rcmfd_sig_above'; |
655bd9
|
536 |
$select_sigabove = new html_select(array('name' => '_sig_above', 'id' => $field_id, 'disabled' => !$config['top_posting'])); |
T |
537 |
$select_sigabove->add(rcube_label('belowquote'), 0); |
|
538 |
$select_sigabove->add(rcube_label('abovequote'), 1); |
0207c4
|
539 |
|
T |
540 |
$blocks['sig']['options']['sig_above'] = array( |
655bd9
|
541 |
'title' => html::label($field_id, Q(rcube_label('replysignaturepos'))), |
T |
542 |
'content' => $select_sigabove->show($config['sig_above']?1:0), |
0207c4
|
543 |
); |
T |
544 |
} |
|
545 |
|
|
546 |
if (!isset($no_override['strip_existing_sig'])) { |
|
547 |
$field_id = 'rcmfd_strip_existing_sig'; |
|
548 |
$input_stripexistingsig = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1)); |
|
549 |
|
|
550 |
$blocks['sig']['options']['strip_existing_sig'] = array( |
|
551 |
'title' => html::label($field_id, Q(rcube_label('replyremovesignature'))), |
|
552 |
'content' => $input_stripexistingsig->show($config['strip_existing_sig']?1:0), |
50f56d
|
553 |
); |
A |
554 |
} |
49771b
|
555 |
|
A |
556 |
break; |
|
557 |
|
|
558 |
// Special IMAP folders |
|
559 |
case 'folders': |
|
560 |
|
|
561 |
$blocks = array( |
|
562 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
563 |
); |
|
564 |
|
|
565 |
// Configure special folders |
|
566 |
if (!isset($no_override['default_imap_folders'])) { |
63ab02
|
567 |
|
47d8d3
|
568 |
$RCMAIL->imap_connect(); |
63ab02
|
569 |
|
A |
570 |
// load folders list only when needed |
|
571 |
if ($current) { |
|
572 |
$select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, |
|
573 |
'maxlength' => 30, 'exceptions' => array('INBOX'))); |
|
574 |
} |
|
575 |
else // dummy select |
|
576 |
$select = new html_select(); |
49771b
|
577 |
|
A |
578 |
if (!isset($no_override['drafts_mbox'])) |
|
579 |
$blocks['main']['options']['drafts_mbox'] = array( |
|
580 |
'title' => Q(rcube_label('drafts')), |
|
581 |
'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox")), |
|
582 |
); |
|
583 |
|
|
584 |
if (!isset($no_override['sent_mbox'])) |
|
585 |
$blocks['main']['options']['sent_mbox'] = array( |
|
586 |
'title' => Q(rcube_label('sent')), |
|
587 |
'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox")), |
|
588 |
); |
|
589 |
|
|
590 |
if (!isset($no_override['junk_mbox'])) |
|
591 |
$blocks['main']['options']['junk_mbox'] = array( |
|
592 |
'title' => Q(rcube_label('junk')), |
|
593 |
'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox")), |
|
594 |
); |
|
595 |
|
|
596 |
if (!isset($no_override['trash_mbox'])) |
|
597 |
$blocks['main']['options']['trash_mbox'] = array( |
|
598 |
'title' => Q(rcube_label('trash')), |
|
599 |
'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox")), |
|
600 |
); |
|
601 |
} |
|
602 |
|
|
603 |
break; |
|
604 |
|
|
605 |
// Server settings |
|
606 |
case 'server': |
|
607 |
|
|
608 |
$blocks = array( |
|
609 |
'main' => array('name' => Q(rcube_label('mainoptions'))), |
|
610 |
'maintenance' => array('name' => Q(rcube_label('maintenance'))), |
|
611 |
); |
|
612 |
|
|
613 |
if (!isset($no_override['read_when_deleted'])) { |
|
614 |
$field_id = 'rcmfd_read_deleted'; |
|
615 |
$input_readdeleted = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1)); |
|
616 |
|
|
617 |
$blocks['main']['options']['read_when_deleted'] = array( |
|
618 |
'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))), |
|
619 |
'content' => $input_readdeleted->show($config['read_when_deleted']?1:0), |
|
620 |
); |
|
621 |
} |
|
622 |
|
|
623 |
if (!isset($no_override['flag_for_deletion'])) { |
|
624 |
$field_id = 'rcmfd_flag_for_deletion'; |
|
625 |
$input_flagfordeletion = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1)); |
|
626 |
|
|
627 |
$blocks['main']['options']['flag_for_deletion'] = array( |
|
628 |
'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))), |
|
629 |
'content' => $input_flagfordeletion->show($config['flag_for_deletion']?1:0), |
|
630 |
); |
|
631 |
} |
|
632 |
|
|
633 |
// don't show deleted messages |
|
634 |
if (!isset($no_override['skip_deleted'])) { |
|
635 |
$field_id = 'rcmfd_skip_deleted'; |
|
636 |
$input_purge = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1)); |
|
637 |
|
|
638 |
$blocks['main']['options']['skip_deleted'] = array( |
|
639 |
'title' => html::label($field_id, Q(rcube_label('skipdeleted'))), |
|
640 |
'content' => $input_purge->show($config['skip_deleted']?1:0), |
|
641 |
); |
|
642 |
} |
|
643 |
|
b7f952
|
644 |
if (!isset($no_override['delete_always'])) { |
A |
645 |
$field_id = 'rcmfd_delete_always'; |
|
646 |
$input_delete_always = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1)); |
|
647 |
|
|
648 |
$blocks['main']['options']['delete_always'] = array( |
|
649 |
'title' => html::label($field_id, Q(rcube_label('deletealways'))), |
|
650 |
'content' => $input_delete_always->show($config['delete_always']?1:0), |
|
651 |
); |
|
652 |
} |
|
653 |
|
49771b
|
654 |
// Trash purging on logout |
A |
655 |
if (!isset($no_override['logout_purge'])) { |
|
656 |
$field_id = 'rcmfd_logout_purge'; |
|
657 |
$input_purge = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); |
|
658 |
|
|
659 |
$blocks['maintenance']['options']['logout_purge'] = array( |
|
660 |
'title' => html::label($field_id, Q(rcube_label('logoutclear'))), |
|
661 |
'content' => $input_purge->show($config['logout_purge']?1:0), |
|
662 |
); |
|
663 |
} |
|
664 |
|
|
665 |
// INBOX compacting on logout |
|
666 |
if (!isset($no_override['logout_expunge'])) { |
|
667 |
$field_id = 'rcmfd_logout_expunge'; |
|
668 |
$input_expunge = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1)); |
|
669 |
|
|
670 |
$blocks['maintenance']['options']['logout_expunge'] = array( |
|
671 |
'title' => html::label($field_id, Q(rcube_label('logoutcompact'))), |
|
672 |
'content' => $input_expunge->show($config['logout_expunge']?1:0), |
|
673 |
); |
|
674 |
} |
|
675 |
|
|
676 |
break; |
|
677 |
} |
|
678 |
|
|
679 |
$data = $RCMAIL->plugins->exec_hook('user_preferences', array('section' => $sect['id'], 'blocks' => $blocks)); |
|
680 |
$found = false; |
|
681 |
|
|
682 |
// create output |
|
683 |
foreach ($data['blocks'] as $block) { |
|
684 |
if ($block['options']) { |
|
685 |
foreach ($block['options'] as $option) { |
|
686 |
$found = true; |
|
687 |
break 2; |
|
688 |
} |
|
689 |
} |
|
690 |
} |
|
691 |
|
|
692 |
if (!$found) |
|
693 |
unset($sections[$idx]); |
|
694 |
else |
|
695 |
$sections[$idx]['blocks'] = $data['blocks']; |
|
696 |
} |
|
697 |
|
|
698 |
return array($sections, $plugin['cols']); |
|
699 |
} |
|
700 |
|
|
701 |
|
|
702 |
function rcmail_get_skins() |
|
703 |
{ |
|
704 |
$path = 'skins'; |
|
705 |
$skins = array(); |
|
706 |
|
|
707 |
$dir = opendir($path); |
|
708 |
|
|
709 |
if (!$dir) |
|
710 |
return false; |
|
711 |
|
|
712 |
while (($file = readdir($dir)) !== false) |
|
713 |
{ |
|
714 |
$filename = $path.'/'.$file; |
90b1cb
|
715 |
if (!preg_match('/^\./', $file) && is_dir($filename) && is_readable($filename)) |
49771b
|
716 |
$skins[] = $file; |
A |
717 |
} |
|
718 |
|
|
719 |
closedir($dir); |
|
720 |
|
|
721 |
return $skins; |
|
722 |
} |
|
723 |
|
|
724 |
|
f11541
|
725 |
// register UI objects |
T |
726 |
$OUTPUT->add_handlers(array( |
f05834
|
727 |
'prefsframe' => 'rcmail_preferences_frame', |
A |
728 |
'sectionslist' => 'rcmail_sections_list', |
b89d5a
|
729 |
'identitieslist' => 'rcmail_identities_list', |
f11541
|
730 |
)); |
T |
731 |
|