Add in email link to roundcube from user accounts

This commit is contained in:
Brian Read 2024-10-04 12:14:56 +01:00
parent c4f9d67abc
commit d49db26f26
2 changed files with 85 additions and 0 deletions

View File

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

View File

@ -0,0 +1,39 @@
% layout 'default', title => "Sme server 2 - roundcube";
% content_for 'module' => begin
<div id='roundcube' class='roundcube roundcube-panel'>
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
</p>
% }
% if ( stash 'error' ) {
<br><div class=sme-error>
%= $c->render_to_string(inline => stash 'error')
</div>
%}
<h1> roundcube - <%=$title %></h1><br>
<p>If the roundcube panel does not appear after logging in, then please check your password.</p><br />
% my $thisdomain = session 'SystemName';
% $thisdomain .= ".".session 'DomainName';
% my $url = $c->stash('modul');
% my $username = 'admin';
% if ($url =~ /[?&]_user=([^&]+)/) {
% $username = $1;
%}
<a href="<%= "https://".$thisdomain."/" %>roundcube?_user=<%= $username %>"><button class="sme-fullwindow1-button" width=20em title="<%= l('Full Window') %>"><%= l('Full Window') %></button></a>
% my $height = $c->stash('height') | '600px';
% if ($height !~ /px$/) { $height = $height.'px';}
% if ($url eq "") {
% $url = "https://".$thisdomain."/roundcube";
%}
<object id="roundcube" class="roundcube" data="<%=$url %>" style="width:99%;height:<%= $height %>;" title="<%= $c->stash('title') %>" type="text/html" ><%= $c->stash('title') %> not found</object>
</div>
%end