improving the dumpac
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jun 2006 18:45:27 +0000 (18:45 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jun 2006 18:45:27 +0000 (18:45 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4582 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm
Open-ILS/xsl/MARC21slim2HTMLCard-holdings.xsl

index 9536462..c041989 100644 (file)
@@ -179,7 +179,6 @@ sub unapi {
                        if ($type eq 'record');
                return 302;
        } else {
-       #} elsif ($format =~ /^html/o) {
                my $feed = create_record_feed(
                        $format => [ $id ],
                        $base,
index 23d653d..ff206d8 100644 (file)
@@ -374,7 +374,7 @@ sub link {
 #----------------------------------------------------------
 
 package OpenILS::WWW::SuperCat::Feed::mods3;
-use base 'OpenILS::WWW::SuperCat::Feed';
+use base 'OpenILS::WWW::SuperCat::Feed::mods';
 
 sub new {
        my $class = shift;
@@ -385,7 +385,7 @@ sub new {
 }
 
 package OpenILS::WWW::SuperCat::Feed::mods3::item;
-use base 'OpenILS::WWW::SuperCat::Feed::mods3';
+use base 'OpenILS::WWW::SuperCat::Feed::mods::item';
 
 sub new {
        my $class = shift;
@@ -397,6 +397,29 @@ sub new {
        return $self;
 }
 
+sub link {
+       my $self = shift;
+       my $type = shift;
+       my $id = shift;
+
+       if ($type eq 'unapi' || $type eq 'opac') {
+               $self->_create_node(
+                       'mods:mods',
+                       'http://www.loc.gov/mods/v3',
+                       'mods:relatedItem',
+                       undef,
+                       { type => 'otherFormat', id => 'link-'.$linkid }
+               );
+               $self->_create_node(
+                       "mods:mods/mods:relatedItem[\@id='link-$linkid']",
+                       'http://www.loc.gov/mods/v3',
+                       'mods:recordIdentifier',
+                       $id
+               );
+               $linkid++;
+       }
+}
+
 
 #----------------------------------------------------------
 
@@ -424,6 +447,24 @@ sub new {
        return $self;
 }
 
+sub link {
+       my $self = shift;
+       my $type = shift;
+       my $id = shift;
+
+       if ($type eq 'unapi' || $type eq 'opac') {
+               $self->_create_node(
+                       'marc:record',
+                       'http://www.w3.org/1999/xhtml',
+                       'xhtml:link',
+                       undef,
+                       { rel => 'otherFormat', href => $id, title => "Dynamic Details" }
+               );
+               $linkid++;
+       }
+}
+
+
 #----------------------------------------------------------
 
 package OpenILS::WWW::SuperCat::Feed::html;
@@ -502,7 +543,7 @@ sub toString {
         $_parser ||= new XML::LibXML;
         $_xslt ||= new XML::LibXSLT;
 
-       $xslt_file ||=
+       $xslt_file =
                 OpenSRF::Utils::SettingsClient
                                ->new
                                ->config_value( dirs => 'xsl' ).$self->{xsl};
@@ -520,6 +561,9 @@ sub toString {
        return $new_doc->toString(1); 
 }
 
+package OpenILS::WWW::SuperCat::Feed::htmlcard::item;
+use base 'OpenILS::WWW::SuperCat::Feed::marcxml::item';
+
 package OpenILS::WWW::SuperCat::Feed::htmlholdings;
 use base 'OpenILS::WWW::SuperCat::Feed::htmlcard';
 
@@ -530,9 +574,6 @@ sub new {
        return $self;
 }
 
-package OpenILS::WWW::SuperCat::Feed::htmlcard::item;
-use base 'OpenILS::WWW::SuperCat::Feed::marcxml::item';
-
 package OpenILS::WWW::SuperCat::Feed::htmlholdings::item;
 use base 'OpenILS::WWW::SuperCat::Feed::htmlcard::item';
 
index ed6c41e..999b2a2 100755 (executable)
@@ -2,6 +2,7 @@
   
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:marc="http://www.loc.gov/MARC21/slim"
   xmlns:hold="http://open-ils.org/spec/holdings/v1"
@@ -23,6 +24,7 @@
     <div class="cardimage">
      <xsl:apply-templates select="marc:datafield[@tag!='082' and @tag!='092' and @tag!='010']"/>
      <span class="bottom">
+      <xsl:apply-templates select="xhtml:link[@rel='otherFormat' and contains(@href,'format=')]"/>
       <xsl:apply-templates select="marc:controlfield[@tag='001']"/>
       <xsl:apply-templates select="marc:datafield[@tag='082' or @tag='092' or @tag='010']"/>
      </span>
     <br/>
   </xsl:template>
 
+  <xsl:template match="xhtml:link">
+    <a>
+      <xsl:attribute name="href">
+        <xsl:value-of select="@href"/>
+      </xsl:attribute>
+      <xsl:value-of select="@title"/>
+    </a>
+    <br/>
+  </xsl:template>
+
   <xsl:template match="hold:volumes">
-    <xsl:if test="count(hold:volume) &gt; 0">
+    <xsl:if test="count(hold:volume/hold:copies/hold:copy) &gt; 0">
        <u>Holdings</u>
     </xsl:if>
     <ul>