[open-ils-commits] r11878 - trunk/Open-ILS/src/perlmods/OpenILS/WWW

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jan 19 13:37:29 EST 2009


Author: erickson
Date: 2009-01-19 13:37:26 -0500 (Mon, 19 Jan 2009)
New Revision: 11878

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm
Log:
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

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm	2009-01-19 16:37:58 UTC (rev 11877)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/EGWeb.pm	2009-01-19 18:37:26 UTC (rev 11878)
@@ -111,15 +111,27 @@
 
         # 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) {
             $r->log->warn("No template configured for path $path");



More information about the open-ils-commits mailing list