data at a time, show all available added content inline in the record description.
Limited to author notes and reviews in our case. Added ability to order the content
display, to always show reviews first, then author notes.
Signed-off-by: Josh Stompro <stomproj@larl.org>
use IO::Select;
my $U = 'OpenILS::Application::AppUtils';
-our $ac_types = ['toc', 'anotes', 'excerpt', 'summary', 'reviews'];
+our $ac_types = ['anotes', 'reviews'];
# context additions:
# record : bre object
$req->host($self->apache->hostname);
- my $http_type = ($type eq $sel_type) ? 'GET' : 'HEAD';
+ my $http_type = 'GET';
$req->write_request($http_type => "/opac/extras/ac/$type/html/r/" . $rec_id);
$ctx->{added_content}->{$type}->{request} = $req;
}
# if we are requesting a specific type of content, give the
# backend code a little extra time to retrieve the content.
- my $wait = $type eq $sel_type ? 3 : 0; # TODO: config?
+ my $wait = 3; # TODO: config?
if ($sel->can_read($wait)) {
my ($code) = $req->read_response_headers;
$content->{status} = $code eq '200' ? 1 : 2;
$logger->debug("tpac: added content request for $type returned $code");
- if ($code eq '200' and $type eq $sel_type) {
+ if ($code eq '200') {
while (1) {
my $buf;
my $n = $req->read_entity_body($buf, 1024);
--- /dev/null
+[%
+ ac_types = {
+ reviews => l('Reviews'),
+ anotes => l('Author Notes'),
+ toc => l('Table of Contents'),
+ excerpt => l('Excerpt'),
+ summary => l('Summary')
+ };
+ ac_types_ordered = [ 'reviews', 'anotes' ];
+
+%]
+ <div id='ac_inline'>
+
+ [%
+
+ # FOR type IN ac_types.keys;
+ FOREACH type IN ac_types_ordered;
+ IF ctx.added_content.$type.content; %]
+ <strong>[% ac_types.$type %]</strong>
+ <p>[% ctx.added_content.$type.content %]</p>
+ [%
+ END;
+ END;
+ %]
+ </div>
[%- content_html %]
</tbody>
</table>
+[%- INCLUDE "opac/parts/record/addedcontentinline.tt2"; %]
[%- END %]
END;
extras = [
- {name => 'summaryplus', label => l('Summaries & More'), hide => hide_summary},
+ {name => 'summaryplus', label => l('Summaries & More'), hide => 1},
{name => 'annotation', label => l('Annotation'), hide => 1},
- {name => 'awards', label => l('Awards, Reviews, & Suggested Reads')},
+ {name => 'awards', label => l('Awards, Reviews, & Suggested Reads'), hide => 1},
{name => 'excerpt', label => l('Excerpt'), hide => 1},
{name => 'issues', label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)},
{name => 'preview', label => l('Preview'), hide => 1},
- {name => 'addedcontent', label => l('Additional Content'), hide => hide_ac}, # hide if all content is known to not exist
+ {name => 'addedcontent', label => l('Additional Content'), hide => 1}, # hide if all content is known to not exist
{name => 'cnbrowse', label => l('Shelf Browser')},
{name => 'marchtml', label => l('MARC Record')}
];