From e6b521085368618c99f4dd81f262d6c0be65643a Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 1 Jun 2010 19:02:19 +0000 Subject: [PATCH] rid ourself of some namespace prefixes because IE is too braindead to understand them 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 | 30 +++++++++++----------- Open-ILS/web/js/dojo/openils/BibTemplate.js | 27 ++++++++++++------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm index bee64aa3d..0690a9075 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm @@ -426,7 +426,7 @@ use base 'OpenILS::WWW::SuperCat::Feed'; sub new { my $class = shift; - my $self = $class->SUPER::build(''); + my $self = $class->SUPER::build(''); $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(''); + my $self = $class->SUPER::build(''); $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(''); + my $self = $class->SUPER::build(''); $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(''); + my $self = $class->SUPER::build(''); $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(''); + my $self = $class->SUPER::build(''); $self->{type} = 'application/xml'; $self->{item_xpath} = '/marc:collection'; return $self; diff --git a/Open-ILS/web/js/dojo/openils/BibTemplate.js b/Open-ILS/web/js/dojo/openils/BibTemplate.js index d25dc5510..1b0f8334d 100644 --- a/Open-ILS/web/js/dojo/openils/BibTemplate.js +++ b/Open-ILS/web/js/dojo/openils/BibTemplate.js @@ -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); -- 2.11.0