Restore URIs in marcxml-uris unAPI format
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Apr 2011 21:22:33 +0000 (21:22 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 Apr 2011 21:22:33 +0000 (21:22 +0000)
At some point (r16750) we started doing a numeric comparison of
$flesh instead of just checking to see if $flesh was defined; this
returned false when $flesh == 'uris', preventing URIs from being
included in the marcxml-uris unAPI format.

This restores URIs to marcxml-uris and so we can revert the extra
BibTemplate call in rdetail_summary.xml.

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

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml

index 0ccdc8b..bfdd53e 100644 (file)
@@ -546,6 +546,12 @@ sub unapi {
 
        if ($type eq 'isbn') {
                my $rec = $supercat->request('open-ils.supercat.isbn.object.retrieve',$id)->gather(1);
+               # Escape user input before display
+               $command = CGI::escapeHTML($command);
+               $id = CGI::escapeHTML($id);
+               $type = CGI::escapeHTML($type);
+               $format = CGI::escapeHTML(decode_utf8($format));
+
                if (!@$rec) {
                        print "Content-type: text/html; charset=utf-8\n\n";
                        $apache->custom_response( 404, <<"                      HTML");
@@ -572,6 +578,10 @@ sub unapi {
                   { $_ eq $base_format }
                   qw/opac html htmlholdings marctxt ris holdings_xml/
        ) {
+               # Escape user input before display
+               $format = CGI::escapeHTML($format);
+               $type = CGI::escapeHTML($type);
+
                print "Content-type: text/html; charset=utf-8\n\n";
                $apache->custom_response( 406, <<"              HTML");
                <html>
@@ -605,6 +615,12 @@ sub unapi {
                );
 
                if (!$feed->count) {
+                       # Escape user input before display
+                       $command = CGI::escapeHTML($command);
+                       $id = CGI::escapeHTML($id);
+                       $type = CGI::escapeHTML($type);
+                       $format = CGI::escapeHTML(decode_utf8($format));
+
                        print "Content-type: text/html; charset=utf-8\n\n";
                        $apache->custom_response( 404, <<"                      HTML");
                        <html>
@@ -643,6 +659,12 @@ sub unapi {
        my $data = $req->gather();
 
        if ($req->failed || !$data) {
+               # Escape user input before display
+               $command = CGI::escapeHTML($command);
+               $id = CGI::escapeHTML($id);
+               $type = CGI::escapeHTML($type);
+               $format = CGI::escapeHTML(decode_utf8($format));
+
                print "Content-type: text/html; charset=utf-8\n\n";
                $apache->custom_response( 404, <<"              HTML");
                <html>
@@ -836,6 +858,9 @@ sub supercat {
                } otherwise {
                        warn shift();
                        
+                       # Escape user input before display
+                       $id = CGI::escapeHTML($id);
+
                        print "Content-type: text/html; charset=utf-8\n\n";
                        $apache->custom_response( 404, <<"                      HTML");
                        <html>
@@ -878,6 +903,12 @@ sub supercat {
        $req->wait_complete;
 
        if ($req->failed) {
+               # Escape user input before display
+               $command = CGI::escapeHTML($command);
+               $id = CGI::escapeHTML($id);
+               $type = CGI::escapeHTML($type);
+               $format = CGI::escapeHTML(decode_utf8($format));
+
                print "Content-type: text/html; charset=utf-8\n\n";
                $apache->custom_response( 404, <<"              HTML");
                <html>
@@ -1428,7 +1459,7 @@ sub create_record_feed {
                next unless $node;
 
                $xml = '';
-               if ($lib && ($type eq 'marcxml' || $type eq 'atom') &&  $flesh > 0) {
+               if ($lib && ($type eq 'marcxml' || $type eq 'atom') &&  ($flesh > 0 || $flesh == 'uris')) {
                        my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, $depth, $flesh_feed, $paging );
                        while ( !$r->complete ) {
                                $xml .= join('', map {$_->content} $r->recv);
@@ -1439,8 +1470,8 @@ sub create_record_feed {
 
                $node->id($item_tag);
                #$node->update_ts(cleanse_ISO8601($record->edit_date));
-               $node->link(alternate => $feed->unapi . "?id=$item_tag&format=htmlholdings-full" => 'text/html') if ($flesh > 0);
-               $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh > 0);
+               $node->link(alternate => $feed->unapi . "?id=$item_tag&format=htmlholdings-full" => 'text/html') if ($flesh > 0 || $flesh == 'uris');
+               $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh > 0 || $flesh == 'uris');
                $node->link(unapi => $feed->unapi . "?id=$item_tag") if ($flesh);
                $node->link('unapi-id' => $item_tag) if ($flesh);
        }
index d024014..d0a9af1 100644 (file)
                                                ]]></script>
                                        </span>
                                </td>
-                               <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' datatype='holdings_xml' query='volumes volume uris uri' join=", ">
+                               <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query='volumes volume uris uri' join=", ">
                                        <script type='opac/slot-format'><![CDATA[
                                                var link = '<a href="' + item.getAttribute('href') + '">' + item.getAttribute('label') + '</a>';
                                                if (item.getAttribute('use_restriction'))