Changeset 94bdcce in github
- Timestamp:
- May 6, 2011 4:14:48 AM (2 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 091b028
- Parents:
- de0a3f9
- Files:
-
- 8 edited
-
program/include/main.inc (modified) (3 diffs)
-
program/include/rcube_imap.php (modified) (12 diffs)
-
program/steps/mail/check_recent.inc (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (1 diff)
-
program/steps/mail/getunread.inc (modified) (1 diff)
-
skins/default/templates/mail.html (modified) (1 diff)
-
skins/default/templates/message.html (modified) (1 diff)
-
skins/default/templates/messageerror.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/include/main.inc
rd08333e r94bdcce 1171 1171 $attrib['id'] = 'rcmboxlist'; 1172 1172 1173 if (empty($attrib['folder_name'])) 1174 $attrib['folder_name'] = '*'; 1175 1173 1176 // get mailbox list 1174 1177 $mbox_name = $RCMAIL->imap->get_mailbox_name(); … … 1177 1180 if (empty($a_mailboxes)) { 1178 1181 // get mailbox list 1179 $a_folders = $RCMAIL->imap->list_mailboxes( );1182 $a_folders = $RCMAIL->imap->list_mailboxes('', $attrib['folder_name'], $attrib['folder_filter']); 1180 1183 $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); 1181 1184 $a_mailboxes = array(); … … 1224 1227 $a_mailboxes = array(); 1225 1228 1229 if (empty($p['folder_name'])) 1230 $p['folder_name'] = '*'; 1231 1226 1232 if ($p['unsubscribed']) 1227 $list = $RCMAIL->imap->list_unsubscribed( );1233 $list = $RCMAIL->imap->list_unsubscribed('', $p['folder_name'], $p['folder_filter']); 1228 1234 else 1229 $list = $RCMAIL->imap->list_mailboxes( );1235 $list = $RCMAIL->imap->list_mailboxes('', $p['folder_name'], $p['folder_filter']); 1230 1236 1231 1237 $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); -
program/include/rcube_imap.php
rd08333e r94bdcce 3015 3015 * 3016 3016 * @param string $root Optional root folder 3017 * @param string $filter Optional filter for mailbox listing 3017 * @param string $name Optional name pattern 3018 * @param string $filter Optional filter 3018 3019 * 3019 3020 * @return array List of mailboxes/folders 3020 3021 * @access public 3021 3022 */ 3022 function list_mailboxes($root='', $ filter='*')3023 { 3024 $a_mboxes = $this->_list_mailboxes($root, $ filter);3023 function list_mailboxes($root='', $name='*', $filter=null) 3024 { 3025 $a_mboxes = $this->_list_mailboxes($root, $name, $filter); 3025 3026 3026 3027 // INBOX should always be available 3027 if ( !in_array('INBOX', $a_mboxes))3028 if ((!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) { 3028 3029 array_unshift($a_mboxes, 'INBOX'); 3030 } 3029 3031 3030 3032 // sort mailboxes … … 3039 3041 * 3040 3042 * @param string $root Optional root folder 3041 * @param string $filter Optional filter for mailbox listing 3043 * @param string $name Optional name pattern 3044 * @param mixed $filter Optional filter 3045 * 3042 3046 * @return array List of mailboxes/folders 3043 3047 * @see rcube_imap::list_mailboxes() 3044 3048 * @access private 3045 3049 */ 3046 private function _list_mailboxes($root='', $filter='*') 3047 { 3050 private function _list_mailboxes($root='', $name='*', $filter=null) 3051 { 3052 $cache_key = 'mailboxes'; 3053 if (!empty($filter)) { 3054 $cache_key .= ':'.substr((is_string($filter) ? $filter : serialize($filter)), 0, 90); 3055 } 3056 3048 3057 // get cached folder list 3049 $a_mboxes = $this->get_cache( 'mailboxes');3050 if (is_array($a_mboxes)) 3058 $a_mboxes = $this->get_cache($cache_key); 3059 if (is_array($a_mboxes)) { 3051 3060 return $a_mboxes; 3061 } 3052 3062 3053 3063 $a_defaults = $a_out = array(); … … 3055 3065 // Give plugins a chance to provide a list of mailboxes 3056 3066 $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', 3057 array('root' => $root, ' filter' => $filter, 'mode' => 'LSUB'));3067 array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LSUB')); 3058 3068 3059 3069 if (isset($data['folders'])) { … … 3066 3076 if (!$config->get('imap_force_lsub') && $this->get_capability('LIST-EXTENDED')) { 3067 3077 // This will also set mailbox options, LSUB doesn't do that 3068 $a_folders = $this->conn->listMailboxes($root, $ filter,3078 $a_folders = $this->conn->listMailboxes($root, $name, 3069 3079 NULL, array('SUBSCRIBED')); 3070 3080 … … 3082 3092 // retrieve list of folders from IMAP server using LSUB 3083 3093 else { 3084 $a_folders = $this->conn->listSubscribed($root, $ filter);3085 } 3086 } 3087 3088 if (!is_array($a_folders) || !sizeof($a_folders)) 3094 $a_folders = $this->conn->listSubscribed($root, $name); 3095 } 3096 } 3097 3098 if (!is_array($a_folders) || !sizeof($a_folders)) { 3089 3099 $a_folders = array(); 3100 } 3090 3101 3091 3102 // write mailboxlist to cache 3092 $this->update_cache( 'mailboxes', $a_folders);3103 $this->update_cache($cache_key, $a_folders); 3093 3104 3094 3105 return $a_folders; … … 3100 3111 * 3101 3112 * @param string $root IMAP root dir 3102 * @param string $filter Optional filter for mailbox listing 3113 * @param string $name Optional name pattern 3114 * @param mixed $filter Optional filter 3115 * 3103 3116 * @return array Indexed array with folder names 3104 3117 */ 3105 function list_unsubscribed($root='', $filter='*') 3106 { 3118 function list_unsubscribed($root='', $name='*', $filter=null) 3119 { 3120 // @TODO: caching 3107 3121 // Give plugins a chance to provide a list of mailboxes 3108 3122 $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', 3109 array('root' => $root, ' filter' => $filter, 'mode' => 'LIST'));3123 array('root' => $root, 'name' => $name, 'filter' => $filter, 'mode' => 'LIST')); 3110 3124 3111 3125 if (isset($data['folders'])) { … … 3114 3128 else { 3115 3129 // retrieve list of folders from IMAP server 3116 $a_mboxes = $this->conn->listMailboxes($root, $ filter);3130 $a_mboxes = $this->conn->listMailboxes($root, $name); 3117 3131 } 3118 3132 … … 3122 3136 3123 3137 // INBOX should always be available 3124 if ( !in_array('INBOX', $a_mboxes))3138 if ((!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) { 3125 3139 array_unshift($a_mboxes, 'INBOX'); 3140 } 3126 3141 3127 3142 // filter folders and sort them … … 3264 3279 // clear cache 3265 3280 $this->clear_message_cache($mailbox.'.msg'); 3266 $this->clear_cache(' mailboxes');3281 $this->clear_cache('/^mailboxes.*/', true); 3267 3282 } 3268 3283 … … 3306 3321 // clear mailbox-related cache 3307 3322 $this->clear_message_cache($mailbox.'.msg'); 3308 $this->clear_cache(' mailboxes');3323 $this->clear_cache('/^mailboxes.*/', true); 3309 3324 } 3310 3325 … … 3778 3793 * Clears the cache. 3779 3794 * 3780 * @param string $key Cache key 3795 * @param string $key Cache key name or pattern 3796 * @param boolean $pattern_mode Enable it to clear all keys with name 3797 * matching PREG pattern in $key 3781 3798 * @access public 3782 3799 */ 3783 function clear_cache($key= NULL)3800 function clear_cache($key=null, $pattern_mode=false) 3784 3801 { 3785 3802 if (!$this->caching_enabled) 3786 3803 return; 3787 3804 3788 if ($key ===NULL) {3789 foreach ( $this->cache as $key => $data)3805 if ($key === null) { 3806 foreach (array_keys($this->cache) as $key) 3790 3807 $this->_clear_cache_record($key); 3791 3808 … … 3793 3810 $this->cache_changed = false; 3794 3811 $this->cache_changes = array(); 3812 } 3813 else if ($pattern_mode) { 3814 foreach (array_keys($this->cache) as $k) { 3815 if (preg_match($key, $k)) { 3816 $this->_clear_cache_record($k); 3817 $this->cache_changes[$k] = false; 3818 unset($this->cache[$key]); 3819 } 3820 } 3821 if (!count($this->cache)) { 3822 $this->cache_changed = false; 3823 } 3795 3824 } 3796 3825 else { -
program/steps/mail/check_recent.inc
rf5e7b353 r94bdcce 25 25 // list of folders to check 26 26 if ($check_all) { 27 $a_mailboxes = $IMAP->list_mailboxes( );27 $a_mailboxes = $IMAP->list_mailboxes('', '*', 'mail'); 28 28 } 29 29 else { -
program/steps/mail/compose.inc
r1abb97f r94bdcce 1298 1298 { 1299 1299 $attrib['name'] = '_store_target'; 1300 $select = rcmail_mailbox_select(array_merge($attrib, array('noselection' => '- '.rcube_label('dontsave').' -'))); 1300 $select = rcmail_mailbox_select(array_merge($attrib, array( 1301 'noselection' => '- '.rcube_label('dontsave').' -', 1302 'folder_filter' => 'mail' 1303 ))); 1301 1304 return $select->show($_SESSION['compose']['param']['sent_mbox'], $attrib); 1302 1305 } -
program/steps/mail/getunread.inc
rf5e7b353 r94bdcce 20 20 */ 21 21 22 $a_folders = $IMAP->list_mailboxes( );22 $a_folders = $IMAP->list_mailboxes('', '*', 'mail'); 23 23 24 24 if (!empty($a_folders)) -
skins/default/templates/mail.html
r9e1daa4 r94bdcce 29 29 <div id="mailboxlist-title" class="boxtitle"><roundcube:label name="mailboxlist" /></div> 30 30 <div class="boxlistcontent"> 31 <roundcube:object name="mailboxlist" id="mailboxlist" />31 <roundcube:object name="mailboxlist" id="mailboxlist" folder_filter="mail" /> 32 32 </div> 33 33 <div class="boxfooter"> -
skins/default/templates/message.html
rc6be456 r94bdcce 29 29 <roundcube:container name="toolbar" id="messagetoolbar" /> 30 30 <roundcube:button name="messagemenulink" id="messagemenulink" type="link" class="button messagemenu" title="messageactions" onclick="rcmail_ui.show_popup('messagemenu');return false" content=" " /> 31 <roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" />31 <roundcube:object name="mailboxlist" type="select" noSelection="moveto" maxlength="25" onchange="rcmail.command('moveto', this.options[this.selectedIndex].value)" class="mboxlist" folder_filter="mail" /> 32 32 </div> 33 33 -
skins/default/templates/messageerror.html
r9e55503 r94bdcce 43 43 <div class="boxtitle"><roundcube:label name="mailboxlist" /></div> 44 44 <div class="boxlistcontent"> 45 <roundcube:object name="mailboxlist" id="mailboxlist" maxlength="25" />45 <roundcube:object name="mailboxlist" id="mailboxlist" folder_filter="mail" /> 46 46 </div> 47 47 <div class="boxfooter">
Note: See TracChangeset
for help on using the changeset viewer.
