Add button to mailu-admin in roundcube task menu

main
Alexander Graf 2 years ago
parent 4315227215
commit c38e6aae4e
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

@ -96,9 +96,9 @@
<li class="nav-header text-uppercase text-primary" role="none">{% trans %}Go to{% endtrans %}</li> <li class="nav-header text-uppercase text-primary" role="none">{% trans %}Go to{% endtrans %}</li>
{%- if config["WEBMAIL"] != "none" and current_user.is_authenticated %} {%- if config["WEBMAIL"] != "none" and current_user.is_authenticated %}
<li class="nav-item" role="none"> <li class="nav-item" role="none">
<a href="{{ config["WEB_WEBMAIL"] }}" target="_blank" class="nav-link" role="menuitem"> <a href="{{ config["WEB_WEBMAIL"] }}" class="nav-link" role="menuitem">
<i class="nav-icon far fa-envelope"></i> <i class="nav-icon far fa-envelope"></i>
<p>{% trans %}Webmail{% endtrans %} <i class="fas fa-external-link-alt text-xs"></i></p> <p>{% trans %}Webmail{% endtrans %}</p>
</a> </a>
</li> </li>
{%- endif %} {%- endif %}

@ -59,6 +59,9 @@ $config['sso_logout_url'] = '/sso/logout';
// configure enigma gpg plugin // configure enigma gpg plugin
$config['enigma_pgp_homedir'] = '/data/gpg'; $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 // set From header for DKIM signed message delivery reports
$config['mdn_use_from'] = true; $config['mdn_use_from'] = true;

@ -0,0 +1,4 @@
<?php
$labels = [];
$labels['mailu'] = 'Mailu';
?>

@ -2,22 +2,41 @@
class mailu extends rcube_plugin class mailu extends rcube_plugin
{ {
public $noajax = true;
function init() function init()
{ {
// sso & mailu admin button
$this->add_hook('startup', array($this, 'startup')); $this->add_hook('startup', array($this, 'startup'));
// sso
$this->add_hook('authenticate', array($this, 'authenticate')); $this->add_hook('authenticate', array($this, 'authenticate'));
$this->add_hook('login_after', array($this, 'login')); $this->add_hook('login_after', array($this, 'login'));
$this->add_hook('login_failed', array($this, 'login_failed')); $this->add_hook('login_failed', array($this, 'login_failed'));
$this->add_hook('logout_after', array($this, 'logout')); $this->add_hook('logout_after', array($this, 'logout'));
// mailu admin button
$this->add_texts('localization/', false);
} }
function startup($args) 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'])) { if (empty($_SESSION['user_id'])) {
$args['action'] = 'login'; $args['action'] = 'login';
} }
return $args; return $args;
} }

@ -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;
}

@ -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;
}

@ -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;
}
Loading…
Cancel
Save