From 73c6e8dc85fa82de666825bbafdd220f15c134d3 Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 14 Apr 2011 21:09:32 +0000 Subject: [PATCH] Restore URIs in marcxml-uris unAPI format 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/trunk@20091 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm | 37 ++++++++++++++++++++-- .../skin/default/xml/rdetail/rdetail_summary.xml | 2 +- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm index 107fc35c2..1e7c75a42 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm @@ -547,6 +547,12 @@ sub unapi { if ($type eq 'isbn') { my $rec = $supercat->request('open-ils.supercat.isbn.object.retrieve',$id)->gather(1); if (!@$rec) { + # 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"); @@ -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"); @@ -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"); @@ -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"); @@ -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"); @@ -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"); @@ -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 eq '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 eq 'uris'); + $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh > 0 || $flesh eq 'uris'); $node->link(unapi => $feed->unapi . "?id=$item_tag") if ($flesh); $node->link('unapi-id' => $item_tag) if ($flesh); } diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml index 17f12d582..9908b2a6d 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml @@ -130,7 +130,7 @@ ]]> - +