* Mon Feb 10 2025 Brian Read <brianr@koozali.org> 11.0.0-51.sme

- Replace url in call to webmail by browser url rather than system host and domain [SME: 12910]
- Fix up CSS so not inline
- Sort out reveiw panel missing routines from FormMagic [SME: 12907].
This commit is contained in:
Brian Read 2025-02-12 16:31:17 +00:00
parent a4668da720
commit d776f20736
7 changed files with 150 additions and 39 deletions

View File

@ -275,7 +275,19 @@ a.menu-title {
left: 2px; left: 2px;
} }
.roundcube div {
height:462px;
width:85%;
margin-bottom:1%;
}
.roundcube object {
margin-top:1%;
height:95%;
width:100%;
}
/*end*/ /*end*/
EOF EOF
} }

View File

@ -31,7 +31,7 @@ use SrvMngr::Plugin::WithoutCache;
use esmith::I18N; use esmith::I18N;
#this is overwrittrn with the "release" by the spec file - release can be "99.el8.sme" #this is overwrittrn with the "release" by the spec file - release can be "99.el8.sme"
our $VERSION = '50.el8.sme'; our $VERSION = '51.el8.sme';
#Extract the release value #Extract the release value
if ($VERSION =~ /^(\d+)/) { if ($VERSION =~ /^(\d+)/) {
$VERSION = $1; # $1 contains the matched numeric digits $VERSION = $1; # $1 contains the matched numeric digits
@ -812,7 +812,6 @@ sub get_public_ip_address
return undef; return undef;
} }
sub email_simple { sub email_simple {
my ($c, $data) = @_; my ($c, $data) = @_;

View File

@ -152,6 +152,55 @@ sub get2_local_networks {
} ## end else [ if ($numNetworks == 0)] } ## end else [ if ($numNetworks == 0)]
} ## end sub get2_local_networks } ## end sub get2_local_networks
sub get_net_prop {
my $fm = shift;
my $item = shift;
my $prop = shift;
my $record = $networks->get($item);
if ($record) {
return $record->prop($prop);
}
else {
return '';
}
}
sub get_local_networks {
my $fm = shift;
my @nets = $networks->get_all_by_prop('type' => 'network');
my $numNetworks = @nets;
if ($numNetworks == 0) {
return $fm->localise('NO_NETWORKS');
}
else {
my $out = "";
foreach my $network (sort @nets) {
if ($out ne "") {
$out .= "<BR>";
}
$out .= $network->key."/" . get_net_prop($fm, $network->key, 'Mask');
if ( defined get_net_prop($fm, $network->key, 'Router') ) {
$out .= " via " . get_net_prop ($fm, $network->key, 'Router');
}
}
return $out;
}
}
sub get_local_domain
{
return (get_value('','DomainName'));
}
=head2 print2_gateway_stanza =head2 print2_gateway_stanza
If this system is a server gateway, show the external ip and gateway ip (mojo ver) If this system is a server gateway, show the external ip and gateway ip (mojo ver)
@ -217,4 +266,51 @@ sub print2_dhcp_stanza {
} ## end if (get_prop($c, 'dhcpd'...)) } ## end if (get_prop($c, 'dhcpd'...))
return $out; return $out;
} ## end sub print2_dhcp_stanza } ## end sub print2_dhcp_stanza
sub get_value {
my $fm = shift;
my $item = shift;
my $record = $db->get($item);
if ($record) {
return $record->value();
}
else {
return '';
}
}
sub get_prop {
my $fm = shift if (ref($_[0]) ); # If we're being called in a formmagick context
# The first argument will always be a fm.
#otherwise, we don't want to grab it
my $item = shift;
my $prop = shift;
my $record = $db->get($item);
if ($record) {
return $record->prop($prop);
}
else {
return '';
}
}
sub get_public_ip_address
{
my $self = shift;
my $sysconfig = $db->get('sysconfig');
if ($sysconfig)
{
my $publicIP = $sysconfig->prop('PublicIP');
if ($publicIP)
{
return $publicIP;
}
}
return undef;
}
1; 1;

View File

