[open-ils-commits] r17453 - in branches/rel_2_0/Open-ILS: examples/apache src/perlmods/OpenILS/WWW (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 2 17:03:54 EDT 2010


Author: erickson
Date: 2010-09-02 17:03:48 -0400 (Thu, 02 Sep 2010)
New Revision: 17453

Modified:
   branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
   branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/Redirect.pm
Log:
back-porting: added support for configuring redirect depth, skin, and locale during IP-based org unit redirection; w/ sample config

Modified: branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf	2010-09-02 21:02:15 UTC (rev 17452)
+++ branches/rel_2_0/Open-ILS/examples/apache/eg_vhost.conf	2010-09-02 21:03:48 UTC (rev 17453)
@@ -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

Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/Redirect.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/Redirect.pm	2010-09-02 21:02:15 UTC (rev 17452)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/WWW/Redirect.pm	2010-09-02 21:03:48 UTC (rev 17453)
@@ -56,13 +56,18 @@
 	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 @@
             '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"; 



More information about the open-ils-commits mailing list