From bf90109b0187b58b8754b091e129b21f44325ac2 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 19 Sep 2011 22:49:55 -0400 Subject: [PATCH] TPAC: and then there were series Also, tighten up spacing considerably. Signed-off-by: Dan Scott Signed-off-by: Thomas Berezansky --- .../templates/opac/parts/record/authors.tt2 | 8 +- .../templates/opac/parts/record/series.tt2 | 38 ++++-- .../templates/opac/parts/record/summary.tt2 | 117 +++++++++--------- 3 files changed, 89 insertions(+), 74 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/record/authors.tt2 b/Open-ILS/src/templates/opac/parts/record/authors.tt2 index e2e749d9ae..fc06cac74c 100644 --- a/Open-ILS/src/templates/opac/parts/record/authors.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/authors.tt2 @@ -1,4 +1,4 @@ -[% +[%- authors = [ { @@ -45,13 +45,13 @@ END; %]
-[% FOREACH author IN authors; +[%- FOREACH author IN authors; NEXT UNLESS author.xpath; links = PROCESS build_author_links(xpath=author.xpath, label=author.label); IF links.match('\S') %] [% links %] - [% END %] -[% END %] + [%- END %] +[%- END %]
diff --git a/Open-ILS/src/templates/opac/parts/record/series.tt2 b/Open-ILS/src/templates/opac/parts/record/series.tt2 index edf99ba504..06def160a0 100644 --- a/Open-ILS/src/templates/opac/parts/record/series.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/series.tt2 @@ -3,14 +3,30 @@ loc = CGI.param('loc'); %] -
- - [% FOR tag IN series_tags; %] -
- [% FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]/*') %] - [% IF !loop.first %] [% END %] - [% node.textContent | html %] - [% END %] - [% END; %] -
-
+[% BLOCK render_series; + results = []; + FOR tag IN series_tags; + FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]/*'); + node_uri = node.textContent | uri; + node_html = node.textContent | html; + IF !loop.first; + results.last = result.last _ ''; + END; + results.push('' _ node_html _ '' + ); + END; + END; +END; +%] + +[%- series_anchors = PROCESS render_series; + IF series_anchors.length > 0; %] + +
    + [%- FOR entry IN series_anchors %] +
  • [% entry %]
  • + [% END %] +
+[%- END %] diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index a073087e77..0585f3973b 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -9,6 +9,8 @@ [% INCLUDE 'opac/parts/record/refworks.tt2' %] [%- END %] +
+ [%- # This holds the record summary information %]
[% ident = attrs.isbn_clean || attrs.upc; IF ident; %] @@ -38,52 +40,53 @@
-

[% attrs.title_extended | html %]

- [%- INCLUDE "opac/parts/record/authors.tt2" %] [%- IF attrs.format_icon %]
[% attrs.format_label %]
[%- END %] - [%- IF openurl.enabled == 'true'; - sfx = [] - FOR issn IN args.issns; - sfx = sfx.import(ResolverResolver.resolve_issn(issn, openurl.baseurl)); - END; - IF sfx.size && sfx.0 != ''; - %] -
- [% l("Electronic resources") %] - - [%- - FOR res IN sfx; - %] - - - - - [%- END %] -
[% res.public_name %][% res.target_coverage %]
- [%- END %] - [%- IF sfx.size && sfx.0 != '' %] -
- [%- END %] - [%- FOR uri IN args.uris; %] -
- [% uri.link %][% ' - ' _ uri.note IF uri.note %] -
+

[% attrs.title_extended | html %]

+ [%- INCLUDE "opac/parts/record/authors.tt2" %] +
+ +[%- IF openurl.enabled == 'true'; + sfx = [] + FOR issn IN args.issns; + sfx = sfx.import(ResolverResolver.resolve_issn(issn, openurl.baseurl)); + END; + IF sfx.size && sfx.0 != ''; +%] +
+ [% l("Electronic resources") %] + +[%- + FOR res IN sfx; +%] + + + + [%- END %] - [%- # hold/copy summary %] - [%- IF ctx.copy_summary.0.count %] -
- - [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", - ctx.record_hold_count, ctx.copy_summary.0.count) %] - - [% l('[quant,_1,copy,copies] currently available.', ctx.copy_summary.0.available) %] -
- [% END %] +
[% res.public_name %][% res.target_coverage %]
+[%- END %] +[%- IF sfx.size && sfx.0 != '' %] +
+[%- END %] +[%- FOR uri IN args.uris; %] +
+ [% uri.link %][% ' - ' _ uri.note IF uri.note %]
+[%- END %] +[%- # hold/copy summary %] +[%- IF ctx.copy_summary.0.count %] +
+ + [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", + ctx.record_hold_count, ctx.copy_summary.0.count) %] + + [% l('[quant,_1,copy,copies] currently available.', ctx.copy_summary.0.available) %] +
+[% END %] [%- IF ctx.copy_summary.0.count %]
@@ -95,17 +98,17 @@ [% l("Call Number") %] [% l("Barcode") %] [% l("Shelving Location") %] - [% IF ctx.is_staff %] + [%- IF ctx.is_staff %] [% l("Age Hold Protection") %] [% l("Create Date") %] [% l("Holdable?") %] - [% END %] + [%- END %] [% l("Status") %] [% l("Due Date") %] - [% last_cn = 0; + [%- last_cn = 0; FOR copy_info IN ctx.copies; NEXT IF copy_info.call_number_label == '##URI##' %] @@ -118,7 +121,7 @@ [% copy_info.call_number_label | html %] [% copy_info.barcode | html %] [% copy_info.copy_location | html %] - [% IF ctx.is_staff %] + [%- IF ctx.is_staff %] [% copy_info.age_protect ? ctx.get_crahp(copy_info.age_protect).name : l('None') | html %] @@ -135,15 +138,15 @@ IF overall_holdable; l("Place on"); %] [% l("copy") %] - [% IF copy_info.call_number != last_cn; + [%- IF copy_info.call_number != last_cn; last_cn = copy_info.call_number; l(" / "); %] [% l("volume") %] - [% END; + [%- END; ELSE; l("No"); END %] - [% END %] + [%- END %] [% copy_info.copy_status | html %] [% IF copy_info.due_date; @@ -155,37 +158,37 @@ '-'; END %] - [% END %] + [%- END %] - [% IF ctx.copy_offset > 0; + [%- IF ctx.copy_offset > 0; new_offset = ctx.copy_offset - ctx.copy_limit; IF new_offset < 0; new_offset = 0; END %] « [% l('Previous [_1]', ctx.copy_offset - new_offset) %] - [% END %] - [% IF ctx.copies.size >= ctx.copy_limit %] + [%- END %] + [%- IF ctx.copies.size >= ctx.copy_limit %] [% l('Next [_1]', ctx.copy_limit) %] » - [% END %] + [%- END %] - [% more_copies_limit = 50 %] [%# TODO: config %] - [% IF ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %] + [%- more_copies_limit = 50 %] [%# TODO: config %] + [%- IF ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
[% l('Show more copies') %]
- [% ELSIF ctx.copy_limit == more_copies_limit %] + [%- ELSIF ctx.copy_limit == more_copies_limit %]
[% l('Show fewer copies') %]
- [% END %] + [%- END %] @@ -209,7 +212,6 @@ [%- END %] [%- END %] - [%- IF attrs.phys_desc %]
  • [% l("Physical Description:") %] @@ -230,8 +232,5 @@ [%- END %] - [%- INCLUDE "opac/parts/record/subjects.tt2" %] - - [%- INCLUDE "opac/parts/record/series.tt2" %] -- 2.43.2