added toc and physical_description to MVR
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 13 Mar 2006 16:28:44 +0000 (16:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 13 Mar 2006 16:28:44 +0000 (16:28 +0000)
added physical_description to record summary display
now loading MARC TOC from the record if none is found from the added content

git-svn-id: svn://svn.open-ils.org/ILS/trunk@3342 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml

index b404c61..666a645 100644 (file)
@@ -142,6 +142,8 @@ sub _init {
                                                                                                          edition       => 1,
                                                                                                          online_loc    => 1,
                                                                                                          synopsis      => 1,
+                                                                                                         physical_description  => 1,
+                                                                                                         toc => 1,
                                                                                             copy_count         => 1,
                                                                                             series             => 1,
                                                                                             serials            => 1,
index f2c7c31..4785d1f 100644 (file)
@@ -23,9 +23,12 @@ my $tcn_xpath                        = "//mods:mods/mods:recordInfo/mods:recordIdentifier";
 my $publisher_xpath    = "//mods:mods/mods:originInfo//mods:publisher[1]";
 my $edition_xpath              = "//mods:mods/mods:originInfo//mods:edition[1]";
 my $abstract_xpath     = "//mods:mods/mods:abstract";
-my $toc_xpath                  = "";
 my $related_xpath              = "";
 my $online_loc_xpath = "(//mods:location/mods:url|//mods:location/mods:url/\@displayLabel)";
+my $physical_desc              = "(//mods:physicalDescription/mods:form|//mods:physicalDescription/mods:extent|".
+       "//mods:physicalDescription/mods:reformattingQuality|//mods:physicalDescription/mods:internetMediaType|".
+       "//mods:physicalDescription/mods:digitalOrigin)";
+my $toc_xpath                  = "//mods:tableOfContents";
 
 my $xpathset = {
 
@@ -165,7 +168,7 @@ sub modsdoc_to_values {
                        for my $arr (@value) {
                                if( ref($arr) ) {
                                        $data->{$class}->{$type} = shift @$arr;
-                                       $data->{$class}->{$type} .= shift @$arr if (lc($data->{$class}->{$type}) =~ /^the|an?/o);
+                                       $data->{$class}->{$type} .= ' : ' . shift @$arr if (lc($data->{$class}->{$type}) =~ /^the|an?/o);
                                        for my $t (@$arr) {
                                                $data->{$class}->{$type} .= ' : ' if ($data->{$class}->{$type} =~ /\w\s*$/o);
                                                $data->{$class}->{$type} .= " $t";
@@ -319,6 +322,14 @@ sub start_mods_batch {
        ($self->{master_doc}->{synopsis}) = 
                $self->get_field_value( $mods, $abstract_xpath );
 
+       $self->{master_doc}->{physical_description} = [];
+       push(@{$self->{master_doc}->{physical_description}},
+               $self->get_field_value( $mods, $physical_desc ) );
+       $self->{master_doc}->{physical_description} = 
+               join( ' ', @{$self->{master_doc}->{physical_description}});
+
+       ($self->{master_doc}->{toc}) = $self->get_field_value($mods, $toc_xpath);
+
 }
 
 
@@ -404,6 +415,11 @@ sub finish_mods_batch {
 
        $record->online_loc($perl->{online_loc});
        $record->synopsis($perl->{synopsis});
+       $record->physical_description($perl->{physical_description});
+       $record->toc($perl->{toc});
+
+       use Data::Dumper;
+       warn Dumper $self->{master_doc};
 
        $self->{master_doc} = undef;
        return $record;
index 4e50256..a03312e 100644 (file)
@@ -16,6 +16,7 @@ var defaultCN;
 var callnumberCache = {};
 var rdetailLocalOnly = true;
 var globalCNCache      = {};
+var localTOC;
 
 var nextContainerIndex;
 
@@ -111,11 +112,11 @@ function _rdetailDraw(r) {
        G.ui.rdetail.edition.appendChild(text(record.edition()));
        G.ui.rdetail.pubdate.appendChild(text(record.pubdate()));
        G.ui.rdetail.publisher.appendChild(text(record.publisher()));
+       $('rdetail_physical_desc').appendChild(text(record.physical_description()));
        G.ui.rdetail.tor.appendChild(text(record.types_of_resource()[0]));
        setResourcePic( G.ui.rdetail.tor_pic, record.types_of_resource()[0]);
        G.ui.rdetail.abstr.appendChild(text(record.synopsis()));
 
-
        $('rdetail_place_hold').setAttribute(
                'href','javascript:holdsDrawWindow("'+record.doc_id()+'");');
 
@@ -226,9 +227,14 @@ function rdetailShowExtra(type) {
                        if(rdetailTocFetched) break;
                        unHideMe($('rdetail_extras_loading'));
                        rdetailTocFetched = true;
-                       var req = new Request(FETCH_TOC, cleanISBN(record.isbn()));
-                       req.callback(rdetailShowTOC);
-                       req.send();
+                       if(localTOC) {
+                               hideMe($('rdetail_extras_loading'));
+                               $('rdetail_toc_div').innerHTML = record.toc().replace(/--/g, "<br/>");
+                       } else {
+                               var req = new Request(FETCH_TOC, cleanISBN(record.isbn()));
+                               req.callback(rdetailShowTOC);
+                               req.send();
+                       }
                        break;
 
                case "marc": 
@@ -296,7 +302,14 @@ function rdetailShowCNBrowse( cn, depth, fromOnclick ) {
 function rdetailHandleAddedContent(r) {
        var resp = r.getResultObject();
        if( resp.Review == 'true' ) unHideMe($('rdetail_reviews_link'));
-       if( resp.TOC == 'true' ) unHideMe($('rdetail_toc_link'));
+       if( resp.TOC == 'true' ) {
+               unHideMe($('rdetail_toc_link'));
+       } else {
+               if( record.toc() ) {
+                       localTOC = true;
+                       unHideMe($('rdetail_toc_link'));
+               }
+       }
 }
 
 
@@ -436,6 +449,7 @@ function rdetailFetchNotes() {
 var rdetailNotesTemplate;
 function rdetailDrawNotes(r) {
        var notes = r.getResultObject();
+       if(!notes) return;
 
        var tbody = $('rdetail_notes_tbody');
        if(!rdetailNotesTemplate) 
index ddc29a8..7548665 100644 (file)
@@ -5,7 +5,7 @@
                <tbody id='rdetail_details_tbody'>
 
                        <tr>
-                               <td id='rdetail_image_cell' rowspan='8'><img id='rdetail_image'> </img></td>
+                               <td id='rdetail_image_cell' rowspan='9'><img id='rdetail_image'> </img></td>
                                <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.title;</td>                
                                <td class='rdetail_item' id='rdetail_title'> </td>
                        </tr>
                                <td class='rdetail_item' id='rdetail_publisher'> </td>
                        </tr>
 
+
+                       <tr>
+                               <td nowrap='nowrap' class='rdetail_desc'>Physical Description</td>              
+                               <td class='rdetail_item' id='rdetail_physical_desc'> </td>
+                       </tr>
+
                        <tr>
                                <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.tor;</td>                  
                                <td class='rdetail_item'>