From: erickson Date: Mon, 19 Jan 2009 18:37:26 +0000 (+0000) Subject: when searching for a path template that's not in the web config, search up the path... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fd9e468939816d34990e3c8dfcd7328d39a115c9;p=Evergreen.git when searching for a path template that's not in the web config, search up the path for the file so that we can take advantage of any path-based arguments to the interface wihtout requiring a config entry git-svn-id: svn://svn.open-ils.org/ILS/trunk@11878 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm index 7208860380..073743cc6b 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm @@ -111,14 +111,26 @@ sub find_template { # see if we can magically find the template based on the path and default extension my $ext = $ctx->{default_template_extension}; - for my $tpath (@{$ctx->{template_paths}}) { - my $fpath = "$tpath/$skin/$path.$ext"; - $r->log->debug("looking at possible template $fpath"); - if(-r $fpath) { - $template = "$path.$ext"; - last; + + my @parts = split('/', $path); + my $localpath = $path; + my @args; + while(@parts) { + last unless $localpath; + for my $tpath (@{$ctx->{template_paths}}) { + my $fpath = "$tpath/$skin/$localpath.$ext"; + $r->log->debug("looking at possible template $fpath"); + if(-r $fpath) { + $template = "$localpath.$ext"; + last; + } } - } + last if $template; + push(@args, pop @parts); + $localpath = '/'.join('/', @parts); + } + + $page_args = [@args]; # no template configured or found unless($template) {