The feed type could end with the string "-full", in which case we want
to return call numbers, copies, and URIS.
-Or the feed type could be "-uris", in which case we want to return
+Or the feed type could end with "-uris", in which case we want to return
call numbers and URIS.
Otherwise, we won't return any holdings.
=cut
sub parse_feed_type {
- my $type = shift;
+ my $type = shift || '';
if ($type =~ /-full$/o) {
return 1;
}
if ($type =~ /-uris$/o) {
- return "uris";
+ return 2;
}
# Otherwise, we'll return just the facts, ma'am
# Enable localized results of copy status, etc
$supercat->session_locale($locale);
- my $format = $cgi->param('format');
+ my $format = $cgi->param('format') || '';
my $flesh_feed = parse_feed_type($format);
(my $base_format = $format) =~ s/(-full|-uris)$//o;
- my ($id,$type,$command,$lib,$depth,$paging) = ('','','');
+ my ($id,$type,$command,$lib,$depth,$paging) = ('','record','');
+ my $body = "Content-type: application/xml; charset=utf-8\n\n";
+
+ if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
+ $id = $2;
+ $paging = $3;
+ ($lib,$depth) = split('/', $4);
+ $type = 'metarecord' if ($1 =~ /^m/o);
+ $type = 'authority' if ($1 =~ /^authority/o);
+ }
if (!$format) {
- my $body = "Content-type: application/xml; charset=utf-8\n\n";
-
if ($uri =~ m{^tag:[^:]+:([^\/]+)/([^\/[]+)(?:\[([0-9,]+)\])?(?:/(.+))?}o) {
- $id = $2;
- $paging = $3;
- ($lib,$depth) = split('/', $4);
- $type = 'record';
- $type = 'metarecord' if ($1 =~ /^m/o);
- $type = 'authority' if ($1 =~ /^authority/o);
my $list = $supercat
->request("open-ils.supercat.$type.formats")
next unless $node;
$xml = '';
- if ($lib && ($type eq 'marcxml' || $type eq 'atom') && ($flesh > 0 || $flesh eq 'uris')) {
+ if ($lib && ($type eq 'marcxml' || $type eq 'atom') && ($flesh > 0)) {
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);
$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 || $flesh eq 'uris');
- $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh > 0 || $flesh eq 'uris');
+ $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(unapi => $feed->unapi . "?id=$item_tag") if ($flesh);
$node->link('unapi-id' => $item_tag) if ($flesh);
}