TPAC: Cleaner title display in simple and detailed views
authorDan Scott <dscott@laurentian.ca>
Sun, 22 Jan 2012 21:34:31 +0000 (16:34 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 31 Jan 2012 19:14:46 +0000 (14:14 -0500)
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 <dscott@laurentian.ca>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2

index 70c4f43..95c6f4a 100644 (file)
         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;
index 5c7cbcf..21ccaa4 100644 (file)
@@ -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" %] 
                     <tbody id="result_table">
                     [%  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;
+                    -%]
                         <tr class="result_table_row">
                                             <td class="results_row_count" name="results_row_count">[%
                                                     result_count; result_count = result_count + 1