From ffed5ee6377841d507a7f779c85425a413278607 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 22 Jan 2012 16:34:31 -0500 Subject: [PATCH] TPAC: Cleaner title display in simple and detailed views The TPAC uses a simple 245a display for the "simple view" in search results, so records like the concerto.sql "Violin concerto no. 3 in G, K. 216 ;" display with a trailing semicolon that is rather disconcerting. Similarly, the subfields in the extended title as displayed in the record detail view was simply concatenating subfields together. This resulted in titles like: Violin concerto no. 3 in G, K. 216 ;Sinfonia ... rather than: Violin concerto no. 3 in G, K. 216 ; Sinfonia ... This commit strips trailing punctuation that suggests a continuation (:;/) from the brief title and joins the subfields with a space for the extended title. Also, enable the detailed view in search results to display the complete title. Signed-off-by: Dan Scott Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/templates/opac/parts/misc_util.tt2 | 13 +++++++++++-- Open-ILS/src/templates/opac/parts/result/table.tt2 | 7 ++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 70c4f43e47..95c6f4a1d4 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -13,9 +13,18 @@ END; args.upc = args.upcs.0; # use first UPC as the default args.issn = xml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent; - args.title = xml.findnodes('//*[@tag="245"]/*[@code="a"]').textContent; - args.title_extended = xml.findnodes('//*[@tag="245"]').textContent; args.author = xml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent; + + # Avoid ugly trailing syntax on brief titles + args.title = xml.findnodes('//*[@tag="245"]/*[@code="a"]').textContent; + args.title = args.title | replace('[:;/]$', ''); + + # Provide correct spacing between the subfields + titsubs = xml.findnodes('//*[@tag="245"]/*[@code]'); + titsubs_content = []; + FOR sub IN titsubs; titsubs_content.push(sub.textContent); END; + args.title_extended = titsubs_content.join(" "); + args.publisher = xml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent; args.pubdate = xml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent; args.summary = xml.findnodes('//*[@tag="520"]/*[@code="a"]').textContent; diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 5c7cbcf6f3..21ccaa4f67 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -7,6 +7,7 @@ IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END; result_count = ctx.result_start; + %] [% PROCESS "opac/parts/result/paginate.tt2" %] @@ -30,7 +31,11 @@ [% FOR rec IN ctx.records; attrs = {marc_xml => rec.marc_xml}; - PROCESS get_marc_attrs args=attrs %] + PROCESS get_marc_attrs args=attrs; + IF CGI.param('detail_record_view'); + attrs.title = attrs.title_extended; + END; + -%] [% result_count; result_count = result_count + 1 -- 2.11.0