Improved subject formatting on summary page, and better title bookmarking
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Oct 2010 15:15:49 +0000 (15:15 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 25 Oct 2010 15:15:49 +0000 (15:15 +0000)
Apply a modified version of Ben Ostrowsky's patch from
https://bugs.launchpad.net/evergreen/+bug/627133 - the modifications include
using BT.textContent() to retrieve the text of the subfields, and
getAttribute() instead of dojo.attr() for IE support.

From the description of 627133:

Currently the BibTemplate code in rdetail/rdetail_summary.xml for display
of subject headings only includes the 650. It should be expanded to:

  * include all standard subject added entry fields (or more broadly, all 6XX)
  * exclude control subfields (those whose subfield label is a digit) from display
  * only using the double-dash separator before subfields $x, $y, $z, and $v.
    The display text of other subfields should be separated from one another only
    by a space.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18456 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml

index 5d02f5e..ba243cf 100644 (file)
@@ -33,6 +33,7 @@
                         for (var i = 0; i < list.length; i++) {
                             out += BT.textContent(list[i]) + ' ';
                         }
+                        document.title += ': ' + out;
                         return out;
                     ]]></script>
                 </td>
                  *** summary screen with complex information, such as new search links on subjects. -->
             <tr>
                 <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.subjects;</td>
-                <td type='opac/slot-data' query='datafield[tag="650"]' class='rdetail_item'>
+                <td type='opac/slot-data' query='datafield[tag^="6"]' class='rdetail_item'>
                     <script type='opac/slot-format'><![CDATA[
                         var cgi = new CGI();
                         var other_params = [ 'd', 'l', 'r', 'av', 's', 'sd' ];
                         var total = '';
                         var output = [];
                         var list = dojo.query( 'subfield', item );
-                        for (var i =0; i < list.length; i++) {
-                            total += BT.textContent(list[i]) + ' ';
-                            var current = '<a href="rresult.xml?rt=subject&tp=subject&t=' + total;
-                            for (var p in other_params) {
-                                if (cgi.param(other_params[p]))
-                                    current += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
+                        for (var i = 0; i < list.length; i++) {
+                            var sub_code = list[i].getAttribute('code');
+                            if ( sub_code.match(/[a-z]/i) ) {
+                                var current = '';
+                                if ( sub_code.match(/[vxyz]/) ) {
+                                    current += '&#x2d;&#x2d; ';
+                                }
+                                total += BT.textContent(list[i]) + ' ';
+                                current += '<a href="rresult.xml?rt=subject&tp=subject&t=' + total.replace(/\s+$/, '');
+                                for (var p in other_params) {
+                                    if (cgi.param(other_params[p]))
+                                        current += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
+                                }
+                                current += '">' + BT.textContent(list[i]) + '</a>'
+                                output.push(current);
                             }
-                            current += '">' + BT.textContent(list[i]) + '</a>'
-                            output.push(current);
                         }
-                        return '<span>' + output.join(' &#x2d;&#x2d; ') + '</span><br/>';
+                        return '<span>' + output.join(' ') + '</span><br/>';
                     ]]></script>
                 </td>
             </tr>