my $host = $cgi->virtual_host || $cgi->server_name;
my $format = $cgi->param('format');
+ my $flesh_feed = ($format =~ /-full$/o) ? 1 : 0;
+ (my $base_format = $format) =~ s/-full$//o;
my ($id,$type,$command,$lib) = ('','','');
if (!$format) {
<formats id='$uri'>
<format name='opac' type='text/html'/>
<format name='html' type='text/html'/>
- <format name='htmlcard' type='text/html'/>
<format name='htmlholdings' type='text/html'/>
+ <format name='html-full' type='text/html'/>
+ <format name='htmlholdings-full' type='text/html'/>
FORMATS
} elsif ($type eq 'metarecord') {
$body = <<" FORMATS";
}
$body .= "/>\n";
+
+ if (OpenILS::WWW::SuperCat::Feed->exists($type)) {
+ $body .= "\t<format name='$type-full' type='application/xml'";
+
+ for my $part ( qw/namespace_uri docs schema_location/ ) {
+ $body .= " $part='$$h{$type}{$part}'"
+ if ($$h{$type}{$part});
+ }
+
+ $body .= "/>\n";
+ }
}
$body .= "</formats>\n";
<formats>
<format name='opac' type='text/html'/>
<format name='html' type='text/html'/>
- <format name='htmlcard' type='text/html'/>
<format name='htmlholdings' type='text/html'/>
+ <format name='html-full' type='text/html'/>
+ <format name='htmlholdings-full' type='text/html'/>
FORMATS
}
$body .= "/>\n";
+
+ if (OpenILS::WWW::SuperCat::Feed->exists($type)) {
+ $body .= "\t<format name='$type-full' type='application/xml'";
+
+ for my $part ( qw/namespace_uri docs schema_location/ ) {
+ $body .= " $part='$$h{$type}{$part}'"
+ if ($$h{$type}{$part});
+ }
+
+ $body .= "/>\n";
+ }
}
$body .= "</formats>\n";
print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id\n\n"
if ($type eq 'record');
return 302;
- } elsif (OpenILS::WWW::SuperCat::Feed->exists($format)) {
+ } elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format)) {
my $feed = create_record_feed(
$format => [ $id ],
$base,
- $lib
+ $lib,
+ $flesh_feed
);
$feed->root($root);
$feed->creator($host);
$feed->update_ts(gmtime_ISO8601());
- $feed->link( unapi => $base);
+ $feed->link( unapi => $base) if ($flesh_feed);
print "Content-type: ". $feed->type ."; charset=utf-8\n\n";
print entityize($feed->toString) . "\n";
my $path = $cgi->path_info;
my ($id,$type,$format,$command) = reverse split '/', $path;
-
+ my $flesh_feed = ($type =~ /-full$/o) ? 1 : 0;
+ (my $base_format = $format) =~ s/-full$//o;
if ( $path =~ m{^/formats(?:/([^\/]+))?$}o ) {
print "Content-type: application/xml; charset=utf-8\n";
if ($1 eq 'record') {
print "<format>
- <name>htmlcard</name>
+ <name>htmlholdings</name>
<type>text/html</type>
</format>
<format>
- <name>htmlholdings</name>
+ <name>html</name>
<type>text/html</type>
</format>
<format>
- <name>html</name>
+ <name>htmlholdings-full</name>
+ <type>text/html</type>
+ </format>
+ <format>
+ <name>html-full</name>
<type>text/html</type>
</format>";
}
}
print '</format>';
+
+ if (OpenILS::WWW::SuperCat::Feed->exists($type)) {
+ print "<format><name>$type-full</name><type>application/xml</type>";
+
+ for my $part ( qw/namespace_uri docs schema_location/ ) {
+ print "<$part>$$h{$type}{$part}</$part>"
+ if ($$h{$type}{$part});
+ }
+
+ print '</format>';
+ }
+
}
print "</formats>\n";
<type>text/html</type>
</format>
<format>
- <name>htmlcard</name>
+ <name>htmlholdings</name>
+ <type>text/html</type>
+ </format>
+ <format>
+ <name>html</name>
<type>text/html</type>
</format>
<format>
- <name>htmlholdings</name>
+ <name>htmlholdings-full</name>
<type>text/html</type>
</format>
<format>
- <name>html</name>
+ <name>html-full</name>
<type>text/html</type>
</format>";
}
print '</format>';
+
+ if (OpenILS::WWW::SuperCat::Feed->exists($type)) {
+ print "<format><name>$type-full</name><type>application/xml</type>";
+
+ for my $part ( qw/namespace_uri docs schema_location/ ) {
+ print "<$part>$$h{$type}{$part}</$part>"
+ if ($$h{$type}{$part});
+ }
+
+ print '</format>';
+ }
+
}
print "</formats>\n";
print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id\n\n"
if ($type eq 'record');
return 302;
- } elsif (OpenILS::WWW::SuperCat::Feed->exists($format)) {
+ } elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format)) {
my $feed = create_record_feed(
$format => [ $id ],
- $base
+ undef, undef,
+ $flesh_feed
);
$feed->root($root);
$feed->creator($host);
$feed->update_ts(gmtime_ISO8601());
- $feed->link( unapi => $base);
+ $feed->link( unapi => $base) if ($flesh_feed);
print "Content-type: ". $feed->type ."; charset=utf-8\n\n";
print entityize($feed->toString) . "\n";
#warn "URL breakdown: $url -> $root -> $base -> $path -> $unapi";
my ($id,$type) = reverse split '/', $path;
+ my $flesh_feed = ($type =~ /-full$/o) ? 1 : 0;
my $bucket = $actor->request("open-ils.actor.container.public.flesh", 'biblio', $id)->gather(1);
return Apache2::Const::NOT_FOUND unless($bucket);
$type,
[ map { $_->target_biblio_record_entry } @{ $bucket->items } ],
$unapi,
+ undef,
+ $flesh_feed
);
$feed->root($root);
$path =~ s/^\/(?:feed\/)?freshmeat\///og;
my ($type,$rtype,$axis,$limit,$date) = split '/', $path;
+ my $flesh_feed = ($type =~ /-full$/o) ? 1 : 0;
$limit ||= 10;
my $list = $supercat->request("open-ils.supercat.$rtype.record.$axis.recent", $date, $limit)->gather(1);
return 302;
}
- my $feed = create_record_feed( $type, $list, $unapi);
+ my $feed = create_record_feed( $type, $list, $unapi, undef, $flesh_feed);
$feed->root($root);
if ($date) {
} elsif ($type eq '-') {
$type = 'atom';
}
-
+ my $flesh_feed = ($type =~ /-full$/o) ? 1 : 0;
$terms = decode_utf8($terms);
$terms =~ s/\+/ /go;
$type,
[ map { $_->[0] } @{$recs->{ids}}[$offset .. $offset + $limit - 1] ],
$unapi,
- $org
+ $org,
+ $flesh_feed
);
$feed->root($root);
$feed->lib($org);
);
$feed->link(
- html =>
+ 'html' =>
$base . "/$version/$org/html/$class?searchTerms=$terms" =>
'text/html'
);
+ $feed->link(
+ 'html-full' =>
+ $base . "/$version/$org/html-full/$class?searchTerms=$terms" =>
+ 'text/html'
+ );
+
$feed->link( unapi => $unapi);
$feed->link(
my $unapi = shift;
my $lib = shift || '-';
+ my $flesh = shift;
+ $flesh = 1 if (!defined($flesh));
my $cgi = new CGI;
my $base = $cgi->url;
my $year = (gmtime())[5] + 1900;
+ my $flesh_feed = ($type =~ s/-full$//o) ? 1 : 0;
+
my $feed = new OpenILS::WWW::SuperCat::Feed ($type);
- $feed->base($base);
- $feed->unapi($unapi);
+ $feed->base($base) if ($flesh);
+ $feed->unapi($unapi) if ($flesh);
$type = 'atom' if ($type eq 'html');
- $type = 'marcxml' if ($type eq 'htmlcard' or $type eq 'htmlholdings');
+ $type = 'marcxml' if ($type eq 'htmlholdings');
#$records = $supercat->request( "open-ils.supercat.record.object.retrieve", $records )->gather(1);
my $node = $feed->add_item($xml);
next unless $node;
- if ($lib && $type eq 'marcxml') {
+ if ($lib && $type eq 'marcxml' && $flesh) {
$xml = $supercat->request( "open-ils.supercat.record.holdings_xml.retrieve", $rec, $lib )->gather(1);
$node->add_holdings($xml);
}
- $node->id($item_tag);
+ $node->id($item_tag) if ($flesh);
#$node->update_ts(clense_ISO8601($record->edit_date));
- $node->link(alternate => $feed->unapi . "?id=$item_tag&format=htmlholdings" => 'text/html');
- $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac");
- $node->link(unapi => $feed->unapi . "?id=$item_tag");
- $node->link('unapi-id' => $item_tag);
+ $node->link(alternate => $feed->unapi . "?id=$item_tag&format=htmlholdings-full" => 'text/html') if ($flesh);
+ $node->link(opac => $feed->unapi . "?id=$item_tag&format=opac") if ($flesh);
+ $node->link(unapi => $feed->unapi . "?id=$item_tag") if ($flesh);
+ $node->link('unapi-id' => $item_tag) if ($flesh);
}
return $feed;