2591: Add button to mailu-admin in roundcube task menu r=mergify[bot] a=ghostwheel42

## What type of PR?

feature

## What does this PR do?

Adds a button to the roundcube interface. This button gets you back to the admin interface.

### Related issue(s)
- Replaces  #2367


Co-authored-by: Alexander Graf <ghostwheel42@users.noreply.github.com>
main
bors[bot] 2 years ago committed by GitHub
commit 23b09518db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -0,0 +1 @@
Adds a button to the roundcube interface that gets you back to the admin interface

@ -47,7 +47,7 @@ RUN set -euxo pipefail \
; rm /tmp/roundcube.diff ; rm /tmp/roundcube.diff
COPY roundcube/config/config.inc.php /conf/ COPY roundcube/config/config.inc.php /conf/
COPY roundcube/login/mailu.php /var/www/roundcube/plugins/mailu/ COPY roundcube/login/ /var/www/roundcube/plugins/mailu/
COPY roundcube/config/config.inc.carddav.php /var/www/roundcube/plugins/carddav/config.inc.php COPY roundcube/config/config.inc.carddav.php /var/www/roundcube/plugins/carddav/config.inc.php
# snappymail # snappymail

@ -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,6 @@
#taskbar a.button-mailu span.button-inner {
background: url('/static/mailu.png');
background-repeat: no-repeat;
background-size: 22px 22px;
height: 19px;
}
Loading…
Cancel
Save