[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. cf3b5e062b11729904952fbc8a1c91a73960bf64

Evergreen Git git at git.evergreen-ils.org
Tue Jan 21 13:41:11 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  cf3b5e062b11729904952fbc8a1c91a73960bf64 (commit)
       via  9f7b95cdaf7d7ecedb928c96d0127522be9b7e73 (commit)
      from  7036fcc024430cca1f3e2ae8e432fa8835800124 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cf3b5e062b11729904952fbc8a1c91a73960bf64
Author: Dan Scott <dscott at laurentian.ca>
Date:   Wed Jan 15 22:33:25 2014 -0500

    TPAC: Display authors using inline-block
    
    Rather than letting author credits wrap willy-nilly, use inline-block mode so
    that each line will begin with a new author. Devices with constrained screens
    in particular benefit from this, as the list of authors is much easier to scan,
    and wider screens can still fit multiple authors on a single line.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2
index 4b00864..1076338 100644
--- a/Open-ILS/src/templates/opac/css/style.css.tt2
+++ b/Open-ILS/src/templates/opac/css/style.css.tt2
@@ -1154,7 +1154,10 @@ a.dash-link:hover { text-decoration: underline !important; }
 
 .text-right { text-align: right; }
 .text-right-top { text-align: right; vertical-align: top; }
-.rdetail-author-div { padding-bottom: 10px; }
+.rdetail-author-div {
+    padding-bottom: 10px;
+    display: inline-block;
+}
 
 .invisible { visibility: hidden; }
 .rdetail-extras-summary { margin: 10px; }

commit 9f7b95cdaf7d7ecedb928c96d0127522be9b7e73
Author: Dan Scott <dscott at laurentian.ca>
Date:   Wed Jan 15 15:25:02 2014 -0500

    TPAC: Use indexed subfields only in author search links
    
    Addresses LP# 1267231 in which we found that the titles of works in the added
    author field (such as subfield t) were showing up in the link ahead of the
    author's birth and death date (if applicable). Now we reserve the link for
    only the indexed author subfields (depends on whether the name is personal,
    corporate, or conference, but generally subfields a/b/c/d/e/n/q), then the
    extra subfields go after the name + dates, then we finally put the relationship
    into the parentheses after everything else.
    
    We also simplify the markup so that each name is contained in a single <span
    class="rdetail_author_div"> element to make it easier to control the layout.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/opac/parts/record/authors.tt2 b/Open-ILS/src/templates/opac/parts/record/authors.tt2
index 676e0f8..c8e5678 100644
--- a/Open-ILS/src/templates/opac/parts/record/authors.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/authors.tt2
@@ -23,19 +23,32 @@ authors = [
     }
 ];
 
+BLOCK normalize_qterm;
+    subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
+END;
+
+BLOCK normalize_authors;
+    link_term = link_term _ ' ' _ sf;
+    sf_raw = PROCESS normalize_qterm;
+    qterm = qterm _ ' ' _ sf_raw;
+    indexed_term = 1;
+END;
+
 BLOCK build_author_links;
     FOR node IN ctx.marc_xml.findnodes(xpath);
         author_cnt = author_cnt + 1;
         contrib_ref = '#schemacontrib' _ author_cnt;
-        iprop = '';
-        term = '';
-        qterm = '';
+        iprop = ''; # schema.org item type / property
+        link_term = ''; # Linked term (e.g. Personal name + Fuller form of name)
+        supp_term = ''; # Supplementary terms
+        qterm = ''; # Search query
         tlabel = '';
         birthdate = '';
         deathdate = '';
         graphics = [];
         tag = node.getAttribute('tag');
         FOR subfield IN node.childNodes;
+            indexed_term = '';
             NEXT UNLESS subfield.nodeName == "subfield";
             code = subfield.getAttribute('code');
             IF code == '4';
@@ -49,23 +62,36 @@ BLOCK build_author_links;
             END;
             NEXT UNLESS code.match('[a-z]');
             sf = subfield.textContent | html;
-            IF code.match('[acdq]');
-                sf_raw = subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
-                qterm = qterm _ ' ' _ sf_raw;
-            END;
+
             # Only Persons have birth/death dates in schema.org
-            IF code.match('d') && tag.substr(1,2) == '00';
-                IF subfield.textContent.match('^\s*\d{4}');
-                    birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
+            # Match personal/corporate/conference MODS subfields
+            IF tag.substr(1,2) == '00';
+                IF code.match('[abcqu]');
+                    PROCESS normalize_authors;
                 END;
