From fe64e470c8d47497d46ef4846a79945478637a3e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 3 Nov 2017 11:43:31 +0100 Subject: [PATCH] Initial Elastic skin support for kolab_delegation and kolab_activesync plugins --- plugins/kolab_2fa/kolab_2fa.php | 4 +- plugins/kolab_activesync/kolab_activesync.php | 2 +- .../kolab_activesync/kolab_activesync_ui.php | 52 +++++++++++++------ .../kolab_activesync/localization/en_US.inc | 2 +- .../skins/elastic/templates/config.html | 39 ++++++++++++++ .../skins/elastic/templates/configedit.html | 23 ++++++++ .../skins/elastic/templates/configempty.html | 11 ++++ plugins/kolab_delegation/kolab_delegation.js | 37 ++++++------- plugins/kolab_delegation/kolab_delegation.php | 24 ++++++--- .../kolab_delegation/localization/en_US.inc | 4 +- .../skins/elastic/templates/editform.html | 23 ++++++++ .../skins/elastic/templates/settings.html | 48 +++++++++++++++++ 12 files changed, 220 insertions(+), 49 deletions(-) create mode 100644 plugins/kolab_activesync/skins/elastic/templates/config.html create mode 100644 plugins/kolab_activesync/skins/elastic/templates/configedit.html create mode 100644 plugins/kolab_activesync/skins/elastic/templates/configempty.html create mode 100644 plugins/kolab_delegation/skins/elastic/templates/editform.html create mode 100644 plugins/kolab_delegation/skins/elastic/templates/settings.html diff --git a/plugins/kolab_2fa/kolab_2fa.php b/plugins/kolab_2fa/kolab_2fa.php index ec3f847c..f1f78788 100644 --- a/plugins/kolab_2fa/kolab_2fa.php +++ b/plugins/kolab_2fa/kolab_2fa.php @@ -377,7 +377,7 @@ class kolab_2fa extends rcube_plugin // register as settings action $args['actions'][] = array( 'action' => 'plugin.kolab-2fa', - 'class' => '2factorauth', + 'class' => 'twofactorauth', 'label' => 'settingslist', 'title' => 'settingstitle', 'domain' => 'kolab_2fa', @@ -397,7 +397,7 @@ class kolab_2fa extends rcube_plugin $this->register_handler('plugin.highsecuritydialog', array($this, 'settings_highsecuritydialog')); $this->include_script('kolab2fa.js'); - $this->include_stylesheet($this->local_skin_path() . '/kolab2fa.css'); + $this->include_stylesheet($this->local_skin_path() . '/kolab2fa.css', true); if ($this->check_secure_mode()) { $this->api->output->set_env('session_secured', $_SESSION['kolab_2fa_secure_mode']); diff --git a/plugins/kolab_activesync/kolab_activesync.php b/plugins/kolab_activesync/kolab_activesync.php index 80c1052e..38791182 100644 --- a/plugins/kolab_activesync/kolab_activesync.php +++ b/plugins/kolab_activesync/kolab_activesync.php @@ -109,7 +109,7 @@ class kolab_activesync extends rcube_plugin if ($content = $this->ui->folder_options_table($mbox_imap, $devices, $type)) { $args['form']['activesync'] = array( - 'name' => rcube::Q($this->gettext('tabtitle')), + 'name' => $this->gettext('tabtitle'), 'content' => $content, ); } diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php index 4b491ada..4959e4a9 100644 --- a/plugins/kolab_activesync/kolab_activesync_ui.php +++ b/plugins/kolab_activesync/kolab_activesync_ui.php @@ -39,7 +39,7 @@ class kolab_activesync_ui $skin_path = $this->plugin->local_skin_path() . '/'; $this->skin_path = 'plugins/kolab_activesync/' . $skin_path; - $this->plugin->include_stylesheet($skin_path . 'config.css'); + $this->plugin->include_stylesheet($skin_path . 'config.css', true); } public function device_list($attrib = array()) @@ -52,7 +52,8 @@ class kolab_activesync_ui foreach ($devices as $id => $device) { $name = $device['ALIAS'] ? $device['ALIAS'] : $id; $table->add_row(array('id' => 'rcmrow' . $id)); - $table->add(null, html::span('devicealias', rcube::Q($name)) . html::span('devicetype', rcube::Q($device['TYPE']))); + $table->add(null, html::span('devicealias', rcube::Q($name)) + . ' ' . html::span('devicetype secondary', rcube::Q($device['TYPE']))); } $this->rc->output->add_gui_object('devicelist', $attrib['id']); @@ -79,7 +80,7 @@ class kolab_activesync_ui if (!empty($info)) { foreach ($info as $key => $value) { if ($value) { - $table->add('title', rcube::Q($this->plugin->gettext($key))); + $table->add('title', html::label(null, rcube::Q($this->plugin->gettext($key)))); $table->add(null, rcube::Q($value)); } } @@ -95,12 +96,14 @@ class kolab_activesync_ui public function folder_subscriptions($attrib = array()) { - if (!$attrib['id']) + if (!$attrib['id']) { $attrib['id'] = 'foldersubscriptions'; + } // group folders by type (show only known types) $folder_groups = array('mail' => array(), 'contact' => array(), 'event' => array(), 'task' => array(), 'note' => array()); $folder_types = kolab_storage::folders_typedata(); + $use_fieldsets = rcube_utils::get_boolean($attrib['use-fieldsets']); $imei = $this->device['_id']; $subscribed = array(); @@ -132,10 +135,17 @@ class kolab_activesync_ui if (empty($group)) { continue; } + $attrib['type'] = $type; - $html .= html::div('subscriptionblock', - html::tag('h3', $type, $this->plugin->gettext($type)) . - $this->folder_subscriptions_block($group, $attrib, $subscribed)); + $table = $this->folder_subscriptions_block($group, $attrib, $subscribed); + $label = $this->plugin->gettext($type); + + if ($use_fieldsets) { + $html .= html::tag('fieldset', 'subscriptionblock', html::tag('legend', $type, $label) . $table); + } + else { + $html .= html::div('subscriptionblock', html::tag('h3', $type, $label) . $table); + } } $this->rc->output->add_gui_object('subscriptionslist', $attrib['id']); @@ -148,14 +158,26 @@ class kolab_activesync_ui $alarms = ($attrib['type'] == 'event' || $attrib['type'] == 'task'); $table = new html_table(array('cellspacing' => 0)); - $table->add_header(array('class' => 'subscription', 'title' => $this->plugin->gettext('synchronize'), 'tabindex' => 0), + $table->add_header(array( + 'class' => 'subscription checkbox-cell', + 'title' => $this->plugin->gettext('synchronize'), + 'tabindex' => 0 + ), $attrib['syncicon'] ? html::img(array('src' => $this->skin_path . $attrib['syncicon'])) : - $this->plugin->gettext('synchronize')); + $this->plugin->gettext('synchronize') + ); + if ($alarms) { - $table->add_header(array('class' => 'alarm', 'title' => $this->plugin->gettext('withalarms'), 'tabindex' => 0), + $table->add_header(array( + 'class' => 'alarm checkbox-cell', + 'title' => $this->plugin->gettext('withalarms'), + 'tabindex' => 0 + ), $attrib['alarmicon'] ? html::img(array('src' => $this->skin_path . $attrib['alarmicon'])) : - $this->plugin->gettext('withalarms')); + $this->plugin->gettext('withalarms') + ); } + $table->add_header('foldername', $this->plugin->gettext('folder')); $checkbox_sync = new html_checkbox(array('name' => 'subscribed[]', 'class' => 'subscription')); @@ -186,12 +208,12 @@ class kolab_activesync_ui } $table->add_row(); - $table->add('subscription', $checkbox_sync->show( + $table->add('subscription checkbox-cell', $checkbox_sync->show( !empty($subscribed[$folder]) ? $folder : null, array('value' => $folder, 'id' => $folder_id))); if ($alarms) { - $table->add('alarm', $checkbox_alarm->show( + $table->add('alarm checkbox-cell', $checkbox_alarm->show( intval($subscribed[$folder]) > 1 ? $folder : null, array('value' => $folder, 'id' => $folder_id.'_alarm'))); } @@ -236,13 +258,13 @@ class kolab_activesync_ui $table->add_row(); $table->add(array('class' => 'device', 'title' => $title), $name); - $table->add('subscription', $checkbox->show(!empty($folder_data[$id]['S']) ? 1 : 0)); + $table->add('subscription checkbox-cell', $checkbox->show(!empty($folder_data[$id]['S']) ? 1 : 0)); if ($alarms) { $checkbox_alarm = new html_checkbox(array('name' => "_alarms[$id]", 'value' => 1, 'onchange' => 'return activesync_object.update_sync_data(this)')); - $table->add('alarm', $checkbox_alarm->show($folder_data[$id]['S'] > 1 ? 1 : 0)); + $table->add('alarm checkbox-cell', $checkbox_alarm->show($folder_data[$id]['S'] > 1 ? 1 : 0)); } } diff --git a/plugins/kolab_activesync/localization/en_US.inc b/plugins/kolab_activesync/localization/en_US.inc index 683488f4..01d6f47f 100644 --- a/plugins/kolab_activesync/localization/en_US.inc +++ b/plugins/kolab_activesync/localization/en_US.inc @@ -10,7 +10,7 @@ $labels['syncsettings'] = 'Synchronization settings'; $labels['deviceconfig'] = 'Device configuration'; $labels['folderstosync'] = 'Folders to synchronize'; $labels['mail'] = 'Email'; -$labels['contact'] = 'Address Books'; +$labels['contact'] = 'Contacts'; $labels['event'] = 'Calendars'; $labels['task'] = 'Tasks'; $labels['note'] = 'Notes'; diff --git a/plugins/kolab_activesync/skins/elastic/templates/config.html b/plugins/kolab_activesync/skins/elastic/templates/config.html new file mode 100644 index 00000000..af9d54d9 --- /dev/null +++ b/plugins/kolab_activesync/skins/elastic/templates/config.html @@ -0,0 +1,39 @@ + + + + +

+ + +
+
+ + + + +
+
+ +
+ +
+ + +
+

+ + +
+ + diff --git a/plugins/kolab_activesync/skins/elastic/templates/configedit.html b/plugins/kolab_activesync/skins/elastic/templates/configedit.html new file mode 100644 index 00000000..a1f1284e --- /dev/null +++ b/plugins/kolab_activesync/skins/elastic/templates/configedit.html @@ -0,0 +1,23 @@ + + +

+ +
+
+
+ + +
+
+ + +
+
+
+ +
+ +
+ + diff --git a/plugins/kolab_activesync/skins/elastic/templates/configempty.html b/plugins/kolab_activesync/skins/elastic/templates/configempty.html new file mode 100644 index 00000000..047b1074 --- /dev/null +++ b/plugins/kolab_activesync/skins/elastic/templates/configempty.html @@ -0,0 +1,11 @@ + + +

+ +
+
+ +
+
+ + diff --git a/plugins/kolab_delegation/kolab_delegation.js b/plugins/kolab_delegation/kolab_delegation.js index 652427a2..f6e320b6 100644 --- a/plugins/kolab_delegation/kolab_delegation.js +++ b/plugins/kolab_delegation/kolab_delegation.js @@ -164,29 +164,24 @@ rcube_webmail.prototype.delegate_delete = function() if (!this.env.active_delegate) return; - var $dialog = $("#delegate-delete-dialog").addClass('uidialog'), - buttons = {}; - - buttons[this.gettext('no', 'kolab_delegation')] = function() { - $dialog.dialog('close'); - }; - buttons[this.gettext('yes', 'kolab_delegation')] = function() { - $dialog.dialog('close'); - var lock = rcmail.set_busy(true, 'kolab_delegation.savingdata'); - rcmail.http_post('plugin.delegation-delete', {id: rcmail.env.active_delegate, - acl: $("#delegate-delete-dialog input:checked").length}, lock); - } + var content = $("#delegate-delete-dialog").addClass('uidialog').clone(), + title = this.gettext('deleteconfirm', 'kolab_delegation'), + save_func = function() { + var lock = rcmail.set_busy(true, 'kolab_delegation.savingdata'), + props = {id: rcmail.env.active_delegate, acl: $("#delegate-delete-dialog input:checked").length}; + rcmail.http_post('plugin.delegation-delete', props, lock); + return true; + }, + opts = { + resizable: false, + closeOnEscape: true, + width: 400, + button: 'kolab_delegation.yes', + cancel_button: 'kolab_delegation.no' + }; // open jquery UI dialog - $dialog.dialog({ - modal: true, - resizable: false, - closeOnEscape: true, - title: this.gettext('deleteconfirm', 'kolab_delegation'), - close: function() { $dialog.dialog('destroy').hide(); }, - buttons: buttons, - width: 400 - }).show(); + this.simple_dialog(content, title, save_func, opts); }; // submit delegate form to the server diff --git a/plugins/kolab_delegation/kolab_delegation.php b/plugins/kolab_delegation/kolab_delegation.php index 85e670bb..306564aa 100644 --- a/plugins/kolab_delegation/kolab_delegation.php +++ b/plugins/kolab_delegation/kolab_delegation.php @@ -78,7 +78,7 @@ class kolab_delegation extends rcube_plugin } $this->skin_path = $this->local_skin_path(); - $this->include_stylesheet($this->skin_path . '/style.css'); + $this->include_stylesheet($this->skin_path . '/style.css', true); } } // Calendar/Tasklist plugin UI bindings @@ -487,6 +487,7 @@ class kolab_delegation extends rcube_plugin } $folder_data = $engine->list_folders($delegate['uid']); + $use_fieldsets = rcube_utils::get_boolean($attrib['use-fieldsets']); $rights = array(); $folder_groups = array(); @@ -500,10 +501,17 @@ class kolab_delegation extends rcube_plugin if (empty($group)) { continue; } + $attrib['type'] = $type; - $html .= html::div('foldersblock', - html::tag('h3', $type, $this->gettext($type)) . - $this->delegate_folders_block($group, $attrib, $rights)); + $table = $this->delegate_folders_block($group, $attrib, $rights); + $label = $this->gettext($type); + + if ($use_fieldsets) { + $html .= html::tag('fieldset', 'foldersblock', html::tag('legend', $type, $label) . $table); + } + else { + $html .= html::div('foldersblock', html::tag('h3', $type, $label) . $table); + } } $this->rc->output->add_gui_object('folderslist', $attrib['id']); @@ -521,8 +529,8 @@ class kolab_delegation extends rcube_plugin $write_ico = $attrib['writeicon'] ? html::img(array('src' => $path . $attrib['writeicon'], 'title' => $this->gettext('write'))) : ''; $table = new html_table(array('cellspacing' => 0)); - $table->add_header(array('class' => 'read', 'title' => $this->gettext('read'), 'tabindex' => 0), $read_ico); - $table->add_header(array('class' => 'write', 'title' => $this->gettext('write'), 'tabindex' => 0), $write_ico); + $table->add_header(array('class' => 'read checkbox-cell', 'title' => $this->gettext('read'), 'tabindex' => 0), $read_ico); + $table->add_header(array('class' => 'write checkbox-cell', 'title' => $this->gettext('write'), 'tabindex' => 0), $write_ico); $table->add_header('foldername', $this->rc->gettext('folder')); $checkbox_read = new html_checkbox(array('name' => 'read[]', 'class' => 'read')); @@ -553,10 +561,10 @@ class kolab_delegation extends rcube_plugin } $table->add_row(); - $table->add('read', $checkbox_read->show( + $table->add('read checkbox-cell', $checkbox_read->show( $rights[$folder] >= kolab_delegation_engine::ACL_READ ? $folder : null, array('value' => $folder))); - $table->add('write', $checkbox_write->show( + $table->add('write checkbox-cell', $checkbox_write->show( $rights[$folder] >= kolab_delegation_engine::ACL_WRITE ? $folder : null, array('value' => $folder, 'id' => $folder_id))); diff --git a/plugins/kolab_delegation/localization/en_US.inc b/plugins/kolab_delegation/localization/en_US.inc index 94ceb9e7..cf69e6a2 100644 --- a/plugins/kolab_delegation/localization/en_US.inc +++ b/plugins/kolab_delegation/localization/en_US.inc @@ -14,8 +14,10 @@ $labels['tabtitle'] = 'Delegation'; $labels['delegationtitle'] = 'Manage delegates'; $labels['delegates'] = 'Delegates'; $labels['delegate'] = 'Delegate'; +$labels['delegatefolders'] = 'Delegated folders'; +$labels['delegateprops'] = 'Delegate properties'; $labels['mail'] = 'Email'; -$labels['contact'] = 'Address Books'; +$labels['contact'] = 'Contacts'; $labels['event'] = 'Calendars'; $labels['task'] = 'Tasks'; $labels['note'] = 'Notes'; diff --git a/plugins/kolab_delegation/skins/elastic/templates/editform.html b/plugins/kolab_delegation/skins/elastic/templates/editform.html new file mode 100644 index 00000000..d75ee69d --- /dev/null +++ b/plugins/kolab_delegation/skins/elastic/templates/editform.html @@ -0,0 +1,23 @@ + + +

+ +
+
+
+ + +
+
+ + +
+
+
+ +
+ +
+ + diff --git a/plugins/kolab_delegation/skins/elastic/templates/settings.html b/plugins/kolab_delegation/skins/elastic/templates/settings.html new file mode 100644 index 00000000..28c9c798 --- /dev/null +++ b/plugins/kolab_delegation/skins/elastic/templates/settings.html @@ -0,0 +1,48 @@ + + + + +

+ + +
+
+ + + + +
+
+ +
+ +
+ + +
+

+ + +
+ + + +