[open-ils-commits] r16735 - in trunk/Open-ILS/src/perlmods/OpenILS: Application WWW (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jun 16 15:41:32 EDT 2010


Author: miker
Date: 2010-06-16 15:41:27 -0400 (Wed, 16 Jun 2010)
New Revision: 16735

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
split registration of authority browse urls out from record; add authority formats ML method

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-06-16 19:25:15 UTC (rev 16734)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-06-16 19:41:27 UTC (rev 16735)
@@ -1789,6 +1789,43 @@
 );
 
 
+sub list_authority_formats {
+	my @list = (
+		{ marcxml =>
+			{ namespace_uri	  => 'http://www.loc.gov/MARC21/slim',
+			  docs		  => 'http://www.loc.gov/marcxml/',
+			  schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
+			}
+		}
+	);
+
+#	for my $type ( keys %record_xslt ) {
+#		push @list,
+#			{ $type => 
+#				{ namespace_uri	  => $record_xslt{$type}{namespace_uri},
+#				  docs		  => $record_xslt{$type}{docs},
+#				  schema_location => $record_xslt{$type}{schema_location},
+#				}
+#			};
+#	}
+#
+	return \@list;
+}
+__PACKAGE__->register_method(
+	method    => 'list_authority_formats',
+	api_name  => 'open-ils.supercat.authority.formats',
+	api_level => 1,
+	argc      => 0,
+	signature =>
+		{ desc     => <<"		  DESC",
+Returns the list of valid authority formats that supercat understands.
+		  DESC
+		  'return' =>
+		  	{ desc => 'The format list',
+			  type => 'array' }
+		}
+);
+
 sub list_record_formats {
 	my @list = (
 		{ marcxml =>

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-06-16 19:25:15 UTC (rev 16734)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-06-16 19:41:27 UTC (rev 16735)
@@ -147,7 +147,7 @@
     $list = [ map { (keys %$_)[0] } @$list ];
     push @$list, 'htmlholdings','html', 'marctxt', 'ris';
 
-    for my $browse_axis ( qw/title author subject topic series item-age authority.title authority.author authority.subject authority.topic/ ) {
+    for my $browse_axis ( qw/title author subject topic series item-age/ ) {
         for my $record_browse_format ( @$list ) {
             {
                 my $__f = $record_browse_format;
@@ -163,8 +163,7 @@
                 	my $site = shift;
 
 			$log->info("Creating record feed with params [$real_format, $record_list, $unapi, $site]");
-                	my $bib_or_authority = $__a =~ /^authority/ ? 'authority' : 'record';
-                	my $feed = create_record_feed( $bib_or_authority, $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
+                	my $feed = create_record_feed( 'record', $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
                 	$feed->root( "$base/../" );
                 	$feed->lib( $site );
                 	$feed->link( next => $next => $feed->type );
@@ -178,6 +177,36 @@
             }
         }
     }
+
+    for my $browse_axis ( qw/authority.title authority.author authority.subject authority.topic/ ) {
+        for my $record_browse_format ( qw/marcxml/ ) {
+            {
+                my $__f = $record_browse_format;
+                my $__a = $browse_axis;
+
+                $browse_types{$__a}{$__f} = sub {
+                	my $record_list = shift;
+                	my $prev = shift;
+                	my $next = shift;
+                	my $real_format = shift || $__f;
+                	my $unapi = shift;
+                	my $base = shift;
+                	my $site = shift;
+
+			$log->info("Creating record feed with params [$real_format, $record_list, $unapi, $site]");
+                	my $feed = create_record_feed( 'authority', $real_format, $record_list, $unapi, $site, 0 );
+                	$feed->root( "$base/../" );
+                	$feed->link( next => $next => $feed->type );
+                	$feed->link( previous => $prev => $feed->type );
+
+                	return (
+                        "Content-type: ". $feed->type ."; charset=utf-8\n\n",
+                        $feed->toString
+                    );
+                };
+            }
+        }
+    }
 }
 
 =head2 parse_feed_type($type)
@@ -341,6 +370,7 @@
 			$lib = uc($4);
 			$type = 'record';
 			$type = 'metarecord' if ($1 =~ /^m/o);
+			$type = 'authority' if ($1 =~ /^authority/o);
 
 			my $list = $supercat
 				->request("open-ils.supercat.$type.formats")
@@ -380,7 +410,7 @@
 
 		} else {
 			my $list = $supercat
-				->request("open-ils.supercat.record.formats")
+				->request("open-ils.supercat.$type.formats")
 				->gather(1);
 				
 			push @$list,
@@ -434,6 +464,7 @@
 		$type = 'acp' if ($1 =~ /^asset-copy/o);
 		$type = 'acn' if ($1 =~ /^asset-call_number/o);
 		$type = 'auri' if ($1 =~ /^asset-uri/o);
+		$type = 'authority' if ($1 =~ /^authority/o);
 		$command = 'retrieve';
 		$command = 'browse' if ($type eq 'call_number');
 	}



More information about the open-ils-commits mailing list