back-porting: added support for configuring redirect depth, skin, and locale during...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 2 Sep 2010 21:03:48 +0000 (21:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 2 Sep 2010 21:03:48 +0000 (21:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@17453 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/apache/eg_vhost.conf
Open-ILS/src/perlmods/OpenILS/WWW/Redirect.pm

index 16d62e6..da999b3 100644 (file)
@@ -9,6 +9,22 @@
 RedirectMatch 301 ^/$ /opac/en-US/skin/default/xml/index.xml
 
 # ----------------------------------------------------------------------------------
+# Point / to the IP address redirector
+# ----------------------------------------------------------------------------------
+#<LocationMatch ^/$>
+#    SetHandler perl-script
+#    PerlHandler OpenILS::WWW::Redirect
+#    Options +ExecCGI
+#    PerlSendHeader On
+#    #PerlSetVar OILSRedirectSkin "default"
+#    # OILSRedirectDepth defaults to the depth of the branch that the OPAC was directed to
+#    #PerlSetVar OILSRedirectDepth "0"
+#    #PerlSetVar OILSRedirectLocale "en-US"
+#    allow from all
+#</LocationMatch>
+
+
+# ----------------------------------------------------------------------------------
 # Assign a default locale to the accessible OPAC
 # ----------------------------------------------------------------------------------
 RedirectMatch 301 ^/opac/extras/slimpac/start.html$ /opac/en-US/extras/slimpac/start.html
index 3cc4a06..b485477 100644 (file)
@@ -56,13 +56,18 @@ sub handler {
        my $apache_obj = shift;
        my $cgi = CGI->new( $apache_obj );
 
+
+       my $skin = $apache_obj->dir_config('OILSRedirectSkin') || 'default';
+       my $depth = $apache_obj->dir_config('OILSRedirectDepth');
+       my $locale = $apache_obj->dir_config('OILSRedirectLocale') || 'en-US';
+
        my $hostname = $cgi->server_name();
        my $port                = $cgi->server_port();
 
        my $proto = "http";
        if($cgi->https) { $proto = "https"; }
 
-       my $url = "$proto://$hostname:$port/opac/en-US/skin/default/xml/index.xml";
+       my $url = "$proto://$hostname:$port/opac/$locale/skin/$skin/xml/index.xml";
 
        my $path = $apache_obj->path_info();
 
@@ -77,7 +82,10 @@ sub handler {
             'open-ils.actor.org_unit.retrieve_by_shortname',
                         $shortname)->gather(1);
 
-               if($org) { $url .= "?ol=" . $org->id; }
+               if($org) { 
+            $url .= "?ol=" . $org->id; 
+            $url .= "&d=$depth" if defined $depth;
+        }
        }
 
        print "Location: $url\n\n";