From: Josh Stompro Date: Mon, 15 May 2017 14:19:23 +0000 (-0500) Subject: Show Added Content Inline - Instead of showing just one element of the added content X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fstompro%2Fadded_content_inline_larl;p=working%2FEvergreen.git Show Added Content Inline - Instead of showing just one element of the added content 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 --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 98aef3c272..488bb95b16 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -9,7 +9,7 @@ use Net::HTTP::NB; 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 @@ -566,7 +566,7 @@ sub added_content_stage1 { $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; } @@ -591,14 +591,14 @@ sub added_content_stage2 { # 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); diff --git a/Open-ILS/src/templates/opac/parts/record/addedcontentinline.tt2 b/Open-ILS/src/templates/opac/parts/record/addedcontentinline.tt2 new file mode 100644 index 0000000000..089ced67d2 --- /dev/null +++ b/Open-ILS/src/templates/opac/parts/record/addedcontentinline.tt2 @@ -0,0 +1,25 @@ +[% + 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' ]; + +%] +
+ + [% + + # FOR type IN ac_types.keys; + FOREACH type IN ac_types_ordered; + IF ctx.added_content.$type.content; %] + [% ac_types.$type %] +

[% ctx.added_content.$type.content %]

+ [% + END; + END; + %] +
diff --git a/Open-ILS/src/templates/opac/parts/record/contents.tt2 b/Open-ILS/src/templates/opac/parts/record/contents.tt2 index 29fc33b4cd..4dca611601 100644 --- a/Open-ILS/src/templates/opac/parts/record/contents.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/contents.tt2 @@ -202,4 +202,5 @@ END [%- content_html %] +[%- INCLUDE "opac/parts/record/addedcontentinline.tt2"; %] [%- END %] diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index b35cf5471d..c4b9f366fb 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -53,13 +53,13 @@ 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')} ];