Changeset 2386 in subversion
- Timestamp:
- Apr 13, 2009 12:11:06 PM (4 years ago)
- Location:
- branches/devel-api
- Files:
-
- 3 added
- 4 edited
-
plugins/example_addressbook (added)
-
plugins/example_addressbook/example_addressbook.php (added)
-
plugins/example_addressbook/example_addressbook_backend.php (added)
-
program/include/main.inc (modified) (1 diff)
-
program/include/rcmail.php (modified) (1 diff)
-
program/steps/addressbook/func.inc (modified) (2 diffs)
-
skins/default/templates/addressbook.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/program/include/main.inc
r2297 r2386 684 684 685 685 // convert attributes to an associative array (name => value) 686 if ($regs) 687 foreach ($regs as $attr) 688 {689 $attrib[strtolower($attr[1])] = $attr[3] . $attr[4];690 }686 if ($regs) { 687 foreach ($regs as $attr) { 688 $attrib[strtolower($attr[1])] = html_entity_decode($attr[3] . $attr[4]); 689 } 690 } 691 691 692 692 return $attrib; -
branches/devel-api/program/include/rcmail.php
r2372 r2386 260 260 $ldap_config = (array)$this->config->get('ldap_public'); 261 261 $abook_type = strtolower($this->config->get('address_book_type')); 262 263 if ($id && $ldap_config[$id]) { 262 263 $plugin = $this->plugins->exec_hook('get_address_book', array('id' => $id, 'writeable' => $writeable)); 264 265 // plugin returned instance of a rcube_addressbook 266 if ($plugin['instance'] instanceof rcube_addressbook) { 267 $contacts = $plugin['instance']; 268 } 269 else if ($id && $ldap_config[$id]) { 264 270 $contacts = new rcube_ldap($ldap_config[$id]); 271 } 272 else if ($id === '0') { 273 $contacts = new rcube_contacts($this->db, $this->user->ID); 265 274 } 266 275 else if ($abook_type == 'ldap') { -
branches/devel-api/program/steps/addressbook/func.inc
r1939 r2386 43 43 if (strtolower($CONFIG['address_book_type']) != 'ldap') { 44 44 // We are using the DB address book, add it. 45 $js_list = array("0" => array('id' => 0, 'readonly' => false));45 $js_list['0'] = array('id' => 0, 'name' => rcube_label('personaladrbook'), 'readonly' => false); 46 46 } 47 47 if (is_array($CONFIG['ldap_public'])) { 48 48 foreach ($CONFIG['ldap_public'] as $id => $prop) 49 $js_list[$id] = array('id' => $id, ' readonly' => !$prop['writable']);49 $js_list[$id] = array('id' => $id, 'name' => $prop['name'], 'readonly' => !$prop['writable']); 50 50 } 51 $OUTPUT->set_env('address_sources', $js_list); 51 52 $plugin = $RCMAIL->plugins->exec_hook('address_sources', array('sources' => $js_list)); 53 $OUTPUT->set_env('address_sources', $plugin['sources']); 52 54 53 55 54 56 function rcmail_directory_list($attrib) 55 57 { 56 global $ CONFIG, $OUTPUT;58 global $RCMAIL, $OUTPUT; 57 59 58 60 if (!$attrib['id']) … … 64 66 $line_templ = html::tag('li', array('id' => 'rcmli%s', 'class' => '%s'), 65 67 html::a(array('href' => '%s', 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); 66 67 if (strtolower($CONFIG['address_book_type']) != 'ldap') { 68 $out .= sprintf($line_templ, $local_id, (!$current ? 'selected' : ''), 69 Q(rcmail_url(null, array('_source' => $local_id))), $local_id, rcube_label('personaladrbook')); 70 } // end if 71 else { 68 69 if (!$current && strtolower($RCMAIL->config->get('address_book_type', 'sql')) != 'ldap') { 70 $current = '0'; 71 } 72 else if (!$current) { 72 73 // DB address book not used, see if a source is set, if not use the 73 74 // first LDAP directory. 74 if (!$current) { 75 $current = key((array)$CONFIG['ldap_public']); 76 } // end if 77 } // end else 78 79 foreach ((array)$CONFIG['ldap_public'] as $id => $prop) { 75 $current = key((array)$RCMAIL->config->get('ldap_public', array())); 76 } 77 78 foreach ((array)$OUTPUT->env['address_sources'] as $j => $source) { 79 $id = $source['id'] ? $source['id'] : $j; 80 80 $js_id = JQ($id); 81 81 $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); 82 82 $out .= sprintf($line_templ, $dom_id, ($current == $id ? 'selected' : ''), 83 Q(rcmail_url(null, array('_source' => $id))), $js_id, (!empty($ prop['name']) ? Q($prop['name']) : Q($id)));84 } 85 83 Q(rcmail_url(null, array('_source' => $id))), $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); 84 } 85 86 86 $OUTPUT->add_gui_object('folderlist', $attrib['id']); 87 87 -
branches/devel-api/skins/default/templates/addressbook.html
r1861 r2386 8 8 9 9 <style type="text/css"> 10 <roundcube:if condition="co nfig:ldap_public == false" />10 <roundcube:if condition="count(env:address_sources) <= 1" /> 11 11 #abookcountbar { left: 20px;} 12 12 #mainscreen { left:20px; /* IE hack */ width:expression((parseInt(document.documentElement.clientWidth)-40)+'px') } … … 45 45 </div> 46 46 47 <roundcube:if condition="co nfig:ldap_public" />47 <roundcube:if condition="count(env:address_sources) > 1" /> 48 48 <div id="directorylist"> 49 49 <div id="groups-title"><roundcube:label name="groups" /></div>
Note: See TracChangeset
for help on using the changeset viewer.
