(sitka) rdetail display should use actual 856 values
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Wed, 7 Mar 2012 00:42:33 +0000 (16:42 -0800)
committertwirlip <twirlip@twirlip.org>
Wed, 18 Apr 2012 04:41:14 +0000 (21:41 -0700)
xml/rdetail/rdetail_summary.xml

index 4d4f415..a35977c 100755 (executable)
                 <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
                      *** summary screen with complex information, such as location-specific URIs (856$9). -->
                 <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.online;</td>
-                <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query="holdings">
+                <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query="datafield[tag='856']">
                     <script type='opac/slot-format'><![CDATA[
+                        var localize = findOrgUnitSN(BT.textContent(dojo.query("subfield[code='9']",item)[0]));
+                        if(localize){
+                            var here = findOrgUnit(getLocation());
+                            if(!orgIsMine(here,localize)){
+                                return;
+                            }
+                        }
                         var output = dojo.create('span');
-                        dojo.query("volumes volume uris uri", item).forEach(function(item){
-                            var caption = item.getAttribute('label');
-                            if (item.getAttribute('use_restriction'))
-                                caption += ' (Use restriction: ' + item.getAttribute('use_restriction') + ')';
-                            output.appendChild(dojo.create('a',{"href":item.getAttribute('href'),"innerHTML": caption}));
-                        });
+                        var href = BT.textContent(dojo.query("subfield[code='u']",item)[0]);
+                        var caption = BT.textContent(dojo.query("subfield[code='y']",item)[0]);
+                        var usage = BT.textContent(dojo.query("subfield[code='z']",item)[0]);
+                        if(!caption){
+                            caption = href;
+                        }
+                        if(usage){
+                                caption += ' (Use restriction: ' + usage + ')';
+                        }
+                        output.appendChild(dojo.create('a',{"href":href,"innerHTML": caption }));
                         return output.innerHTML;
                     ]]></script>
                 </td>