@ -2,7 +2,7 @@ package SrvMngr::Controller::Roundcubepanel;
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# heading : System # heading : System
# description : Roundcube webmail # description : Webmail
# navigation : 99999 9999 # navigation : 99999 9999
#---------------------------------------------------------------------- #----------------------------------------------------------------------
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -21,10 +21,9 @@ use SrvMngr qw(theme_list init_session);
sub main { sub main {
my $c = shift; my $c = shift;
$c->app->log->info($c->log_req); $c->app->log->info($c->log_req);
my $title = $c->l('Roundcube Webmail'); my $title = $c->l('Webmail');
my $roundcube_url = $c->param('url'); my $roundcube_url = $c->param('url');
my $roundcube_height = $c->param('height') | 600; $c->stash(title => $title, modul => $roundcube_url);
$c->stash(title => $title, modul => $roundcube_url, height => $roundcube_height);
$c->render(template => 'roundcube'); $c->render(template => 'roundcube');
} ## end sub main } ## end sub main

View File

@ -59,11 +59,11 @@
%= t td => (class => 'sme-border') => "$first $last" %= t td => (class => 'sme-border') => "$first $last"
%= t td => (class => 'sme-border') => $vpnaccess %= t td => (class => 'sme-border') => $vpnaccess
%= t td => (class => 'sme-border') => $fwd %= t td => (class => 'sme-border') => $fwd
%my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = '&nbsp;'; % my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = '&nbsp;';
%my $modify_text = l('MODIFY'); # Localized text % my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security % my $csrf_token = "TOKEN"; # CSRF token for security
%my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure % my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%my $password_text = l("PASSWORD_RESET"); % my $password_text = l("PASSWORD_RESET");
%if ($useraccounts_user_name eq 'admin') { %if ($useraccounts_user_name eq 'admin') {
%$actionModify = qq{ %$actionModify = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name"> %<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name">
@ -98,9 +98,9 @@
%</a> %</a>
%}; %};
%} elsif ($useraccounts_user_name ne 'admin') { %} elsif ($useraccounts_user_name ne 'admin') {
%my $lock_text = l('ACCOUNT LOCKED'); # Localized text % my $lock_text = l('ACCOUNT LOCKED'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security % my $csrf_token = "TOKEN"; # CSRF token for security
%my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure % my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%$actionLock = qq{ %$actionLock = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name"> %<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name">
% <button type='button' class='sme-lock-button' title='$lock_text' > % <button type='button' class='sme-lock-button' title='$lock_text' >
@ -117,8 +117,8 @@
%}; %};
%} %}
%if ( $removable eq 'yes' ) { %if ( $removable eq 'yes' ) {
%my $remove_text = l('REMOVE'); # Localized text % my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security % my $csrf_token = "TOKEN"; # CSRF token for security
%$actionRemove = qq{ %$actionRemove = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name"> %<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name">
% <button type='button' class='sme-remove-button' title='$remove_text' > % <button type='button' class='sme-remove-button' title='$remove_text' >
@ -128,13 +128,12 @@
%}; %};
%} %}
%my $thisdomain = session 'SystemName'; % my $thisdomain = $c->req->url->to_abs->host;
%$thisdomain .= ".".session 'DomainName'; % my $roundcube_text = l('Webmail'); # Localized text
%my $roundcube_text = l('Webmail'); # Localized text % $csrf_token = "TOKEN"; # CSRF token for security
%my $csrf_token = "TOKEN"; # CSRF token for security % $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure % $actionroundcube = qq{
%$actionroundcube = qq{ %<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name&height=600px">
%<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name">
% <button type='button' class='sme-email-button' title='$roundcube_text' > % <button type='button' class='sme-email-button' title='$roundcube_text' >
% $roundcube_text % $roundcube_text
% </button> % </button>
@ -156,4 +155,4 @@
%= hidden_field 'trt' => $usr_datas->{trt} %= hidden_field 'trt' => $usr_datas->{trt}
</div> </div>

View File

@ -14,25 +14,26 @@
%= $c->render_to_string(inline => stash 'error') %= $c->render_to_string(inline => stash 'error')
</div> </div>
%} %}
<h1> roundcube - <%=$title %></h1><br> <h1><%=$title %></h1><br>
<p>If the roundcube panel does not appear after logging in, then please check your password.</p><br /> <p>If the Webmail panel does not appear after logging in, then please check your password.</p><br />
% my $thisdomain = session 'SystemName'; % my $thisdomain = $c->req->url->to_abs->host;
% $thisdomain .= ".".session 'DomainName';
% my $url = $c->stash('modul'); % my $url = $c->stash('modul');
% if (!$url) {
% $url = $thisdomain."/roundcube";
%}
% my $username = 'admin'; % my $username = 'admin';
% if ($url =~ /[?&]_user=([^&]+)/) { % if ($url =~ /[?&]_user=([^&]+)/) {
% $username = $1; % $username = $1;
%} %}
% if (!($url =~ /https:/)) {
<a href="<%= "https://".$thisdomain."/" %>roundcube?_user=<%= $username %>"><button class="sme-fullwindow1-button" width=20em title="<%= l('Full Window') %>"><%= l('Full Window') %></button></a> % $url = 'https://' . $url;
% 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 class='roundcube'>
<a href="<%= "https://".$thisdomain."/" %>roundcube?_user=<%= $username %>"><button class="sme-fullwindow1-button" width=20em title="<%= l('Full Window') %>"><%= l('Full Window') %></button></a>
<object id="roundcube" data="<%=$url %>" title="<%= $c->stash('title') %>" type="text/html" ><%= $c->stash('title') %> not found</object>
</div>
</div> </div>

View File

@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2
%define name smeserver-manager %define name smeserver-manager
Name: %{name} Name: %{name}
%define version 11.0.0 %define version 11.0.0
%define release 50 %define release 51
Version: %{version} Version: %{version}
Release: %{release}%{?dist} Release: %{release}%{?dist}
License: GPL License: GPL
@ -143,8 +143,13 @@ true
%defattr(-,root,root) %defattr(-,root,root)
%changelog %changelog
* Mon Feb 10 2025 Brian Read <brianr@koozali.org> 11.0.0-51.sme
- Replace url in call to webmail by browser url rather than system host and domain [SME: 12910]
- Fix up CSS so not inline
- Sort out reveiw panel missing routines from FormMagic [SME: 12907].
* Sun Feb 09 2025 Brian Read <brianr@koozali.org> 11.0.0-50.sme * Sun Feb 09 2025 Brian Read <brianr@koozali.org> 11.0.0-50.sme
- Move all routines from FormMagic still called by SM2 panels to SM2 [SME:12906] - Move all routines from FormMagic still called by SM2 panels to SM2 [SME: 12906]
- delete all references to FormMagic - delete all references to FormMagic
* Fri Feb 07 2025 Brian Read <brianr@koozali.org> 11.0.0-49.sme * Fri Feb 07 2025 Brian Read <brianr@koozali.org> 11.0.0-49.sme