Add subjects to sidebar
authorJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 03:31:04 +0000 (23:31 -0400)
committerJeff Godin <jgodin@tadl.org>
Mon, 23 Apr 2012 03:31:04 +0000 (23:31 -0400)
Add bibtemplate style subjects to the sidebar. Shows only in
record detail view, no apparent problems being present-but-
not-visible elsewhere.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv4/xml/common/sidebar.xml

index f1f4d36..78bef51 100644 (file)
                </div>
        </div>
 
+    <div id='sidebarSubjects' class='hide_me'>
+                <div>
+                <h4>Related Subjects</h4>
+                </div>
+                <div 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', 'ol' ];
+                        var total = '';
+                        var output = [];
+                        var list = dojo.query( 'subfield', item );
+                        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);
+                            }
+                        }
+                        unHideMe($('sidebarSubjects'));
+                        return '<span>' + output.join(' ') + '</span><br/>';
+                    ]]></script>
+                </div>
+    </div>
+
     <div id='facetSidebarContainer' class='hide_me'>
 
         <div class="side_bar_item" style="margin-top: 10px; font-weight: bold;">