commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
a95874
|
3 |
/** |
4e17e6
|
4 |
+-----------------------------------------------------------------------+ |
T |
5 |
| program/steps/settings/func.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
d575e4
|
8 |
| Copyright (C) 2005-2013, The Roundcube Dev Team | |
7fe381
|
9 |
| | |
T |
10 |
| Licensed under the GNU General Public License version 3 or | |
|
11 |
| any later version with exceptions for skins & plugins. | |
|
12 |
| See the README file for a full license statement. | |
4e17e6
|
13 |
| | |
T |
14 |
| PURPOSE: | |
|
15 |
| Provide functionality for user's settings & preferences | |
|
16 |
| | |
|
17 |
+-----------------------------------------------------------------------+ |
|
18 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
19 |
+-----------------------------------------------------------------------+ |
|
20 |
*/ |
|
21 |
|
c6406e
|
22 |
if (!$OUTPUT->ajax_call) { |
6b2b2e
|
23 |
$OUTPUT->set_pagetitle($RCMAIL->gettext('preferences')); |
c6406e
|
24 |
} |
d575e4
|
25 |
|
AM |
26 |
// register UI objects |
|
27 |
$OUTPUT->add_handlers(array( |
|
28 |
'settingstabs' => 'rcmail_settings_tabs', |
|
29 |
'prefsframe' => 'rcmail_preferences_frame', |
|
30 |
'sectionslist' => 'rcmail_sections_list', |
|
31 |
'identitieslist' => 'rcmail_identities_list', |
|
32 |
)); |
|
33 |
|
|
34 |
// register action aliases |
|
35 |
$RCMAIL->register_action_map(array( |
|
36 |
'folders' => 'folders.inc', |
|
37 |
'rename-folder' => 'folders.inc', |
|
38 |
'delete-folder' => 'folders.inc', |
|
39 |
'subscribe' => 'folders.inc', |
|
40 |
'unsubscribe' => 'folders.inc', |
|
41 |
'purge' => 'folders.inc', |
|
42 |
'folder-size' => 'folders.inc', |
|
43 |
'add-identity' => 'edit_identity.inc', |
|
44 |
'add-response' => 'edit_response.inc', |
|
45 |
'save-response' => 'edit_response.inc', |
|
46 |
'delete-response' => 'responses.inc', |
ca01e2
|
47 |
'delete-identity' => 'identities.inc', |
3cc1af
|
48 |
'upload-display' => 'upload.inc', |
d575e4
|
49 |
)); |
AM |
50 |
|
b19097
|
51 |
|
f05834
|
52 |
// similar function as /steps/settings/identities.inc::rcmail_identity_frame() |
A |
53 |
function rcmail_preferences_frame($attrib) |
d11fb2
|
54 |
{ |
c6406e
|
55 |
global $OUTPUT; |
cb3538
|
56 |
|
c6406e
|
57 |
if (!$attrib['id']) { |
AM |
58 |
$attrib['id'] = 'rcmprefsframe'; |
|
59 |
} |
35c31e
|
60 |
|
c6406e
|
61 |
return $OUTPUT->frame($attrib, true); |
d11fb2
|
62 |
} |
f05834
|
63 |
|
A |
64 |
|
|
65 |
function rcmail_sections_list($attrib) |
d11fb2
|
66 |
{ |
c6406e
|
67 |
global $RCMAIL; |
f8e8af
|
68 |
|
c6406e
|
69 |
// add id to message list table if not specified |
AM |
70 |
if (!strlen($attrib['id'])) { |
|
71 |
$attrib['id'] = 'rcmsectionslist'; |
|
72 |
} |
f05834
|
73 |
|
c6406e
|
74 |
list($list, $cols) = rcmail_user_prefs(); |
f8e8af
|
75 |
|
c6406e
|
76 |
// create XHTML table |
6b2b2e
|
77 |
$out = $RCMAIL->table_output($attrib, $list, $cols, 'id'); |
f05834
|
78 |
|
c6406e
|
79 |
// set client env |
AM |
80 |
$RCMAIL->output->add_gui_object('sectionslist', $attrib['id']); |
|
81 |
$RCMAIL->output->include_script('list.js'); |
f05834
|
82 |
|
c6406e
|
83 |
return $out; |
d11fb2
|
84 |
} |
4e17e6
|
85 |
|
T |
86 |
|
|
87 |
function rcmail_identities_list($attrib) |
d11fb2
|
88 |
{ |
c6406e
|
89 |
global $OUTPUT, $RCMAIL; |
4e17e6
|
90 |
|
c6406e
|
91 |
// add id to message list table if not specified |
AM |
92 |
if (!strlen($attrib['id'])) { |
|
93 |
$attrib['id'] = 'rcmIdentitiesList'; |
|
94 |
} |
4e17e6
|
95 |
|
c6406e
|
96 |
// get identities list and define 'mail' column |
2f4678
|
97 |
$list = $RCMAIL->user->list_emails(); |
c6406e
|
98 |
foreach ($list as $idx => $row) { |
2f4678
|
99 |
$list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_utils::idn_to_utf8($row['email']) . '>'); |
c6406e
|
100 |
} |
54759c
|
101 |
|
c6406e
|
102 |
// get all identites from DB and define list of cols to be displayed |
AM |
103 |
$plugin = $RCMAIL->plugins->exec_hook('identities_list', array( |
|
104 |
'list' => $list, |
|
105 |
'cols' => array('mail') |
|
106 |
)); |
4e17e6
|
107 |
|
c6406e
|
108 |
// @TODO: use <UL> instead of <TABLE> for identities list |
AM |
109 |
// create XHTML table |
6b2b2e
|
110 |
$out = $RCMAIL->table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id'); |
54759c
|
111 |
|
c6406e
|
112 |
// set client env |
AM |
113 |
$OUTPUT->add_gui_object('identitieslist', $attrib['id']); |
4e17e6
|
114 |
|
c6406e
|
115 |
return $out; |
d11fb2
|
116 |
} |
4e17e6
|
117 |
|
T |
118 |
|
|
119 |
// similar function as in /steps/addressbook/edit.inc |
57f0c8
|
120 |
function get_form_tags($attrib, $action, $id = null, $hidden = null) |
d11fb2
|
121 |
{ |
c6406e
|
122 |
global $EDIT_FORM, $RCMAIL; |
4e17e6
|
123 |
|
c6406e
|
124 |
$form_start = $form_end = ''; |
f8e8af
|
125 |
|
c6406e
|
126 |
if (empty($EDIT_FORM)) { |
AM |
127 |
$request_key = $action . (isset($id) ? '.'.$id : ''); |
|
128 |
$form_start = $RCMAIL->output->request_form(array( |
|
129 |
'name' => 'form', |
|
130 |
'method' => 'post', |
|
131 |
'task' => $RCMAIL->task, |
|
132 |
'action' => $action, |
|
133 |
'request' => $request_key, |
|
134 |
'noclose' => true |
|
135 |
) + $attrib); |
f8e8af
|
136 |
|
c6406e
|
137 |
if (is_array($hidden)) { |
AM |
138 |
$hiddenfields = new html_hiddenfield($hidden); |
|
139 |
$form_start .= $hiddenfields->show(); |
|
140 |
} |
|
141 |
|
|
142 |
$form_end = !strlen($attrib['form']) ? '</form>' : ''; |
|
143 |
|
|
144 |
$EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
|
145 |
$RCMAIL->output->add_gui_object('editform', $EDIT_FORM); |
4e17e6
|
146 |
} |
f8e8af
|
147 |
|
c6406e
|
148 |
return array($form_start, $form_end); |
d11fb2
|
149 |
} |
4e17e6
|
150 |
|
ec0171
|
151 |
|
c6406e
|
152 |
function rcmail_user_prefs($current = null) |
49771b
|
153 |
{ |
c6406e
|
154 |
global $RCMAIL; |
49771b
|
155 |
|
6b2b2e
|
156 |
$sections['general'] = array('id' => 'general', 'section' => $RCMAIL->gettext('uisettings')); |
AM |
157 |
$sections['mailbox'] = array('id' => 'mailbox', 'section' => $RCMAIL->gettext('mailboxview')); |
|
158 |
$sections['mailview'] = array('id' => 'mailview','section' => $RCMAIL->gettext('messagesdisplaying')); |
|
159 |
$sections['compose'] = array('id' => 'compose', 'section' => $RCMAIL->gettext('messagescomposition')); |
|
160 |
$sections['addressbook'] = array('id' => 'addressbook','section' => $RCMAIL->gettext('addressbook')); |
|
161 |
$sections['folders'] = array('id' => 'folders', 'section' => $RCMAIL->gettext('specialfolders')); |
|
162 |
$sections['server'] = array('id' => 'server', 'section' => $RCMAIL->gettext('serversettings')); |
49771b
|
163 |
|
c6406e
|
164 |
// hook + define list cols |
AM |
165 |
$plugin = $RCMAIL->plugins->exec_hook('preferences_sections_list', |
49771b
|
166 |
array('list' => $sections, 'cols' => array('section'))); |
A |
167 |
|
c6406e
|
168 |
$sections = $plugin['list']; |
AM |
169 |
$config = $RCMAIL->config->all(); |
|
170 |
$no_override = array_flip((array)$RCMAIL->config->get('dont_override')); |
f8e8af
|
171 |
|
c6406e
|
172 |
foreach ($sections as $idx => $sect) { |
AM |
173 |
if ($current && $sect['id'] != $current) { |
|
174 |
continue; |
476fa9
|
175 |
} |
5879c0
|
176 |
|
c6406e
|
177 |
$blocks = array(); |
5879c0
|
178 |
|
c6406e
|
179 |
switch ($sect['id']) { |
49771b
|
180 |
|
c6406e
|
181 |
// general |
AM |
182 |
case 'general': |
|
183 |
$blocks = array( |
6b2b2e
|
184 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
185 |
'skin' => array('name' => rcube::Q($RCMAIL->gettext('skin'))), |
|
186 |
'browser' => array('name' => rcube::Q($RCMAIL->gettext('browseroptions'))), |
|
187 |
'advanced'=> array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
188 |
); |
1cc9e2
|
189 |
|
c6406e
|
190 |
// language selection |
AM |
191 |
if (!isset($no_override['language'])) { |
|
192 |
if (!$current) { |
|
193 |
continue 2; |
|
194 |
} |
1cc9e2
|
195 |
|
c6406e
|
196 |
$a_lang = $RCMAIL->list_languages(); |
AM |
197 |
asort($a_lang); |
1cc9e2
|
198 |
|
c6406e
|
199 |
$field_id = 'rcmfd_lang'; |
AM |
200 |
$select = new html_select(array('name' => '_language', 'id' => $field_id)); |
|
201 |
$select->add(array_values($a_lang), array_keys($a_lang)); |
1cc9e2
|
202 |
|
c6406e
|
203 |
$blocks['main']['options']['language'] = array( |
6b2b2e
|
204 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('language'))), |
c6406e
|
205 |
'content' => $select->show($RCMAIL->user->language), |
AM |
206 |
); |
|
207 |
} |
49771b
|
208 |
|
c6406e
|
209 |
// timezone selection |
AM |
210 |
if (!isset($no_override['timezone'])) { |
|
211 |
if (!$current) { |
|
212 |
continue 2; |
|
213 |
} |
49771b
|
214 |
|
c6406e
|
215 |
$field_id = 'rcmfd_timezone'; |
AM |
216 |
$select = new html_select(array('name' => '_timezone', 'id' => $field_id)); |
6b2b2e
|
217 |
$select->add($RCMAIL->gettext('autodetect'), 'auto'); |
aa8359
|
218 |
|
c6406e
|
219 |
$zones = array(); |
AM |
220 |
foreach (DateTimeZone::listIdentifiers() as $i => $tzs) { |
|
221 |
try { |
|
222 |
$tz = new DateTimeZone($tzs); |
d1bf0f
|
223 |
$date = new DateTime(date('Y') . '-12-21', $tz); |
c6406e
|
224 |
$offset = $date->format('Z') + 45000; |
AM |
225 |
$sortkey = sprintf('%06d.%s', $offset, $tzs); |
|
226 |
$zones[$sortkey] = array($tzs, $date->format('P')); |
|
227 |
} |
|
228 |
catch (Exception $e) {} |
|
229 |
} |
aa8359
|
230 |
|
c6406e
|
231 |
ksort($zones); |
aa8359
|
232 |
|
c6406e
|
233 |
foreach ($zones as $zone) { |
AM |
234 |
list($tzs, $offset) = $zone; |
|
235 |
$select->add('(GMT ' . $offset . ') ' . strtr($tzs, '_', ' '), $tzs); |
|
236 |
} |
49771b
|
237 |
|
c6406e
|
238 |
$blocks['main']['options']['timezone'] = array( |
6b2b2e
|
239 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timezone'))), |
c6406e
|
240 |
'content' => $select->show((string)$config['timezone']), |
AM |
241 |
); |
|
242 |
} |
49771b
|
243 |
|
c6406e
|
244 |
// date/time formatting |
AM |
245 |
if (!isset($no_override['time_format'])) { |
|
246 |
if (!$current) { |
|
247 |
continue 2; |
|
248 |
} |
18b738
|
249 |
|
c6406e
|
250 |
$reftime = mktime(7,30,0); |
AM |
251 |
$defaults = array('G:i', 'H:i', 'g:i a', 'h:i A'); |
|
252 |
$formats = (array)$RCMAIL->config->get('time_formats', $defaults); |
|
253 |
$field_id = 'rcmfd_time_format'; |
|
254 |
$select = new html_select(array('name' => '_time_format', 'id' => $field_id)); |
18b738
|
255 |
|
c6406e
|
256 |
foreach ($formats as $choice) { |
AM |
257 |
$select->add(date($choice, $reftime), $choice); |
|
258 |
} |
f8e8af
|
259 |
|
c6406e
|
260 |
$blocks['main']['options']['time_format'] = array( |
6b2b2e
|
261 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('timeformat'))), |
c6406e
|
262 |
'content' => $select->show($RCMAIL->config->get('time_format')), |
AM |
263 |
); |
|
264 |
} |
3863a9
|
265 |
|
c6406e
|
266 |
if (!isset($no_override['date_format'])) { |
AM |
267 |
if (!$current) { |
|
268 |
continue 2; |
|
269 |
} |
3863a9
|
270 |
|
c6406e
|
271 |
$refdate = mktime(12,30,0,7,24); |
AM |
272 |
$defaults = array('Y-m-d','d-m-Y','Y/m/d','m/d/Y','d/m/Y','d.m.Y','j.n.Y'); |
|
273 |
$formats = (array)$RCMAIL->config->get('date_formats', $defaults); |
|
274 |
$field_id = 'rcmfd_date_format'; |
|
275 |
$select = new html_select(array('name' => '_date_format', 'id' => $field_id)); |
3863a9
|
276 |
|
c6406e
|
277 |
foreach ($formats as $choice) { |
AM |
278 |
$select->add(date($choice, $refdate), $choice); |
|
279 |
} |
06c990
|
280 |
|
c6406e
|
281 |
$blocks['main']['options']['date_format'] = array( |
6b2b2e
|
282 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('dateformat'))), |
c6406e
|
283 |
'content' => $select->show($config['date_format']), |
AM |
284 |
); |
|
285 |
} |
06c990
|
286 |
|
c6406e
|
287 |
// Show checkbox for toggling 'pretty dates' |
AM |
288 |
if (!isset($no_override['prettydate'])) { |
|
289 |
if (!$current) { |
|
290 |
continue 2; |
|
291 |
} |
f8e8af
|
292 |
|
c6406e
|
293 |
$field_id = 'rcmfd_prettydate'; |
AM |
294 |
$input = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); |
f8e8af
|
295 |
|
c6406e
|
296 |
$blocks['main']['options']['prettydate'] = array( |
6b2b2e
|
297 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('prettydate'))), |
c6406e
|
298 |
'content' => $input->show($config['prettydate']?1:0), |
AM |
299 |
); |
|
300 |
} |
49771b
|
301 |
|
c6406e
|
302 |
if (!isset($no_override['refresh_interval'])) { |
AM |
303 |
if (!$current) { |
|
304 |
continue 2; |
|
305 |
} |
49771b
|
306 |
|
c6406e
|
307 |
$field_id = 'rcmfd_refresh_interval'; |
AM |
308 |
$select = new html_select(array('name' => '_refresh_interval', 'id' => $field_id)); |
49771b
|
309 |
|
6b2b2e
|
310 |
$select->add($RCMAIL->gettext('never'), 0); |
c6406e
|
311 |
foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) { |
AM |
312 |
if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) { |
6b2b2e
|
313 |
$label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min))); |
c6406e
|
314 |
$select->add($label, $min); |
AM |
315 |
} |
|
316 |
} |
f8e8af
|
317 |
|
c6406e
|
318 |
$blocks['main']['options']['refresh_interval'] = array( |
6b2b2e
|
319 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('refreshinterval'))), |
c6406e
|
320 |
'content' => $select->show($config['refresh_interval']/60), |
AM |
321 |
); |
|
322 |
} |
bc4960
|
323 |
|
c6406e
|
324 |
// show drop-down for available skins |
AM |
325 |
if (!isset($no_override['skin'])) { |
|
326 |
if (!$current) { |
|
327 |
continue 2; |
|
328 |
} |
bc4960
|
329 |
|
c6406e
|
330 |
$skins = rcmail_get_skins(); |
bc4960
|
331 |
|
c6406e
|
332 |
if (count($skins) > 1) { |
AM |
333 |
$field_id = 'rcmfd_skin'; |
|
334 |
$input = new html_radiobutton(array('name'=>'_skin')); |
49771b
|
335 |
|
c6406e
|
336 |
foreach ($skins as $skin) { |
681ba6
|
337 |
$thumbnail = "skins/$skin/thumbnail.png"; |
c6406e
|
338 |
$skinname = ucfirst($skin); |
AM |
339 |
$author_link = $license_link = ''; |
681ba6
|
340 |
$meta = @json_decode(@file_get_contents(INSTALL_PATH . "skins/$skin/meta.json"), true); |
63ab02
|
341 |
|
c6406e
|
342 |
if (is_array($meta) && $meta['name']) { |
AM |
343 |
$skinname = $meta['name']; |
6b2b2e
|
344 |
$author_link = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), rcube::Q($meta['author'])) : rcube::Q($meta['author']); |
77043f
|
345 |
$license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank', 'tabindex' => '-1'), rcube::Q($meta['license'])) : rcube::Q($meta['license']); |
c6406e
|
346 |
} |
f8e8af
|
347 |
|
681ba6
|
348 |
$img = html::img(array( |
AM |
349 |
'src' => $thumbnail, |
|
350 |
'class' => 'skinthumbnail', |
|
351 |
'alt' => $skin, |
|
352 |
'width' => 64, |
|
353 |
'height' => 64, |
|
354 |
'onerror' => "this.src = rcmail.assets_path('program/resources/blank.gif')", |
|
355 |
)); |
|
356 |
|
c75670
|
357 |
$skinnames[] = mb_strtolower($skinname); |
c6406e
|
358 |
$blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'), |
AM |
359 |
html::span('skinitem', $input->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) . |
681ba6
|
360 |
html::span('skinitem', $img) . |
6b2b2e
|
361 |
html::span('skinitem', html::span('skinname', rcube::Q($skinname)) . html::br() . |
c6406e
|
362 |
html::span('skinauthor', $author_link ? 'by ' . $author_link : '') . html::br() . |
6b2b2e
|
363 |
html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').': ' . $license_link : '')) |
c6406e
|
364 |
); |
AM |
365 |
} |
c75670
|
366 |
array_multisort($blocks['skin']['options'], SORT_ASC, SORT_STRING, $skinnames); |
c6406e
|
367 |
} |
AM |
368 |
} |
08ffd9
|
369 |
|
c6406e
|
370 |
// standard_windows option decides if new windows should be |
AM |
371 |
// opened as popups or standard windows (which can be handled by browsers as tabs) |
|
372 |
if (!isset($no_override['standard_windows'])) { |
|
373 |
if (!$current) { |
|
374 |
continue 2; |
|
375 |
} |
a61cce
|
376 |
|
c6406e
|
377 |
$field_id = 'rcmfd_standard_windows'; |
AM |
378 |
$checkbox = new html_checkbox(array('name' => '_standard_windows', 'id' => $field_id, 'value' => 1)); |
08ffd9
|
379 |
|
c6406e
|
380 |
$blocks['browser']['options']['standard_windows'] = array( |
6b2b2e
|
381 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('standardwindows'))), |
c6406e
|
382 |
'content' => $checkbox->show($config['standard_windows']?1:0), |
AM |
383 |
); |
|
384 |
} |
49771b
|
385 |
|
c6406e
|
386 |
if ($current) { |
AM |
387 |
$product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail'); |
|
388 |
$RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');", |
d22157
|
389 |
rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'docready'); |
c6406e
|
390 |
} |
49771b
|
391 |
|
c6406e
|
392 |
$blocks['browser']['options']['mailtoprotohandler'] = array( |
AM |
393 |
'content' => html::a(array( |
d22157
|
394 |
'href' => '#', |
TB |
395 |
'id' => 'mailtoprotohandler' |
|
396 |
), |
|
397 |
rcube::Q($RCMAIL->gettext('mailtoprotohandler'))) . |
|
398 |
html::span('mailtoprotohandler-status', ''), |
c6406e
|
399 |
); |
f8e8af
|
400 |
|
3863a9
|
401 |
break; |
c6406e
|
402 |
|
AM |
403 |
// Mailbox view (mail screen) |
|
404 |
case 'mailbox': |
|
405 |
$blocks = array( |
6b2b2e
|
406 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
407 |
'new_message' => array('name' => rcube::Q($RCMAIL->gettext('newmessage'))), |
|
408 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
409 |
); |
AM |
410 |
|
|
411 |
// show config parameter for preview pane |
|
412 |
if (!isset($no_override['preview_pane'])) { |
|
413 |
if (!$current) { |
|
414 |
continue 2; |
|
415 |
} |
|
416 |
|
|
417 |
$field_id = 'rcmfd_preview'; |
|
418 |
$input = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1, |
|
419 |
'onchange' => "$('#rcmfd_preview_pane_mark_read').prop('disabled', !this.checked)")); |
|
420 |
|
|
421 |
$blocks['main']['options']['preview_pane'] = array( |
6b2b2e
|
422 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpane'))), |
c6406e
|
423 |
'content' => $input->show($config['preview_pane']?1:0), |
AM |
424 |
); |
|
425 |
} |
|
426 |
|
|
427 |
// show config parameter for preview pane auto mark as read delay |
|
428 |
if (!isset($no_override['preview_pane_mark_read'])) { |
|
429 |
if (!$current) { |
|
430 |
continue 2; |
|
431 |
} |
|
432 |
|
|
433 |
// apply default if config option is not set at all |
|
434 |
$config['preview_pane_mark_read'] = $RCMAIL->config->get('preview_pane_mark_read', 0); |
|
435 |
|
|
436 |
$field_id = 'rcmfd_preview_pane_mark_read'; |
|
437 |
$select = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id, |
|
438 |
'disabled' => $config['preview_pane']?0:1)); |
|
439 |
|
6b2b2e
|
440 |
$select->add($RCMAIL->gettext('never'), '-1'); |
AM |
441 |
$select->add($RCMAIL->gettext('immediately'), 0); |
c6406e
|
442 |
|
AM |
443 |
foreach (array(5, 10, 20, 30) as $sec) { |
6b2b2e
|
444 |
$label = $RCMAIL->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); |
c6406e
|
445 |
$select->add($label, $sec); |
AM |
446 |
} |
|
447 |
|
|
448 |
$blocks['main']['options']['preview_pane_mark_read'] = array( |
6b2b2e
|
449 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('previewpanemarkread'))), |
c6406e
|
450 |
'content' => $select->show(intval($config['preview_pane_mark_read'])), |
AM |
451 |
); |
|
452 |
} |
|
453 |
|
|
454 |
if (!isset($no_override['mdn_requests'])) { |
|
455 |
if (!$current) { |
|
456 |
continue 2; |
|
457 |
} |
|
458 |
|
|
459 |
$field_id = 'rcmfd_mdn_requests'; |
|
460 |
$select = new html_select(array('name' => '_mdn_requests', 'id' => $field_id)); |
6b2b2e
|
461 |
$select->add($RCMAIL->gettext('askuser'), 0); |
AM |
462 |
$select->add($RCMAIL->gettext('autosend'), 1); |
|
463 |
$select->add($RCMAIL->gettext('autosendknown'), 3); |
|
464 |
$select->add($RCMAIL->gettext('autosendknownignore'), 4); |
61ca79
|
465 |
$select->add($RCMAIL->gettext('ignorerequest'), 2); |
c6406e
|
466 |
|
AM |
467 |
$blocks['main']['options']['mdn_requests'] = array( |
6b2b2e
|
468 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mdnrequests'))), |
c6406e
|
469 |
'content' => $select->show($config['mdn_requests']), |
AM |
470 |
); |
|
471 |
} |
|
472 |
|
|
473 |
if (!isset($no_override['autoexpand_threads'])) { |
|
474 |
if (!$current) { |
|
475 |
continue 2; |
|
476 |
} |
|
477 |
|
|
478 |
$storage = $RCMAIL->get_storage(); |
|
479 |
$supported = $storage->get_capability('THREAD'); |
|
480 |
|
|
481 |
if ($supported) { |
|
482 |
$field_id = 'rcmfd_autoexpand_threads'; |
|
483 |
$select = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id)); |
6b2b2e
|
484 |
$select->add($RCMAIL->gettext('never'), 0); |
AM |
485 |
$select->add($RCMAIL->gettext('do_expand'), 1); |
|
486 |
$select->add($RCMAIL->gettext('expand_only_unread'), 2); |
c6406e
|
487 |
|
AM |
488 |
$blocks['main']['options']['autoexpand_threads'] = array( |
6b2b2e
|
489 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoexpand_threads'))), |
c6406e
|
490 |
'content' => $select->show($config['autoexpand_threads']), |
AM |
491 |
); |
|
492 |
} |
|
493 |
} |
|
494 |
|
|
495 |
// show page size selection |
|
496 |
if (!isset($no_override['mail_pagesize'])) { |
|
497 |
if (!$current) { |
|
498 |
continue 2; |
|
499 |
} |
|
500 |
|
|
501 |
$field_id = 'rcmfd_mail_pagesize'; |
|
502 |
$input = new html_inputfield(array('name' => '_mail_pagesize', 'id' => $field_id, 'size' => 5)); |
827159
|
503 |
$size = intval($config['mail_pagesize'] ?: $config['pagesize']); |
c6406e
|
504 |
|
AM |
505 |
$blocks['main']['options']['pagesize'] = array( |
6b2b2e
|
506 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), |
827159
|
507 |
'content' => $input->show($size ?: 50), |
c6406e
|
508 |
); |
AM |
509 |
} |
|
510 |
|
|
511 |
if (!isset($no_override['check_all_folders'])) { |
|
512 |
if (!$current) { |
|
513 |
continue 2; |
|
514 |
} |
|
515 |
|
|
516 |
$field_id = 'rcmfd_check_all_folders'; |
|
517 |
$input = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); |
|
518 |
|
|
519 |
$blocks['new_message']['options']['check_all_folders'] = array( |
6b2b2e
|
520 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('checkallfolders'))), |
c6406e
|
521 |
'content' => $input->show($config['check_all_folders']?1:0), |
AM |
522 |
); |
|
523 |
} |
|
524 |
break; |
|
525 |
|
|
526 |
// Message viewing |
|
527 |
case 'mailview': |
|
528 |
$blocks = array( |
6b2b2e
|
529 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
530 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
531 |
); |
AM |
532 |
|
|
533 |
// show checkbox to open message view in new window |
|
534 |
if (!isset($no_override['message_extwin'])) { |
|
535 |
if (!$current) { |
|
536 |
continue 2; |
|
537 |
} |
|
538 |
|
|
539 |
$field_id = 'rcmfd_message_extwin'; |
|
540 |
$input = new html_checkbox(array('name' => '_message_extwin', 'id' => $field_id, 'value' => 1)); |
|
541 |
|
|
542 |
$blocks['main']['options']['message_extwin'] = array( |
6b2b2e
|
543 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinextwin'))), |
c6406e
|
544 |
'content' => $input->show($config['message_extwin']?1:0), |
AM |
545 |
); |
|
546 |
} |
|
547 |
|
|
548 |
// show checkbox to show email instead of name |
|
549 |
if (!isset($no_override['message_show_email'])) { |
|
550 |
if (!$current) { |
|
551 |
continue 2; |
|
552 |
} |
|
553 |
|
|
554 |
$field_id = 'rcmfd_message_show_email'; |
|
555 |
$input = new html_checkbox(array('name' => '_message_show_email', 'id' => $field_id, 'value' => 1)); |
|
556 |
|
|
557 |
$blocks['main']['options']['message_show_email'] = array( |
6b2b2e
|
558 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showemail'))), |
c6406e
|
559 |
'content' => $input->show($config['message_show_email']?1:0), |
AM |
560 |
); |
|
561 |
} |
|
562 |
|
|
563 |
// show checkbox for HTML/plaintext messages |
|
564 |
if (!isset($no_override['prefer_html'])) { |
|
565 |
if (!$current) { |
|
566 |
continue 2; |
|
567 |
} |
|
568 |
|
|
569 |
$field_id = 'rcmfd_htmlmsg'; |
|
570 |
$input = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1, |
|
571 |
'onchange' => "$('#rcmfd_show_images').prop('disabled', !this.checked).val(0)")); |
|
572 |
|
|
573 |
$blocks['main']['options']['prefer_html'] = array( |
6b2b2e
|
574 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('preferhtml'))), |
c6406e
|
575 |
'content' => $input->show($config['prefer_html']?1:0), |
AM |
576 |
); |
|
577 |
} |
|
578 |
|
|
579 |
if (!isset($no_override['default_charset'])) { |
|
580 |
if (!$current) { |
|
581 |
continue 2; |
|
582 |
} |
|
583 |
|
|
584 |
$field_id = 'rcmfd_default_charset'; |
|
585 |
|
7be8a9
|
586 |
$blocks['advanced']['options']['default_charset'] = array( |
6b2b2e
|
587 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultcharset'))), |
c6406e
|
588 |
'content' => $RCMAIL->output->charset_selector(array( |
7d7d14
|
589 |
'id' => $field_id, 'name' => '_default_charset', 'selected' => $config['default_charset'] |
c6406e
|
590 |
))); |
AM |
591 |
} |
|
592 |
|
|
593 |
if (!isset($no_override['show_images'])) { |
|
594 |
if (!$current) { |
|
595 |
continue 2; |
|
596 |
} |
|
597 |
|
|
598 |
$field_id = 'rcmfd_show_images'; |
|
599 |
$input = new html_select(array('name' => '_show_images', 'id' => $field_id, |
|
600 |
'disabled' => !$config['prefer_html'])); |
|
601 |
|
6b2b2e
|
602 |
$input->add($RCMAIL->gettext('never'), 0); |
AM |
603 |
$input->add($RCMAIL->gettext('fromknownsenders'), 1); |
|
604 |
$input->add($RCMAIL->gettext('always'), 2); |
c6406e
|
605 |
|
AM |
606 |
$blocks['main']['options']['show_images'] = array( |
6b2b2e
|
607 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showremoteimages'))), |
c6406e
|
608 |
'content' => $input->show($config['prefer_html'] ? $config['show_images'] : 0), |
AM |
609 |
); |
|
610 |
} |
|
611 |
|
|
612 |
if (!isset($no_override['inline_images'])) { |
|
613 |
if (!$current) { |
|
614 |
continue 2; |
|
615 |
} |
|
616 |
|
|
617 |
$field_id = 'rcmfd_inline_images'; |
|
618 |
$input = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1)); |
|
619 |
|
|
620 |
$blocks['main']['options']['inline_images'] = array( |
6b2b2e
|
621 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('showinlineimages'))), |
c6406e
|
622 |
'content' => $input->show($config['inline_images']?1:0), |
AM |
623 |
); |
|
624 |
} |
|
625 |
|
|
626 |
// "display after delete" checkbox |
|
627 |
if (!isset($no_override['display_next'])) { |
|
628 |
if (!$current) { |
|
629 |
continue 2; |
|
630 |
} |
|
631 |
|
|
632 |
$field_id = 'rcmfd_displaynext'; |
|
633 |
$input = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); |
|
634 |
|
|
635 |
$blocks['main']['options']['display_next'] = array( |
6b2b2e
|
636 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('displaynext'))), |
c6406e
|
637 |
'content' => $input->show($config['display_next']?1:0), |
AM |
638 |
); |
|
639 |
} |
|
640 |
break; |
|
641 |
|
|
642 |
// Mail composition |
|
643 |
case 'compose': |
|
644 |
$blocks = array( |
6b2b2e
|
645 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
646 |
'sig' => array('name' => rcube::Q($RCMAIL->gettext('signatureoptions'))), |
|
647 |
'spellcheck' => array('name' => rcube::Q($RCMAIL->gettext('spellcheckoptions'))), |
|
648 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
649 |
); |
AM |
650 |
|
|
651 |
// show checkbox to compose messages in a new window |
|
652 |
if (!isset($no_override['compose_extwin'])) { |
|
653 |
if (!$current) { |
|
654 |
continue 2; |
|
655 |
} |
|
656 |
|
|
657 |
$field_id = 'rcmfdcompose_extwin'; |
|
658 |
$input = new html_checkbox(array('name' => '_compose_extwin', 'id' => $field_id, 'value' => 1)); |
|
659 |
|
|
660 |
$blocks['main']['options']['compose_extwin'] = array( |
6b2b2e
|
661 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('composeextwin'))), |
c6406e
|
662 |
'content' => $input->show($config['compose_extwin']?1:0), |
AM |
663 |
); |
|
664 |
} |
|
665 |
|
|
666 |
if (!isset($no_override['htmleditor'])) { |
|
667 |
if (!$current) { |
|
668 |
continue 2; |
|
669 |
} |
|
670 |
|
|
671 |
$field_id = 'rcmfd_htmleditor'; |
|
672 |
$select = new html_select(array('name' => '_htmleditor', 'id' => $field_id)); |
|
673 |
|
6b2b2e
|
674 |
$select->add($RCMAIL->gettext('never'), 0); |
AM |
675 |
$select->add($RCMAIL->gettext('htmlonreply'), 2); |
|
676 |
$select->add($RCMAIL->gettext('htmlonreplyandforward'), 3); |
6ca1e6
|
677 |
$select->add($RCMAIL->gettext('always'), 1); |
AM |
678 |
$select->add($RCMAIL->gettext('alwaysbutplain'), 4); |
c6406e
|
679 |
|
AM |
680 |
$blocks['main']['options']['htmleditor'] = array( |
6b2b2e
|
681 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('htmleditor'))), |
c6406e
|
682 |
'content' => $select->show(intval($config['htmleditor'])), |
AM |
683 |
); |
|
684 |
} |
|
685 |
|
|
686 |
if (!isset($no_override['draft_autosave'])) { |
|
687 |
if (!$current) { |
|
688 |
continue 2; |
|
689 |
} |
|
690 |
|
|
691 |
$field_id = 'rcmfd_autosave'; |
|
692 |
$select = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox']))); |
|
693 |
|
6b2b2e
|
694 |
$select->add($RCMAIL->gettext('never'), 0); |
c6406e
|
695 |
foreach (array(1, 3, 5, 10) as $i => $min) { |
6b2b2e
|
696 |
$label = $RCMAIL->gettext(array('name' => 'everynminutes', 'vars' => array('n' => $min))); |
c6406e
|
697 |
$select->add($label, $min*60); |
AM |
698 |
} |
|
699 |
|
|
700 |
$blocks['main']['options']['draft_autosave'] = array( |
6b2b2e
|
701 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autosavedraft'))), |
c6406e
|
702 |
'content' => $select->show($config['draft_autosave']), |
AM |
703 |
); |
|
704 |
} |
|
705 |
|
|
706 |
if (!isset($no_override['mime_param_folding'])) { |
|
707 |
if (!$current) { |
|
708 |
continue 2; |
|
709 |
} |
|
710 |
|
|
711 |
$field_id = 'rcmfd_param_folding'; |
|
712 |
$select = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id)); |
|
713 |
|
6b2b2e
|
714 |
$select->add($RCMAIL->gettext('2231folding'), 0); |
AM |
715 |
$select->add($RCMAIL->gettext('miscfolding'), 1); |
|
716 |
$select->add($RCMAIL->gettext('2047folding'), 2); |
c6406e
|
717 |
|
7be8a9
|
718 |
$blocks['advanced']['options']['mime_param_folding'] = array( |
6b2b2e
|
719 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('mimeparamfolding'))), |
c6406e
|
720 |
'content' => $select->show($config['mime_param_folding']), |
AM |
721 |
); |
|
722 |
} |
|
723 |
|
|
724 |
if (!isset($no_override['force_7bit'])) { |
|
725 |
if (!$current) { |
|
726 |
continue 2; |
|
727 |
} |
|
728 |
|
|
729 |
$field_id = 'rcmfd_force_7bit'; |
|
730 |
$input = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1)); |
|
731 |
|
7be8a9
|
732 |
$blocks['advanced']['options']['force_7bit'] = array( |
6b2b2e
|
733 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('force7bit'))), |
c6406e
|
734 |
'content' => $input->show($config['force_7bit']?1:0), |
AM |
735 |
); |
|
736 |
} |
|
737 |
|
|
738 |
if (!isset($no_override['mdn_default'])) { |
|
739 |
if (!$current) { |
|
740 |
continue 2; |
|
741 |
} |
|
742 |
|
|
743 |
$field_id = 'rcmfd_mdn_default'; |
|
744 |
$input = new html_checkbox(array('name' => '_mdn_default', 'id' => $field_id, 'value' => 1)); |
|
745 |
|
|
746 |
$blocks['main']['options']['mdn_default'] = array( |
6b2b2e
|
747 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqmdn'))), |
c6406e
|
748 |
'content' => $input->show($config['mdn_default']?1:0), |
AM |
749 |
); |
|
750 |
} |
|
751 |
|
|
752 |
if (!isset($no_override['dsn_default'])) { |
|
753 |
if (!$current) { |
|
754 |
continue 2; |
|
755 |
} |
|
756 |
|
|
757 |
$field_id = 'rcmfd_dsn_default'; |
|
758 |
$input = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1)); |
|
759 |
|
|
760 |
$blocks['main']['options']['dsn_default'] = array( |
6b2b2e
|
761 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('reqdsn'))), |
c6406e
|
762 |
'content' => $input->show($config['dsn_default']?1:0), |
AM |
763 |
); |
|
764 |
} |
|
765 |
|
|
766 |
if (!isset($no_override['reply_same_folder'])) { |
|
767 |
if (!$current) { |
|
768 |
continue 2; |
|
769 |
} |
|
770 |
|
|
771 |
$field_id = 'rcmfd_reply_same_folder'; |
|
772 |
$input = new html_checkbox(array('name' => '_reply_same_folder', 'id' => $field_id, 'value' => 1)); |
|
773 |
|
|
774 |
$blocks['main']['options']['reply_same_folder'] = array( |
6b2b2e
|
775 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replysamefolder'))), |
c6406e
|
776 |
'content' => $input->show($config['reply_same_folder']?1:0), |
AM |
777 |
); |
|
778 |
} |
|
779 |
|
|
780 |
if (!isset($no_override['reply_mode'])) { |
|
781 |
if (!$current) { |
|
782 |
continue 2; |
|
783 |
} |
|
784 |
|
|
785 |
$field_id = 'rcmfd_reply_mode'; |
|
786 |
$select = new html_select(array('name' => '_reply_mode', 'id' => $field_id)); |
|
787 |
|
6b2b2e
|
788 |
$select->add($RCMAIL->gettext('replyempty'), -1); |
AM |
789 |
$select->add($RCMAIL->gettext('replybottomposting'), 0); |
|
790 |
$select->add($RCMAIL->gettext('replytopposting'), 1); |
c6406e
|
791 |
|
AM |
792 |
$blocks['main']['options']['reply_mode'] = array( |
6b2b2e
|
793 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('whenreplying'))), |
c6406e
|
794 |
'content' => $select->show(intval($config['reply_mode'])), |
AM |
795 |
); |
|
796 |
} |
|
797 |
|
|
798 |
if (!isset($no_override['spellcheck_before_send']) && $config['enable_spellcheck']) { |
|
799 |
if (!$current) { |
|
800 |
continue 2; |
|
801 |
} |
|
802 |
|
|
803 |
$field_id = 'rcmfd_spellcheck_before_send'; |
|
804 |
$input = new html_checkbox(array('name' => '_spellcheck_before_send', 'id' => $field_id, 'value' => 1)); |
|
805 |
|
|
806 |
$blocks['spellcheck']['options']['spellcheck_before_send'] = array( |
6b2b2e
|
807 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('spellcheckbeforesend'))), |
c6406e
|
808 |
'content' => $input->show($config['spellcheck_before_send']?1:0), |
AM |
809 |
); |
|
810 |
} |
|
811 |
|
|
812 |
if ($config['enable_spellcheck']) { |
|
813 |
if (!$current) { |
|
814 |
continue 2; |
|
815 |
} |
|
816 |
|
|
817 |
foreach (array('syms', 'nums', 'caps') as $key) { |
|
818 |
$key = 'spellcheck_ignore_'.$key; |
|
819 |
if (!isset($no_override[$key])) { |
|
820 |
$input = new html_checkbox(array('name' => '_'.$key, 'id' => 'rcmfd_'.$key, 'value' => 1)); |
|
821 |
|
|
822 |
$blocks['spellcheck']['options'][$key] = array( |
6b2b2e
|
823 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext(str_replace('_', '', $key)))), |
c6406e
|
824 |
'content' => $input->show($config[$key]?1:0), |
AM |
825 |
); |
|
826 |
} |
|
827 |
} |
|
828 |
} |
|
829 |
|
|
830 |
if (!isset($no_override['show_sig'])) { |
|
831 |
if (!$current) { |
|
832 |
continue 2; |
|
833 |
} |
|
834 |
|
|
835 |
$field_id = 'rcmfd_show_sig'; |
|
836 |
$select = new html_select(array('name' => '_show_sig', 'id' => $field_id)); |
|
837 |
|
6b2b2e
|
838 |
$select->add($RCMAIL->gettext('never'), 0); |
AM |
839 |
$select->add($RCMAIL->gettext('always'), 1); |
|
840 |
$select->add($RCMAIL->gettext('newmessageonly'), 2); |
|
841 |
$select->add($RCMAIL->gettext('replyandforwardonly'), 3); |
c6406e
|
842 |
|
AM |
843 |
$blocks['sig']['options']['show_sig'] = array( |
6b2b2e
|
844 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autoaddsignature'))), |
c6406e
|
845 |
'content' => $select->show($RCMAIL->config->get('show_sig', 1)), |
AM |
846 |
); |
|
847 |
} |
|
848 |
|
09225a
|
849 |
if (!isset($no_override['sig_below'])) { |
AM |
850 |
if (!$current) { |
|
851 |
continue 2; |
|
852 |
} |
|
853 |
|
|
854 |
$field_id = 'rcmfd_sig_below'; |
|
855 |
$input = new html_checkbox(array('name' => '_sig_below', 'id' => $field_id, 'value' => 1)); |
|
856 |
|
|
857 |
$blocks['sig']['options']['sig_below'] = array( |
|
858 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigbelow'))), |
|
859 |
'content' => $input->show($RCMAIL->config->get('sig_below') ? 1 : 0), |
|
860 |
); |
|
861 |
} |
|
862 |
|
c6406e
|
863 |
if (!isset($no_override['strip_existing_sig'])) { |
AM |
864 |
if (!$current) { |
|
865 |
continue 2; |
|
866 |
} |
|
867 |
|
|
868 |
$field_id = 'rcmfd_strip_existing_sig'; |
|
869 |
$input = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1)); |
|
870 |
|
|
871 |
$blocks['sig']['options']['strip_existing_sig'] = array( |
6b2b2e
|
872 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyremovesignature'))), |
c6406e
|
873 |
'content' => $input->show($config['strip_existing_sig']?1:0), |
AM |
874 |
); |
|
875 |
} |
|
876 |
|
399a2d
|
877 |
if (!isset($no_override['sig_separator'])) { |
AM |
878 |
if (!$current) { |
|
879 |
continue 2; |
|
880 |
} |
|
881 |
|
|
882 |
$field_id = 'rcmfd_sig_separator'; |
|
883 |
$input = new html_checkbox(array('name' => '_sig_separator', 'id' => $field_id, 'value' => 1)); |
|
884 |
|
|
885 |
$blocks['sig']['options']['sig_separator'] = array( |
|
886 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigseparator'))), |
|
887 |
'content' => $input->show($RCMAIL->config->get('sig_separator') ? 1 : 0), |
|
888 |
); |
|
889 |
} |
|
890 |
|
c6406e
|
891 |
if (!isset($no_override['forward_attachment'])) { |
AM |
892 |
if (!$current) { |
|
893 |
continue 2; |
|
894 |
} |
|
895 |
|
|
896 |
$field_id = 'rcmfd_forward_attachment'; |
|
897 |
$select = new html_select(array('name' => '_forward_attachment', 'id' => $field_id)); |
|
898 |
|
6b2b2e
|
899 |
$select->add($RCMAIL->gettext('inline'), 0); |
AM |
900 |
$select->add($RCMAIL->gettext('asattachment'), 1); |
c6406e
|
901 |
|
AM |
902 |
$blocks['main']['options']['forward_attachment'] = array( |
6b2b2e
|
903 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('forwardmode'))), |
c6406e
|
904 |
'content' => $select->show(intval($config['forward_attachment'])), |
AM |
905 |
); |
|
906 |
} |
|
907 |
|
f7b2bf
|
908 |
if (!isset($no_override['default_font']) || !isset($no_override['default_font_size'])) { |
c6406e
|
909 |
if (!$current) { |
AM |
910 |
continue 2; |
|
911 |
} |
|
912 |
|
d8d569
|
913 |
// Default font size |
D |
914 |
$field_id = 'rcmfd_default_font_size'; |
|
915 |
$select_default_font_size = new html_select(array('name' => '_default_font_size', 'id' => $field_id)); |
c6406e
|
916 |
|
f7b2bf
|
917 |
$fontsizes = array('', '8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); |
d8d569
|
918 |
foreach ($fontsizes as $size) { |
D |
919 |
$select_default_font_size->add($size, $size); |
c6406e
|
920 |
} |
AM |
921 |
|
d8d569
|
922 |
// Default font |
D |
923 |
$field_id = 'rcmfd_default_font'; |
|
924 |
$select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); |
f7b2bf
|
925 |
$select_default_font->add('', ''); |
c6406e
|
926 |
|
6b2b2e
|
927 |
$fonts = rcmail::font_defs(); |
07a641
|
928 |
foreach (array_keys($fonts) as $fname) { |
d8d569
|
929 |
$select_default_font->add($fname, $fname); |
D |
930 |
} |
c6406e
|
931 |
|
AM |
932 |
$blocks['main']['options']['default_font'] = array( |
6b2b2e
|
933 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultfont'))), |
c1ff57
|
934 |
'content' => $select_default_font->show($RCMAIL->config->get('default_font', 1)) . |
TB |
935 |
$select_default_font_size->show($RCMAIL->config->get('default_font_size', 1)) |
c6406e
|
936 |
); |
AM |
937 |
} |
b972b4
|
938 |
|
AM |
939 |
if (!isset($no_override['reply_all_mode'])) { |
|
940 |
if (!$current) { |
|
941 |
continue 2; |
|
942 |
} |
|
943 |
|
|
944 |
$field_id = 'rcmfd_reply_all_mode'; |
|
945 |
$select = new html_select(array('name' => '_reply_all_mode', 'id' => $field_id)); |
|
946 |
|
6b2b2e
|
947 |
$select->add($RCMAIL->gettext('replyalldefault'), 0); |
AM |
948 |
$select->add($RCMAIL->gettext('replyalllist'), 1); |
b972b4
|
949 |
|
AM |
950 |
$blocks['main']['options']['reply_all_mode'] = array( |
6b2b2e
|
951 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('replyallmode'))), |
b972b4
|
952 |
'content' => $select->show(intval($config['reply_all_mode'])), |
AM |
953 |
); |
|
954 |
} |
|
955 |
|
44b47d
|
956 |
if (!isset($no_override['compose_save_localstorage'])) { |
TB |
957 |
if (!$current) { |
|
958 |
continue 2; |
|
959 |
} |
|
960 |
|
|
961 |
$field_id = 'rcmfd_compose_save_localstorage'; |
|
962 |
$input = new html_checkbox(array('name' => '_compose_save_localstorage', 'id' => $field_id, 'value' => 1)); |
|
963 |
|
|
964 |
$blocks['advanced']['options']['compose_save_localstorage'] = array( |
|
965 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('savelocalstorage'))), |
|
966 |
'content' => $input->show($config['compose_save_localstorage']?1:0), |
|
967 |
); |
|
968 |
} |
|
969 |
|
c6406e
|
970 |
break; |
AM |
971 |
|
|
972 |
// Addressbook config |
|
973 |
case 'addressbook': |
|
974 |
$blocks = array( |
6b2b2e
|
975 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
976 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
977 |
); |
AM |
978 |
|
|
979 |
if (!isset($no_override['default_addressbook']) |
|
980 |
&& (!$current || ($books = $RCMAIL->get_address_sources(true, true))) |
|
981 |
) { |
|
982 |
if (!$current) { |
|
983 |
continue 2; |
|
984 |
} |
|
985 |
|
|
986 |
$field_id = 'rcmfd_default_addressbook'; |
|
987 |
$select = new html_select(array('name' => '_default_addressbook', 'id' => $field_id)); |
|
988 |
|
|
989 |
foreach ($books as $book) { |
|
990 |
$select->add(html_entity_decode($book['name'], ENT_COMPAT, 'UTF-8'), $book['id']); |
|
991 |
} |
|
992 |
|
|
993 |
$blocks['main']['options']['default_addressbook'] = array( |
6b2b2e
|
994 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('defaultabook'))), |
c6406e
|
995 |
'content' => $select->show($config['default_addressbook']), |
AM |
996 |
); |
|
997 |
} |
|
998 |
|
|
999 |
// show addressbook listing mode selection |
|
1000 |
if (!isset($no_override['addressbook_name_listing'])) { |
|
1001 |
if (!$current) { |
|
1002 |
continue 2; |
|
1003 |
} |
|
1004 |
|
|
1005 |
$field_id = 'rcmfd_addressbook_name_listing'; |
|
1006 |
$select = new html_select(array('name' => '_addressbook_name_listing', 'id' => $field_id)); |
|
1007 |
|
6b2b2e
|
1008 |
$select->add($RCMAIL->gettext('name'), 0); |
AM |
1009 |
$select->add($RCMAIL->gettext('firstname') . ' ' . $RCMAIL->gettext('surname'), 1); |
|
1010 |
$select->add($RCMAIL->gettext('surname') . ' ' . $RCMAIL->gettext('firstname'), 2); |
|
1011 |
$select->add($RCMAIL->gettext('surname') . ', ' . $RCMAIL->gettext('firstname'), 3); |
c6406e
|
1012 |
|
AM |
1013 |
$blocks['main']['options']['list_name_listing'] = array( |
6b2b2e
|
1014 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listnamedisplay'))), |
c6406e
|
1015 |
'content' => $select->show($config['addressbook_name_listing']), |
AM |
1016 |
); |
|
1017 |
} |
|
1018 |
|
|
1019 |
// show addressbook sort column |
|
1020 |
if (!isset($no_override['addressbook_sort_col'])) { |
|
1021 |
if (!$current) { |
|
1022 |
continue 2; |
|
1023 |
} |
|
1024 |
|
|
1025 |
$field_id = 'rcmfd_addressbook_sort_col'; |
|
1026 |
$select = new html_select(array('name' => '_addressbook_sort_col', 'id' => $field_id)); |
|
1027 |
|
6b2b2e
|
1028 |
$select->add($RCMAIL->gettext('name'), 'name'); |
AM |
1029 |
$select->add($RCMAIL->gettext('firstname'), 'firstname'); |
|
1030 |
$select->add($RCMAIL->gettext('surname'), 'surname'); |
c6406e
|
1031 |
|
AM |
1032 |
$blocks['main']['options']['sort_col'] = array( |
6b2b2e
|
1033 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('listsorting'))), |
c6406e
|
1034 |
'content' => $select->show($config['addressbook_sort_col']), |
AM |
1035 |
); |
|
1036 |
} |
|
1037 |
|
|
1038 |
// show addressbook page size selection |
|
1039 |
if (!isset($no_override['addressbook_pagesize'])) { |
|
1040 |
if (!$current) { |
|
1041 |
continue 2; |
|
1042 |
} |
|
1043 |
|
|
1044 |
$field_id = 'rcmfd_addressbook_pagesize'; |
|
1045 |
$input = new html_inputfield(array('name' => '_addressbook_pagesize', 'id' => $field_id, 'size' => 5)); |
827159
|
1046 |
$size = intval($config['addressbook_pagesize'] ?: $config['pagesize']); |
c6406e
|
1047 |
|
AM |
1048 |
$blocks['main']['options']['pagesize'] = array( |
6b2b2e
|
1049 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('pagesize'))), |
827159
|
1050 |
'content' => $input->show($size ?: 50), |
c6406e
|
1051 |
); |
AM |
1052 |
} |
|
1053 |
|
|
1054 |
if (!isset($no_override['autocomplete_single'])) { |
|
1055 |
if (!$current) { |
|
1056 |
continue 2; |
|
1057 |
} |
|
1058 |
|
|
1059 |
$field_id = 'rcmfd_autocomplete_single'; |
|
1060 |
$checkbox = new html_checkbox(array('name' => '_autocomplete_single', 'id' => $field_id, 'value' => 1)); |
|
1061 |
|
|
1062 |
$blocks['main']['options']['autocomplete_single'] = array( |
6b2b2e
|
1063 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('autocompletesingle'))), |
c6406e
|
1064 |
'content' => $checkbox->show($config['autocomplete_single']?1:0), |
AM |
1065 |
); |
|
1066 |
} |
|
1067 |
break; |
|
1068 |
|
|
1069 |
// Special IMAP folders |
|
1070 |
case 'folders': |
|
1071 |
$blocks = array( |
6b2b2e
|
1072 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
1073 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
1074 |
); |
AM |
1075 |
|
|
1076 |
if (!isset($no_override['show_real_foldernames'])) { |
|
1077 |
if (!$current) { |
|
1078 |
continue 2; |
|
1079 |
} |
|
1080 |
|
|
1081 |
$field_id = 'show_real_foldernames'; |
|
1082 |
$input = new html_checkbox(array('name' => '_show_real_foldernames', 'id' => $field_id, 'value' => 1)); |
|
1083 |
|
|
1084 |
$blocks['main']['options']['show_real_foldernames'] = array( |
6b2b2e
|
1085 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('show_real_foldernames'))), |
c6406e
|
1086 |
'content' => $input->show($config['show_real_foldernames']?1:0), |
AM |
1087 |
); |
|
1088 |
} |
|
1089 |
|
|
1090 |
// Configure special folders |
dc0b50
|
1091 |
$set = array('drafts_mbox', 'sent_mbox', 'junk_mbox', 'trash_mbox'); |
AM |
1092 |
if ($current && count(array_intersect($no_override, $set)) < 4) { |
6b2b2e
|
1093 |
$select = $RCMAIL->folder_selector(array( |
c6406e
|
1094 |
'noselection' => '---', |
AM |
1095 |
'realnames' => true, |
|
1096 |
'maxlength' => 30, |
|
1097 |
'folder_filter' => 'mail', |
|
1098 |
'folder_rights' => 'w', |
|
1099 |
)); |
0c2ffb
|
1100 |
|
dc0b50
|
1101 |
// #1486114, #1488279, #1489219 |
AM |
1102 |
$onchange = "if ($(this).val() == 'INBOX') $(this).val('')"; |
|
1103 |
} |
c6406e
|
1104 |
|
AM |
1105 |
if (!isset($no_override['drafts_mbox'])) { |
|
1106 |
if (!$current) { |
|
1107 |
continue 2; |
|
1108 |
} |
|
1109 |
|
|
1110 |
$blocks['main']['options']['drafts_mbox'] = array( |
6b2b2e
|
1111 |
'title' => rcube::Q($RCMAIL->gettext('drafts')), |
0c2ffb
|
1112 |
'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox", 'onchange' => $onchange)), |
c6406e
|
1113 |
); |
AM |
1114 |
} |
|
1115 |
|
|
1116 |
if (!isset($no_override['sent_mbox'])) { |
|
1117 |
if (!$current) { |
|
1118 |
continue 2; |
|
1119 |
} |
|
1120 |
|
|
1121 |
$blocks['main']['options']['sent_mbox'] = array( |
6b2b2e
|
1122 |
'title' => rcube::Q($RCMAIL->gettext('sent')), |
0c2ffb
|
1123 |
'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox", 'onchange' => '')), |
c6406e
|
1124 |
); |
AM |
1125 |
} |
|
1126 |
|
|
1127 |
if (!isset($no_override['junk_mbox'])) { |
|
1128 |
if (!$current) { |
|
1129 |
continue 2; |
|
1130 |
} |
|
1131 |
|
|
1132 |
$blocks['main']['options']['junk_mbox'] = array( |
6b2b2e
|
1133 |
'title' => rcube::Q($RCMAIL->gettext('junk')), |
0c2ffb
|
1134 |
'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox", 'onchange' => $onchange)), |
c6406e
|
1135 |
); |
AM |
1136 |
} |
|
1137 |
|
|
1138 |
if (!isset($no_override['trash_mbox'])) { |
|
1139 |
if (!$current) { |
|
1140 |
continue 2; |
|
1141 |
} |
|
1142 |
|
|
1143 |
$blocks['main']['options']['trash_mbox'] = array( |
6b2b2e
|
1144 |
'title' => rcube::Q($RCMAIL->gettext('trash')), |
0c2ffb
|
1145 |
'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox", 'onchange' => $onchange)), |
c6406e
|
1146 |
); |
AM |
1147 |
} |
|
1148 |
break; |
|
1149 |
|
|
1150 |
// Server settings |
|
1151 |
case 'server': |
|
1152 |
$blocks = array( |
6b2b2e
|
1153 |
'main' => array('name' => rcube::Q($RCMAIL->gettext('mainoptions'))), |
AM |
1154 |
'maintenance' => array('name' => rcube::Q($RCMAIL->gettext('maintenance'))), |
|
1155 |
'advanced' => array('name' => rcube::Q($RCMAIL->gettext('advancedoptions'))), |
c6406e
|
1156 |
); |
AM |
1157 |
|
|
1158 |
if (!isset($no_override['read_when_deleted'])) { |
|
1159 |
if (!$current) { |
|
1160 |
continue 2; |
|
1161 |
} |
|
1162 |
|
|
1163 |
$field_id = 'rcmfd_read_deleted'; |
|
1164 |
$input = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1)); |
|
1165 |
|
|
1166 |
$blocks['main']['options']['read_when_deleted'] = array( |
6b2b2e
|
1167 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('readwhendeleted'))), |
c6406e
|
1168 |
'content' => $input->show($config['read_when_deleted']?1:0), |
AM |
1169 |
); |
|
1170 |
} |
|
1171 |
|
|
1172 |
if (!isset($no_override['flag_for_deletion'])) { |
|
1173 |
if (!$current) { |
|
1174 |
continue 2; |
|
1175 |
} |
|
1176 |
|
|
1177 |
$field_id = 'rcmfd_flag_for_deletion'; |
|
1178 |
$input = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1)); |
|
1179 |
|
|
1180 |
$blocks['main']['options']['flag_for_deletion'] = array( |
6b2b2e
|
1181 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('flagfordeletion'))), |
c6406e
|
1182 |
'content' => $input->show($config['flag_for_deletion']?1:0), |
AM |
1183 |
); |
|
1184 |
} |
|
1185 |
|
|
1186 |
// don't show deleted messages |
|
1187 |
if (!isset($no_override['skip_deleted'])) { |
|
1188 |
if (!$current) { |
|
1189 |
continue 2; |
|
1190 |
} |
|
1191 |
|
|
1192 |
$field_id = 'rcmfd_skip_deleted'; |
|
1193 |
$input = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1)); |
|
1194 |
|
|
1195 |
$blocks['main']['options']['skip_deleted'] = array( |
6b2b2e
|
1196 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('skipdeleted'))), |
c6406e
|
1197 |
'content' => $input->show($config['skip_deleted']?1:0), |
AM |
1198 |
); |
|
1199 |
} |
|
1200 |
|
|
1201 |
if (!isset($no_override['delete_always'])) { |
|
1202 |
if (!$current) { |
|
1203 |
continue 2; |
|
1204 |
} |
|
1205 |
|
|
1206 |
$field_id = 'rcmfd_delete_always'; |
|
1207 |
$input = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1)); |
|
1208 |
|
|
1209 |
$blocks['main']['options']['delete_always'] = array( |
6b2b2e
|
1210 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletealways'))), |
c6406e
|
1211 |
'content' => $input->show($config['delete_always']?1:0), |
AM |
1212 |
); |
|
1213 |
} |
|
1214 |
|
|
1215 |
if (!isset($no_override['delete_junk'])) { |
|
1216 |
if (!$current) { |
|
1217 |
continue 2; |
|
1218 |
} |
|
1219 |
|
|
1220 |
$field_id = 'rcmfd_delete_junk'; |
|
1221 |
$input = new html_checkbox(array('name' => '_delete_junk', 'id' => $field_id, 'value' => 1)); |
|
1222 |
|
|
1223 |
$blocks['main']['options']['delete_junk'] = array( |
6b2b2e
|
1224 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('deletejunk'))), |
c6406e
|
1225 |
'content' => $input->show($config['delete_junk']?1:0), |
AM |
1226 |
); |
|
1227 |
} |
|
1228 |
|
|
1229 |
// Trash purging on logout |
|
1230 |
if (!isset($no_override['logout_purge'])) { |
|
1231 |
if (!$current) { |
|
1232 |
continue 2; |
|
1233 |
} |
|
1234 |
|
|
1235 |
$field_id = 'rcmfd_logout_purge'; |
|
1236 |
$input = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); |
|
1237 |
|
|
1238 |
$blocks['maintenance']['options']['logout_purge'] = array( |
6b2b2e
|
1239 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutclear'))), |
c6406e
|
1240 |
'content' => $input->show($config['logout_purge']?1:0), |
AM |
1241 |
); |
|
1242 |
} |
|
1243 |
|
|
1244 |
// INBOX compacting on logout |
|
1245 |
if (!isset($no_override['logout_expunge'])) { |
|
1246 |
if (!$current) { |
|
1247 |
continue 2; |
|
1248 |
} |
|
1249 |
|
|
1250 |
$field_id = 'rcmfd_logout_expunge'; |
|
1251 |
$input = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1)); |
|
1252 |
|
|
1253 |
$blocks['maintenance']['options']['logout_expunge'] = array( |
6b2b2e
|
1254 |
'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('logoutcompact'))), |
c6406e
|
1255 |
'content' => $input->show($config['logout_expunge']?1:0), |
AM |
1256 |
); |
|
1257 |
} |
|
1258 |
} |
|
1259 |
|
|
1260 |
$found = false; |
|
1261 |
$data = $RCMAIL->plugins->exec_hook('preferences_list', |
|
1262 |
array('section' => $sect['id'], 'blocks' => $blocks, 'current' => $current)); |
|
1263 |
|
ee43f0
|
1264 |
$advanced_prefs = (array) $RCMAIL->config->get('advanced_prefs'); |
4a05e8
|
1265 |
|
c6406e
|
1266 |
// create output |
4a05e8
|
1267 |
foreach ($data['blocks'] as $key => $block) { |
c6406e
|
1268 |
if (!empty($block['content']) || !empty($block['options'])) { |
AM |
1269 |
$found = true; |
4a05e8
|
1270 |
} |
TB |
1271 |
// move some options to the 'advanced' block as configured by admin |
|
1272 |
if ($key != 'advanced') { |
|
1273 |
foreach ($advanced_prefs as $opt) { |
|
1274 |
if ($block['options'][$opt]) { |
|
1275 |
$data['blocks']['advanced']['options'][$opt] = $block['options'][$opt]; |
|
1276 |
unset($data['blocks'][$key]['options'][$opt]); |
|
1277 |
} |
|
1278 |
} |
c6406e
|
1279 |
} |
AM |
1280 |
} |
|
1281 |
|
f9c8e8
|
1282 |
// move 'advanced' block to the end of the list |
TB |
1283 |
if (!empty($data['blocks']['advanced'])) { |
|
1284 |
$adv = $data['blocks']['advanced']; |
|
1285 |
unset($data['blocks']['advanced']); |
|
1286 |
$data['blocks']['advanced'] = $adv; |
|
1287 |
} |
|
1288 |
|
c6406e
|
1289 |
if (!$found) |
AM |
1290 |
unset($sections[$idx]); |
|
1291 |
else |
|
1292 |
$sections[$idx]['blocks'] = $data['blocks']; |
49771b
|
1293 |
|
d9c22a
|
1294 |
// allow plugins to add a header to each section |
C |
1295 |
$data = $RCMAIL->plugins->exec_hook('preferences_section_header', |
74ce01
|
1296 |
array('section' => $sect['id'], 'header' => '', 'current' => $current)); |
dba1c6
|
1297 |
|
74ce01
|
1298 |
if (!empty($data['header'])) { |
d9c22a
|
1299 |
$sections[$idx]['header'] = $data['header']; |
C |
1300 |
} |
dba1c6
|
1301 |
} |
C |
1302 |
|
c6406e
|
1303 |
return array($sections, $plugin['cols']); |
49771b
|
1304 |
} |
A |
1305 |
|
|
1306 |
|
|
1307 |
function rcmail_get_skins() |
|
1308 |
{ |
b7addf
|
1309 |
$path = RCUBE_INSTALL_PATH . 'skins'; |
c6406e
|
1310 |
$skins = array(); |
AM |
1311 |
$dir = opendir($path); |
49771b
|
1312 |
|
c6406e
|
1313 |
if (!$dir) { |
AM |
1314 |
return false; |
|
1315 |
} |
f8e8af
|
1316 |
|
c6406e
|
1317 |
while (($file = readdir($dir)) !== false) { |
AM |
1318 |
$filename = $path.'/'.$file; |
|
1319 |
if (!preg_match('/^\./', $file) && is_dir($filename) && is_readable($filename)) { |
|
1320 |
$skins[] = $file; |
|
1321 |
} |
|
1322 |
} |
f8e8af
|
1323 |
|
c6406e
|
1324 |
closedir($dir); |
49771b
|
1325 |
|
c6406e
|
1326 |
return $skins; |
49771b
|
1327 |
} |
A |
1328 |
|
bbce3e
|
1329 |
|
254d5e
|
1330 |
function rcmail_folder_options($mailbox) |
bbce3e
|
1331 |
{ |
A |
1332 |
global $RCMAIL; |
|
1333 |
|
c321a9
|
1334 |
$options = $RCMAIL->get_storage()->folder_info($mailbox); |
67975b
|
1335 |
$options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders')); |
bbce3e
|
1336 |
|
1a0343
|
1337 |
return $options; |
bbce3e
|
1338 |
} |
A |
1339 |
|
1a0343
|
1340 |
/** |
A |
1341 |
* Updates (or creates) folder row in the subscriptions table |
|
1342 |
* |
|
1343 |
* @param string $name Folder name |
|
1344 |
* @param string $oldname Old folder name (for update) |
|
1345 |
* @param bool $subscribe Checks subscription checkbox |
|
1346 |
* @param string $class CSS class name for folder row |
|
1347 |
*/ |
|
1348 |
function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class_name=null) |
254d5e
|
1349 |
{ |
63ff2a
|
1350 |
global $RCMAIL, $OUTPUT; |
A |
1351 |
|
|
1352 |
$protect_folders = $RCMAIL->config->get('protect_default_folders'); |
dc0b50
|
1353 |
$storage = $RCMAIL->get_storage(); |
AM |
1354 |
$delimiter = $storage->get_hierarchy_delimiter(); |
254d5e
|
1355 |
|
3cb61e
|
1356 |
$name_utf8 = rcube_charset::convert($name, 'UTF7-IMAP'); |
AM |
1357 |
$protected = $protect_folders && $storage->is_special_folder($name); |
c321a9
|
1358 |
$foldersplit = explode($delimiter, $storage->mod_folder($name)); |
254d5e
|
1359 |
$level = count($foldersplit) - 1; |
3cb61e
|
1360 |
$display_name = $protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP'); |
AM |
1361 |
$class_name = trim($class_name . ' mailbox'); |
c6447e
|
1362 |
|
d575e4
|
1363 |
if ($oldname === null) { |
3cb61e
|
1364 |
$OUTPUT->command('add_folder_row', $name, $name_utf8, $display_name, $protected, $subscribe, |
AM |
1365 |
$class_name); |
d575e4
|
1366 |
} |
AM |
1367 |
else { |
3cb61e
|
1368 |
$OUTPUT->command('replace_folder_row', $oldname, $name, $name_utf8, $display_name, $protected, $class_name); |
d575e4
|
1369 |
} |
254d5e
|
1370 |
} |
A |
1371 |
|
c49c35
|
1372 |
/** |
TB |
1373 |
* Render the list of settings sections (AKA tabs) |
|
1374 |
*/ |
|
1375 |
function rcmail_settings_tabs($attrib) |
|
1376 |
{ |
|
1377 |
global $RCMAIL, $OUTPUT; |
|
1378 |
|
|
1379 |
// add default attributes |
|
1380 |
$attrib += array('tagname' => 'span', 'idprefix' => 'settingstab', 'selclass' => 'selected'); |
|
1381 |
|
|
1382 |
$default_actions = array( |
|
1383 |
array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'), |
|
1384 |
array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'), |
|
1385 |
array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'), |
1e22cb
|
1386 |
array('command' => 'responses', 'type' => 'link', 'label' => 'responses', 'title' => 'manageresponses'), |
c49c35
|
1387 |
); |
TB |
1388 |
|
|
1389 |
// get all identites from DB and define list of cols to be displayed |
|
1390 |
$plugin = $RCMAIL->plugins->exec_hook('settings_actions', array( |
|
1391 |
'actions' => $default_actions, |
d575e4
|
1392 |
'attrib' => $attrib, |
c49c35
|
1393 |
)); |
TB |
1394 |
|
d575e4
|
1395 |
$attrib = $plugin['attrib']; |
c49c35
|
1396 |
$tagname = $attrib['tagname']; |
d575e4
|
1397 |
$tabs = array(); |
c49c35
|
1398 |
|
07a641
|
1399 |
foreach ($plugin['actions'] as $action) { |
c49c35
|
1400 |
if (!$action['command'] && !$action['href'] && $action['action']) { |
TB |
1401 |
$action['href'] = $RCMAIL->url(array('_action' => $action['action'])); |
|
1402 |
} |
|
1403 |
|
|
1404 |
$button = $OUTPUT->button($action); |
d575e4
|
1405 |
$attr = $attrib; |
c49c35
|
1406 |
|
827159
|
1407 |
$cmd = $action['action'] ?: $action['command']; |
AM |
1408 |
$id = $action['id'] ?: $cmd; |
d575e4
|
1409 |
|
c49c35
|
1410 |
if (!empty($id)) { |
TB |
1411 |
$attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id); |
|
1412 |
} |
d575e4
|
1413 |
|
c49c35
|
1414 |
$classnames = array($attrib['class']); |
TB |
1415 |
if (!empty($action['class'])) { |
|
1416 |
$classnames[] = $action['class']; |
|
1417 |
} |
|
1418 |
else if (!empty($cmd)) { |
|
1419 |
$classnames[] = $cmd; |
|
1420 |
} |
|
1421 |
if ($RCMAIL->action == $cmd) { |
|
1422 |
$classnames[] = $attrib['selclass']; |
|
1423 |
} |
d575e4
|
1424 |
|
c49c35
|
1425 |
$attr['class'] = join(' ', $classnames); |
TB |
1426 |
$tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib); |
|
1427 |
} |
|
1428 |
|
|
1429 |
return join('', $tabs); |
|
1430 |
} |