Changeset 5398 in subversion
- Timestamp:
- Nov 8, 2011 6:22:14 AM (20 months ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 6 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/main.inc (modified) (3 diffs)
-
program/include/rcube_imap.php (modified) (5 diffs)
-
program/include/rcube_imap_generic.php (modified) (1 diff)
-
program/steps/settings/edit_folder.inc (modified) (1 diff)
-
program/steps/settings/folders.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r5394 r5398 2 2 =========================== 3 3 4 - Fix so folders with \Noinferiors attribute aren't listed in parent selector 4 5 - Fix handling of curly brackets in URLs (#1488168) 5 6 - Fix handling of dates (birthday/anniversary) in contact data (#1488147) -
trunk/roundcubemail/program/include/main.inc
r5390 r5398 1233 1233 $select->add($p['noselection'], ''); 1234 1234 1235 rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p ['exceptions']);1235 rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p); 1236 1236 1237 1237 return $select; … … 1282 1282 1283 1283 if (!isset($arrFolders[$currentFolder])) { 1284 // Check \Noselect option (if options are in cache)1285 if (!$virtual && ($ opts = $RCMAIL->imap->mailbox_options($path))) {1286 $virtual = in_array('\\Noselect', $ opts);1284 // Check \Noselect attribute (if attributes are in cache) 1285 if (!$virtual && ($attrs = $RCMAIL->imap->mailbox_attributes($path))) { 1286 $virtual = in_array('\\Noselect', $attrs); 1287 1287 } 1288 1288 … … 1403 1403 * @return string 1404 1404 */ 1405 function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0, $exceptions=array()) 1406 { 1405 function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0, $opts=array()) 1406 { 1407 global $RCMAIL; 1408 1407 1409 $out = ''; 1408 1410 1409 1411 foreach ($arrFolders as $key => $folder) { 1410 if (empty($exceptions) || !in_array($folder['id'], $exceptions)) { 1411 if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) 1412 $foldername = rcube_label($folder_class); 1413 else { 1414 $foldername = $folder['name']; 1415 1416 // shorten the folder name to a given length 1417 if ($maxlength && $maxlength>1) 1418 $foldername = abbreviate_string($foldername, $maxlength); 1419 } 1420 1421 $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']); 1422 } 1423 else if ($nestLevel) 1412 // skip exceptions (and its subfolders) 1413 if (!empty($opts['exceptions']) && in_array($folder['id'], $opts['exceptions'])) { 1424 1414 continue; 1415 } 1416 1417 // skip folders in which it isn't possible to create subfolders 1418 if (!empty($opts['skip_noinferiors']) && ($attrs = $RCMAIL->imap->mailbox_attributes($folder['id'])) 1419 && in_array('\\Noinferiors', $attrs) 1420 ) { 1421 continue; 1422 } 1423 1424 if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) 1425 $foldername = rcube_label($folder_class); 1426 else { 1427 $foldername = $folder['name']; 1428 1429 // shorten the folder name to a given length 1430 if ($maxlength && $maxlength>1) 1431 $foldername = abbreviate_string($foldername, $maxlength); 1432 } 1433 1434 $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']); 1425 1435 1426 1436 if (!empty($folder['folders'])) 1427 1437 $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, 1428 $select, $realnames, $nestLevel+1, $ exceptions);1438 $select, $realnames, $nestLevel+1, $opts); 1429 1439 } 1430 1440 -
trunk/roundcubemail/program/include/rcube_imap.php
r5397 r5398 3088 3088 function list_unsubscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false) 3089 3089 { 3090 // @TODO: caching 3090 $cache_key = $root.':'.$name; 3091 if (!empty($filter)) { 3092 $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter)); 3093 } 3094 $cache_key .= ':'.$rights; 3095 $cache_key = 'mailboxes.list.'.md5($cache_key); 3096 3097 // get cached folder list 3098 $a_mboxes = $this->get_cache($cache_key); 3099 if (is_array($a_mboxes)) { 3100 return $a_mboxes; 3101 } 3102 3091 3103 // Give plugins a chance to provide a list of mailboxes 3092 3104 $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', … … 3110 3122 } 3111 3123 3124 // cache folder attributes 3125 if ($root == '' && $name == '*' && empty($filter)) { 3126 $this->update_cache('mailboxes.attributes', $this->conn->data['LIST']); 3127 } 3128 3112 3129 // filter folders list according to rights requirements 3113 3130 if ($rights && $this->get_capability('ACL')) { … … 3119 3136 $a_mboxes = $this->_sort_mailbox_list($a_mboxes); 3120 3137 } 3138 3139 // write mailboxlist to cache 3140 $this->update_cache($cache_key, $a_mboxes); 3121 3141 3122 3142 return $a_mboxes; … … 3451 3471 3452 3472 /** 3453 * Gets folder options from LIST response, e.g. \Noselect, \Noinferiors3473 * Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors 3454 3474 * 3455 3475 * @param string $mailbox Folder name 3456 * @param bool $force Set to True if options should be refreshed 3457 * Options are available after LIST command only 3476 * @param bool $force Set to True if attributes should be refreshed 3458 3477 * 3459 3478 * @return array Options list 3460 3479 */ 3461 function mailbox_ options($mailbox, $force=false)3462 { 3463 if ($mailbox == 'INBOX') {3464 return array();3465 }3466 3467 if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mailbox])) {3468 if ($force) {3469 $this->conn->listMailboxes('', $mailbox);3470 }3471 else {3472 return array(); 3473 }3474 }3475 3476 $opts = $this->conn->data['LIST'][$mailbox];3480 function mailbox_attributes($mailbox, $force=false) 3481 { 3482 // get attributes directly from LIST command 3483 if (!empty($this->conn->data['LIST']) && is_array($this->conn->data['LIST'][$mailbox])) { 3484 $opts = $this->conn->data['LIST'][$mailbox]; 3485 } 3486 // get cached folder attributes 3487 else if (!$force) { 3488 $opts = $this->get_cache('mailboxes.attributes'); 3489 $opts = $opts[$mailbox]; 3490 } 3491 3492 if (!is_array($opts)) { 3493 $this->conn->listMailboxes('', $mailbox); 3494 $opts = $this->conn->data['LIST'][$mailbox]; 3495 } 3477 3496 3478 3497 return is_array($opts) ? $opts : array(); … … 3557 3576 } 3558 3577 3559 $options['name'] = $mailbox;3560 $options[' options'] = $this->mailbox_options($mailbox, true);3561 $options['namespace'] = $this->mailbox_namespace($mailbox);3562 $options['rights'] = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array();3563 $options['special'] = in_array($mailbox, $this->default_folders);3578 $options['name'] = $mailbox; 3579 $options['attributes'] = $this->mailbox_attributes($mailbox, true); 3580 $options['namespace'] = $this->mailbox_namespace($mailbox); 3581 $options['rights'] = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); 3582 $options['special'] = in_array($mailbox, $this->default_folders); 3564 3583 3565 3584 // Set 'noselect' and 'norename' flags 3566 if (is_array($options[' options'])) {3567 foreach ($options[' options'] as $opt) {3568 $ opt = strtolower($opt);3569 if ($ opt == '\noselect' || $opt== '\nonexistent') {3585 if (is_array($options['attributes'])) { 3586 foreach ($options['attributes'] as $attrib) { 3587 $attrib = strtolower($attrib); 3588 if ($attrib == '\noselect' || $attrib == '\nonexistent') { 3570 3589 $options['noselect'] = true; 3571 3590 } -
trunk/roundcubemail/program/include/rcube_imap_generic.php
r5365 r5398 2259 2259 2260 2260 // Add to options array 2261 if (!empty($opts)) { 2262 if (empty($this->data['LIST'][$mailbox])) 2263 $this->data['LIST'][$mailbox] = $opts; 2264 else 2265 $this->data['LIST'][$mailbox] = array_unique(array_merge( 2266 $this->data['LIST'][$mailbox], $opts)); 2267 } 2261 if (empty($this->data['LIST'][$mailbox])) 2262 $this->data['LIST'][$mailbox] = $opts; 2263 else if (!empty($opts)) 2264 $this->data['LIST'][$mailbox] = array_unique(array_merge( 2265 $this->data['LIST'][$mailbox], $opts)); 2268 2266 } 2269 2267 // * STATUS <mailbox> (<result>) -
trunk/roundcubemail/program/steps/settings/edit_folder.inc
r5306 r5398 120 120 'maxlength' => 150, 121 121 'unsubscribed' => true, 122 'exceptions' => array($mbox_imap), 122 'skip_noinferiors' => true, 123 'exceptions' => array($mbox_imap), 123 124 )); 124 125 -
trunk/roundcubemail/program/steps/settings/folders.inc
r5309 r5398 284 284 285 285 if (!$protected) { 286 $ opts = $IMAP->mailbox_options($folder['id']);287 $noselect = in_array('\\Noselect', $ opts);286 $attrs = $IMAP->mailbox_attributes($folder['id']); 287 $noselect = in_array('\\Noselect', $attrs); 288 288 } 289 289
Note: See TracChangeset
for help on using the changeset viewer.
