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