-                IF subfield.textContent.match('-\d{4}.*$');
-                    deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
+                IF code.match('d');
+                    IF subfield.textContent.match('^\s*\d{4}');
+                        birthdate = subfield.textContent.replace('^\s*(\d{4}).*$', '$1');
+                    END;
+                    IF subfield.textContent.match('-\d{4}.*$');
+                        deathdate = subfield.textContent.replace('^\s*.{4}\-(\d{4}).*$', '$1');
+                    END;
+                    indexed_term = 1;
+                    sf_raw = PROCESS normalize_qterm;
+                    qterm = qterm _ sf_raw;
                 END;
-            ELSE;
-                term = term _ ' ' _ sf;
+            ELSIF tag.substr(1,2) == '10';
+                IF code.match('[abcdn]');
+                    PROCESS normalize_authors;
+                END;
+            ELSIF code.match('[acdeq]');
+                PROCESS normalize_authors;
+            END;
+            UNLESS indexed_term;
+                supp_term = supp_term _ ' ' _ sf;
             END;
         END;
-        url = mkurl(ctx.opac_root _ '/results', {query => qterm, qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms));
+        url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms));
         author_type = (tlabel || label) | html;
         
         # schema.org changes
@@ -79,33 +105,41 @@ BLOCK build_author_links;
             END;
         ELSIF type == 'added';
             IF tag.substr(1,2) == '00';
-                iprop = ' typeOf="Person" property="contributor"';
+                iprop = ' typeof="Person" property="contributor"';
             ELSE;
-                iprop = ' typeOf="Organization" property="contributor"';
+                iprop = ' typeof="Organization" property="contributor"';
             END;
         END;
-        '<span' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '">';
-        IF iprop; '<span property="name" about="' _ contrib_ref _ '">'; END;
-        term.replace('^\s+', '');
-        IF iprop; '</span>'; END;
+        authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '"><span resource="' _ contrib_ref _ '">';
+        IF iprop; authtml = authtml _ '<span property="name">'; END;
+        authtml = authtml _ link_term.replace('^\s+', '');
+        IF iprop; authtml = authtml _ '</span>'; END;
         IF birthdate;
-            ' <span property="birthDate" about="' _ contrib_ref _ '">' _ birthdate _ '</span>-';
+            authtml = authtml _ ' <span property="birthDate">' _ birthdate _ '</span>-';
         END;
         IF deathdate;
-            '<span property="deathDate" about="' _ contrib_ref _ '">' _ deathdate _ '</span>';
+            authtml = authtml _ '<span property="deathDate">' _ deathdate _ '</span>';
+        END;
+        authtml = authtml _ '</span></a>'; # End search link
+
+        # Display supplemental terms (mostly about the author's work)
+        IF supp_term;
+            authtml = authtml _ ' ' _ supp_term;
         END;
-        '</a>'; # End search link
+
+        # Display linked 880 fields
         FOREACH link880 IN graphics;
             diratt = '';
             IF link880.dir;
                 diratt = ' dir="' _ link880.dir _ '"';
             END;
-            ' <span class="graphic880"' _ diratt _ '>';
+            authtml = authtml _ ' <span class="graphic880"' _ diratt _ '>';
             link880.value | html;
-            '</span>';
+            authtml = authtml _ '</span>';
         END;
-        ' (<span property="description" about="' _ contrib_ref _ '">' _ author_type _ '</span>). ';
-        '</span>'; # End author span
+        authtml = authtml _ ' (<span property="description">' _ author_type _ '</span>). ';
+        authtml = authtml _ '</span>'; # End author span
+        authlist.push(authtml);
     END;
 END;
 %]
@@ -113,13 +147,16 @@ END;
 <div class='rdetail_authors_div'>
 [%- FOREACH author IN authors;
     NEXT UNLESS author.xpath; 
-    links = PROCESS build_author_links(
+    authlist = [];
+    PROCESS build_author_links(
         xpath=author.xpath, label=author.label, type=author.type
     );
-    IF links.match('\S') %]
-    <span class='rdetail-author-div'>[% links %]</span>
-    [%- END %]
-[%- END %]
+    IF authlist.size;
+        FOREACH authtml IN authlist;
+            authtml;
+        END;
+    END;
+END %]
 </div>
 
 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/opac/css/style.css.tt2      |    5 +-
 .../src/templates/opac/parts/record/authors.tt2    |  103 +++++++++++++------
 2 files changed, 74 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list