rid ourself of some namespace prefixes because IE is too braindead to understand...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 1 Jun 2010 19:02:19 +0000 (19:02 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 1 Jun 2010 19:02:19 +0000 (19:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16546 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm
Open-ILS/web/js/dojo/openils/BibTemplate.js

index bee64aa..0690a90 100644 (file)
@@ -426,7 +426,7 @@ use base 'OpenILS::WWW::SuperCat::Feed';
 
 sub new {
        my $class = shift;
-       my $self = $class->SUPER::build('<mods:modsCollection version="3.0" xmlns:mods="http://www.loc.gov/mods/"/>');
+       my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/" xmlns:mods="http://www.loc.gov/mods/"/>');
        $self->{type} = 'application/xml';
        $self->{item_xpath} = '/mods:modsCollection';
        return $self;
@@ -456,15 +456,15 @@ sub link {
        if ($type eq 'unapi' || $type eq 'opac') {
                $self->_create_node(
                        'mods:mods',
-                       'http://www.loc.gov/mods/',
-                       'mods:relatedItem',
+            undef,
+                       'relatedItem',
                        undef,
                        { type => 'otherFormat', id => 'link-'.$linkid }
                );
                $self->_create_node(
-                       "mods:mods/mods:relatedItem[\@id='link-$linkid']",
-                       'http://www.loc.gov/mods/',
-                       'mods:recordIdentifier',
+                       "mods:mods/relatedItem[\@id='link-$linkid']",
+            undef,
+                       'recordIdentifier',
                        $id
                );
                $linkid++;
@@ -478,7 +478,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods';
 
 sub new {
        my $class = shift;
-       my $self = $class->SUPER::build('<mods:modsCollection version="3.0" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+       my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
        $self->{type} = 'application/xml';
        $self->{item_xpath} = '/mods:modsCollection';
        return $self;
@@ -506,15 +506,15 @@ sub link {
        if ($type eq 'unapi' || $type eq 'opac') {
                $self->_create_node(
                        'mods:mods',
-                       'http://www.loc.gov/mods/v3',
-                       'mods:relatedItem',
+                       undef,
+                       'relatedItem',
                        undef,
                        { type => 'otherFormat', id => 'link-'.$linkid }
                );
                $self->_create_node(
-                       "mods:mods/mods:relatedItem[\@id='link-$linkid']",
-                       'http://www.loc.gov/mods/v3',
-                       'mods:recordIdentifier',
+                       "mods:mods/relatedItem[\@id='link-$linkid']",
+                       undef,
+                       'recordIdentifier',
                        $id
                );
                $linkid++;
@@ -529,7 +529,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 
 sub new {
        my $class = shift;
-       my $self = $class->SUPER::build('<mods:modsCollection version="3.2" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+       my $self = $class->SUPER::build('<modsCollection version="3.2" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
        $self->{type} = 'application/xml';
        $self->{item_xpath} = '/mods:modsCollection';
        return $self;
@@ -545,7 +545,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 
 sub new {
        my $class = shift;
-       my $self = $class->SUPER::build('<mods:modsCollection version="3.3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+       my $self = $class->SUPER::build('<modsCollection version="3.3" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
        $self->{type} = 'application/xml';
        $self->{item_xpath} = '/mods:modsCollection';
        return $self;
@@ -562,7 +562,7 @@ use base 'OpenILS::WWW::SuperCat::Feed';
 
 sub new {
        my $class = shift;
-       my $self = $class->SUPER::build('<marc:collection xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
+       my $self = $class->SUPER::build('<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
        $self->{type} = 'application/xml';
        $self->{item_xpath} = '/marc:collection';
        return $self;
index d25dc55..1b0f833 100644 (file)
@@ -17,7 +17,7 @@
 if(!dojo._hasResource["openils.BibTemplate"]) {
 
     dojo.require('DojoSRF');
-    dojo.require('dojox.data.dom');
+    dojo.require('dojox.xml.parser');
     dojo.require('dojo.string');
     dojo._hasResource["openils.BibTemplate"] = true;
     dojo.provide("openils.BibTemplate");
@@ -51,6 +51,15 @@ if(!dojo._hasResource["openils.BibTemplate"]) {
             return new_nl;
         },
 
+        textContent : function (node) {
+            var content = '';
+            if (node) {
+                if(window.ActiveXObject) content = node.text;
+                else content = node.textContent;
+            }
+            return content;
+        },
+
         render : function() {
 
             var all_slots = dojo.query('*[type^=opac/slot-data]', this.root);
@@ -122,25 +131,25 @@ if(!dojo._hasResource["openils.BibTemplate"]) {
                                     var templated = slot.getAttribute('templated') == 'true';
                                     if (debug) alert('BibTemplate debug -- slot ' + (templated ? 'is' : 'is not') + ' templated');
                                     if (templated) {
+                                        if (debug) alert('BibTemplate debug -- slot template innerHTML:\n' + slot.innerHTML);
                                         var template_values = {};
 
                                         dojo.query(
                                             '*[type=opac/template-value]',
                                             slot
                                         ).orphan().forEach(function(x) {
-                                            dojo.setObject(
-                                                x.getAttribute('name'),
-                                                (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot),
-                                                template_values
-                                            );
+                                            var name = x.getAttribute('name');
+                                            var value = (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot);
+                                            if (name && (value || value == '')) template_values[name] = value;
                                         });
-    
+
+                                        if (debug) alert('BibTemplate debug -- template values:\n' + dojo.toJson( template_values ));
                                         slot.innerHTML = dojo.string.substitute( unescape(slot.innerHTML), template_values );
                                     }
 
                                     var handler_node = dojo.query( '*[type=opac/slot-format]', slot )[0];
-                                    if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item', dojox.data.dom.textContent(handler_node) || handler_node.innerHTML);
-                                    else slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item','return dojox.data.dom.textContent(item) || item.innerHTML;');
+                                    if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item', dojox.xml.parser.textContent(handler_node) || handler_node.innerHTML);
+                                    else slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item','return dojox.xml.parser.textContent(item) || item.innerHTML;');
 
                                     if (item_list.length) {
                                         var content = dojo.map(item_list, dojo.partial(slot_handler,item_list,BT,bib,slot)).join(joiner);