From: Mike Rylander Date: Fri, 8 Mar 2013 18:21:23 +0000 (-0500) Subject: MARC21 feed support -- initial cut X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmiker%2Fwip%2Fmarc21-supercat;p=evergreen%2Fequinox.git MARC21 feed support -- initial cut Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index dc62eee9d2..592a33eef3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm @@ -2963,7 +2963,8 @@ sub list_authority_formats { { 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', - } + }, + marc21 => { docs => 'http://www.loc.gov/marc/' } } ); @@ -3001,7 +3002,8 @@ sub list_record_formats { docs => 'http://www.loc.gov/marcxml/', schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd', } - } + marc21 => { docs => 'http://www.loc.gov/marc/' } + }, ); for my $type ( keys %record_xslt ) { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm index 8fc95f1efe..6b6fbf9b9e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm @@ -679,7 +679,7 @@ sub unapi { $feed->link( unapi => $base) if ($flesh_feed); print "Content-type: ". $feed->type ."; charset=utf-8\n\n"; - print $U->entityize($feed->toString) . "\n"; + print $feed->toString . "\n"; return Apache2::Const::OK; } @@ -940,7 +940,7 @@ sub supercat { $feed->link( unapi => $base) if ($flesh_feed); print "Content-type: ". $feed->type ."; charset=utf-8\n\n"; - print $U->entityize($feed->toString) . "\n"; + print $feed->toString . "\n"; return Apache2::Const::OK; } @@ -1064,7 +1064,7 @@ sub bookbag_feed { print "Content-type: ". $feed->type ."; charset=utf-8\n\n"; - print $U->entityize($feed->toString) . "\n"; + print $feed->toString . "\n"; return Apache2::Const::OK; } @@ -1151,7 +1151,7 @@ sub changes_feed { print "Content-type: ". $feed->type ."; charset=utf-8\n\n"; - print $U->entityize($feed->toString) . "\n"; + print $feed->toString . "\n"; return Apache2::Const::OK; } @@ -1198,6 +1198,8 @@ Content-type: application/opensearchdescription+xml; charset=utf-8 template="$base/1.1/$lib/mods3/$class/?searchTerms={searchTerms}&startPage={startPage?}&startIndex={startIndex?}&count={count?}&searchLang={language?}"/> + 'utf8', RecordFormat => 'USMARC' ); + +sub new { + my $class = shift; + my $self = $class->SUPER::new; + $self->{type} = 'application/octet-stream'; + return $self; +} + + +sub toString { + my $self = shift; + + $self->{doc} = ''; + for my $item ( $self->items ) { + my $r = MARC::Record->new_from_xml( $item->{doc}->toString(1) ); + $r->update_leader; + $self->{doc} .= $r->encode; + } + + return $self->{doc}; +} + +package OpenILS::WWW::SuperCat::Feed::marc21::item; +use base 'OpenILS::WWW::SuperCat::Feed::marcxml::item'; + 1;