From c38e6aae4e7b5723f1616b7f6fe96ff31ab20cba Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 20 Dec 2022 12:30:03 +0100 Subject: [PATCH] Add button to mailu-admin in roundcube task menu --- core/admin/mailu/ui/templates/sidebar.html | 4 ++-- webmails/roundcube/config/config.inc.php | 3 +++ .../roundcube/login/localization/en_US.inc | 4 ++++ webmails/roundcube/login/mailu.php | 21 ++++++++++++++++++- .../roundcube/login/skins/classic/mailu.css | 7 +++++++ .../roundcube/login/skins/elastic/mailu.css | 11 ++++++++++ .../roundcube/login/skins/larry/mailu.css | 10 +++++++++ 7 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 webmails/roundcube/login/localization/en_US.inc create mode 100644 webmails/roundcube/login/skins/classic/mailu.css create mode 100644 webmails/roundcube/login/skins/elastic/mailu.css create mode 100644 webmails/roundcube/login/skins/larry/mailu.css diff --git a/core/admin/mailu/ui/templates/sidebar.html b/core/admin/mailu/ui/templates/sidebar.html index 54448c8b..526b5908 100644 --- a/core/admin/mailu/ui/templates/sidebar.html +++ b/core/admin/mailu/ui/templates/sidebar.html @@ -96,9 +96,9 @@ {%- if config["WEBMAIL"] != "none" and current_user.is_authenticated %} {%- endif %} diff --git a/webmails/roundcube/config/config.inc.php b/webmails/roundcube/config/config.inc.php index e8aedeff..160c7d26 100644 --- a/webmails/roundcube/config/config.inc.php +++ b/webmails/roundcube/config/config.inc.php @@ -59,6 +59,9 @@ $config['sso_logout_url'] = '/sso/logout'; // configure enigma gpg plugin $config['enigma_pgp_homedir'] = '/data/gpg'; +// configure mailu button +$config['show_mailu_button'] = {{ 'true' if ADMIN AND WEB_ADMIN else 'false' }}; + // set From header for DKIM signed message delivery reports $config['mdn_use_from'] = true; diff --git a/webmails/roundcube/login/localization/en_US.inc b/webmails/roundcube/login/localization/en_US.inc new file mode 100644 index 00000000..95e59383 --- /dev/null +++ b/webmails/roundcube/login/localization/en_US.inc @@ -0,0 +1,4 @@ + diff --git a/webmails/roundcube/login/mailu.php b/webmails/roundcube/login/mailu.php index 86de6562..4177c2ec 100644 --- a/webmails/roundcube/login/mailu.php +++ b/webmails/roundcube/login/mailu.php @@ -2,22 +2,41 @@ class mailu extends rcube_plugin { + public $noajax = true; function init() { + // sso & mailu admin button $this->add_hook('startup', array($this, 'startup')); + // sso $this->add_hook('authenticate', array($this, 'authenticate')); $this->add_hook('login_after', array($this, 'login')); $this->add_hook('login_failed', array($this, 'login_failed')); $this->add_hook('logout_after', array($this, 'logout')); + // mailu admin button + $this->add_texts('localization/', false); } function startup($args) { + // mailu admin button + $rcmail = rcmail::get_instance(); + if (!$rcmail->output->framed and $rcmail->config->get('show_mailu_button', false)) { + $this->include_stylesheet($this->local_skin_path() . '/mailu.css'); + $this->add_button([ + 'type' => 'link', + 'href' => $rcmail->config->get('support_url'), + 'class' => 'button-mailu', + 'label' => 'mailu.mailu', + 'tabindex' => '0', + 'innerclass' => 'button-inner', + ], 'taskbar' + ); + } + // sso if (empty($_SESSION['user_id'])) { $args['action'] = 'login'; } - return $args; } diff --git a/webmails/roundcube/login/skins/classic/mailu.css b/webmails/roundcube/login/skins/classic/mailu.css new file mode 100644 index 00000000..dd4068d0 --- /dev/null +++ b/webmails/roundcube/login/skins/classic/mailu.css @@ -0,0 +1,7 @@ +#taskbar a.button-mailu +{ + background-image: url('/static/mailu.png'); + background-repeat: no-repeat; + background-size: 30px 30px; + background-position: -6px -4px; +} diff --git a/webmails/roundcube/login/skins/elastic/mailu.css b/webmails/roundcube/login/skins/elastic/mailu.css new file mode 100644 index 00000000..a14d25b1 --- /dev/null +++ b/webmails/roundcube/login/skins/elastic/mailu.css @@ -0,0 +1,11 @@ +#taskmenu a.button-mailu { + background: url('/static/mailu.png'); + background-repeat: no-repeat; + background-position: center; + background-position-y: 6px; + background-size: 22px 22px; +} +#taskmenu a.button-mailu.selected, #taskmenu a.button-mailu.selected:hover, #taskmenu a.button-mailu:hover { + color: #fff; + background-color: #45555c; +} diff --git a/webmails/roundcube/login/skins/larry/mailu.css b/webmails/roundcube/login/skins/larry/mailu.css new file mode 100644 index 00000000..cc408d68 --- /dev/null +++ b/webmails/roundcube/login/skins/larry/mailu.css @@ -0,0 +1,10 @@ +#taskbar a.button-mailu span.button-inner { + background: url('/static/mailu.png'); + background-repeat: no-repeat; + background-size: 22px 22px; + height: 19px; +} +#taskbar a.button-mailu.selected, #taskmenu a.button-mailu.selected:hover, #taskmenu a.button-mailu:hover { + color: #fff; + background-color: #45555c; +}