Use a default auri label instead of http:// urls
authorJeff Godin <jgodin@tadl.org>
Tue, 3 Apr 2012 18:39:52 +0000 (14:39 -0400)
committerJeff Godin <jgodin@tadl.org>
Tue, 3 Apr 2012 18:39:52 +0000 (14:39 -0400)
Use a default auri label in search results and record summary
pages. This is mostly to prevent the symptoms of LP 918020
but may be more generally useful as well.

Also, use css_button class for BibTemplate-generated auri links
in a record summary.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv2/js/rdetail.js
Open-ILS/web/opac/skin/tadlv2/xml/rdetail/rdetail_summary.xml
Open-ILS/web/opac/skin/tadlv2/xml/result/result_table.xml

index ba8f086..beb5321 100644 (file)
@@ -541,6 +541,10 @@ function _rdetailDraw(r) {
                                        displayLabel = note;
                                }
                        }
+                       // Latch-ditch attempt to prevent URLs as display labels
+                       if (displayLabel.substring(0,7) == 'http://') {
+                               displayLabel = 'Connect to this resource online';
+                       }
                        $('rdetail_online').appendChild(elem('a', {href:href,'class':'css_button'}, displayLabel));
                        if (note && note != displayLabel) {
                                $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note));
index 3bc25f0..90dd95e 100644 (file)
                                <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.online;</td>
                                <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query='volumes volume uris uri' join=", ">
                                        <script type='opac/slot-format'><![CDATA[
-                                               var link = '<a href="' + item.getAttribute('href') + '">' + item.getAttribute('label') + '</a>';
+                                               var link;
+                                               var linklabel = item.getAttribute('label');
+                                               if (linklabel.substring(0,7) == 'http://') {
+                                                       linklabel = 'Connect to this resource online';
+                                               }
+                                               var link = '<a href="' + item.getAttribute('href') + '" class="css_button">' + linklabel + '</a>';
                                                if (item.getAttribute('use_restriction'))
                                                        link += ' (Use restriction: ' + item.getAttribute('use_restriction') + ')';
                                                return link;
index 4c628eb..a1e05e9 100644 (file)
                                             if (urihref.substring(0,20) == "http://via.tadl.org/") {
                                                 var uri_entry = dojo.create('div', {"style":"padding-bottom: 5px;"});
                                                 var link = dojo.create('a', {"class":"css_button", "href": urihref}, uri_entry);
+                                                if (urilabel.substring(0,7) == "http://") {
+                                                    // Provide a default label if label appears to be a URL
+                                                    urilabel = "Connect to this resource online";
+                                                }
                                                 var link_text = dojo.doc.createTextNode(urilabel);
                                                 link.appendChild(link_text);
                                                 output.appendChild(uri_entry);