* Thu Jun 19 2025 Brian Read <brianr@koozali.org> 11.0.0-93.sme

- Sort out case of first letter of ctlact in routes added in from header on controller file [SME: 13053]
This commit is contained in:
Brian Read 2025-06-19 06:26:38 +01:00
parent d1f2013375
commit c208419704
2 changed files with 57 additions and 23 deletions

View File

@ -37,7 +37,7 @@ use esmith::NavigationDB; # no UTF8 raw is ok for ASCII only flat file
use SrvMngr_Auth qw(check_admin_access); use SrvMngr_Auth qw(check_admin_access);
#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 = '91.el8.sme'; our $VERSION = '92.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
@ -421,29 +421,60 @@ sub setup_routing {
# additional routes (for contribs) got from 'routes' db # additional routes (for contribs) got from 'routes' db
#my @routes = @{SrvMngr::get_routes_list()}; #my @routes = @{SrvMngr::get_routes_list()};
foreach (@{SrvMngr::get_routes_list()}) { #foreach (@{SrvMngr::get_routes_list()}) {
#if ( defined $_->{method} and defined $_->{url} and defined $_->{ctlact} and defined $_->{name} ) {
#my $menu = defined $_->{menu} ? $_->{menu} : 'A';
#if ( $menu eq 'N' ) {
#$r->get($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'get');
#$r->post($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'post');
#} elsif ( $menu eq 'U' ) {
#$if_logged_in->get($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'get');
#$if_logged_in->post($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'post');
#} else {
#$if_admin->get($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'get');
#$if_admin->post($_->{url})->to($_->{ctlact})->name($_->{name})
#if ( $_->{method} eq 'post');
#}
#}
#}
foreach my $route (@{SrvMngr::get_routes_list()}) {
if (defined $route->{method} && defined $route->{url} && defined $route->{ctlact} && defined $route->{name}) {
my $menu = defined $route->{menu} ? $route->{menu} : 'A';
# Fix controller case: convert "ControllerName" to "controllername" in "ControllerName#action"
# this is so that AdminLTE breadcrumb works - it appears that perl Packages names are NOT case sensitive
# and that the breadcrumb package assumes that the package name is the same as the main route.
my ($controller, $action) = split /#/, $route->{ctlact}, 2;
my $fixed_ctlact = lc($controller) . '#' . $action;
if ( defined $_->{method} and defined $_->{url} and defined $_->{ctlact} and defined $_->{name} ) {
my $menu = defined $_->{menu} ? $_->{menu} : 'A';
if ($menu eq 'N') { if ($menu eq 'N') {
$r->get($_->{url})->to($_->{ctlact})->name($_->{name}) $r->get($route->{url})->to($fixed_ctlact)->name($route->{name})
if ( $_->{method} eq 'get'); if $route->{method} eq 'get';
$r->post($_->{url})->to($_->{ctlact})->name($_->{name}) $r->post($route->{url})->to($fixed_ctlact)->name($route->{name})
if ( $_->{method} eq 'post'); if $route->{method} eq 'post';
} elsif ( $menu eq 'U' ) { }
$if_logged_in->get($_->{url})->to($_->{ctlact})->name($_->{name}) elsif ($menu eq 'U') {
if ( $_->{method} eq 'get'); $if_logged_in->get($route->{url})->to($fixed_ctlact)->name($route->{name})
$if_logged_in->post($_->{url})->to($_->{ctlact})->name($_->{name}) if $route->{method} eq 'get';
if ( $_->{method} eq 'post'); $if_logged_in->post($route->{url})->to($fixed_ctlact)->name($route->{name})
} else { if $route->{method} eq 'post';
$if_admin->get($_->{url})->to($_->{ctlact})->name($_->{name}) }
if ( $_->{method} eq 'get'); else { # Default: menu 'A'
$if_admin->post($_->{url})->to($_->{ctlact})->name($_->{name}) $if_admin->get($route->{url})->to($fixed_ctlact)->name($route->{name})
if ( $_->{method} eq 'post'); if $route->{method} eq 'get';
$if_admin->post($route->{url})->to($fixed_ctlact)->name($route->{name})
if $route->{method} eq 'post';
} }
} }
} }
$if_admin->get('/config/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getconfig')->name('getconfig'); $if_admin->get('/config/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getconfig')->name('getconfig');
$if_admin->get('/account/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getaccount')->name('getaccount'); $if_admin->get('/account/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getaccount')->name('getaccount');
$if_admin->get('/:module' => {module => qr/[a-z0-9]{2,32}/})->to('modules#modsearch')->name('module_search'); $if_admin->get('/:module' => {module => qr/[a-z0-9]{2,32}/})->to('modules#modsearch')->name('module_search');

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 92 %define release 93
Version: %{version} Version: %{version}
Release: %{release}%{?dist} Release: %{release}%{?dist}
License: GPL License: GPL
@ -144,6 +144,9 @@ true
%defattr(-,root,root) %defattr(-,root,root)
%changelog %changelog
* Thu Jun 19 2025 Brian Read <brianr@koozali.org> 11.0.0-93.sme
- Sort out case of first letter of ctlact in routes added in from header on controller file [SME: 13053]
* Sun Jun 15 2025 Brian Read <brianr@koozali.org> 11.0.0-92.sme * Sun Jun 15 2025 Brian Read <brianr@koozali.org> 11.0.0-92.sme
- rework datetime panel [SME: 13020] - rework datetime panel [SME: 13020]
- Fix errors in error messages for local networks panel [SME: 13044] - Fix errors in error messages for local networks panel [SME: 13044]