[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3ad39d5e661cf84001a2013a3a2f395e878fab71

Evergreen Git git at git.evergreen-ils.org
Wed Mar 13 16:12:03 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  3ad39d5e661cf84001a2013a3a2f395e878fab71 (commit)
      from  f6ac572987d68c443e16998aeb633990c37e389b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3ad39d5e661cf84001a2013a3a2f395e878fab71
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Mar 8 13:21:23 2013 -0500

    MARC21 feed support
    
    Now you can get MARC21 feeds from OpenSearch, e.g.
    http://<host>/opac/extras/opensearch/1.1/-/marc21?searchTerms=piano
    
    with the Concerto dataset.
    
    [LFW] Syntax corrections, utf-8 encoding, release note
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
index dc62eee..c8d35b6 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/' }
 		}
 	);
 
@@ -3000,8 +3001,9 @@ sub list_record_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/' }
+		},
 	);
 
 	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 8fc95f1..1956b5a 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}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
   <Url type="application/x-mods+xml"
        template="$base/1.1/$lib/mods/$class/?searchTerms={searchTerms}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
+  <Url type="application/octet-stream"
+       template="$base/1.1/$lib/marc21/$class/?searchTerms={searchTerms}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
   <Url type="application/x-marcxml+xml"
        template="$base/1.1/$lib/marcxml/$class/?searchTerms={searchTerms}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
   <Url type="text/html"
@@ -1487,7 +1489,11 @@ sub create_record_feed {
     $feed->unapi($unapi) if ($flesh);
 
     $type = 'atom' if ($type eq 'html');
-    $type = 'marcxml' if (($type eq 'htmlholdings') || ($type eq 'marctxt') || ($type eq 'ris'));
+    $type = 'marcxml' if
+        $type eq 'htmlholdings' or
+        $type eq 'marctxt' or
+        $type eq 'ris' or
+        $type eq 'marc21';  # kludgy since it isn't an XML format, but needed
 
     #$records = $supercat->request( "open-ils.supercat.record.object.retrieve", $records )->gather(1);
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
index 57bb67f..d4cd14c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
@@ -852,5 +852,33 @@ sub toString {
 package OpenILS::WWW::SuperCat::Feed::ris::item;
 use base 'OpenILS::WWW::SuperCat::Feed::marcxml::item';
 
+package OpenILS::WWW::SuperCat::Feed::marc21;
+use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
+use MARC::File::XML ( BinaryEncoding => '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) );
+        $self->{doc} .= $r->as_usmarc;
+    }
+
+    utf8::encode($self->{doc});
+    return $self->{doc};
+}
+
+package OpenILS::WWW::SuperCat::Feed::marc21::item;
+use base 'OpenILS::WWW::SuperCat::Feed::marcxml::item';
+
 
 1;
diff --git a/docs/RELEASE_NOTES_NEXT/marc21-feeds.txt b/docs/RELEASE_NOTES_NEXT/marc21-feeds.txt
new file mode 100644
index 0000000..0b861a9
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/marc21-feeds.txt
@@ -0,0 +1,8 @@
+MARC21 Feeds from OpenSearch
+============================
+
+In addition to the already supported formats, you can now get raw MARC21 from
+OpenSearch feeds, à la:
+
+    http://<host>/opac/extras/opensearch/1.1/-/marc21?searchTerms=piano
+

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/lib/OpenILS/Application/SuperCat.pm   |    8 +++--
 Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm  |   16 ++++++++---
 .../src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm  |   28 ++++++++++++++++++++
 docs/RELEASE_NOTES_NEXT/marc21-feeds.txt           |    8 +++++
 4 files changed, 52 insertions(+), 8 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/marc21-feeds.txt


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list