[open-ils-commits] r13534 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 8 13:48:58 EDT 2009


Author: dbs
Date: 2009-07-08 13:48:55 -0400 (Wed, 08 Jul 2009)
New Revision: 13534

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
Merge r13491 from trunk: Give unAPI and friends the ability to redirect to an OPAC with a specific locale and skin

Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-07-08 17:48:04 UTC (rev 13533)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-07-08 17:48:55 UTC (rev 13534)
@@ -230,6 +230,9 @@
 	my $uri = $cgi->param('id') || '';
 	my $host = $cgi->virtual_host || $cgi->server_name;
 
+	my $skin = $cgi->param('skin') || 'default';
+	my $locale = $cgi->param('locale') || 'en-US';
+
 	my $format = $cgi->param('format');
 	my $flesh_feed = ($format =~ /-full$/o) ? 1 : 0;
 	(my $base_format = $format) =~ s/-full$//o;
@@ -420,9 +423,9 @@
 	}
 
 	if ($format eq 'opac') {
-		print "Location: $root/../../en-US/skin/default/xml/rresult.xml?m=$id&l=$lib_id&d=$lib_depth\n\n"
+		print "Location: $root/../../$locale/skin/$skin/xml/rresult.xml?m=$id&l=$lib_id&d=$lib_depth\n\n"
 			if ($type eq 'metarecord');
-		print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id&l=$lib_id&d=$lib_depth\n\n"
+		print "Location: $root/../../$locale/skin/$skin/xml/rdetail.xml?r=$id&l=$lib_id&d=$lib_depth\n\n"
 			if ($type eq 'record');
 		return 302;
 	} elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format) && ($type ne 'acn' && $type ne 'acp' && $type ne 'auri')) {
@@ -509,6 +512,9 @@
 	my ($id,$type,$format,$command) = reverse split '/', $path;
 	my $flesh_feed = ($type =~ /-full$/o) ? 1 : 0;
 	(my $base_format = $format) =~ s/-full$//o;
+
+	my $skin = $cgi->param('skin') || 'default';
+	my $locale = $cgi->param('locale') || 'en-US';
 	
 	if ( $path =~ m{^/formats(?:/([^\/]+))?$}o ) {
 		print "Content-type: application/xml; charset=utf-8\n";
@@ -639,9 +645,9 @@
 	}
 
 	if ($format eq 'opac') {
-		print "Location: $root/../../en-US/skin/default/xml/rresult.xml?m=$id\n\n"
+		print "Location: $root/../../$locale/skin/$skin/xml/rresult.xml?m=$id\n\n"
 			if ($type eq 'metarecord');
-		print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id\n\n"
+		print "Location: $root/../../$locale/skin/$skin/xml/rdetail.xml?r=$id\n\n"
 			if ($type eq 'record');
 		return 302;
 
@@ -753,6 +759,9 @@
 	my $base = (split 'bookbag', $url)[0] . '/bookbag';
 	my $unapi = (split 'feed', $url)[0] . '/unapi';
 
+	my $skin = $cgi->param('skin') || 'default';
+	my $locale = $cgi->param('locale') || 'en-US';
+
 	$root =~ s{(?<!http:)//}{/}go;
 	$base =~ s{(?<!http:)//}{/}go;
 	$unapi =~ s{(?<!http:)//}{/}go;
@@ -768,7 +777,7 @@
 
 	my $bucket_tag = "tag:$host,$year:record_bucket/$id";
 	if ($type eq 'opac') {
-		print "Location: $root/../../en-US/skin/default/xml/rresult.xml?rt=list&" .
+		print "Location: $root/../../$locale/skin/$skin/xml/rresult.xml?rt=list&" .
 			join('&', map { "rl=" . $_->target_biblio_record_entry } @{ $bucket->items }) .
 			"\n\n";
 		return 302;
@@ -796,7 +805,7 @@
 
 	$feed->link(
 		OPAC =>
-		$host . '/opac/en-US/skin/default/xml/rresult.xml?rt=list&' .
+		$host . "/opac/$locale/skin/$skin/xml/rresult.xml?rt=list&" .
 			join('&', map { 'rl=' . $_->target_biblio_record_entry } @{$bucket->items} ),
 		'text/html'
 	);
@@ -828,6 +837,9 @@
 	my $base = (split 'freshmeat', $url)[0] . '/freshmeat';
 	my $unapi = (split 'feed', $url)[0] . 'unapi';
 
+	my $skin = $cgi->param('skin') || 'default';
+	my $locale = $cgi->param('locale') || 'en-US';
+
 	my $path = $cgi->path_info;
 	#warn "URL breakdown: $url ($rel_name) -> $root -> $base -> $path -> $unapi";
 
@@ -865,7 +877,7 @@
 
 	$feed->link(
 		OPAC =>
-		$host . '/opac/en-US/skin/default/xml/rresult.xml?rt=list&' .
+		$host . "/opac/$locale/skin/$skin/xml/rresult.xml?rt=list&" .
 			join('&', map { 'rl=' . $_} @$list ),
 		'text/html'
 	);



More information about the open-ils-commits mailing list