Changeset 3302 in subversion
- Timestamp:
- Mar 2, 2010 9:35:53 AM (3 years ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 2 edited
-
include/rcmail.php (modified) (2 diffs)
-
steps/addressbook/func.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcmail.php
r3296 r3302 245 245 * Return instance of the internal address book class 246 246 * 247 * @param string Address book identifier 247 248 * @param boolean True if the address book needs to be writeable 248 249 * @return object rcube_contacts Address book object … … 275 276 } 276 277 } 277 else { 278 else { // $id == 'sql' 278 279 $contacts = new rcube_contacts($this->db, $this->user->ID); 279 280 } 280 281 281 282 return $contacts; 283 } 284 285 286 /** 287 * Return address books list 288 * 289 * @param boolean True if the address book needs to be writeable 290 * @return array Address books array 291 */ 292 public function get_address_sources($writeable = false) 293 { 294 $abook_type = strtolower($this->config->get('address_book_type')); 295 $ldap_config = (array)$this->config->get('ldap_public'); 296 $autocomplete = (array)$this->config->get('autocomplete_addressbooks'); 297 $list = array(); 298 299 // We are using the DB address book 300 if ($abook_type != 'ldap') { 301 $list['0'] = array( 302 'id' => 0, 303 'name' => rcube_label('personaladrbook'), 304 'readonly' => false, 305 'autocomplete' => in_array('sql', $autocomplete) 306 ); 307 } 308 309 if (is_array($ldap_config)) { 310 foreach ($ldap_config as $id => $prop) 311 $list[$id] = array( 312 'id' => $id, 313 'name' => $prop['name'], 314 'readonly' => !$prop['writable'], 315 'autocomplete' => in_array('sql', $autocomplete) 316 ); 317 } 318 319 $plugin = $this->plugins->exec_hook('address_sources', array('sources' => $list)); 320 $list = $plugin['sources']; 321 322 if ($writeable && !empty($list)) { 323 foreach ($list as $idx => $item) { 324 if ($item['readonly']) { 325 unset($list[$idx]); 326 } 327 } 328 } 329 330 return $list; 282 331 } 283 332 -
trunk/roundcubemail/program/steps/addressbook/func.inc
r2894 r3302 21 21 22 22 // add list of address sources to client env 23 $js_list = array(); 24 if (strtolower($CONFIG['address_book_type']) != 'ldap') { 25 // We are using the DB address book, add it. 26 $js_list['0'] = array('id' => 0, 'name' => rcube_label('personaladrbook'), 'readonly' => false); 27 } 28 if (is_array($CONFIG['ldap_public'])) { 29 foreach ($CONFIG['ldap_public'] as $id => $prop) 30 $js_list[$id] = array('id' => $id, 'name' => $prop['name'], 'readonly' => !$prop['writable']); 31 } 32 33 $plugin = $RCMAIL->plugins->exec_hook('address_sources', array('sources' => $js_list)); 34 $js_list = $plugin['sources']; 23 $js_list = $RCMAIL->get_address_sources(); 35 24 36 25 // select source … … 40 29 if (empty($source)) 41 30 $source = $js_list[key($js_list)]['id']; 42 43 31 44 32 // instantiate a contacts object according to the given source
Note: See TracChangeset
for help on using the changeset viewer.
