Changeset View
Changeset View
Standalone View
Standalone View
plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | private function init_ui() | ||||
// Include script | // Include script | ||||
$this->plugin->include_script('kolab_addressbook.js'); | $this->plugin->include_script('kolab_addressbook.js'); | ||||
if (empty($this->rc->action)) { | if (empty($this->rc->action)) { | ||||
// Include stylesheet (for directorylist) | // Include stylesheet (for directorylist) | ||||
$this->plugin->include_stylesheet($this->plugin->local_skin_path().'/kolab_addressbook.css'); | $this->plugin->include_stylesheet($this->plugin->local_skin_path().'/kolab_addressbook.css'); | ||||
if ($this->plugin->driver != 'kolab') { | |||||
return; | |||||
} | |||||
// include kolab folderlist widget if available | // include kolab folderlist widget if available | ||||
if (in_array('libkolab', $this->plugin->api->loaded_plugins())) { | if (in_array('libkolab', $this->plugin->api->loaded_plugins())) { | ||||
$this->plugin->api->include_script('libkolab/libkolab.js'); | $this->plugin->api->include_script('libkolab/libkolab.js'); | ||||
} | } | ||||
$this->rc->output->add_footer($this->rc->output->parse('kolab_addressbook.search_addon', false, false)); | $this->rc->output->add_footer($this->rc->output->parse('kolab_addressbook.search_addon', false, false)); | ||||
// Add actions on address books | // Add actions on address books | ||||
$options = array('book-create', 'book-edit', 'book-delete', 'book-remove'); | $options = array('book-create', 'book-edit', 'book-delete', 'book-remove'); | ||||
$idx = 0; | $idx = 0; | ||||
if ($dav_url = $this->rc->config->get('kolab_addressbook_carddav_url')) { | if ($dav_url = $this->rc->config->get('kolab_addressbook_carddav_url')) { | ||||
$options[] = 'book-showurl'; | $options[] = 'book-showurl'; | ||||
$this->rc->output->set_env('kolab_addressbook_carddav_url', true); | $this->rc->output->set_env('kolab_addressbook_carddav_url', true); | ||||
// set CardDAV URI for specified ldap addressbook | // set CardDAV URI for specified ldap addressbook | ||||
if ($ldap_abook = $this->rc->config->get('kolab_addressbook_carddav_ldap')) { | if ($ldap_abook = $this->rc->config->get('kolab_addressbook_carddav_ldap')) { | ||||
$dav_ldap_url = strtr($dav_url, array( | $dav_ldap_url = strtr($dav_url, array( | ||||
'%h' => $_SERVER['HTTP_HOST'], | '%h' => $_SERVER['HTTP_HOST'], | ||||
'%u' => urlencode($this->rc->get_user_name()), | '%u' => urlencode($this->rc->get_user_name()), | ||||
'%i' => 'ldap-directory', | '%i' => 'ldap-directory', | ||||
'%n' => '', | '%n' => '', | ||||
)); | )); | ||||
$this->rc->output->set_env('kolab_addressbook_carddav_ldap', $ldap_abook); | $this->rc->output->set_env('kolab_addressbook_carddav_ldap', $ldap_abook); | ||||
$this->rc->output->set_env('kolab_addressbook_carddav_ldap_url', $dav_ldap_url); | $this->rc->output->set_env('kolab_addressbook_carddav_ldap_url', $dav_ldap_url); | ||||
} | } | ||||
} | } | ||||
foreach ($options as $command) { | foreach ($options as $command) { | ||||
$content = html::tag('li', $idx ? null : array('class' => 'separator_above'), | $content = html::tag('li', $idx ? null : array('class' => 'separator_above'), | ||||
$this->plugin->api->output->button(array( | $this->plugin->api->output->button(array( | ||||
'label' => 'kolab_addressbook.'.str_replace('-', '', $command), | 'label' => 'kolab_addressbook.'.str_replace('-', '', $command), | ||||
'domain' => $this->ID, | 'domain' => $this->ID, | ||||
'class' => str_replace('-', ' ', $command) . ' disabled', | 'class' => str_replace('-', ' ', $command) . ' disabled', | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |