Page MenuHomePhorge

D5724.1775251314.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D5724.1775251314.diff

diff --git a/plugins/kolab/Kolab/CockpitLink.php b/plugins/kolab/Kolab/CockpitLink.php
new file mode 100644
--- /dev/null
+++ b/plugins/kolab/Kolab/CockpitLink.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Kolab;
+
+/**
+ * Adds a link to the Kolab Cockpit in the task menu
+ */
+class CockpitLink extends Feature
+{
+ /**
+ * Feature initialization.
+ */
+ public function init()
+ {
+ $this->plugin->add_hook('ready', [$this, 'readyHook']);
+ }
+
+ /**
+ * Ready hook handler
+ */
+ public function readyHook($args): array
+ {
+ if ($this->rc->output->type !== 'html' || !empty($this->rc->output->env['framed'])) {
+ return $args;
+ }
+
+ $url = $this->rc->config->get('kolab_cockpit_url');
+
+ if (empty($url)) {
+ return $args;
+ }
+
+ // Add the button
+ $this->plugin->add_button([
+ 'command' => 'cockpit',
+ 'class' => 'button-cockpit',
+ 'classsel' => 'button-cockpit button-selected',
+ 'innerclass' => 'button-inner',
+ 'label' => 'kolab.account',
+ 'type' => 'link',
+ ], 'taskbar');
+
+ // Register button image and action
+ $this->rc->output->add_footer(
+ "<style>#taskmenu a.button-cockpit:before { content: \"\\f007\"; }</style>"
+ . "<script>rcmail.register_command('cockpit', () => location.href = '$url', true)</script>"
+ );
+
+ return $args;
+ }
+}
diff --git a/plugins/kolab/config.inc.php.dist b/plugins/kolab/config.inc.php.dist
--- a/plugins/kolab/config.inc.php.dist
+++ b/plugins/kolab/config.inc.php.dist
@@ -15,3 +15,6 @@
// Lifetime of cache entries. Possible units: s, m, h, d, w
$config['kolab_client_cache_ttl'] = '10m';
+
+// Kolab Cockpit URL - for a button in the task menu
+$config['kolab_cockpit_url'] = null;
diff --git a/plugins/kolab/kolab.php b/plugins/kolab/kolab.php
--- a/plugins/kolab/kolab.php
+++ b/plugins/kolab/kolab.php
@@ -25,6 +25,7 @@
{
private $features = [
'Kolab\Addresses',
+ 'Kolab\CockpitLink',
'Kolab\Configuration',
'Kolab\Contacts',
'Kolab\Delegation',
@@ -76,6 +77,9 @@
// Read the plugin config, we try to not do this in init()
$this->load_config();
+ // Load localization
+ $this->add_texts('localization/', false);
+
return $args;
}
diff --git a/plugins/kolab/localization/en_US.inc b/plugins/kolab/localization/en_US.inc
new file mode 100644
--- /dev/null
+++ b/plugins/kolab/localization/en_US.inc
@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * Localization for the Kolab plugin
+ */
+
+$labels = [];
+$labels['account'] = 'Account';

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 9:21 PM (17 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826677
Default Alt Text
D5724.1775251314.diff (2 KB)

Event Timeline