From d49db26f26bef059e59ec352dec995fb67a98032 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Fri, 4 Oct 2024 12:14:56 +0100 Subject: [PATCH] Add in email link to roundcube from user accounts --- .../lib/SrvMngr/Controller/Roundcubepanel.pm | 46 +++++++++++++++++++ .../default/templates/roundcube.html.ep | 39 ++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm create mode 100644 root/usr/share/smanager/themes/default/templates/roundcube.html.ep diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm new file mode 100644 index 0000000..b6d5550 --- /dev/null +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm @@ -0,0 +1,46 @@ +package SrvMngr::Controller::Roundcubepanel; + +#---------------------------------------------------------------------- +# heading : System +# description : Roundcube webmail +# navigation : 99999 9999 +#---------------------------------------------------------------------- +#---------------------------------------------------------------------- +# name : roundcubepanel, method : get, url : /roundcubepanel, ctlact : Roundcubepanel#main +# +# routes : end +#---------------------------------------------------------------------- + +use strict; +use warnings; + +use Mojo::Base 'Mojolicious::Controller'; + +use Locale::gettext; +use SrvMngr::I18N; +use SrvMngr qw(theme_list init_session); + +#use SrvMngr::Model::Main; + + +sub main { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $title = $c->l('Roundcube Webmail'); + my $roundcube_url = $c->param('url'); + my $roundcube_height = $c->param('height') | 600; + $c->stash( title => $title, modul => $roundcube_url, height => $roundcube_height ); + $c->render(template => 'roundcube'); + +} + +sub getroundcubeurl { + my $c = shift; + my $url = shift; + return "/smanager/roundcube?url=$url"; +} + + +1; diff --git a/root/usr/share/smanager/themes/default/templates/roundcube.html.ep b/root/usr/share/smanager/themes/default/templates/roundcube.html.ep new file mode 100644 index 0000000..92a968d --- /dev/null +++ b/root/usr/share/smanager/themes/default/templates/roundcube.html.ep @@ -0,0 +1,39 @@ +% layout 'default', title => "Sme server 2 - roundcube"; + +% content_for 'module' => begin + + +
+ % if ($config->{debug} == 1) { +

+ %= dumper $c->current_route +

+ % } + % if ( stash 'error' ) { +
+ %= $c->render_to_string(inline => stash 'error') +
+ %} +

roundcube - <%=$title %>


+

If the roundcube panel does not appear after logging in, then please check your password.


+ + % my $thisdomain = session 'SystemName'; + % $thisdomain .= ".".session 'DomainName'; + % my $url = $c->stash('modul'); + % my $username = 'admin'; + % if ($url =~ /[?&]_user=([^&]+)/) { + % $username = $1; + %} + + roundcube?_user=<%= $username %>"> + + % my $height = $c->stash('height') | '600px'; + % if ($height !~ /px$/) { $height = $height.'px';} + % if ($url eq "") { + % $url = "https://".$thisdomain."/roundcube"; + %} + <%= $c->stash('title') %> not found +
+ + +%end