From d776f207363f08424fdf5838369b1cab053cd1f4 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Wed, 12 Feb 2025 16:31:17 +0000 Subject: [PATCH] * Mon Feb 10 2025 Brian Read 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]. --- .../default/public/css/styles.css/50body | 14 ++- root/usr/share/smanager/lib/SrvMngr.pm | 3 +- .../smanager/lib/SrvMngr/Controller/Review.pm | 96 +++++++++++++++++++ .../lib/SrvMngr/Controller/Roundcubepanel.pm | 7 +- .../templates/partials/_usr_list.html.ep | 35 ++++--- .../default/templates/roundcube.html.ep | 25 ++--- smeserver-manager.spec | 9 +- 7 files changed, 150 insertions(+), 39 deletions(-) diff --git a/root/etc/e-smith/templates/usr/share/smanager/themes/default/public/css/styles.css/50body b/root/etc/e-smith/templates/usr/share/smanager/themes/default/public/css/styles.css/50body index eeeb0d9..6ef9b84 100644 --- a/root/etc/e-smith/templates/usr/share/smanager/themes/default/public/css/styles.css/50body +++ b/root/etc/e-smith/templates/usr/share/smanager/themes/default/public/css/styles.css/50body @@ -275,7 +275,19 @@ a.menu-title { left: 2px; } +.roundcube div { + height:462px; + width:85%; + margin-bottom:1%; +} + +.roundcube object { + margin-top:1%; + height:95%; + width:100%; +} + /*end*/ EOF -} \ No newline at end of file +} diff --git a/root/usr/share/smanager/lib/SrvMngr.pm b/root/usr/share/smanager/lib/SrvMngr.pm index 617a3b1..32d2f89 100644 --- a/root/usr/share/smanager/lib/SrvMngr.pm +++ b/root/usr/share/smanager/lib/SrvMngr.pm @@ -31,7 +31,7 @@ use SrvMngr::Plugin::WithoutCache; use esmith::I18N; #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 if ($VERSION =~ /^(\d+)/) { $VERSION = $1; # $1 contains the matched numeric digits @@ -812,7 +812,6 @@ sub get_public_ip_address return undef; } - sub email_simple { my ($c, $data) = @_; diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm index 83b71fc..89a2df0 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Review.pm @@ -152,6 +152,55 @@ sub get2_local_networks { } ## end else [ if ($numNetworks == 0)] } ## 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 .= "
"; + } + + $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 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'...)) return $out; } ## 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; diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm index 9d3cba3..fef3337 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Roundcubepanel.pm @@ -2,7 +2,7 @@ package SrvMngr::Controller::Roundcubepanel; #---------------------------------------------------------------------- # heading : System -# description : Roundcube webmail +# description : Webmail # navigation : 99999 9999 #---------------------------------------------------------------------- #---------------------------------------------------------------------- @@ -21,10 +21,9 @@ use SrvMngr qw(theme_list init_session); sub main { my $c = shift; $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_height = $c->param('height') | 600; - $c->stash(title => $title, modul => $roundcube_url, height => $roundcube_height); + $c->stash(title => $title, modul => $roundcube_url); $c->render(template => 'roundcube'); } ## end sub main diff --git a/root/usr/share/smanager/themes/default/templates/partials/_usr_list.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_usr_list.html.ep index a7483bd..524c692 100644 --- a/root/usr/share/smanager/themes/default/templates/partials/_usr_list.html.ep +++ b/root/usr/share/smanager/themes/default/templates/partials/_usr_list.html.ep @@ -59,11 +59,11 @@ %= t td => (class => 'sme-border') => "$first $last" %= t td => (class => 'sme-border') => $vpnaccess %= t td => (class => 'sme-border') => $fwd - %my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = ' '; - %my $modify_text = l('MODIFY'); # Localized text - %my $csrf_token = "TOKEN"; # CSRF token for security - %my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure - %my $password_text = l("PASSWORD_RESET"); + % my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = ' '; + % my $modify_text = l('MODIFY'); # Localized text + % my $csrf_token = "TOKEN"; # CSRF token for security + % my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure + % my $password_text = l("PASSWORD_RESET"); %if ($useraccounts_user_name eq 'admin') { %$actionModify = qq{ % @@ -98,9 +98,9 @@ % %}; %} elsif ($useraccounts_user_name ne 'admin') { - %my $lock_text = l('ACCOUNT LOCKED'); # Localized text - %my $csrf_token = "TOKEN"; # CSRF token for security - %my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure + % my $lock_text = l('ACCOUNT LOCKED'); # Localized text + % my $csrf_token = "TOKEN"; # CSRF token for security + % my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure %$actionLock = qq{ % % @@ -156,4 +155,4 @@ %= hidden_field 'trt' => $usr_datas->{trt} - \ No newline at end of file + diff --git a/root/usr/share/smanager/themes/default/templates/roundcube.html.ep b/root/usr/share/smanager/themes/default/templates/roundcube.html.ep index 515f233..dcf6cbe 100644 --- a/root/usr/share/smanager/themes/default/templates/roundcube.html.ep +++ b/root/usr/share/smanager/themes/default/templates/roundcube.html.ep @@ -14,25 +14,26 @@ %= $c->render_to_string(inline => stash 'error') %} -

roundcube - <%=$title %>


-

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


+

<%=$title %>


+

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


- % my $thisdomain = session 'SystemName'; - % $thisdomain .= ".".session 'DomainName'; + % my $thisdomain = $c->req->url->to_abs->host; % my $url = $c->stash('modul'); + % if (!$url) { + % $url = $thisdomain."/roundcube"; + %} % 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"; + % if (!($url =~ /https:/)) { + % $url = 'https://' . $url; %} - <%= $c->stash('title') %> not found + +
+ roundcube?_user=<%= $username %>"> + <%= $c->stash('title') %> not found +
diff --git a/smeserver-manager.spec b/smeserver-manager.spec index ca20887..b18e386 100644 --- a/smeserver-manager.spec +++ b/smeserver-manager.spec @@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2 %define name smeserver-manager Name: %{name} %define version 11.0.0 -%define release 50 +%define release 51 Version: %{version} Release: %{release}%{?dist} License: GPL @@ -143,8 +143,13 @@ true %defattr(-,root,root) %changelog +* Mon Feb 10 2025 Brian Read 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 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 * Fri Feb 07 2025 Brian Read 11.0.0-49.sme