commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/settings/manage_folders.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
A |
8 |
| Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Provide functionality to create/delete/rename folders | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
a5897a
|
22 |
// WARNING: folder names in UI are encoded with RCMAIL_CHARSET |
a55606
|
23 |
|
c8c1e0
|
24 |
// init IMAP connection |
47d8d3
|
25 |
$RCMAIL->imap_connect(); |
4e17e6
|
26 |
|
T |
27 |
// subscribe to one or more mailboxes |
197601
|
28 |
if ($RCMAIL->action=='subscribe') |
4e17e6
|
29 |
{ |
a5897a
|
30 |
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
c5097c
|
31 |
$IMAP->subscribe(array($mbox)); |
4e17e6
|
32 |
} |
T |
33 |
|
|
34 |
// unsubscribe one or more mailboxes |
197601
|
35 |
else if ($RCMAIL->action=='unsubscribe') |
4e17e6
|
36 |
{ |
a5897a
|
37 |
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
c5097c
|
38 |
$IMAP->unsubscribe(array($mbox)); |
4e17e6
|
39 |
} |
T |
40 |
|
f52c93
|
41 |
// enable threading for one or more mailboxes |
T |
42 |
else if ($RCMAIL->action=='enable-threading') |
|
43 |
{ |
|
44 |
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
|
45 |
rcube_set_threading($mbox, true); |
|
46 |
} |
|
47 |
|
|
48 |
// enable threading for one or more mailboxes |
|
49 |
else if ($RCMAIL->action=='disable-threading') |
|
50 |
{ |
|
51 |
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST, false, 'UTF7-IMAP')) |
|
52 |
rcube_set_threading($mbox, false); |
|
53 |
} |
|
54 |
|
4e17e6
|
55 |
// create a new mailbox |
197601
|
56 |
else if ($RCMAIL->action=='create-folder') |
4e17e6
|
57 |
{ |
8d0758
|
58 |
if (!empty($_POST['_name'])) |
32ac95
|
59 |
{ |
a5897a
|
60 |
$name = trim(get_input_value('_name', RCUBE_INPUT_POST, FALSE, 'UTF7-IMAP')); |
32ac95
|
61 |
$create = $IMAP->create_mailbox($name, TRUE); |
A |
62 |
} |
|
63 |
|
f11541
|
64 |
if ($create && $OUTPUT->ajax_call) |
4e17e6
|
65 |
{ |
9490b7
|
66 |
$delimiter = $IMAP->get_hierarchy_delimiter(); |
681a59
|
67 |
$folderlist = $IMAP->list_unsubscribed(); |
A |
68 |
$index = array_search($create, $folderlist); |
a5897a
|
69 |
$before = $index !== false && isset($folderlist[$index+1]) ? rcube_charset_convert($folderlist[$index+1], 'UTF7-IMAP') : false; |
681a59
|
70 |
|
a5897a
|
71 |
$create = rcube_charset_convert($create, 'UTF7-IMAP'); |
9490b7
|
72 |
$foldersplit = explode($delimiter, $create); |
681a59
|
73 |
$display_create = str_repeat(' ', substr_count($create, $delimiter)) . $foldersplit[count($foldersplit)-1]; |
A |
74 |
|
|
75 |
$OUTPUT->command('add_folder_row', $create, $display_create, false, $before); |
4e17e6
|
76 |
} |
09c1a3
|
77 |
else if (!$create) |
4e17e6
|
78 |
{ |
f11541
|
79 |
$OUTPUT->show_message('errorsaving', 'error'); |
4e17e6
|
80 |
} |
c8c1e0
|
81 |
} |
S |
82 |
|
|
83 |
// rename a mailbox |
197601
|
84 |
else if ($RCMAIL->action=='rename-folder') |
c8c1e0
|
85 |
{ |
8d0758
|
86 |
if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) |
32ac95
|
87 |
{ |
681a59
|
88 |
$name_utf8 = trim(get_input_value('_folder_newname', RCUBE_INPUT_POST)); |
A |
89 |
$oldname_utf8 = get_input_value('_folder_oldname', RCUBE_INPUT_POST); |
a5897a
|
90 |
$name = rcube_charset_convert($name_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); |
A |
91 |
$oldname = rcube_charset_convert($oldname_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); |
681a59
|
92 |
|
A |
93 |
$rename = $IMAP->rename_mailbox($oldname, $name); |
f52c93
|
94 |
} |
T |
95 |
|
|
96 |
// update per-folder options for modified folder and its subfolders |
|
97 |
if ($rename) { |
|
98 |
$a_threaded = $RCMAIL->config->get('message_threading', array()); |
|
99 |
$delimiter = $IMAP->get_hierarchy_delimiter(); |
|
100 |
$oldprefix = '/^' . preg_quote($oldname . $delimiter, '/') . '/'; |
|
101 |
foreach ($a_threaded as $key => $val) |
|
102 |
if ($key == $oldname) { |
|
103 |
unset($a_threaded[$key]); |
|
104 |
$a_threaded[$name] = true; |
|
105 |
} |
|
106 |
else if (preg_match($oldprefix, $key)) { |
|
107 |
unset($a_threaded[$key]); |
|
108 |
$a_threaded[preg_replace($oldprefix, $name.$delimiter, $key)] = true; |
|
109 |
} |
|
110 |
|
|
111 |
$RCMAIL->user->save_prefs(array('message_threading' => $a_threaded)); |
32ac95
|
112 |
} |
A |
113 |
|
f11541
|
114 |
if ($rename && $OUTPUT->ajax_call) |
c8c1e0
|
115 |
{ |
681a59
|
116 |
$folderlist = $IMAP->list_unsubscribed(); |
9490b7
|
117 |
$delimiter = $IMAP->get_hierarchy_delimiter(); |
681a59
|
118 |
|
A |
119 |
$regexp = '/^' . preg_quote($rename . $delimiter, '/') . '/'; |
|
120 |
|
|
121 |
// subfolders |
|
122 |
for ($x=sizeof($folderlist)-1; $x>=0; $x--) |
|
123 |
{ |
|
124 |
if (preg_match($regexp, $folderlist[$x])) |
|
125 |
{ |
3e8bd7
|
126 |
$oldfolder = $oldname . $delimiter . preg_replace($regexp, '', $folderlist[$x]); |
681a59
|
127 |
$foldersplit = explode($delimiter, $folderlist[$x]); |
A |
128 |
$level = count($foldersplit) - 1; |
|
129 |
$display_rename = str_repeat(' ', $level) |
a5897a
|
130 |
. rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'); |
681a59
|
131 |
|
a5897a
|
132 |
$before = isset($folderlist[$x+1]) ? rcube_charset_convert($folderlist[$x+1], 'UTF7-IMAP') : false; |
681a59
|
133 |
|
a5897a
|
134 |
$OUTPUT->command('replace_folder_row', rcube_charset_convert($oldfolder, 'UTF7-IMAP'), |
A |
135 |
rcube_charset_convert($folderlist[$x], 'UTF7-IMAP'), $display_rename, $before); |
681a59
|
136 |
} |
A |
137 |
} |
|
138 |
|
9490b7
|
139 |
$foldersplit = explode($delimiter, $rename); |
6b79f7
|
140 |
$level = count($foldersplit) - 1; |
a5897a
|
141 |
$display_rename = str_repeat(' ', $level) . rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'); |
681a59
|
142 |
$index = array_search($rename, $folderlist); |
a5897a
|
143 |
$before = $index !== false && isset($folderlist[$index+1]) ? rcube_charset_convert($folderlist[$index+1], 'UTF7-IMAP') : false; |
09c1a3
|
144 |
|
a5897a
|
145 |
$OUTPUT->command('replace_folder_row', $oldname_utf8, rcube_charset_convert($rename, 'UTF7-IMAP'), $display_rename, $before); |
f11541
|
146 |
$OUTPUT->command('reset_folder_rename'); |
c8c1e0
|
147 |
} |
f11541
|
148 |
else if (!$rename && $OUTPUT->ajax_call) |
c8c1e0
|
149 |
{ |
f11541
|
150 |
$OUTPUT->command('reset_folder_rename'); |
T |
151 |
$OUTPUT->show_message('errorsaving', 'error'); |
c8c1e0
|
152 |
} |
S |
153 |
else if (!$rename) |
f11541
|
154 |
$OUTPUT->show_message('errorsaving', 'error'); |
4e17e6
|
155 |
} |
T |
156 |
|
|
157 |
// delete an existing IMAP mailbox |
197601
|
158 |
else if ($RCMAIL->action=='delete-folder') |
4e17e6
|
159 |
{ |
681a59
|
160 |
$a_mboxes = $IMAP->list_unsubscribed(); |
97a656
|
161 |
$delimiter = $IMAP->get_hierarchy_delimiter(); |
681a59
|
162 |
|
A |
163 |
$mboxes_utf8 = get_input_value('_mboxes', RCUBE_INPUT_POST); |
a5897a
|
164 |
$mboxes = rcube_charset_convert($mboxes_utf8, RCMAIL_CHARSET, 'UTF7-IMAP'); |
97a656
|
165 |
|
681a59
|
166 |
if ($mboxes) |
b3ce79
|
167 |
$deleted = $IMAP->delete_mailbox(array($mboxes)); |
4e17e6
|
168 |
|
f11541
|
169 |
if ($OUTPUT->ajax_call && $deleted) |
f9c107
|
170 |
{ |
681a59
|
171 |
$OUTPUT->command('remove_folder_row', $mboxes_utf8); |
97a656
|
172 |
foreach ($a_mboxes as $mbox) |
fa0152
|
173 |
{ |
681a59
|
174 |
if (preg_match('/^'. preg_quote($mboxes.$delimiter, '/') .'/', $mbox)) |
fa0152
|
175 |
{ |
a5897a
|
176 |
$OUTPUT->command('remove_folder_row', rcube_charset_convert($mbox, 'UTF7-IMAP')); |
fa0152
|
177 |
} |
T |
178 |
} |
f11541
|
179 |
$OUTPUT->show_message('folderdeleted', 'confirmation'); |
f9c107
|
180 |
} |
09c1a3
|
181 |
else if (!$deleted) |
1cded8
|
182 |
{ |
f11541
|
183 |
$OUTPUT->show_message('errorsaving', 'error'); |
1cded8
|
184 |
} |
4e17e6
|
185 |
} |
T |
186 |
|
09c1a3
|
187 |
if ($OUTPUT->ajax_call) |
A |
188 |
$OUTPUT->send(); |
4e17e6
|
189 |
|
T |
190 |
|
|
191 |
// build table with all folders listed by server |
|
192 |
function rcube_subscription_form($attrib) |
|
193 |
{ |
f52c93
|
194 |
global $RCMAIL, $IMAP, $CONFIG, $OUTPUT; |
T |
195 |
|
|
196 |
$threading_supported = $IMAP->get_capability('thread=references') |
|
197 |
|| $IMAP->get_capability('thread=orderedsubject') |
|
198 |
|| $IMAP->get_capability('thread=refs'); |
4e17e6
|
199 |
|
T |
200 |
list($form_start, $form_end) = get_form_tags($attrib, 'folders'); |
|
201 |
unset($attrib['form']); |
|
202 |
|
|
203 |
if (!$attrib['id']) |
|
204 |
$attrib['id'] = 'rcmSubscriptionlist'; |
|
205 |
|
3e8bd7
|
206 |
$table = new html_table(); |
4e17e6
|
207 |
|
T |
208 |
// add table header |
3e8bd7
|
209 |
$table->add_header('name', rcube_label('foldername')); |
T |
210 |
$table->add_header('msgcount', rcube_label('messagecount')); |
|
211 |
$table->add_header('subscribed', rcube_label('subscribed')); |
f52c93
|
212 |
if ($threading_supported) |
T |
213 |
$table->add_header('threaded', rcube_label('threaded')); |
3e8bd7
|
214 |
$table->add_header('rename', ' '); |
T |
215 |
$table->add_header('delete', ' '); |
4e17e6
|
216 |
|
T |
217 |
// get folders from server |
4d4264
|
218 |
$IMAP->clear_cache('mailboxes'); |
T |
219 |
|
4e17e6
|
220 |
$a_unsubscribed = $IMAP->list_unsubscribed(); |
T |
221 |
$a_subscribed = $IMAP->list_mailboxes(); |
f52c93
|
222 |
$a_threaded = $a_threaded_copy = $RCMAIL->config->get('message_threading', array()); |
9490b7
|
223 |
$delimiter = $IMAP->get_hierarchy_delimiter(); |
3e8bd7
|
224 |
$a_js_folders = $seen_folders = $list_folders = array(); |
cbf1f3
|
225 |
|
3e8bd7
|
226 |
// pre-process folders list |
T |
227 |
foreach ($a_unsubscribed as $i => $folder) { |
|
228 |
$foldersplit = explode($delimiter, $folder); |
a5897a
|
229 |
$name = rcube_charset_convert(array_pop($foldersplit), 'UTF7-IMAP'); |
3e8bd7
|
230 |
$parent_folder = join($delimiter, $foldersplit); |
T |
231 |
$level = count($foldersplit); |
cbf1f3
|
232 |
|
0456f8
|
233 |
// add any necessary "virtual" parent folders |
A |
234 |
if ($parent_folder && !$seen[$parent_folder]) { |
|
235 |
for ($i=1; $i<=$level; $i++) { |
|
236 |
$ancestor_folder = join($delimiter, array_slice($foldersplit, 0, $i)); |
|
237 |
if ($ancestor_folder && !$seen[$ancestor_folder]++) { |
a5897a
|
238 |
$ancestor_name = rcube_charset_convert($foldersplit[$i-1], 'UTF7-IMAP'); |
0456f8
|
239 |
$list_folders[] = array('id' => $ancestor_folder, 'name' => $ancestor_name, 'level' => $i-1, 'virtual' => true); |
A |
240 |
} |
|
241 |
} |
3e8bd7
|
242 |
} |
T |
243 |
|
f52c93
|
244 |
unset($a_threaded_copy[$folder]); |
T |
245 |
|
3e8bd7
|
246 |
$list_folders[] = array('id' => $folder, 'name' => $name, 'level' => $level); |
T |
247 |
$seen[$folder]++; |
f52c93
|
248 |
} |
T |
249 |
|
|
250 |
// remove 'message_threading' option for not existing folders |
|
251 |
if ($a_threaded_copy) { |
|
252 |
foreach ($a_threaded_copy as $key => $val) |
|
253 |
unset($a_threaded[$key]); |
|
254 |
unset($a_threaded_copy); |
|
255 |
$RCMAIL->user->save_prefs(array('message_threading' => $a_threaded)); |
3e8bd7
|
256 |
} |
681a59
|
257 |
|
3e8bd7
|
258 |
$checkbox_subscribe = new html_checkbox(array( |
T |
259 |
'name' => '_subscribed[]', |
|
260 |
'onclick' => JS_OBJECT_NAME.".command(this.checked?'subscribe':'unsubscribe',this.value)", |
f52c93
|
261 |
)); |
T |
262 |
$checkbox_threaded = new html_checkbox(array( |
|
263 |
'name' => '_threaded[]', |
|
264 |
'onclick' => JS_OBJECT_NAME.".command(this.checked?'enable-threading':'disable-threading',this.value)", |
3e8bd7
|
265 |
)); |
4e17e6
|
266 |
|
24053e
|
267 |
if (!empty($attrib['deleteicon'])) |
70087c
|
268 |
$del_button = html::img(array('src' => $CONFIG['skin_path'] . $attrib['deleteicon'], 'alt' => rcube_label('delete'))); |
4e17e6
|
269 |
else |
24053e
|
270 |
$del_button = rcube_label('delete'); |
4e17e6
|
271 |
|
24053e
|
272 |
if (!empty($attrib['renameicon'])) |
70087c
|
273 |
$edit_button = html::img(array('src' => $CONFIG['skin_path'] . $attrib['renameicon'], 'alt' => rcube_label('rename'))); |
24053e
|
274 |
else |
731590
|
275 |
$edit_button = rcube_label('rename'); |
4e17e6
|
276 |
|
3e8bd7
|
277 |
// create list of available folders |
T |
278 |
foreach ($list_folders as $i => $folder) { |
|
279 |
$idx = $i + 1; |
|
280 |
$subscribed = in_array($folder['id'], $a_subscribed); |
f52c93
|
281 |
$threaded = $a_threaded[$folder['id']]; |
0456f8
|
282 |
$protected = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders'])); |
3e8bd7
|
283 |
$classes = array($i%2 ? 'even' : 'odd'); |
T |
284 |
$folder_js = JQ($folder['id']); |
|
285 |
$display_folder = str_repeat(' ', $folder['level']) . ($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); |
a5897a
|
286 |
$folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); |
3e8bd7
|
287 |
|
T |
288 |
if ($folder['virtual']) |
|
289 |
$classes[] = 'virtual'; |
|
290 |
|
|
291 |
$table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes))); |
|
292 |
|
|
293 |
$table->add('name', Q($display_folder)); |
a03c98
|
294 |
$table->add('msgcount', ($folder['virtual'] ? '' : $IMAP->messagecount($folder['id'], 'ALL', false, false))); |
01538d
|
295 |
$table->add('subscribed', $checkbox_subscribe->show(($subscribed ? $folder_utf8 : ''), |
A |
296 |
array('value' => $folder_utf8, 'disabled' => $protected ? 'disabled' : ''))); |
258a04
|
297 |
if ($threading_supported) { |
8ed015
|
298 |
$table->add('threaded', $folder['virtual'] ? '' : |
A |
299 |
$checkbox_threaded->show(($threaded ? $folder_utf8 : ''), array('value' => $folder_utf8))); |
f52c93
|
300 |
} |
3e8bd7
|
301 |
|
T |
302 |
// add rename and delete buttons |
0456f8
|
303 |
if (!$protected && !$folder['virtual']) { |
3e8bd7
|
304 |
$table->add('rename', html::a(array('href' => "#rename", 'title' => rcube_label('renamefolder')), $edit_button)); |
T |
305 |
$table->add('delete', html::a(array('href' => "#delete", 'title' => rcube_label('deletefolder')), $del_button)); |
4e17e6
|
306 |
} |
3e8bd7
|
307 |
else { |
de2e0b
|
308 |
$table->add('rename', ' '); |
A |
309 |
$table->add('delete', ' '); |
3e8bd7
|
310 |
} |
T |
311 |
|
0456f8
|
312 |
$a_js_folders['rcmrow'.$idx] = array($folder_utf8, $display_folder, $protected || $folder['virtual']); |
3e8bd7
|
313 |
} |
4e17e6
|
314 |
|
e6ce00
|
315 |
rcmail::get_instance()->plugins->exec_hook('folders_list', array('table'=>$table)); |
4e17e6
|
316 |
|
f11541
|
317 |
$OUTPUT->add_gui_object('subscriptionlist', $attrib['id']); |
T |
318 |
$OUTPUT->set_env('subscriptionrows', $a_js_folders); |
b0dbf3
|
319 |
$OUTPUT->set_env('defaultfolders', $CONFIG['default_imap_folders']); |
9490b7
|
320 |
$OUTPUT->set_env('delimiter', $delimiter); |
4e17e6
|
321 |
|
3e8bd7
|
322 |
return $form_start . $table->show($attrib) . $form_end; |
4e17e6
|
323 |
} |
T |
324 |
|
|
325 |
|
|
326 |
function rcube_create_folder_form($attrib) |
|
327 |
{ |
a8d23d
|
328 |
global $OUTPUT; |
T |
329 |
|
4e17e6
|
330 |
list($form_start, $form_end) = get_form_tags($attrib, 'create-folder'); |
T |
331 |
unset($attrib['form']); |
|
332 |
|
a8d23d
|
333 |
if ($attrib['hintbox']) |
T |
334 |
$OUTPUT->add_gui_object('createfolderhint', $attrib['hintbox']); |
4e17e6
|
335 |
|
T |
336 |
// return the complete edit form as table |
|
337 |
$out = "$form_start\n"; |
|
338 |
|
47124c
|
339 |
$input = new html_inputfield(array('name' => '_folder_name')); |
4e17e6
|
340 |
$out .= $input->show(); |
T |
341 |
|
|
342 |
if (get_boolean($attrib['button'])) |
|
343 |
{ |
47124c
|
344 |
$button = new html_inputfield(array('type' => 'button', |
4e17e6
|
345 |
'value' => rcube_label('create'), |
f11541
|
346 |
'onclick' => JS_OBJECT_NAME.".command('create-folder',this.form)")); |
4e17e6
|
347 |
$out .= $button->show(); |
T |
348 |
} |
|
349 |
|
|
350 |
$out .= "\n$form_end"; |
|
351 |
|
|
352 |
return $out; |
|
353 |
} |
|
354 |
|
c8c1e0
|
355 |
function rcube_rename_folder_form($attrib) |
S |
356 |
{ |
f11541
|
357 |
global $CONFIG, $IMAP; |
c8c1e0
|
358 |
|
S |
359 |
list($form_start, $form_end) = get_form_tags($attrib, 'rename-folder'); |
|
360 |
unset($attrib['form']); |
|
361 |
|
|
362 |
// return the complete edit form as table |
|
363 |
$out = "$form_start\n"; |
|
364 |
|
|
365 |
$a_unsubscribed = $IMAP->list_unsubscribed(); |
47124c
|
366 |
$select_folder = new html_select(array('name' => '_folder_oldname', 'id' => 'rcmfd_oldfolder')); |
c8c1e0
|
367 |
|
S |
368 |
foreach ($a_unsubscribed as $i => $folder) |
|
369 |
{ |
|
370 |
if ($CONFIG['protect_default_folders'] == TRUE && in_array($folder,$CONFIG['default_imap_folders'])) |
|
371 |
continue; |
|
372 |
|
|
373 |
$select_folder->add($folder); |
|
374 |
} |
|
375 |
|
|
376 |
$out .= $select_folder->show(); |
|
377 |
|
|
378 |
$out .= " to "; |
47124c
|
379 |
$inputtwo = new html_inputfield(array('name' => '_folder_newname')); |
c8c1e0
|
380 |
$out .= $inputtwo->show(); |
S |
381 |
|
|
382 |
if (get_boolean($attrib['button'])) |
|
383 |
{ |
47124c
|
384 |
$button = new html_inputfield(array('type' => 'button', |
c8c1e0
|
385 |
'value' => rcube_label('rename'), |
f11541
|
386 |
'onclick' => JS_OBJECT_NAME.".command('rename-folder',this.form)")); |
c8c1e0
|
387 |
$out .= $button->show(); |
S |
388 |
} |
|
389 |
|
|
390 |
$out .= "\n$form_end"; |
a8d23d
|
391 |
|
c8c1e0
|
392 |
return $out; |
S |
393 |
} |
|
394 |
|
f52c93
|
395 |
|
T |
396 |
// (un)set 'threading' for selected folder |
|
397 |
function rcube_set_threading($mbox, $state=true) |
|
398 |
{ |
|
399 |
global $RCMAIL; |
|
400 |
$mbox = (array)$mbox; |
|
401 |
$a_prefs = (array)$RCMAIL->config->get('message_threading'); |
|
402 |
|
|
403 |
if ($state) { |
|
404 |
foreach ($mbox as $box) |
|
405 |
$a_prefs[$box] = true; |
|
406 |
} |
|
407 |
else { |
|
408 |
foreach ($mbox as $box) |
|
409 |
unset($a_prefs[$box]); |
|
410 |
} |
|
411 |
|
|
412 |
$RCMAIL->user->save_prefs(array('message_threading' => $a_prefs)); |
|
413 |
} |
|
414 |
|
|
415 |
|
681a59
|
416 |
$OUTPUT->set_pagetitle(rcube_label('folders')); |
28c59f
|
417 |
$OUTPUT->include_script('list.js'); |
4e17e6
|
418 |
|
f11541
|
419 |
// register UI objects |
T |
420 |
$OUTPUT->add_handlers(array( |
|
421 |
'foldersubscription' => 'rcube_subscription_form', |
|
422 |
'createfolder' => 'rcube_create_folder_form', |
|
423 |
'renamefolder' => 'rcube_rename_folder_form' |
|
424 |
)); |
|
425 |
|
1cded8
|
426 |
// add some labels to client |
701b9a
|
427 |
$OUTPUT->add_label('deletefolderconfirm','addsubfolderhint','forbiddencharacter','folderdeleting','folderrenaming','foldercreating','foldermoving'); |
1cded8
|
428 |
|
f11541
|
429 |
$OUTPUT->send('managefolders'); |
b25dfd
|
430 |
|