export UPDATESDIR=@localstatedir@/updates
export datadir=@localstatedir@/data
-export circrulesdir=@localstatedir@/circ
-export catalogscriptdir=@localstatedir@/catalog
-export penaltyrulesdir=@localstatedir@/penalty
export XSLDIR=@localstatedir@/xsl
export REPORTERDIR=@localstatedir@/reporter
export SOCK=@localstatedir@/lock
+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-use lib '../src/perlmods/lib/';
-use lib '../src/perlmods/lib/OpenILS/Utils/';
-
-use OpenSRF::Utils::JSON;
-use OpenSRF::System;
-use OpenILS::Utils::ScriptRunner;
-use OpenSRF::Utils::Logger;
-use OpenSRF::Utils::SettingsClient;
-use OpenSRF::EX qw(:try);
-use Fieldmapper (IDL => 'fm_IDL.xml');
-
-unless (@ARGV > 1) {
- print <<USAGE;
-Usage: $0 /openils-root-dir script.js
-USAGE
-}
-
-my $root = shift(@ARGV);
-
-OpenSRF::System->bootstrap_client( config_file => $root.'/conf/opensrf_core.xml');
-
-try {
- OpenILS::Utils::ScriptRunner->add_path($root.'/var/web/opac/common/js/');
- OpenILS::Utils::ScriptRunner->add_path('../src/javascript/backend/libs/');
- OpenILS::Utils::ScriptRunner->add_path('./');
-
- print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new( file => shift(@ARGV) )->run );
- #print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new->run( shift(@ARGV) ) );
-
-} otherwise {
- warn 'crap:'.shift();
-};
-
<notify_hold>
<email>false</email> <!-- set to false to disable hold notice emails -->
</notify_hold>
-
- <!-- circulation policy scripts -->
- <script_path>LIBDIR/javascript</script_path>
- <script_path>LOCALSTATEDIR</script_path>
- <script_path>LOCALSTATEDIR/catalog</script_path>
- <legacy_script_support>false</legacy_script_support>
- <scripts>
- <circ_permit_patron>circ/circ_permit_patron.js</circ_permit_patron>
- <circ_permit_copy>circ/circ_permit_copy.js</circ_permit_copy>
- <circ_duration>circ/circ_duration.js</circ_duration>
- <circ_recurring_fines>circ/circ_recurring_fines.js</circ_recurring_fines>
- <circ_max_fines>circ/circ_max_fines.js</circ_max_fines>
- <circ_permit_renew>circ/circ_permit_renew.js</circ_permit_renew>
- <circ_permit_hold>circ/circ_permit_hold.js</circ_permit_hold>
- </scripts>
-
</app_settings>
</open-ils.circ>
prefix=@prefix@
exec_prefix=@exec_prefix@
datadir=@localstatedir@/data
-circrulesdir=@localstatedir@/circ
-catalogscriptdir=@localstatedir@/catalog
-penaltyrulesdir=@localstatedir@/penalty
examples = @top_srcdir@/Open-ILS/examples
-jsbackend = @srcdir@/javascript/backend
supportscr = @srcdir@/support-scripts
# Collect files to be used by multiple targets
installautojs = $(autojsbinscripts)
-#circ-rules-install
-circrules_SCRIPTS = $(jsbackend)/circ/circ_duration.js \
- $(jsbackend)/circ/circ_groups.js \
- $(jsbackend)/circ/circ_item_config.js \
- $(jsbackend)/circ/circ_lib.js \
- $(jsbackend)/circ/circ_permit_copy.js \
- $(jsbackend)/circ/circ_permit_hold.js \
- $(jsbackend)/circ/circ_permit_patron.js \
- $(jsbackend)/circ/circ_permit_renew.js
-penaltyrules_SCRIPTS = $(jsbackend)/penalty/patron_penalty.js
-catalogscript_SCRIPTS = $(jsbackend)/catalog/biblio_descriptor.js \
- $(jsbackend)/catalog/biblio_fingerprint.js \
- $(jsbackend)/catalog/fixed_fields.js \
- $(jsbackend)/catalog/phys_char.js \
- $(jsbackend)/catalog/record_type.js
-
endif
#--------------------
# Currently supports Debian (jessie, wheezy, squeeze), Ubuntu (12.04),
# Ubuntu (14.04) and Fedora (16 and 17).
#
-# Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
+# Installs Perl prereqs, libdbi, libdbi-drivers, and libyaz
#
# usage:
# make -f Makefile.install debian-jessie
# Make any assumptions about the shell being used explicit
export SHELL=/bin/bash
-export LIBJS=js-1.7.0
-export LIBJS_PERL=JavaScript-SpiderMonkey-0.21
-export LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
-export LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
-
-# used for installing libjs lib and header files
-export JS_INSTALL_PREFIX=/usr/
-
export LIBNET_Z3950_SIMPLESERVER=Net-Z3950-SimpleServer-1.15
export LIBNET_Z3950_SIMPLESERVER_URL=http://ftp.indexdata.dk/pub/simpleserver/$(LIBNET_Z3950_SIMPLESERVER)
clean:
make -C $(LIBDBI) clean
make -C $(LIBDBI_DRIVERS) clean
- make -C $(LIBJS_PERL) clean
# vim:noet:sw=4:ts=4:
install_debs:
$(APT_TOOL) install $(DEBS)
-# Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
-install_js_sm: install_libjs install_spidermonkey
-
-install_libjs:
- if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
- tar -zxf $(LIBJS).tar.gz
- cd js/src/ && JS_DIST=/usr make -f Makefile.ref
- mkdir -p $(JS_INSTALL_PREFIX)/include/js/
- cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
- cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
- cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
- cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
- ldconfig
-
-
-install_spidermonkey:
- if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi
- tar -zxf $(LIBJS_PERL).tar.gz
- cd $(LIBJS_PERL) && perl Makefile.PL -E4X \
- && make && make test && make install
-
# On Ubuntu and possibly Debian, the libdbi0 package prevents the
# compiled-from-source version from being used and breaks the install.
# This package might get installed depending on the install-time choices
ldconfig
clean:
- make -f Makefile.ref -C js/src/ clean
-
+ echo "cleaning"
# vim:noet:sw=4:ts=4:
make -f $(DIR)/Makefile.debian install_debs
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
- make -f $(DIR)/Makefile.debian install_js_sm
make -f $(DIR)/Makefile.debian debian_sys_config
install_postgres_server:
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
make -f $(DIR)/Makefile.common install_libdbi
- make -f $(DIR)/Makefile.debian install_js_sm
make -f $(DIR)/Makefile.debian debian_sys_config
install_yaz:
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
make -f $(DIR)/Makefile.common install_libdbi
- make -f $(DIR)/Makefile.debian install_js_sm
make -f $(DIR)/Makefile.debian debian_sys_config
install_postgres_server:
postgresql-plperl \
postgresql-server
-all: install_fedora_rpms install_js_sm
+all: install_fedora_rpms
make -f $(DIR)/Makefile.common install_net_z3950_simpleserver
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
yum -y update
yum -y install $(FEDORA_RPMS)
-install_js_sm: install_libjs install_spidermonkey
-
-install_libjs:
- if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
- tar -zxf $(LIBJS).tar.gz
- cd js/src/ && JS_DIST=/usr make -f Makefile.ref
- mkdir -p $(JS_INSTALL_PREFIX)/include/js/
- cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
- cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
- if [ ! -z $(FEDORA_64) ]; then \
- cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
- cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
- else \
- cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
- cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
- fi;
- ldconfig
-
-install_spidermonkey:
- if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
- tar -zxf $(LIBJS_PERL).tar.gz
- if [ ! -z $(FEDORA_64) ]; then \
- sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
- fi;
- if [ ! -z $(FEDORA) ]; then \
- sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
- fi;
- cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
-
-
clean:
make -f $(DIR)/Makefile.common clean
make -f $(DIR)/Makefile.debian test_for_libdbi_pkg
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
- make -f $(DIR)/Makefile.debian install_js_sm
make -f $(DIR)/Makefile.debian debian_sys_config
install_postgres_server:
make -f $(DIR)/Makefile.debian test_for_libdbi_pkg
make -f $(DIR)/Makefile.common install_cpan
make -f $(DIR)/Makefile.common install_cpan_force
- make -f $(DIR)/Makefile.debian install_js_sm
make -f $(DIR)/Makefile.debian debian_sys_config
install_postgres_server:
+++ /dev/null
-// so we can tell if it's a book or other type
-load_lib('fmall.js');
-load_lib('fmgen.js');
-load_lib('record_type.js');
-load_lib('JSON_v1.js');
-
-var marcdoc = new XML(environment.marc);
-var marc_ns = new Namespace('http://www.loc.gov/MARC21/slim');
-
-default xml namespace = marc_ns;
-
-environment.result = new mrd();
-
-environment.result.item_type( extractFixedField( marcdoc, 'Type' ) );
-environment.result.item_form( extractFixedField( marcdoc, 'Form' ) );
-environment.result.bib_level( extractFixedField( marcdoc, 'BLvl' ) );
-environment.result.control_type( extractFixedField( marcdoc, 'Ctrl' ) );
-environment.result.enc_level( extractFixedField( marcdoc, 'ELvl' ) );
-environment.result.audience( extractFixedField( marcdoc, 'Audn' ) );
-environment.result.lit_form( extractFixedField( marcdoc, 'LitF' ) );
-environment.result.type_mat( extractFixedField( marcdoc, 'TMat' ) );
-environment.result.cat_form( extractFixedField( marcdoc, 'Desc' ) );
-environment.result.pub_status( extractFixedField( marcdoc, 'DtSt' ) );
-environment.result.item_lang( extractFixedField( marcdoc, 'Lang' ) );
-environment.result.date1( extractFixedField( marcdoc, 'Date1' ) );
-environment.result.date2( extractFixedField( marcdoc, 'Date2' ) );
-
-environment.result.vr_format( videorecordingFormatCode( marcdoc ) );
-
+++ /dev/null
-// so we can tell if it's a book or other type
-load_lib('record_type.js');
-load_lib('JSON_v1.js');
-
-environment.result = {};
-
-var marcdoc = new XML(environment.marc);
-var marc_ns = new Namespace('http://www.loc.gov/MARC21/slim');
-
-var modsdoc = new XML(environment.mods);
-var mods_ns = new Namespace('http://www.loc.gov/mods/');
-default xml namespace = marc_ns;
-
-//var mods3_ns = new Namespace('http://www.loc.gov/mods/v3');
-
-
-var rtype = recordType(marcdoc); // BKS, SER, VIS, MIX, MAP, SCO, REC, COM
-
-var quality = 0;
-var t = '';
-var a = '';
-
-try {
- // first, related items entries (700t)
- var t = marcdoc.datafield.( @tag == '700' ).subfield.( @code == 't');
- if (!t.length()) throw "No title in related item added entry (700)";
-
- a = t.parent().subfield.( @code == 'a' );
-
- quality += 10;
-
- log_debug("title: " + t);
- log_debug("author: " + a);
-} catch(e) {
- log_debug(e);
- log_debug("Looking in main entries");
-
- var _t = '';
- try {
- try {
- try { // uniform title
- _t = marcdoc.datafield.( @tag == '240' ).subfield.( @code == 'a' );
- if (!_t.length()) throw "No title in 240";
- } catch(e) { // translation of title
- log_debug(e);
- _t = marcdoc.datafield.( @tag == '242' ).subfield.( @code == 'a' );
- if (!_t.length()) throw "No title in 242";
- }
- } catch(e) { // alternate title (not as note)
- log_debug(e);
- _t = marcdoc.datafield.( @tag == '246' && !(@ind1.match(/0|1/)) ).subfield.( @code == 'a' );
- if (!_t.length()) throw "No title in 246";
- }
-
- t = _t[0];
- log_debug("Title: " + t);
- quality += 25;
-
- } catch(e) {
- log_debug(e);
- log_debug("Using title proper (245a)");
- t = marcdoc.datafield.( @tag == '245' ).subfield.( @code == 'a' );
- t = t[0];
- quality += 10;
- }
-
- try {
- var _a = marcdoc.datafield.( @tag == '100' || @tag == '110' || @tag == '111').subfield.( @code == 'a' );
- if (!_a.length()) throw "No author in 100, 110, 111";
-
- a = _a[0];
- log_debug("Author: " + a);
-
- } catch(e) {
- log_debug(e);
- log_debug("Trying to find a publisher (260b)");
- a = marcdoc.datafield.( @tag == '260' ).subfield.( @code == 'b' );
- a = a[0];
- }
-}
-
-if (rtype != 'BKS') {
- quality += marcdoc.datafield.length() / 2;
-} else {
- quality += 40 + marcdoc.datafield.length();
-}
-
-var title = t;
-if (!title) {
- log_debug("no title found");
- title = '';
-} else {
- title = title.toString();
-}
-
-title = title
- .toLowerCase()
- .replace(/\[.+?\]/,'')
- .replace(/\bthe\b|\ban?d?\b|\W+/g,'');
-
-
-var author = a;
-if (!author) {
- author = '';
-} else {
- author = author.toString();
-}
-
-author = author.toLowerCase().replace(/^\s*(\w+).*?$/,"$1");
-
-environment.result.fingerprint = title + author;
-
-if (marcdoc.datafield.(@tag == '040').subfield.(@code == 'a').toString().match(/DLC/)) {
- quality += 5;
- log_debug( 'got DLC bump' );
-}
-
-if (marcdoc.datafield.(@tag == '039').subfield.(@code == 'b').toString().match(/oclc/i)) {
- quality += 10;
- log_debug( 'got OCLC source bump' );
-
-} else if (marcdoc.datafield.(@tag == '039').subfield.(@code == 'b').toString().match(/isxn/i)) {
- quality += 5;
- log_debug( 'got ISxN source bump' );
-
-} else if (marcdoc.datafield.(@tag == '039').subfield.(@code == 'b').toString().match(/local/i)) {
- quality += 1;
- log_debug( 'got Local source bump' );
-}
-
-if (extractFixedField(marcdoc, 'Lang') == 'eng') {
- quality += 100;
- log_debug( 'got language bump for ' + extractFixedField(marcdoc, 'Lang') );
-}
-
-
-environment.result.quality = quality;
-
+++ /dev/null
-
-var rec_type = {
- BKS : { Type : /[at]{1}/, BLvl : /[acdm]{1}/ },
- SER : { Type : /[a]{1}/, BLvl : /[bsi]{1}/ },
- VIS : { Type : /[gkro]{1}/, BLvl : /[abcdmsi]{1}/ },
- MIX : { Type : /[p]{1}/, BLvl : /[cdi]{1}/ },
- MAP : { Type : /[ef]{1}/, BLvl : /[abcdmsi]{1}/ },
- SCO : { Type : /[cd]{1}/, BLvl : /[abcdmsi]{1}/ },
- REC : { Type : /[ij]{1}/, BLvl : /[abcdmsi]{1}/ },
- COM : { Type : /[m]{1}/, BLvl : /[abcdmsi]{1}/ },
- AUT : { Type : /[z]{1}/, BLvl : /.{1}/ },
- MFHD : { Type : /[uvxy]{1}/, BLvl : /.{1}/ }
-};
-
-var ff_pos = {
- Ctry : {
- _8 : {
- BKS : {start : 15, len : 3, def : ' ' },
- SER : {start : 15, len : 3, def : ' ' },
- VIS : {start : 15, len : 3, def : ' ' },
- MIX : {start : 15, len : 3, def : ' ' },
- MAP : {start : 15, len : 3, def : ' ' },
- SCO : {start : 15, len : 3, def : ' ' },
- REC : {start : 15, len : 3, def : ' ' },
- COM : {start : 15, len : 3, def : ' ' },
- }
- },
- Lang : {
- _8 : {
- BKS : {start : 35, len : 3, def : ' ' },
- SER : {start : 35, len : 3, def : ' ' },
- VIS : {start : 35, len : 3, def : ' ' },
- MIX : {start : 35, len : 3, def : ' ' },
- MAP : {start : 35, len : 3, def : ' ' },
- SCO : {start : 35, len : 3, def : ' ' },
- REC : {start : 35, len : 3, def : ' ' },
- COM : {start : 35, len : 3, def : ' ' },
- }
- },
- MRec : {
- _8 : {
- BKS : {start : 38, len : 1, def : ' ' },
- SER : {start : 38, len : 1, def : ' ' },
- VIS : {start : 38, len : 1, def : ' ' },
- MIX : {start : 38, len : 1, def : ' ' },
- MAP : {start : 38, len : 1, def : ' ' },
- SCO : {start : 38, len : 1, def : ' ' },
- REC : {start : 38, len : 1, def : ' ' },
- COM : {start : 38, len : 1, def : ' ' },
- }
- },
- DtSt : {
- _8 : {
- BKS : {start : 6, len : 1, def : ' ' },
- SER : {start : 6, len : 1, def : 'c' },
- VIS : {start : 6, len : 1, def : ' ' },
- MIX : {start : 6, len : 1, def : ' ' },
- MAP : {start : 6, len : 1, def : ' ' },
- SCO : {start : 6, len : 1, def : ' ' },
- REC : {start : 6, len : 1, def : ' ' },
- COM : {start : 6, len : 1, def : ' ' },
- }
- },
- Type : {
- ldr : {
- BKS : {start : 6, len : 1, def : 'a' },
- SER : {start : 6, len : 1, def : 'a' },
- VIS : {start : 6, len : 1, def : 'g' },
- MIX : {start : 6, len : 1, def : 'p' },
- MAP : {start : 6, len : 1, def : 'e' },
- SCO : {start : 6, len : 1, def : 'c' },
- REC : {start : 6, len : 1, def : 'i' },
- COM : {start : 6, len : 1, def : 'm' },
- AUT : {start : 6, len : 1, def : 'z' },
- MFHD : {start : 6, len : 1, def : 'y' }
-
- }
- },
- Ctrl : {
- ldr : {
- BKS : {start : 8, len : 1, def : ' ' },
- SER : {start : 8, len : 1, def : ' ' },
- VIS : {start : 8, len : 1, def : ' ' },
- MIX : {start : 8, len : 1, def : ' ' },
- MAP : {start : 8, len : 1, def : ' ' },
- SCO : {start : 8, len : 1, def : ' ' },
- REC : {start : 8, len : 1, def : ' ' },
- COM : {start : 8, len : 1, def : ' ' },
- }
- },
- BLvl : {
- ldr : {
- BKS : {start : 7, len : 1, def : 'm' },
- SER : {start : 7, len : 1, def : 's' },
- VIS : {start : 7, len : 1, def : 'm' },
- MIX : {start : 7, len : 1, def : 'c' },
- MAP : {start : 7, len : 1, def : 'm' },
- SCO : {start : 7, len : 1, def : 'm' },
- REC : {start : 7, len : 1, def : 'm' },
- COM : {start : 7, len : 1, def : 'm' },
- }
- },
- Desc : {
- ldr : {
- BKS : {start : 18, len : 1, def : ' ' },
- SER : {start : 18, len : 1, def : ' ' },
- VIS : {start : 18, len : 1, def : ' ' },
- MIX : {start : 18, len : 1, def : ' ' },
- MAP : {start : 18, len : 1, def : ' ' },
- SCO : {start : 18, len : 1, def : ' ' },
- REC : {start : 18, len : 1, def : ' ' },
- COM : {start : 18, len : 1, def : ' ' },
- }
- },
- Item : {
- ldr : {
- MFHD : {start : 18, len : 1, def : 'i' }
- }
- },
- ELvl : {
- ldr : {
- BKS : {start : 17, len : 1, def : ' ' },
- SER : {start : 17, len : 1, def : ' ' },
- VIS : {start : 17, len : 1, def : ' ' },
- MIX : {start : 17, len : 1, def : ' ' },
- MAP : {start : 17, len : 1, def : ' ' },
- SCO : {start : 17, len : 1, def : ' ' },
- REC : {start : 17, len : 1, def : ' ' },
- COM : {start : 17, len : 1, def : ' ' },
- AUT : {start : 17, len : 1, def : 'n' },
- MFHD : {start : 17, len : 1, def : 'u' }
- }
- },
- TMat : {
- _8 : {
- VIS : {start : 33, len : 1, def : ' ' },
- },
- _6 : {
- VIS : {start : 16, len : 1, def : ' ' },
- }
- },
- Indx : {
- _8 : {
- BKS : {start : 31, len : 1, def : '0' },
- MAP : {start : 31, len : 1, def : '0' },
- },
- _6 : {
- BKS : {start : 14, len : 1, def : '0' },
- MAP : {start : 14, len : 1, def : '0' },
- }
- },
- Date1 : {
- _8 : {
- BKS : {start : 7, len : 4, def : ' ' },
- SER : {start : 7, len : 4, def : ' ' },
- VIS : {start : 7, len : 4, def : ' ' },
- MIX : {start : 7, len : 4, def : ' ' },
- MAP : {start : 7, len : 4, def : ' ' },
- SCO : {start : 7, len : 4, def : ' ' },
- REC : {start : 7, len : 4, def : ' ' },
- COM : {start : 7, len : 4, def : ' ' },
- },
- },
- Date2 : {
- _8 : {
- BKS : {start : 11, len : 4, def : ' ' },
- SER : {start : 11, len : 4, def : '9' },
- VIS : {start : 11, len : 4, def : ' ' },
- MIX : {start : 11, len : 4, def : ' ' },
- MAP : {start : 11, len : 4, def : ' ' },
- SCO : {start : 11, len : 4, def : ' ' },
- REC : {start : 11, len : 4, def : ' ' },
- COM : {start : 11, len : 4, def : ' ' },
- },
- },
- LitF : {
- _8 : {
- BKS : {start : 33, len : 1, def : '0' },
- },
- _6 : {
- BKS : {start : 16, len : 1, def : '0' },
- }
- },
- Biog : {
- _8 : {
- BKS : {start : 34, len : 1, def : ' ' },
- },
- _6 : {
- BKS : {start : 17, len : 1, def : ' ' },
- }
- },
- Ills : {
- _8 : {
- BKS : {start : 18, len : 4, def : ' ' },
- },
- _6 : {
- BKS : {start : 1, len : 4, def : ' ' },
- }
- },
- Fest : {
- _8 : {
- BKS : {start : 30, len : 1, def : '0' },
- },
- _6 : {
- BKS : {start : 13, len : 1, def : '0' },
- }
- },
- Conf : {
- _8 : {
- BKS : {start : 24, len : 4, def : ' ' },
- SER : {start : 25, len : 3, def : ' ' },
- },
- _6 : {
- BKS : {start : 7, len : 4, def : ' ' },
- SER : {start : 8, len : 3, def : ' ' },
- }
- },
- GPub : {
- _8 : {
- BKS : {start : 28, len : 1, def : ' ' },
- SER : {start : 28, len : 1, def : ' ' },
- VIS : {start : 28, len : 1, def : ' ' },
- MAP : {start : 28, len : 1, def : ' ' },
- COM : {start : 28, len : 1, def : ' ' },
- },
- _6 : {
- BKS : {start : 11, len : 1, def : ' ' },
- SER : {start : 11, len : 1, def : ' ' },
- VIS : {start : 11, len : 1, def : ' ' },
- MAP : {start : 11, len : 1, def : ' ' },
- COM : {start : 11, len : 1, def : ' ' },
- }
- },
- Audn : {
- _8 : {
- BKS : {start : 22, len : 1, def : ' ' },
- SER : {start : 22, len : 1, def : ' ' },
- VIS : {start : 22, len : 1, def : ' ' },
- SCO : {start : 22, len : 1, def : ' ' },
- REC : {start : 22, len : 1, def : ' ' },
- COM : {start : 22, len : 1, def : ' ' },
- },
- _6 : {
- BKS : {start : 5, len : 1, def : ' ' },
- SER : {start : 5, len : 1, def : ' ' },
- VIS : {start : 5, len : 1, def : ' ' },
- SCO : {start : 5, len : 1, def : ' ' },
- REC : {start : 5, len : 1, def : ' ' },
- COM : {start : 5, len : 1, def : ' ' },
- }
- },
- Form : {
- _8 : {
- BKS : {start : 23, len : 1, def : ' ' },
- SER : {start : 23, len : 1, def : ' ' },
- VIS : {start : 29, len : 1, def : ' ' },
- MIX : {start : 23, len : 1, def : ' ' },
- MAP : {start : 29, len : 1, def : ' ' },
- SCO : {start : 23, len : 1, def : ' ' },
- REC : {start : 23, len : 1, def : ' ' },
- },
- _6 : {
- BKS : {start : 6, len : 1, def : ' ' },
- SER : {start : 6, len : 1, def : ' ' },
- VIS : {start : 12, len : 1, def : ' ' },
- MIX : {start : 6, len : 1, def : ' ' },
- MAP : {start : 12, len : 1, def : ' ' },
- SCO : {start : 6, len : 1, def : ' ' },
- REC : {start : 6, len : 1, def : ' ' },
- }
- },
- 'S/L' : {
- _8 : {
- SER : {start : 34, len : 1, def : '0' },
- },
- _6 : {
- SER : {start : 17, len : 1, def : '0' },
- }
- },
- 'Alph' : {
- _8 : {
- SER : {start : 33, len : 1, def : ' ' },
- },
- _6 : {
- SER : {start : 16, len : 1, def : ' ' },
- }
- },
- "GeoDiv" : {
- "_8" : {
- "AUT" : {"start" : 6, "len" : 1, "def" : ' ' }
- }
- },
- "Roman" : {
- "_8" : {
- "AUT" : {"start" : 7, "len" : 1, "def" : ' ' }
- }
- },
- "CatLang" : {
- "_8" : {
- "AUT" : {"start" : 8, "len" : 1, "def" : ' ' }
- }
- },
- "Kind" : {
- "_8" : {
- "AUT" : {"start" : 9, "len" : 1, "def" : ' ' }
- }
- },
- "Rules" : {
- "_8" : {
- "AUT" : {"start" : 10, "len" : 1, "def" : ' ' }
- }
- },
- "Subj" : {
- "_8" : {
- "AUT" : {"start" : 11, "len" : 1, "def" : ' ' }
- }
- },
- "SHSys" : {
- "_8" : {
- "AUT" : {"start" : 11, "len" : 1, "def" : ' ' }
- }
- },
- "SerType" : {
- "_8" : {
- "AUT" : {"start" : 12, "len" : 1, "def" : ' ' }
- }
- },
- "SerNum" : {
- "_8" : {
- "AUT" : {"start" : 13, "len" : 1, "def" : ' ' }
- }
- },
- "HeadMain" : {
- "_8" : {
- "AUT" : {"start" : 14, "len" : 1, "def" : ' ' }
- }
- },
- "SubjUse" : {
- "_8" : {
- "AUT" : {"start" : 15, "len" : 1, "def" : ' ' }
- }
- },
- "HeadSubj" : {
- "_8" : {
- "AUT" : {"start" : 15, "len" : 1, "def" : ' ' }
- }
- },
- "HeadSer" : {
- "_8" : {
- "AUT" : {"start" : 16, "len" : 1, "def" : ' ' }
- }
- },
- "TypeSubd" : {
- "_8" : {
- "AUT" : {"start" : 17, "len" : 1, "def" : ' ' }
- }
- },
- "TypeGov" : {
- "_8" : {
- "AUT" : {"start" : 28, "len" : 1, "def" : ' ' }
- }
- },
- "RefEval" : {
- "_8" : {
- "AUT" : {"start" : 29, "len" : 1, "def" : ' ' }
- }
- },
- "RecUpd" : {
- "_8" : {
- "AUT" : {"start" : 31, "len" : 1, "def" : ' ' }
- }
- },
- "NameDiff" : {
- "_8" : {
- "AUT" : {"start" : 32, "len" : 1, "def" : ' ' }
- }
- },
- "Level" : {
- "_8" : {
- "AUT" : {"start" : 33, "len" : 1, "def" : ' ' }
- }
- },
- "ModRec" : {
- "_8" : {
- "AUT" : {"start" : 38, "len" : 1, "def" : ' ' }
- }
- },
- "CatSrc" : {
- "_8" : {
- "AUT" : {"start" : 39, "len" : 1, "def" : ' ' }
- }
- }
-};
-
+++ /dev/null
-var physical_characteristics = {
- c : {
- label : "Electronic Resource",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { a : "Tape Cartridge",
- b : "Chip cartridge",
- c : "Computer optical disk cartridge",
- f : "Tape cassette",
- h : "Tape reel",
- j : "Magnetic disk",
- m : "Magneto-optical disk",
- o : "Optical disk",
- r : "Remote",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { a : "One color",
- b : "Black-and-white",
- c : "Multicolored",
- g : "Gray scale",
- m : "Mixed",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Dimensions",
- values: { a : "3 1/2 in.",
- e : "12 in.",
- g : "4 3/4 in. or 12 cm.",
- i : "1 1/8 x 2 3/8 in.",
- j : "3 7/8 x 2 1/2 in.",
- n : "Not applicable",
- o : "5 1/4 in.",
- u : "Unknown",
- v : "8 in.",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Sound",
- values: { ' ' : "No sound (Silent)",
- a : "Sound",
- u : "Unknown",
- },
- },
- g : { start : 6,
- len : 3,
- label : "Image bit depth",
- values: { mmm : "Multiple",
- nnn : "Not applicable",
- '---' : "Unknown",
- },
- },
- h : { start : 9,
- len : 1,
- label : "File formats",
- values: { a : "One file format",
- m : "Multiple file formats",
- u : "Unknown",
- },
- },
- i : { start : 10,
- len : 1,
- label : "Quality assurance target(s)",
- values: { a : "Absent",
- n : "Not applicable",
- p : "Present",
- u : "Unknown",
- },
- },
- j : { start : 11,
- len : 1,
- label : "Antecedent/Source",
- values: { a : "File reproduced from original",
- b : "File reproduced from microform",
- c : "File reproduced from electronic resource",
- d : "File reproduced from an intermediate (not microform)",
- m : "Mixed",
- n : "Not applicable",
- u : "Unknown",
- },
- },
- k : { start : 12,
- len : 1,
- label : "Level of compression",
- values: { a : "Uncompressed",
- b : "Lossless",
- d : "Lossy",
- m : "Mixed",
- u : "Unknown",
- },
- },
- l : { start : 13,
- len : 1,
- label : "Reformatting quality",
- values: { a : "Access",
- n : "Not applicable",
- p : "Preservation",
- r : "Replacement",
- u : "Unknown",
- },
- },
- },
- },
- d : {
- label : "Globe",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { a : "Celestial globe",
- b : "Planetary or lunar globe",
- c : "Terrestrial globe",
- e : "Earth moon globe",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { a : "One color",
- c : "Multicolored",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Physical medium",
- values: { a : "Paper",
- b : "Wood",
- c : "Stone",
- d : "Metal",
- e : "Synthetics",
- f : "Skins",
- g : "Textile",
- p : "Plaster",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Type of reproduction",
- values: { f : "Facsimile",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- a : {
- label : "Map",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { d : "Atlas",
- g : "Diagram",
- j : "Map",
- k : "Profile",
- q : "Model",
- r : "Remote-sensing image",
- s : "Section",
- u : "Unspecified",
- y : "View",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { a : "One color",
- c : "Multicolored",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Physical medium",
- values: { a : "Paper",
- b : "Wood",
- c : "Stone",
- d : "Metal",
- e : "Synthetics",
- f : "Skins",
- g : "Textile",
- p : "Plaster",
- q : "Flexible base photographic medium, positive",
- r : "Flexible base photographic medium, negative",
- s : "Non-flexible base photographic medium, positive",
- t : "Non-flexible base photographic medium, negative",
- u : "Unknown",
- y : "Other photographic medium",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Type of reproduction",
- values: { f : "Facsimile",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Production/reproduction details",
- values: { a : "Photocopy, blueline print",
- b : "Photocopy",
- c : "Pre-production",
- d : "Film",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Positive/negative",
- values: { a : "Positive",
- b : "Negative",
- m : "Mixed",
- n : "Not applicable",
- },
- },
- },
- },
- h : {
- label : "Microform",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { a : "Aperture card",
- b : "Microfilm cartridge",
- c : "Microfilm cassette",
- d : "Microfilm reel",
- e : "Microfiche",
- f : "Microfiche cassette",
- g : "Microopaque",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Positive/negative",
- values: { a : "Positive",
- b : "Negative",
- m : "Mixed",
- u : "Unknown",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Dimensions",
- values: { a : "8 mm.",
- e : "16 mm.",
- f : "35 mm.",
- g : "70mm.",
- h : "105 mm.",
- l : "3 x 5 in. (8 x 13 cm.)",
- m : "4 x 6 in. (11 x 15 cm.)",
- o : "6 x 9 in. (16 x 23 cm.)",
- p : "3 1/4 x 7 3/8 in. (9 x 19 cm.)",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 4,
- label : "Reduction ratio range/Reduction ratio",
- values: { a : "Low (1-16x)",
- b : "Normal (16-30x)",
- c : "High (31-60x)",
- d : "Very high (61-90x)",
- e : "Ultra (90x-)",
- u : "Unknown",
- v : "Reduction ratio varies",
- },
- },
- g : { start : 9,
- len : 1,
- label : "Color",
- values: { b : "Black-and-white",
- c : "Multicolored",
- m : "Mixed",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 10,
- len : 1,
- label : "Emulsion on film",
- values: { a : "Silver halide",
- b : "Diazo",
- c : "Vesicular",
- m : "Mixed",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 11,
- len : 1,
- label : "Quality assurance target(s)",
- values: { a : "1st gen. master",
- b : "Printing master",
- c : "Service copy",
- m : "Mixed generation",
- u : "Unknown",
- },
- },
- j : { start : 12,
- len : 1,
- label : "Base of film",
- values: { a : "Safety base, undetermined",
- c : "Safety base, acetate undetermined",
- d : "Safety base, diacetate",
- l : "Nitrate base",
- m : "Mixed base",
- n : "Not applicable",
- p : "Safety base, polyester",
- r : "Safety base, mixed",
- t : "Safety base, triacetate",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- m : {
- label : "Motion Picture",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { a : "Film cartridge",
- f : "Film cassette",
- r : "Film reel",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { b : "Black-and-white",
- c : "Multicolored",
- h : "Hand-colored",
- m : "Mixed",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Motion picture presentation format",
- values: { a : "Standard sound aperture, reduced frame",
- b : "Nonanamorphic (wide-screen)",
- c : "3D",
- d : "Anamorphic (wide-screen)",
- e : "Other-wide screen format",
- f : "Standard. silent aperture, full frame",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Sound on medium or separate",
- values: { a : "Sound on medium",
- b : "Sound separate from medium",
- u : "Unknown",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Medium for sound",
- values: { a : "Optical sound track on motion picture film",
- b : "Magnetic sound track on motion picture film",
- c : "Magnetic audio tape in cartridge",
- d : "Sound disc",
- e : "Magnetic audio tape on reel",
- f : "Magnetic audio tape in cassette",
- g : "Optical and magnetic sound track on film",
- h : "Videotape",
- i : "Videodisc",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Dimensions",
- values: { a : "Standard 8 mm.",
- b : "Super 8 mm./single 8 mm.",
- c : "9.5 mm.",
- d : "16 mm.",
- e : "28 mm.",
- f : "35 mm.",
- g : "70 mm.",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 8,
- len : 1,
- label : "Configuration of playback channels",
- values: { k : "Mixed",
- m : "Monaural",
- n : "Not applicable",
- q : "Multichannel, surround or quadraphonic",
- s : "Stereophonic",
- u : "Unknown",
- z : "Other",
- },
- },
- j : { start : 9,
- len : 1,
- label : "Production elements",
- values: { a : "Work print",
- b : "Trims",
- c : "Outtakes",
- d : "Rushes",
- e : "Mixing tracks",
- f : "Title bands/inter-title rolls",
- g : "Production rolls",
- n : "Not applicable",
- z : "Other",
- },
- },
- },
- },
- k : {
- label : "Non-projected Graphic",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { c : "Collage",
- d : "Drawing",
- e : "Painting",
- f : "Photo-mechanical print",
- g : "Photonegative",
- h : "Photoprint",
- i : "Picture",
- j : "Print",
- l : "Technical drawing",
- n : "Chart",
- o : "Flash/activity card",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { a : "One color",
- b : "Black-and-white",
- c : "Multicolored",
- h : "Hand-colored",
- m : "Mixed",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Primary support material",
- values: { a : "Canvas",
- b : "Bristol board",
- c : "Cardboard/illustration board",
- d : "Glass",
- e : "Synthetics",
- f : "Skins",
- g : "Textile",
- h : "Metal",
- m : "Mixed collection",
- o : "Paper",
- p : "Plaster",
- q : "Hardboard",
- r : "Porcelain",
- s : "Stone",
- t : "Wood",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Secondary support material",
- values: { a : "Canvas",
- b : "Bristol board",
- c : "Cardboard/illustration board",
- d : "Glass",
- e : "Synthetics",
- f : "Skins",
- g : "Textile",
- h : "Metal",
- m : "Mixed collection",
- o : "Paper",
- p : "Plaster",
- q : "Hardboard",
- r : "Porcelain",
- s : "Stone",
- t : "Wood",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- g : {
- label : "Projected Graphic",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { c : "Film cartridge",
- d : "Filmstrip",
- f : "Film filmstrip type",
- o : "Filmstrip roll",
- s : "Slide",
- t : "Transparency",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { b : "Black-and-white",
- c : "Multicolored",
- h : "Hand-colored",
- m : "Mixed",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Base of emulsion",
- values: { d : "Glass",
- e : "Synthetics",
- j : "Safety film",
- k : "Film base, other than safety film",
- m : "Mixed collection",
- o : "Paper",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Sound on medium or separate",
- values: { a : "Sound on medium",
- b : "Sound separate from medium",
- u : "Unknown",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Medium for sound",
- values: { a : "Optical sound track on motion picture film",
- b : "Magnetic sound track on motion picture film",
- c : "Magnetic audio tape in cartridge",
- d : "Sound disc",
- e : "Magnetic audio tape on reel",
- f : "Magnetic audio tape in cassette",
- g : "Optical and magnetic sound track on film",
- h : "Videotape",
- i : "Videodisc",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Dimensions",
- values: { a : "Standard 8 mm.",
- b : "Super 8 mm./single 8 mm.",
- c : "9.5 mm.",
- d : "16 mm.",
- e : "28 mm.",
- f : "35 mm.",
- g : "70 mm.",
- j : "2 x 2 in. (5 x 5 cm.)",
- k : "2 1/4 x 2 1/4 in. (6 x 6 cm.)",
- s : "4 x 5 in. (10 x 13 cm.)",
- t : "5 x 7 in. (13 x 18 cm.)",
- v : "8 x 10 in. (21 x 26 cm.)",
- w : "9 x 9 in. (23 x 23 cm.)",
- x : "10 x 10 in. (26 x 26 cm.)",
- y : "7 x 7 in. (18 x 18 cm.)",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 8,
- len : 1,
- label : "Secondary support material",
- values: { c : "Cardboard",
- d : "Glass",
- e : "Synthetics",
- h : "metal",
- j : "Metal and glass",
- k : "Synthetics and glass",
- m : "Mixed collection",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- r : {
- label : "Remote-sensing Image",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { u : "Unspecified" },
- },
- d : { start : 3,
- len : 1,
- label : "Altitude of sensor",
- values: { a : "Surface",
- b : "Airborne",
- c : "Spaceborne",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Attitude of sensor",
- values: { a : "Low oblique",
- b : "High oblique",
- c : "Vertical",
- n : "Not applicable",
- u : "Unknown",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Cloud cover",
- values: { 0 : "0-09%",
- 1 : "10-19%",
- 2 : "20-29%",
- 3 : "30-39%",
- 4 : "40-49%",
- 5 : "50-59%",
- 6 : "60-69%",
- 7 : "70-79%",
- 8 : "80-89%",
- 9 : "90-100%",
- n : "Not applicable",
- u : "Unknown",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Platform construction type",
- values: { a : "Balloon",
- b : "Aircraft-low altitude",
- c : "Aircraft-medium altitude",
- d : "Aircraft-high altitude",
- e : "Manned spacecraft",
- f : "Unmanned spacecraft",
- g : "Land-based remote-sensing device",
- h : "Water surface-based remote-sensing device",
- i : "Submersible remote-sensing device",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Platform use category",
- values: { a : "Meteorological",
- b : "Surface observing",
- c : "Space observing",
- m : "Mixed uses",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 8,
- len : 1,
- label : "Sensor type",
- values: { a : "Active",
- b : "Passive",
- u : "Unknown",
- z : "Other",
- },
- },
- j : { start : 9,
- len : 2,
- label : "Data type",
- values: { nn : "Not applicable",
- uu : "Unknown",
- zz : "Other",
- aa : "Visible light",
- da : "Near infrared",
- db : "Middle infrared",
- dc : "Far infrared",
- dd : "Thermal infrared",
- de : "Shortwave infrared (SWIR)",
- df : "Reflective infrared",
- dv : "Combinations",
- dz : "Other infrared data",
- ga : "Sidelooking airborne radar (SLAR)",
- gb : "Synthetic aperture radar (SAR-single frequency)",
- gc : "SAR-multi-frequency (multichannel)",
- gd : "SAR-like polarization",
- ge : "SAR-cross polarization",
- gf : "Infometric SAR",
- gg : "Polarmetric SAR",
- gu : "Passive microwave mapping",
- gz : "Other microwave data",
- ja : "Far ultraviolet",
- jb : "Middle ultraviolet",
- jc : "Near ultraviolet",
- jv : "Ultraviolet combinations",
- jz : "Other ultraviolet data",
- ma : "Multi-spectral, multidata",
- mb : "Multi-temporal",
- mm : "Combination of various data types",
- pa : "Sonar-water depth",
- pb : "Sonar-bottom topography images, sidescan",
- pc : "Sonar-bottom topography, near-surface",
- pd : "Sonar-bottom topography, near-bottom",
- pe : "Seismic surveys",
- pz : "Other acoustical data",
- ra : "Gravity anomales (general)",
- rb : "Free-air",
- rc : "Bouger",
- rd : "Isostatic",
- sa : "Magnetic field",
- ta : "Radiometric surveys",
- },
- },
- },
- },
- s : {
- label : "Sound Recording",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { d : "Sound disc",
- e : "Cylinder",
- g : "Sound cartridge",
- i : "Sound-track film",
- q : "Roll",
- s : "Sound cassette",
- t : "Sound-tape reel",
- u : "Unspecified",
- w : "Wire recording",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Speed",
- values: { a : "16 rpm",
- b : "33 1/3 rpm",
- c : "45 rpm",
- d : "78 rpm",
- e : "8 rpm",
- f : "1.4 mps",
- h : "120 rpm",
- i : "160 rpm",
- k : "15/16 ips",
- l : "1 7/8 ips",
- m : "3 3/4 ips",
- o : "7 1/2 ips",
- p : "15 ips",
- r : "30 ips",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Configuration of playback channels",
- values: { m : "Monaural",
- q : "Quadraphonic",
- s : "Stereophonic",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Groove width or pitch",
- values: { m : "Microgroove/fine",
- n : "Not applicable",
- s : "Coarse/standard",
- u : "Unknown",
- z : "Other",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Dimensions",
- values: { a : "3 in.",
- b : "5 in.",
- c : "7 in.",
- d : "10 in.",
- e : "12 in.",
- f : "16 in.",
- g : "4 3/4 in. (12 cm.)",
- j : "3 7/8 x 2 1/2 in.",
- o : "5 1/4 x 3 7/8 in.",
- s : "2 3/4 x 4 in.",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Tape width",
- values: { l : "1/8 in.",
- m : "1/4in.",
- n : "Not applicable",
- o : "1/2 in.",
- p : "1 in.",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 8,
- len : 1,
- label : "Tape configuration ",
- values: { a : "Full (1) track",
- b : "Half (2) track",
- c : "Quarter (4) track",
- d : "8 track",
- e : "12 track",
- f : "16 track",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- m : { start : 12,
- len : 1,
- label : "Special playback",
- values: { a : "NAB standard",
- b : "CCIR standard",
- c : "Dolby-B encoded, standard Dolby",
- d : "dbx encoded",
- e : "Digital recording",
- f : "Dolby-A encoded",
- g : "Dolby-C encoded",
- h : "CX encoded",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- n : { start : 13,
- len : 1,
- label : "Capture and storage",
- values: { a : "Acoustical capture, direct storage",
- b : "Direct storage, not acoustical",
- d : "Digital storage",
- e : "Analog electrical storage",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- f : {
- label : "Tactile Material",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { a : "Moon",
- b : "Braille",
- c : "Combination",
- d : "Tactile, with no writing system",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 2,
- label : "Class of braille writing",
- values: { a : "Literary braille",
- b : "Format code braille",
- c : "Mathematics and scientific braille",
- d : "Computer braille",
- e : "Music braille",
- m : "Multiple braille types",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Level of contraction",
- values: { a : "Uncontracted",
- b : "Contracted",
- m : "Combination",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- f : { start : 6,
- len : 3,
- label : "Braille music format",
- values: { a : "Bar over bar",
- b : "Bar by bar",
- c : "Line over line",
- d : "Paragraph",
- e : "Single line",
- f : "Section by section",
- g : "Line by line",
- h : "Open score",
- i : "Spanner short form scoring",
- j : "Short form scoring",
- k : "Outline",
- l : "Vertical score",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- g : { start : 9,
- len : 1,
- label : "Special physical characteristics",
- values: { a : "Print/braille",
- b : "Jumbo or enlarged braille",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
- v : {
- label : "Videorecording",
- subfields : {
- b : { start : 1,
- len : 1,
- label : "SMD",
- values: { c : "Videocartridge",
- d : "Videodisc",
- f : "Videocassette",
- r : "Videoreel",
- u : "Unspecified",
- z : "Other",
- },
- },
- d : { start : 3,
- len : 1,
- label : "Color",
- values: { b : "Black-and-white",
- c : "Multicolored",
- m : "Mixed",
- n : "Not applicable",
- u : "Unknown",
- z : "Other",
- },
- },
- e : { start : 4,
- len : 1,
- label : "Videorecording format",
- values: { a : "Beta",
- b : "VHS",
- c : "U-matic",
- d : "EIAJ",
- e : "Type C",
- f : "Quadruplex",
- g : "Laserdisc",
- h : "CED",
- i : "Betacam",
- j : "Betacam SP",
- k : "Super-VHS",
- m : "M-II",
- o : "D-2",
- p : "8 mm.",
- q : "Hi-8 mm.",
- u : "Unknown",
- v : "DVD",
- z : "Other",
- },
- },
- f : { start : 5,
- len : 1,
- label : "Sound on medium or separate",
- values: { a : "Sound on medium",
- b : "Sound separate from medium",
- u : "Unknown",
- },
- },
- g : { start : 6,
- len : 1,
- label : "Medium for sound",
- values: { a : "Optical sound track on motion picture film",
- b : "Magnetic sound track on motion picture film",
- c : "Magnetic audio tape in cartridge",
- d : "Sound disc",
- e : "Magnetic audio tape on reel",
- f : "Magnetic audio tape in cassette",
- g : "Optical and magnetic sound track on motion picture film",
- h : "Videotape",
- i : "Videodisc",
- u : "Unknown",
- z : "Other",
- },
- },
- h : { start : 7,
- len : 1,
- label : "Dimensions",
- values: { a : "8 mm.",
- m : "1/4 in.",
- o : "1/2 in.",
- p : "1 in.",
- q : "2 in.",
- r : "3/4 in.",
- u : "Unknown",
- z : "Other",
- },
- },
- i : { start : 8,
- len : 1,
- label : "Configuration of playback channel",
- values: { k : "Mixed",
- m : "Monaural",
- n : "Not applicable",
- q : "Multichannel, surround or quadraphonic",
- s : "Stereophonic",
- u : "Unknown",
- z : "Other",
- },
- },
- },
- },
-};
-
+++ /dev/null
-// Constants ...
-load_lib('phys_char.js');
-load_lib('fixed_fields.js');
-load_lib('JSON_v1.js');
-
-function recordType (rec) {
-
- var marcns = new Namespace("http://www.loc.gov/MARC21/slim");
- var _l = rec.marcns::leader.toString();
-
- var _t = _l.substr(ff_pos.Type.ldr.BKS.start, ff_pos.Type.ldr.BKS.len);
- var _b = _l.substr(ff_pos.BLvl.ldr.BKS.start, ff_pos.BLvl.ldr.BKS.len);
-
- for (var t in rec_type) {
- if (_t.match(rec_type[t].Type) && _b.match(rec_type[t].BLvl)) {
- return t;
- }
- }
-}
-
-function videorecordingFormatName (rec) {
- var marcns = new Namespace("http://www.loc.gov/MARC21/slim");
- var _7 = rec.marcns::controlfield.(@tag.match(/007/)).text().toString();
-
- if (_7.match(/^v/)) {
- var _v_e = _7.substr(
- physical_characteristics.v.subfields.e.start,
- physical_characteristics.v.subfields.e.len
- );
-
- return physical_characteristics.v.subfields.e.values[ _v_e ];
- }
-
- return null;
-}
-
-function videorecordingFormatCode (rec) {
- var marcns = new Namespace("http://www.loc.gov/MARC21/slim");
- var _7 = rec.marcns::controlfield.(@tag.match(/007/)).text().toString();
-
- if (_7.match(/^v/)) {
- return _7.substr(
- physical_characteristics.v.subfields.e.start,
- physical_characteristics.v.subfields.e.len
- );
- }
-
- return null;
-}
-
-
-function extractFixedField (rec, field) {
-
- var marcns = new Namespace("http://www.loc.gov/MARC21/slim");
- var _l = rec.marcns::leader.toString();
- var _8 = rec.marcns::controlfield.(@tag.match(/008/)).text().toString();
- var _6 = rec.marcns::controlfield.(@tag.match(/006/)).text().toString();
-
- var rtype = recordType(rec);
-
- var val;
-
- if (ff_pos[field].ldr) {
- if (ff_pos[field].ldr[rtype]) {
- val = _l.substr(
- ff_pos[field].ldr[rtype].start,
- ff_pos[field].ldr[rtype].len
- );
- }
- } else if (ff_pos[field]._8) {
- if (ff_pos[field]._8[rtype]) {
- val = _8.substr(
- ff_pos[field]._8[rtype].start,
- ff_pos[field]._8[rtype].len
- );
- }
- }
-
- if (!val && ff_pos[field]._6) {
- if (ff_pos[field]._6[rtype]) {
- val = _6.substr(
- ff_pos[field]._6[rtype].start,
- ff_pos[field]._6[rtype].len
- );
- }
- }
-
- return val;
-}
-
+++ /dev/null
-function go(){
-
-load_lib('circ/circ_item_config.js');
-load_lib('JSON_v1.js');
-log_vars('circ_duration');
-
-
-/* treat pre-cat copies like vanilla books */
-if( isTrue(isPrecat) ) {
- log_info("pre-cat copy getting duration defaults...");
- result.durationRule = 'default';
- result.recurringFinesRule = 'default';
- result.maxFine = 'default'
- return;
-}
-
-
-/* grab the config from the config script */
-var config = getItemConfig();
-var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
-
-
-/* -----------------------------------------------------------------------------
- Now set the rule values based on the config. If there is no configured info
- on this copy, fall back on defaults.
- ----------------------------------------------------------------------------- */
-if( config ) {
-
- log_debug("circ_duration found a config for the copy");
- result.durationRule = config.durationRule;
- result.recurringFinesRule = config.recurringFinesRule;
- result.maxFine = config.maxFine;
-
-} else {
-
- result.durationRule = 'default';
- result.recurringFinesRule = 'default';
- result.maxFine = 'default';
-}
-
-
-log_info('final duration results: ' +
- result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine );
-
-} go();
-
-
-
-
+++ /dev/null
-/* ---------------------------------------------------------------------
- Set up the limits for the various profiles (aka permission groups).
- Values of -1 mean there is no limit
-
- maxItemsOut - the maximum number of items the user can have out
- fineThreshold - the fine threshold.
- overdueThreshold - the overdue items threshold.
- maxHolds - The maximum number of holds the user can have
-
- A user exceeds the fineThreshold and/or overdueThreshold if they are
- equal to or exceed the threshold
- --------------------------------------------------------------------- */
-
-var GROUP_CONFIG = {
- 'Patron' : {
- maxItemsOut : 50,
- fineThreshold : 10,
- overdueThreshold : 10,
- maxHolds : -1
- },
-}
+++ /dev/null
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_debug('loading circ_item_config.js ...');
-
-
-/* SIP media types
-000 Other
-001 Book
-002 Magazine
-003 Bound journal
-004 Audio tape
-005 Video tape
-006 CD/CDROM
-007 Diskette
-008 Book with diskette
-009 Book with CD
-010 Book with audio tape
-*/
-
-/* -----------------------------------------------------------------------------
- Configure the duration rules for the various item types and circ modifiers
- MARC Fixed Field info:
- http://www.oclc.org/bibformats/en/fixedfield/
- ----------------------------------------------------------------------------- */
-
-var MARC_ITEM_TYPE_MAP = {
- a : { /* Language material [Books] */
- SIPMediaType : '001',
- magneticMedia : 'f',
- durationRule : 'default',
- recurringFinesRule : 'default',
- maxFine : 'default'
- },
- /* add more MARC item type configs as needed... */
-}
-
-/* make 't' and 'a' share the same config info */
-MARC_ITEM_TYPE_MAP.t = MARC_ITEM_TYPE_MAP.a;
-
-
-var CIRC_MOD_MAP = {
- 'bestseller' : {
- SIPMediaType : '001',
- magneticMedia : 'f',
- durationRule : 'default',
- recurringFinesRule : 'default',
- maxFine : 'default'
- },
-}
-
-
-/* this will set defaults even if no one asked for them */
-log_debug("Calling getItemConfig() to force defaults..");
-result.item_config = getItemConfig();
-
-
-function getItemConfig() {
-
- var config = null;
- var marcType = getMARCItemType();
- var circMod = copy.circ_modifier;
-
- if( circMod ) {
- config = CIRC_MOD_MAP[circMod];
- if(!config)
- config = CIRC_MOD_MAP[circMod.toLowerCase()]
- }
-
- if(!config)
- config = MARC_ITEM_TYPE_MAP[marcType];
-
- if(!config) {
- config = {};
- config.SIPMediaType = '001';
- config.magneticMedia = 'f';
- config.durationRule = 'default';
- config.recurringFinesRule = 'default';
- config.maxFine = 'default';
- }
-
- return config
-}
-
-
-
-
-
+++ /dev/null
-load_lib('catalog/record_type.js');
-load_lib('circ/circ_groups.js');
-load_lib('JSON_v1.js');
-
-
-try {
- if( environment.copy ) {
- environment.copy.fetchBestHold = function() {
- var key = scratchKey();
- environment.copy.__OILS_FUNC_fetch_best_hold(scratchPad(key));
- var val = getScratch(key);
- return (val) ? val : null;
- }
- }
-} catch(e) {}
-
-
-/* -----------------------------------------------------------------------------
- Collect all of the global variables
- ----------------------------------------------------------------------------- */
-
-/* the global result object. Any data returned to the
- caller must be put into this object. */
-var result = environment.result = {};
-result.event = 'SUCCESS';
-result.events = [];
-result.fatalEvents = [];
-result.infoEvents = [];
-
-
-/* Pull in any variables passed in from the calling process */
-var copy = environment.copy;
-var volume = environment.volume;
-var title = environment.title;
-var recDescriptor = environment.titleDescriptor;
-var patron = environment.patron;
-var patronItemsOut = environment.patronItemsOut;
-var patronOverdueCount = environment.patronOverdueCount;
-var patronFines = environment.patronFines;
-var isRenewal = environment.isRenewal;
-var isPrecat = environment.isPrecat;
-var currentLocation = environment.location;
-var holdRequestLib = environment.requestLib;
-var holdPickupLib = environment.pickupLib; /* hold pickup lib */
-var requestor = environment.requestor || patron;
-var newHold = environment.newHold;
-
-
-
-/* create some new vars based on the data we have wherever possible */
-var patronProfile;
-var copyStatus;
-var marcXMLDoc;
-
-if( patron && patron.profile )
- patronProfile = patron.profile.name;
-if( copy && copy.status )
- copyStatus = copy.status.name;
-if( title && title.marc )
- marcXMLDoc = new XML(title.marc);
-
-
-
-/* copy the group tree into some other useful data structures */
-var groupTree = environment.groupTree;
-var groupList = {};
-var groupIDList = {};
-flattenGroupTree(groupTree);
-
-
-
-
-
-
-/* -----------------------------------------------------------------------------
- Define all of the utility functions
- ----------------------------------------------------------------------------- */
-
-
-
-/* useful functions for creating wrappers around system functions */
-var __scratchKey = 0;
-var __SCRATCH = {};
-function scratchKey() { return '_' + __scratchKey++; };
-function scratchPad(key) { return '__SCRATCH.'+ key; }
-function getScratch(key) { return __SCRATCH[ key ]; }
-function scratchClear() { for( var o in __SCRATCH ) __SCRATCH[o] = null; }
-
-
-/* note: returns false if the value is 'f' or 'F' ... */
-function isTrue(d) {
- if( d &&
- d != "0" &&
- d != "f" &&
- d != "F" )
- return true;
- return false;
-}
-
-/* Utility function for iterating over array */
-function iterate( arr, callback ) {
- for( var i = 0; i < arr.length; i++ )
- callback(arr[i]);
-}
-
-
-/**
- * returns a list of items that when passed to the callback
- * 'func' returned true returns null if none were found
- */
-function grep( arr, func ) {
- var results = [];
- iterate( arr,
- function(d) {
- if( func(d) )
- results.push(d);
- }
- );
- if(results.length > 0)
- return results;
- return null;
-}
-
-
-
-function flattenGroupTree(node) {
- if(!node) return null;
- groupList[node.name] = node;
- groupIDList[node.id] = node;
- iterate( node.children,
- function(n) {
- flattenGroupTree(n);
- }
- );
-}
-
-
-
-/**
- * Returns true if 'child' is equal or descends from 'parent'
- * @param parent The name of the parent group
- * @param child The name of the child group
- */
-function isGroupDescendant( parent, child ) {
- log_debug("checking descendant p="+parent + " c=" + child);
- return __isGroupDescendant(
- groupList[parent],
- groupList[child]);
-}
-
-function isGroupDescendantId( parentName, childId ) {
- log_debug("checking descendant ID p="+parentName + " c=" + childId);
- return __isGroupDescendant(
- groupList[parentName],
- groupIDList[childId]);
-}
-
-
-/**
- * Returns true if 'child' is equal or descends from 'parent'
- * @param parent The node of the parent group
- * @param child The node of the child group
- */
-function __isGroupDescendant( parent, child ) {
- if(!(parent && child)) return false;
- if (parent.id == child.id) return true;
- var node = child;
- while( (node = groupIDList[node.parent]) ) {
- if( node.id == parent.id )
- return true;
- }
- return false;
-}
-
-
-function getMARCItemType() {
- if( copy &&
- copy.circ_as_type &&
- copy.circ_as_type != 'undef' )
- return copy.circ_as_type;
-
- return (marcXMLDoc) ? extractFixedField(marcXMLDoc, 'Type') : "";
-}
-
-
-function isOrgDescendent( parentName, childId ) {
- var key = scratchKey();
- __OILS_FUNC_isOrgDescendent(scratchPad(key), parentName, childId);
- var val = getScratch(key);
- if( val == '1' ) return true;
- return false;
-}
-
-/* returns the number of unfulfilled holds open on this user */
-function userHoldCount(userid) {
- var key = scratchKey();
- __OILS_FUNC_userHoldCount(scratchPad(key), userid);
- return getScratch(key);
-}
-
-function hasCommonAncestor( org1, org2, depth ) {
- var key = scratchKey();
- __OILS_FUNC_hasCommonAncestor(scratchPad(key), org1, org2, depth);
- var val = getScratch(key);
- if( val == '1' ) return true;
- return false;
-}
-
-/* returns a dictionary of circmod : count for checked out items */
-function checkoutsByCircModifier(userid) {
- var key = scratchKey();
- __OILS_FUNC_userCircsByCircmod(scratchPad(key), userid);
- var val = getScratch(key);
- return (val) ? val : {};
-}
-
-/* useful for testing */
-function die(msg) {
- log_error("die(): "+msg);
- log_stderr("die(): "+msg);
- var foo = null;
- var baz = foo.bar;
-}
-
-
-
-/* logs a load of info */
-function log_vars( prefix ) {
- var str = prefix + ' : ';
-
- if(patron) {
- str += ' Patron=' + patron.id;
- str += ', Patron_Username='+ patron.usrname;
- str += ', Patron_Profile_Group='+ patronProfile;
- str += ', Patron_Fines=' + patronFines;
- str += ', Patron_OverdueCount=' + patronOverdueCount;
- str += ', Patron_Items_Out=' + patronItemsOut;
-
- try {
- str += ', Patron_Barcode=' + patron.card.barcode;
- str += ', Patron_Library=' + patron.home_ou.name;
- } catch(e) {}
- }
-
- if(requestor.id != patron.id)
- str+= ' Requestor='+requestor.usrname;
-
- if(copy) {
- str += ', Copy=' + copy.id;
- str += ', Copy_Barcode=' + copy.barcode;
- str += ', Copy_status=' + copyStatus;
- str += (copy.circ_modifier) ? ', Circ_Mod=' + copy.circ_modifier : '';
-
- try {
- str += ', Circ_Lib=' + copy.circ_lib.shortname;
- str += ', Copy_location=' + copy.location.name;
- } catch(e) {}
- }
-
- if(volume) {
- str += ', Item_Owning_lib=' + volume.owning_lib;
- str += ', Volume=' + volume.id;
- }
-
- if(title) str += ', Record=' + title.id;
-
- if(recDescriptor) {
- str += ', Record_Descriptor=' + recDescriptor.id;
- str += ', Item_Type=' + recDescriptor.item_type;
- str += ', Item_Form=' + recDescriptor.item_form;
- str += ', Item_Lang=' + recDescriptor.item_lang;
- str += ', Item_Audience=' + recDescriptor.audience;
- }
-
- str += ', Is_Renewal: ' + ( (isTrue(isRenewal)) ? "yes" : "no" );
- str += ', Is_Precat: ' + ( (isTrue(isPrecat)) ? "yes" : "no" );
- str += (holdRequestLib) ? ', Hold_request_lib=' + holdRequestLib.shortname : '';
- str += (holdPickupLib) ? ', Hold_Pickup_Lib=' + holdPickupLib : '';
-
- log_info(str);
-}
-
-
-
-/**
- * Returns config information for the requested group. If
- * no config info exists for the requested group, then this
- * function searches up the tree to find the config info
- * for the nearest ancestor
- * @param The name of the group who's config info to return
- */
-function findGroupConfig(name) {
- if(!name) return null;
- var node = groupList[name];
- do {
- if( GROUP_CONFIG[node.name] ) {
- debugGroupConfig(name, node.name, GROUP_CONFIG[node.name]);
- return GROUP_CONFIG[node.name];
- }
- } while( (node = groupIDList[node.parent]) );
- return null;
-}
-
-
-/** prints out the settings for the given group config **/
-function debugGroupConfig(name, foundName, config) {
- if(!config) return;
- var str = "findGroupConfig('"+name+"'): returning config info for '"+ foundName +"': ";
- for( var i in config )
- str += i + '=' + config[i] + ' ';
- log_debug(str);
-}
-
-
+++ /dev/null
-function go() {
-
-/* load the lib script */
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_vars('circ_permit_copy');
-
-
-if( ! isTrue(copy.circulate) || !isTrue(copy.location.circulate) )
- result.events.push('COPY_CIRC_NOT_ALLOWED');
-
-
-if( ! isTrue(isRenewal) ) {
- if(copyStatus != 'Available' &&
- copyStatus != 'On holds shelf' && copyStatus != 'Reshelving' ) {
- result.events.push('COPY_NOT_AVAILABLE');
- }
-}
-
-
-
-} go();
-
-
+++ /dev/null
-function go() {
-
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_vars('circ_permit_hold');
-
-
-
-if( isTrue(patron.barred) )
- result.events.push('PATRON_BARRED');
-
-if( isTrue(copy.ref) )
- result.events.push('ITEM_NOT_HOLDABLE');
-
-if( !isTrue(copy.circulate) )
- result.events.push('ITEM_NOT_HOLDABLE');
-
-
-var config = findGroupConfig(patronProfile);
-
-
-if( config ) {
-
- /* see if they have too many items out */
- if(newHold) {
- log_info("This is a new hold, checking maxHolds...");
- var limit = config.maxHolds;
- var count = userHoldCount(patron.id);
- if( limit >= 0 && count >= limit ) {
- log_info("patron has " + count + " open holds");
- result.events.push('MAX_HOLDS');
- }
- } else {
- log_info("Ignoring maxHolds on existing hold...");
- }
-}
-
-
-} go();
-
-
-
+++ /dev/null
-function go() {
-
-/* load the script library */
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_vars('circ_permit_patron');
-
-
-if( isTrue(patron.barred) )
- result.events.push('PATRON_BARRED');
-
-var config = findGroupConfig(patronProfile);
-
-if( config ) {
-
- var limit = config.maxItemsOut;
- if( limit >= 0 ) {
- log_info('patron items out = ' + patronItemsOut +' limit = ' + limit);
- if( !isTrue(isRenewal) && patronItemsOut >= limit ) {
- result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
- }
- }
-
-} else {
-
- log_warn("** profile has no configured information: " + patronProfile);
-}
-
-
-
-} go();
-
-
+++ /dev/null
-function go() {
-
-/* load the lib script */
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_vars('circ_permit_renew');
-
-} go();
+++ /dev/null
-try {
- load_lib('jsOO.js')
- load_lib('xpath.js')
-} catch (e) {}
-
-function DOMException (c) { this.code = c }
-DOMException.INDEX_SIZE_ERR = 1;
-DOMException.DOMSTRING_SIZE_ERR = 2;
-DOMException.HIERARCHY_REQUEST_ERR = 3;
-DOMException.WRONG_DOCUMENT_ERR = 4;
-DOMException.INVALID_CHARACTER_ERR = 5;
-DOMException.NO_DATA_ALLOWED_ERR = 6;
-DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
-DOMException.NOT_FOUND_ERR = 8;
-DOMException.NOT_SUPPORTED_ERR = 9;
-DOMException.INUSE_ATTRIBUTE_ERR = 10;
-DOMException.INVALID_STATE_ERR = 11;
-DOMException.SYNTAX_ERR = 12;
-DOMException.INVALID_MODIFICATION_ERR = 13;
-DOMException.NAMESPACE_ERR = 14;
-DOMException.INVALID_ACCESS_ERR = 15;
-
-function DOMImplementation () {
- this._features = {};
- this._features['CORE'] = {};
- this._features['CORE']['any'] = true;
- this._features['CORE']['1.0'] = true;
- this._features['CORE']['2.0'] = true;
- this._features['XML'] = {};
- this._features['XML']['any'] = true;
- this._features['XML']['1.0'] = true;
- this._features['XML']['2.0'] = true;
-}
-
-DOMImplementation.method('hasFeature', function (f, v) {
- if (!v) v = 'any';
- if (this._features[f] && this._features[f][v])
- return this._features[f][v];
- return false;
-});
-DOMImplementation.method('createDocumentType', function (n, p, s) {
- return null;
-});
-DOMImplementation.method('createDocument', function (ns,qn,dt) {
- var d = new Document(dt);
- d.documentElement = d.createElement(qn);
- d.appendChild(d.documentElement);
- if (ns)
- d.documentElement.namespaceURI = ns;
-
- installDOM3XPathSupport(d,new XPathParser());
- return d;
-});
-
-var __XMLDOC = {};
-var __XMLDOCid = 0;
-DOMImplementation.parseString = function (xml) {
- __XMLDOC['id' + __XMLDOCid] = {};
- try {
- _OILS_FUNC_xml_parse_string(xml, '__XMLDOC.id' + __XMLDOCid);
- } catch (e) {
- alert("Sorry, no string parsing support");
- }
- var x = __XMLDOC['id' + __XMLDOCid];
- __XMLDOCid++;
- return x;
-}
-
-
-// NodeList interface
-function NodeList () {
- this.length = 0;
- //log_stdout(' -- NodeList constructor');
-}
-
-NodeList.method('item', function (idx) {
- return this[idx];
-});
-NodeList.method('push', function (node) {
- var idx = this.length;
- this[idx] = node;
- this.length++;
- return this[idx];
-});
-
-
-
-
-// NamedNodeMap interface
-function NamedNodeMap () {
- this.length = 0;
- this._nodes = {};
- this._ns_nodes = {};
- //log_stdout(' -- NamedNodeMap constructor');
-}
-
-NamedNodeMap.method('item', function (idx) {
- return this.getNamedItem(idx);
-});
-
-NamedNodeMap.method('removeNamedItemNS', function (ns, name) {
- var x = this._ns_nodes[ns][name];
- for (var i in this._nodes) {
- if (this._nodes[i] === x) {
- this._nodes[i] = null;
- }
- }
- this._ns_nodes[ns][name] = null;
- return x;
-});
-
-NamedNodeMap.method('removeNamedItem', function (name) {
- var x = this._nodes[name];
- for (var i in this._nodes) {
- if (this._nodes[i] === x) {
- this._nodes[i] = null;
- }
- }
- return x;
-});
-
-NamedNodeMap.method('getNamedItem', function (name) {
- return this._nodes[name];
-});
-
-NamedNodeMap.method('getNamedItemNS', function (ns,name) {
- return this._ns_nodes[ns][name];
-});
-
-NamedNodeMap.method('setNamedItem', function (node) {
- if (node.nodeName == 'length') return null;
- this[node.nodeName] = node.value;
- this[this.length] = node.value;
- this._nodes[node.nodeName] = node;
- this._nodes[this.length] = node;
- this.length++;
-});
-
-NamedNodeMap.method('setNamedItemNS', function (node) {
- if (node.nodeName == 'length') return null;
- this[this.length] = node.value;
- if (!this._ns_nodes[node.namespaceURI]) this._ns_nodes[node.namespaceURI] = {};
- this._ns_nodes[node.namespaceURI][node.nodeName] = node;
- this._nodes[this.length] = node;
- this.length++;
-});
-
-// Node interface
-function Node (name) {
- this.nodeName = name;
- this.nodeValue = null;
- this.nodeType = null;
- this.parentNode = null;
- this.childNodes = new NodeList();
- this.firstChild = null;
- this.lastChild = null;
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributes = new NamedNodeMap();
- this.ownerDocument = null;
- this.namespaceURI = null;
-
- if (name) {
- var p = name.indexOf(':');
- if (p != -1) {
- this.prefix = name.substring(0,p);
- this.localName = name.substring(p + 1);
- } else {
- this.localName = name;
- }
- }
-
- //log_stdout(' -- Node constructor');
-}
-Node.ELEMENT_NODE = 1;
-Node.ATTRIBUTE_NODE = 2;
-Node.TEXT_NODE = 3;
-Node.CDATA_SECTION_NODE = 4;
-Node.ENTITY_REFERENCE_NODE = 5;
-Node.ENTITY_NODE = 6;
-Node.PROCESSING_INSTRUCTION_NODE = 7;
-Node.COMMENT_NODE = 8;
-Node.DOCUMENT_NODE = 9;
-Node.DOCUMENT_TYPE_NODE = 10;
-Node.DOCUMENT_FRAGMENT_NODE = 11;
-Node.NOTATION_NODE = 12;
-Node.NAMESPACE_DECL = 18;
-
-Node.method('_childIndex', function (node) {
- for (var i = 0; i < this.childNodes.length; i++)
- if (this.childNodes[i] === node) return i;
-});
-Node.method('insertBefore', function (node, target) {
-
- if (node.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
- for (var i = 0; i < node.childNodes.length; i++)
- this.insertBefore(node.childNodes.item(i));
- return node;
- }
-
- node.parentNode = this;
- node.ownerDocument = this.ownerDocument;
- var i = this._childIndex(target);
-
- for (var j = this.childNodes.length; j > i; j--)
- this.childNodes[j] = this.childNodes[j - 1];
-
- this.childNodes[i] = node;
-
- if (i == 0) {
- this.firstChild = node;
- } else {
- this.childNodes[i - 1].nextSibling = node;
- node.previousSibling = this.childNodes[i + 1];
- }
-
- this.childNodes[i + 1].previousSibling = node;
- node.nextSibling = this.childNodes[i + 1];
-
- node._index = this.ownerDocument._nodes.length;
- this.ownerDocument._nodes[this.ownerDocument._nodes.length] = node;
-
- this.childNodes.length++;
- return node;
-});
-
-Node.method('removeChild', function (node) {
- node.parentNode = this;
- node.ownerDocument = this.ownerDocument;
- var i = this._childIndex(node);
-
- if (node === this.firstChild) {
- this.firstChild = node.nextSibling;
- } else {
- node.previousSibling.nextSibling = node.nextSibling;
- for (var j = i; j < this.childNodes.length; j++)
- this.childNodes[j - 1] = this.childNodes[j];
- }
-
- if (node === this.lastChild) {
- this.lastChild = node.previousSibling;
- } else {
- node.nextSibling.previousSibling = node.previousSibling;
- }
-
- this.ownerDocument._nodes[node._index] = null;
-
- this.childNodes.length--;
- return node;
-});
-
-Node.method('appendChild', function (node) {
-
- if (node.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
- for (var i = 0; i < node.childNodes.length; i++)
- this.appendChild(node.childNodes.item(i));
- return node;
- }
-
- node.parentNode = this;
- this.childNodes.push( node );
- this.lastChild = node;
- if (this.childNodes.length == 1) {
- this.firstChild = node;
- } else {
- this.lastChild.previousSibling = this.childNodes[this.childNodes.length - 2]
- this.lastChild.previousSibling.nextSibling = this.lastChild;
- }
-
- return node;
-});
-
-Node.method('hasChildNodes', function () {
- if (this.childNodes.length) return true;
- return false;
-});
-
-Node.method('hasAttributes', function () {
- if (this.attributes.length) return true;
- return false;
-});
-
-Node.method('cloneNode', function (deep) {
- //log_stdout(this.constructor);
- var newNode = new this.constructor( this.nodeName );
- newNode.ownerDocument = this.ownerDocument;
- newNode.namespaceURI = this.namespaceURI;
- newNode.prefix = this.prefix;
-
- if (deep) {
- for (var i = 0; i < this.childNodes.length; i++)
- newNode.appendChild( this.childNodes.item(i).cloneNode(deep) );
- }
-
- for (var i = 0; i < this.attributes.length; i++)
- newNode.attributes.setNamedItem( this.attributes.item(i) );
-
- return newNode;
-});
-
-function DocumentType (n,p,s) {
- this.uber('constructor');
- this.constructor = DocumentType;
- this.nodeType = Node.DOCUMENT_TYPE_NODE;
- this.name = n;
- this.entities = new NamedNodeMap();
- this.notations = new NamedNodeMap();
- this.publicId = p;
- this.systemId = s;
- this.internalSubset = null;
-}
-DocumentType.inherits(Node);
-
-function Notation (p, s) {
- this.uber('constructor');
- this.constructor = Notation;
- this.nodeType = Node.NOTATION_NODE;
- this.publicId = p;
- this.systemId = s;
-}
-Notation.inherits(Node);
-
-function ProcessingInstruction (target, data) {
- this.uber('constructor');
- this.constructor = ProcessingInstruction;
- this.nodeType = Node.PROCESSING_INSTRUCTION_NODE;
- this.target = target;
- this.data = data;
-}
-ProcessingInstruction.inherits(Node);
-
-function Entity (p, s, n) {
- this.uber('constructor');
- this.constructor = Entity;
- this.nodeType = Node.ENTITY_NODE;
- this.publicId = p;
- this.systemId = s;
- this.notationName = n;
-}
-Entity.inherits(Node);
-
-function EntityReference () {
- this.uber('constructor');
- this.constructor = EntityReference;
- this.nodeType = Node.ENTITY_REFERENCE_NODE;
-}
-EntityReference.inherits(Node);
-
-// Document interface
-function Document (dt) {
- this.uber('constructor');
- this.constructor = Document;
- this.nodeType = Node.DOCUMENT_NODE;
- this.doctype = dt;
- this.documentElement = null;
- this.implementation = new DOMImplementation();
- this._nodes = [];
- //log_stdout(' -- Document constructor');
-}
-
-Document.inherits(Node);
-Document.method('createAttribute', function (tagName) {
- var node = new Attr(tagName);
- node.ownerDocument = this;
- return node;
-});
-
-Document.method('createAttributeNS', function (ns,tagName) {
- var node = this.createAttribute(tagName);
- node.namespaceURI = ns;
- return node;
-});
-
-Document.method('createElement', function (tagName) {
- var node = new Element(tagName);
- node.ownerDocument = this;
- node._index = this._nodes.length;
- this._nodes[this._nodes.length] = node;
- return node;
-});
-
-Document.method('createElementNS', function (ns,tagName) {
- var node = this.createElement(tagName);
- node.namespaceURI = ns;
- return node;
-});
-
-Document.method('importNode', function (node, deep) {
- var tmp = node.clone(deep);
- tmp.ownerDocument = this;
- var newNode = tmp.cloneNode(deep);
- return newNode;
-});
-
-Document.method('createDocumentFragment', function () {
- var x = new Node();
- x.nodeType = Node.DOCUMENT_FRAGMENT_NODE;
- x.ownerDocument = this;
-});
-
-Document.method('createTextNode', function (content) {
- var node = new Text(content);
- node.ownerDocument = this;
- return node;
-});
-
-Document.method('createComment', function (content) {
- var node = new Comment(content);
- node.ownerDocument = this;
- return node;
-});
-
-Document.method('createCDATASection', function (content) {
- var node = new CDATASection(content);
- node.ownerDocument = this;
- return node;
-});
-
-Document.method('getElementById', function (id) {
- for (var i in this._nodes) {
- //log_stdout(' id = ' + this._nodes[i].attributes.id);
- if (this._nodes[i] && this._nodes[i].attributes.id == id)
- return this._nodes[i];
- }
- return null;
-});
-
-Document.method('getElementsByTagName', function (tname) {
- var list = new NodeList();
- this.documentElement.getElementsByTagName(tname, list);
- return list;
-});
-
-Document.method('getElementsByTagNameNS', function (ns, tname) {
- var list = new NodeList();
- this.documentElement.getElementsByTagNameNS(ns, tname, list);
- return list;
-});
-
-// Attr interface
-function Attr ( name, value ) {
- this.uber('constructor',name);
- this.constructor = Attr;
- this.nodeType = Node.ATTRIBUTE_NODE;
- this.name = name;
- this.value = this.nodeValue = value;
- this.specified = (this.value ? true : false);
- this.ownerElement = null;
- //log_stdout(' -- Attr constructor');
-}
-Attr.inherits(Node);
-
-
-// Element interface
-function Element ( name ) {
- this.uber('constructor',name);
- this.constructor = Element;
- this.nodeType = Node.ELEMENT_NODE;
- this.tagName = name;
- //log_stdout(' -- Element constructor')
-}
-Element.inherits(Node);
-
-Element.method('getAttribute', function (aname) {
- var x = this.attributes.getNamedItem(aname);
- if (x) return x.value;
- return null;
-});
-
-Element.method('setAttribute', function (aname,aval) {
- var attr = new Attr(aname, aval);
- attr.ownerElement = this;
- return this.attributes.setNamedItem(attr);
-});
-
-Element.method('removeAttribute', function (aname) {
- this.attributes.removeNamedItem(aname);
- return null;
-});
-
-Element.method('getAttributeNode', function (aname) {
- return this.attributes.getNamedItem(aname);
-});
-
-Element.method('setAttributeNode', function (attr) {
- attr.ownerElement = this;
- attr.namespaceURI = (attr.namespaceURI ? attr.namespaceURI : this.namespaceURI);
- return this.attributes.setNamedItem(attr);
-});
-
-Element.method('removeAttributeNode', function (attr) {
- if (attr.namespaceURI) {
- return this.attributes.removeNamedItemNS(attr.namespaceURI, attr.name);
- } else {
- return this.attributes.removeNamedItem(attr.name);
- }
-});
-
-Element.method('getAttributeNS', function (ns,aname) {
- var x = this.attributes.getNamedItemNS(ns,aname);
- if (x) return x.value;
- return null;
-});
-
-Element.method('setAttributeNS', function (ns,aname,aval) {
- var attr = new Attr(aname, aval);
- attr.ownerElement = this;
- attr.namespaceURI = ns;
- return this.attributes.setNamedItem(ns,attr);
-});
-
-Element.method('removeAttributeNS', function (ns,aname) {
- this.attributes.removeNamedItemNS(ns,aname);
- return null;
-});
-
-Element.method('getAttributeNodeNS', function (ns, aname) {
- return this.attributes.getNamedItemNS(ns,aname);
-});
-
-Element.method('setAttributeNodeNS', function (attr) {
- attr.ownerElement = this;
- attr.namespaceURI = (attr.namespaceURI ? attr.namespaceURI : this.namespaceURI);
- return this.attributes.setNamedItemNS(attr);
-});
-
-Element.method('hasAttribute', function (name) {
- return ( this.getAttribute(name) ? true : false );
-});
-
-Element.method('hasAttributeNS', function (ns, name) {
- return ( this.getAttributeNS(ns, name) ? true : false );
-});
-
-Element.method('getElementsByTagName', function (tname, list) {
- if (!list) list = new NodeList();
- if (this.tagName == tname) list.push(this);
- //log_stdout(' -- ' + this.tagName + ' :: ' + this.childNodes.length);
- for (var i = 0; i < this.childNodes.length; i++) {
- if (this.childNodes.item(i).nodeType == 1)
- this.childNodes.item(i).getElementsByTagName(tname, list);
- }
- return list;
-});
-
-Element.method('getElementsByTagNameNS', function (ns, tname, list) {
- if (!list) list = new NodeList();
- if (this.localName == tname && this.namespaceURI == ns) list.push(this);
- //log_stdout(' -- {' + this.namespaceURI + '}:' + this.localName + ' :: ' + this.childNodes.length);
- for (var i = 0; i < this.childNodes.length; i++) {
- if (this.childNodes.item(i).nodeType == 1)
- this.childNodes.item(i).getElementsByTagNameNS(ns, tname, list);
- }
- return list;
-});
-
-
-// CharacterData interface
-function CharacterData ( name, content ) {
- this.uber('constructor', name);
- this.constructor = CharacterData;
- this.setData(content);
- //log_stdout(' -- CharacterData constructor');
- //log_stdout(' -- CharacterData length == ' + this.length + ' :: ' + this.data);
-}
-CharacterData.inherits(Node);
-
-CharacterData.method('setData', function (content) {
- this.data = this.nodeValue = content;
- if (this.data)
- this.length = this.data.length;
-});
-CharacterData.method('substringData', function (offset,count) {
- this.data.substring(offset,count);
-});
-CharacterData.method('appendData', function (txt) {
- this.data = this.nodeValue = this.data + txt;
- this.length = this.data.length;
-});
-CharacterData.method('insertData', function (offset,txt) {
- var b = this.data.substring(0,offset);
- var a = this.data.substring(offset);
- this.data = this.nodeValue = b + txt + a;
- this.length = this.data.length;
-});
-CharacterData.method('deleteData', function (offset,count) {
- var b = this.data.substring(0,offset);
- var a = this.data.substring(offset + count);
- this.data = this.nodeValue = b + a;
- this.length = this.data.length;
-});
-CharacterData.method('replaceData', function (offset,count,txt) {
- var b = this.data.substring(0,offset);
- var a = this.data.substring(offset + count);
- this.data = this.nodeValue = b + txt + a;
- this.length = this.data.length;
-});
-
-
-
-// Text interface
-function Text ( content ) {
- this.superclass.constructor.call(this, '#text', content);
- this.constructor = Text;
- this.nodeType = Node.TEXT_NODE;
- //log_stdout(' -- Text constructor :: ' + this.data);
-}
-Text.inherits(CharacterData);
-
-
-// CDATASection interface
-function CDATASection ( content ) {
- this.uber('constructor', '#cdata', content);
- this.constructor = CDATASection;
- this.nodeType = Node.COMMENT_NODE;
- //log_stdout(' -- Comment constructor');
-}
-CDATASection.inherits(Text);
-
-// Comment interface
-function Comment ( content ) {
- this.uber('constructor', '#comment', content);
- this.constructor = Comment;
- this.nodeType = Node.COMMENT_NODE;
- //log_stdout(' -- Comment constructor');
-}
-Comment.inherits(Text);
-
-
-
-//////////////////////// XPath stuff /////////////////////////
-
-function XPathNamespaceResolver (data) {
- this.data = data;
-}
-XPathNamespaceResolver.inherits(NamespaceResolver);
-
-XPathNamespaceResolver.method('lookupNamespaceURI', function (prefix) {
- return this.data[prefix];
-});
-XPathNamespaceResolver.method('setNamespaceURI', function (prefix, uri) {
- this.data[prefix] = uri;
-});
-
+++ /dev/null
-Function.prototype.method = function (name, func) {
- this.prototype[name] = func;
- return this;
-}
-
-Function.method('inherits', function (parent) {
- var d = 0, p = (this.prototype = new parent());
- this.constructor = this;
- this.prototype.superclass = parent;
- this.method('uber', function uber(name) {
- var f, r, t = d, v = parent.prototype;
- if (t) {
- while (t) {
- v = v.constructor.prototype;
- t -= 1;
- }
- f = v[name];
- } else {
- f = p[name];
- if (f == this[name]) {
- f = v[name];
- }
- }
- d += 1;
- r = f.apply(this, Array.prototype.slice.apply(arguments, [1]));
- d -= 1;
- return r;
- });
- return this;
-});
-
-
-instance_of = function(o, c) {
- while (o != null) {
- if (o.constructor === c) {
- return true;
- }
- if (o === Object) {
- return false;
- }
- o = o.superclass;
- }
- return false;
-};
-
-
+++ /dev/null
-try {
- load_lib('jsOO.js');
- load_lib('JSON_v1.js');
-} catch (e) {}
-
-var __jsonopensrfreqid = 1;
-var __jsonopensrfreq_hash = {};
-
-function JSONOpenSRFRequest () {
- // Cache this for later ...
- this._hash_id = __jsonopensrfreqid;
- __jsonopensrfreqid++;
-}
-
-JSONOpenSRFRequest.method('create',function (service) {
- this._service = service;
- __jsonopensrfreq_hash['id' + this._hash_id] = {};
-});
-
-JSONOpenSRFRequest.method('open',function (service, method, async) {
- this._service = service;
- this._method = method;
- this._async = (async ? 1 : 0);
- __jsonopensrfreq_hash['id' + this._hash_id] = {};
-});
-
-JSONOpenSRFRequest.method('close',function () {
- this._service = null;
- this._method = null;
- this._async = null;
- __jsonopensrfreq_hash['id' + this._hash_id] = {};
-});
-
-JSONOpenSRFRequest.method('call',function (method, async) {
- this._method = method;
- this._async = (async ? 1 : 0);
-});
-
-JSONOpenSRFRequest.method('connect', function (service) {
-
- if (service) this._service = service;
-
- if (!this._service)
- throw "call .open with a service before calling .connect";
- try {
- _OILS_FUNC_jsonopensrfrequest_connect(this._hash_id,this._service);
- } catch (e) {
- alert("Sorry, no JSONOpenSRFRequest support");
- }
-
- this.connected = __jsonopensrfreq_hash['id' + this._hash_id].connected;
-});
-
-JSONOpenSRFRequest.method('disconnect', function () {
-
- if (!this._service)
- throw "call .connect before calling .disconnect";
- try {
- _OILS_FUNC_jsonopensrfrequest_disconnect(this._hash_id);
- } catch (e) {
- alert("Sorry, no JSONOpenSRFRequest support");
- }
-
- this.connected = __jsonopensrfreq_hash['id' + this._hash_id].connected;
-});
-
-JSONOpenSRFRequest.method('finish', function () {
-
- if (!this._service)
- throw "call .connect before calling .finish";
- try {
- _OILS_FUNC_jsonopensrfrequest_disconnect(this._hash_id);
- _OILS_FUNC_jsonopensrfrequest_finish(this._hash_id);
- } catch (e) {
- alert("Sorry, no JSONOpenSRFRequest support");
- }
-
- this.connected = __jsonopensrfreq_hash['id' + this._hash_id].connected;
-});
-
-JSONOpenSRFRequest.method('send', function () {
-
- if (!this._service)
- throw "call .open with a service and a method before calling .send";
-
- var data = [];
- for (var i = 0; i < arguments.length; i++) {
- data[i] = arguments[i];
- }
-
- try {
- //log_debug( this._hash_id + " -> " + this._service + " -> " + this._method + " -> " + this._async + " -> " + js2JSON(data));
- _OILS_FUNC_jsonopensrfrequest_send(this._hash_id,this._service,this._method,this._async,js2JSON(data));
- } catch (e) {
- alert("Sorry, no JSONOpenSRFRequest support");
- }
-
- this.responseText = __jsonopensrfreq_hash['id' + this._hash_id].responseText;
- this.readyState = __jsonopensrfreq_hash['id' + this._hash_id].readyState;
- this.status = __jsonopensrfreq_hash['id' + this._hash_id].status;
- this.statusText = __jsonopensrfreq_hash['id' + this._hash_id].statusText;
- this.responseJSON = JSON2js(this.responseText);
-
- if (this._async)
- this.onreadystatechange();
-});
-
-
+++ /dev/null
-try {
- load_lib('jsOO.js');
- load_lib('jsDOM.js');
-} catch (e) {}
-
-var __xmlhttpreqid = 1;
-var __xmlhttpreq_hash = {};
-
-function XMLHttpRequest () {
- // Cache this for later ...
- this._hash_id = __xmlhttpreqid;
- __xmlhttpreqid++;
-}
-
-XMLHttpRequest.method('open',function (method, url, async) {
- this._method = method;
- this._url = url;
- this._async = (async ? 1 : 0);
-});
-
-XMLHttpRequest.method('setRequestHeader', function (header, header_value) {
- if (!this._headers) this._headers = {}
- this._headers[header] = header_value;
-});
-
-XMLHttpRequest.method('send', function (data) {
-
- var headerlist = '';
- for (var i in this._headers) {
- headerlist = headerlist + '\n' + i + '|' + this._headers[i];
- }
-
- __xmlhttpreq_hash['id' + this._hash_id] = {};
-
- try {
- _OILS_FUNC_xmlhttprequest_send(this._hash_id,this._method,this._url,this._async,headerlist,data);
- } catch (e) {
- alert("Sorry, no XMLHttpRequest support");
- }
-
- this.responseText = __xmlhttpreq_hash['id' + this._hash_id].responseText;
- this.readyState = __xmlhttpreq_hash['id' + this._hash_id].readyState;
- this.status = __xmlhttpreq_hash['id' + this._hash_id].status;
- this.statusText = __xmlhttpreq_hash['id' + this._hash_id].statusText;
- this.responseXML = DOMImplementation.parseString(this.responseText);
-
- if (this._async)
- this.onreadystatechange();
-});
-
-
+++ /dev/null
-/*
- * xpath.js
- *
- * An XPath 1.0 library for JavaScript.
- *
- * Cameron McCormack <cam (at) mcc.id.au>
- *
- * This work is licensed under the Creative Commons Attribution-ShareAlike
- * License. To view a copy of this license, visit
- *
- * http://creativecommons.org/licenses/by-sa/2.0/
- *
- * or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford,
- * California 94305, USA.
- *
- *
- * Patch m1: January 13, 2006
- * Forcing namespace resolution for default namespaces. In the current
- * code the default namespace (no prefix) is the same as no namespace,
- * but AFAICT this is incorrect. If a node has a namespaceURI then it
- * should be used, and the expression should use the NamespaceResolver
- * to match the node's namespaceURI.
- *
- * On a more positive note, I am using this library to test the correctness
- * of my pure-JS DOM implementation for use in libjs environments. You can
- * currently find that at
- * http://open-ils.org/cgi-bin/viewcvs.cgi/ILS/Open-ILS/src/javascript/backend/libs/jsDOM.js
- *
- * Revision 19: November 29, 2005
- * Nodesets now store their nodes in a height balanced tree, increasing
- * performance for the common case of selecting nodes in document order,
- * thanks to Sébastien Cramatte <contact (at) zeninteractif.com>.
- * AVL tree code adapted from Raimund Neumann <rnova (at) gmx.net>.
- *
- * Revision 18: October 27, 2005
- * DOM 3 XPath support. Caveats:
- * - namespace prefixes aren't resolved in XPathEvaluator.createExpression,
- * but in XPathExpression.evaluate.
- * - XPathResult.invalidIteratorState is not implemented.
- *
- * Revision 17: October 25, 2005
- * Some core XPath function fixes and a patch to avoid crashing certain
- * versions of MSXML in PathExpr.prototype.getOwnerElement, thanks to
- * Sébastien Cramatte <contact (at) zeninteractif.com>.
- *
- * Revision 16: September 22, 2005
- * Workarounds for some IE 5.5 deficiencies.
- * Fixed problem with prefix node tests on attribute nodes.
- *
- * Revision 15: May 21, 2005
- * Fixed problem with QName node tests on elements with an xmlns="...".
- *
- * Revision 14: May 19, 2005
- * Fixed QName node tests on attribute node regression.
- *
- * Revision 13: May 3, 2005
- * Node tests are case insensitive now if working in an HTML DOM.
- *
- * Revision 12: April 26, 2005
- * Updated licence. Slight code changes to enable use of Dean
- * Edwards' script compression, http://dean.edwards.name/packer/ .
- *
- * Revision 11: April 23, 2005
- * Fixed bug with 'and' and 'or' operators, fix thanks to
- * Sandy McArthur <sandy (at) mcarthur.org>.
- *
- * Revision 10: April 15, 2005
- * Added support for a virtual root node, supposedly helpful for
- * implementing XForms. Fixed problem with QName node tests and
- * the parent axis.
- *
- * Revision 9: March 17, 2005
- * Namespace resolver tweaked so using the document node as the context
- * for namespace lookups is equivalent to using the document element.
- *
- * Revision 8: February 13, 2005
- * Handle implicit declaration of 'xmlns' namespace prefix.
- * Fixed bug when comparing nodesets.
- * Instance data can now be associated with a FunctionResolver, and
- * workaround for MSXML not supporting 'localName' and 'getElementById',
- * thanks to Grant Gongaware.
- * Fix a few problems when the context node is the root node.
- *
- * Revision 7: February 11, 2005
- * Default namespace resolver fix from Grant Gongaware
- * <grant (at) gongaware.com>.
- *
- * Revision 6: February 10, 2005
- * Fixed bug in 'number' function.
- *
- * Revision 5: February 9, 2005
- * Fixed bug where text nodes not getting converted to string values.
- *
- * Revision 4: January 21, 2005
- * Bug in 'name' function, fix thanks to Bill Edney.
- * Fixed incorrect processing of namespace nodes.
- * Fixed NamespaceResolver to resolve 'xml' namespace.
- * Implemented union '|' operator.
- *
- * Revision 3: January 14, 2005
- * Fixed bug with nodeset comparisons, bug lexing < and >.
- *
- * Revision 2: October 26, 2004
- * QName node test namespace handling fixed. Few other bug fixes.
- *
- * Revision 1: August 13, 2004
- * Bug fixes from William J. Edney <bedney (at) technicalpursuit.com>.
- * Added minimal licence.
- *
- * Initial version: June 14, 2004
- */
-
-// XPathParser ///////////////////////////////////////////////////////////////
-
-XPathParser.prototype = new Object();
-XPathParser.prototype.constructor = XPathParser;
-XPathParser.superclass = Object.prototype;
-
-function XPathParser() {
- this.init();
-}
-
-XPathParser.prototype.init = function() {
- this.reduceActions = [];
-
- this.reduceActions[3] = function(rhs) {
- return new OrOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[5] = function(rhs) {
- return new AndOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[7] = function(rhs) {
- return new EqualsOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[8] = function(rhs) {
- return new NotEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[10] = function(rhs) {
- return new LessThanOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[11] = function(rhs) {
- return new GreaterThanOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[12] = function(rhs) {
- return new LessThanOrEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[13] = function(rhs) {
- return new GreaterThanOrEqualOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[15] = function(rhs) {
- return new PlusOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[16] = function(rhs) {
- return new MinusOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[18] = function(rhs) {
- return new MultiplyOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[19] = function(rhs) {
- return new DivOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[20] = function(rhs) {
- return new ModOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[22] = function(rhs) {
- return new UnaryMinusOperation(rhs[1]);
- };
- this.reduceActions[24] = function(rhs) {
- return new BarOperation(rhs[0], rhs[2]);
- };
- this.reduceActions[25] = function(rhs) {
- return new PathExpr(undefined, undefined, rhs[0]);
- };
- this.reduceActions[27] = function(rhs) {
- rhs[0].locationPath = rhs[2];
- return rhs[0];
- };
- this.reduceActions[28] = function(rhs) {
- rhs[0].locationPath = rhs[2];
- rhs[0].locationPath.steps.unshift(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
- return rhs[0];
- };
- this.reduceActions[29] = function(rhs) {
- return new PathExpr(rhs[0], [], undefined);
- };
- this.reduceActions[30] = function(rhs) {
- if (Utilities.instance_of(rhs[0], PathExpr)) {
- if (rhs[0].filterPredicates == undefined) {
- rhs[0].filterPredicates = [];
- }
- rhs[0].filterPredicates.push(rhs[1]);
- return rhs[0];
- } else {
- return new PathExpr(rhs[0], [rhs[1]], undefined);
- }
- };
- this.reduceActions[32] = function(rhs) {
- return rhs[1];
- };
- this.reduceActions[33] = function(rhs) {
- return new XString(rhs[0]);
- };
- this.reduceActions[34] = function(rhs) {
- return new XNumber(rhs[0]);
- };
- this.reduceActions[36] = function(rhs) {
- return new FunctionCall(rhs[0], []);
- };
- this.reduceActions[37] = function(rhs) {
- return new FunctionCall(rhs[0], rhs[2]);
- };
- this.reduceActions[38] = function(rhs) {
- return [ rhs[0] ];
- };
- this.reduceActions[39] = function(rhs) {
- rhs[2].unshift(rhs[0]);
- return rhs[2];
- };
- this.reduceActions[43] = function(rhs) {
- return new LocationPath(true, []);
- };
- this.reduceActions[44] = function(rhs) {
- rhs[1].absolute = true;
- return rhs[1];
- };
- this.reduceActions[46] = function(rhs) {
- return new LocationPath(false, [ rhs[0] ]);
- };
- this.reduceActions[47] = function(rhs) {
- rhs[0].steps.push(rhs[2]);
- return rhs[0];
- };
- this.reduceActions[49] = function(rhs) {
- return new Step(rhs[0], rhs[1], []);
- };
- this.reduceActions[50] = function(rhs) {
- return new Step(Step.CHILD, rhs[0], []);
- };
- this.reduceActions[51] = function(rhs) {
- return new Step(rhs[0], rhs[1], rhs[2]);
- };
- this.reduceActions[52] = function(rhs) {
- return new Step(Step.CHILD, rhs[0], rhs[1]);
- };
- this.reduceActions[54] = function(rhs) {
- return [ rhs[0] ];
- };
- this.reduceActions[55] = function(rhs) {
- rhs[1].unshift(rhs[0]);
- return rhs[1];
- };
- this.reduceActions[56] = function(rhs) {
- if (rhs[0] == "ancestor") {
- return Step.ANCESTOR;
- } else if (rhs[0] == "ancestor-or-self") {
- return Step.ANCESTORORSELF;
- } else if (rhs[0] == "attribute") {
- return Step.ATTRIBUTE;
- } else if (rhs[0] == "child") {
- return Step.CHILD;
- } else if (rhs[0] == "descendant") {
- return Step.DESCENDANT;
- } else if (rhs[0] == "descendant-or-self") {
- return Step.DESCENDANTORSELF;
- } else if (rhs[0] == "following") {
- return Step.FOLLOWING;
- } else if (rhs[0] == "following-sibling") {
- return Step.FOLLOWINGSIBLING;
- } else if (rhs[0] == "namespace") {
- return Step.NAMESPACE;
- } else if (rhs[0] == "parent") {
- return Step.PARENT;
- } else if (rhs[0] == "preceding") {
- return Step.PRECEDING;
- } else if (rhs[0] == "preceding-sibling") {
- return Step.PRECEDINGSIBLING;
- } else if (rhs[0] == "self") {
- return Step.SELF;
- }
- return -1;
- };
- this.reduceActions[57] = function(rhs) {
- return Step.ATTRIBUTE;
- };
- this.reduceActions[59] = function(rhs) {
- if (rhs[0] == "comment") {
- return new NodeTest(NodeTest.COMMENT, undefined);
- } else if (rhs[0] == "text") {
- return new NodeTest(NodeTest.TEXT, undefined);
- } else if (rhs[0] == "processing-instruction") {
- return new NodeTest(NodeTest.PI, undefined);
- } else if (rhs[0] == "node") {
- return new NodeTest(NodeTest.NODE, undefined);
- }
- return new NodeTest(-1, undefined);
- };
- this.reduceActions[60] = function(rhs) {
- return new NodeTest(NodeTest.PI, rhs[2]);
- };
- this.reduceActions[61] = function(rhs) {
- return rhs[1];
- };
- this.reduceActions[63] = function(rhs) {
- rhs[1].absolute = true;
- rhs[1].steps.unshift(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
- return rhs[1];
- };
- this.reduceActions[64] = function(rhs) {
- rhs[0].steps.push(new Step(Step.DESCENDANTORSELF, new NodeTest(NodeTest.NODE, undefined), []));
- rhs[0].steps.push(rhs[2]);
- return rhs[0];
- };
- this.reduceActions[65] = function(rhs) {
- return new Step(Step.SELF, new NodeTest(NodeTest.NODE, undefined), []);
- };
- this.reduceActions[66] = function(rhs) {
- return new Step(Step.PARENT, new NodeTest(NodeTest.NODE, undefined), []);
- };
- this.reduceActions[67] = function(rhs) {
- return new VariableReference(rhs[1]);
- };
- this.reduceActions[68] = function(rhs) {
- return new NodeTest(NodeTest.NAMETESTANY, undefined);
- };
- this.reduceActions[69] = function(rhs) {
- var prefix = rhs[0].substring(0, rhs[0].indexOf(":"));
- return new NodeTest(NodeTest.NAMETESTPREFIXANY, prefix);
- };
- this.reduceActions[70] = function(rhs) {
- return new NodeTest(NodeTest.NAMETESTQNAME, rhs[0]);
- };
-};
-
-XPathParser.actionTable = [
- " s s sssssssss s ss s ss",
- " s ",
- "r rrrrrrrrr rrrrrrr rr r ",
- " rrrrr ",
- " s s sssssssss s ss s ss",
- "rs rrrrrrrr s sssssrrrrrr rrs rs ",
- " s s sssssssss s ss s ss",
- " s ",
- " s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- " s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "a ",
- "r s rr r ",
- "r sr rr r ",
- "r s rr s rr r ",
- "r rssrr rss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrrs rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r srrrrrrrr rrrrrrs rr sr ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- " sssss ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrr rrrrr rr r ",
- " s ",
- " s ",
- " rrrrr ",
- " s s sssssssss s sss s ss",
- "r srrrrrrrr rrrrrrs rr r ",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssssssss ss s ss",
- " s s sssssssss s ss s ss",
- " s s sssss s s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s s sssss s s ",
- " s s sssss s s ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr sr ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " rr ",
- " s ",
- " rs ",
- "r sr rr r ",
- "r s rr s rr r ",
- "r rssrr rss rr r ",
- "r rssrr rss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrr rrrss rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrsss rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrr rr r ",
- "r rrrrrrrr rrrrrr rr r ",
- " r ",
- " s ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r srrrrrrrr rrrrrrs rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr r ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " s s sssssssss s ss s ss",
- "r rrrrrrrrr rrrrrrr rr rr ",
- " r "
-];
-
-XPathParser.actionTableNumber = [
- " 1 0 /.-,+*)(' & %$ # \"!",
- " J ",
- "a aaaaaaaaa aaaaaaa aa a ",
- " YYYYY ",
- " 1 0 /.-,+*)(' & %$ # \"!",
- "K1 KKKKKKKK . +*)('KKKKKK KK# K\" ",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " N ",
- " O ",
- "e eeeeeeeee eeeeeee ee ee ",
- "f fffffffff fffffff ff ff ",
- "d ddddddddd ddddddd dd dd ",
- "B BBBBBBBBB BBBBBBB BB BB ",
- "A AAAAAAAAA AAAAAAA AA AA ",
- " P ",
- " Q ",
- " 1 . +*)(' # \" ",
- "b bbbbbbbbb bbbbbbb bb b ",
- " ",
- "! S !! ! ",
- "\" T\" \"\" \" ",
- "$ V $$ U $$ $ ",
- "& &ZY&& &XW && & ",
- ") ))))) )))\\[ )) ) ",
- ". ....._^] ..... .. . ",
- "1 11111111 11111 11 1 ",
- "5 55555555 55555` 55 5 ",
- "7 77777777 777777 77 7 ",
- "9 99999999 999999 99 9 ",
- ": c:::::::: ::::::b :: a: ",
- "I fIIIIIIII IIIIIIe II I ",
- "= ========= ======= == == ",
- "? ????????? ??????? ?? ?? ",
- "C CCCCCCCCC CCCCCCC CC CC ",
- "J JJJJJJJJ JJJJJJ JJ J ",
- "M MMMMMMMM MMMMMM MM M ",
- "N NNNNNNNNN NNNNNNN NN N ",
- "P PPPPPPPPP PPPPPPP PP P ",
- " +*)(' ",
- "R RRRRRRRRR RRRRRRR RR aR ",
- "U UUUUUUUUU UUUUUUU UU U ",
- "Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ",
- "c ccccccccc ccccccc cc cc ",
- " j ",
- "L fLLLLLLLL LLLLLLe LL L ",
- "6 66666666 66666 66 6 ",
- " k ",
- " l ",
- " XXXXX ",
- " 1 0 /.-,+*)(' & %$m # \"!",
- "_ f________ ______e __ _ ",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 0 /.-,+*)(' %$ # \"!",
- " 1 0 /.-,+*)(' & %$ # \"!",
- " 1 . +*)(' # \" ",
- " 1 . +*)(' # \" ",
- "> >>>>>>>>> >>>>>>> >> >> ",
- " 1 . +*)(' # \" ",
- " 1 . +*)(' # \" ",
- "Q QQQQQQQQQ QQQQQQQ QQ aQ ",
- "V VVVVVVVVV VVVVVVV VV aV ",
- "T TTTTTTTTT TTTTTTT TT T ",
- "@ @@@@@@@@@ @@@@@@@ @@ @@ ",
- " \x87 ",
- "[ [[[[[[[[[ [[[[[[[ [[ [[ ",
- "D DDDDDDDDD DDDDDDD DD DD ",
- " HH ",
- " \x88 ",
- " F\x89 ",
- "# T# ## # ",
- "% V %% U %% % ",
- "' 'ZY'' 'XW '' ' ",
- "( (ZY(( (XW (( ( ",
- "+ +++++ +++\\[ ++ + ",
- "* ***** ***\\[ ** * ",
- "- ----- ---\\[ -- - ",
- ", ,,,,, ,,,\\[ ,, , ",
- "0 00000_^] 00000 00 0 ",
- "/ /////_^] ///// // / ",
- "2 22222222 22222 22 2 ",
- "3 33333333 33333 33 3 ",
- "4 44444444 44444 44 4 ",
- "8 88888888 888888 88 8 ",
- " ^ ",
- " \x8a ",
- "; f;;;;;;;; ;;;;;;e ;; ; ",
- "< f<<<<<<<< <<<<<<e << < ",
- "O OOOOOOOOO OOOOOOO OO O ",
- "` ````````` ``````` `` ` ",
- "S SSSSSSSSS SSSSSSS SS S ",
- "W WWWWWWWWW WWWWWWW WW W ",
- "\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ",
- "E EEEEEEEEE EEEEEEE EE EE ",
- " 1 0 /.-,+*)(' & %$ # \"!",
- "] ]]]]]]]]] ]]]]]]] ]] ]] ",
- " G "
-];
-
-XPathParser.gotoTable = [
- "3456789:;<=>?@ AB CDEFGH IJ ",
- " ",
- " ",
- " ",
- "L456789:;<=>?@ AB CDEFGH IJ ",
- " M EFGH IJ ",
- " N;<=>?@ AB CDEFGH IJ ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " S EFGH IJ ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " e ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " h J ",
- " i j ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "o456789:;<=>?@ ABpqCDEFGH IJ ",
- " ",
- " r6789:;<=>?@ AB CDEFGH IJ ",
- " s789:;<=>?@ AB CDEFGH IJ ",
- " t89:;<=>?@ AB CDEFGH IJ ",
- " u89:;<=>?@ AB CDEFGH IJ ",
- " v9:;<=>?@ AB CDEFGH IJ ",
- " w9:;<=>?@ AB CDEFGH IJ ",
- " x9:;<=>?@ AB CDEFGH IJ ",
- " y9:;<=>?@ AB CDEFGH IJ ",
- " z:;<=>?@ AB CDEFGH IJ ",
- " {:;<=>?@ AB CDEFGH IJ ",
- " |;<=>?@ AB CDEFGH IJ ",
- " };<=>?@ AB CDEFGH IJ ",
- " ~;<=>?@ AB CDEFGH IJ ",
- " \x7f=>?@ AB CDEFGH IJ ",
- "\x80456789:;<=>?@ AB CDEFGH IJ\x81",
- " \x82 EFGH IJ ",
- " \x83 EFGH IJ ",
- " ",
- " \x84 GH IJ ",
- " \x85 GH IJ ",
- " i \x86 ",
- " i \x87 ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- "o456789:;<=>?@ AB\x8cqCDEFGH IJ ",
- " ",
- " "
-];
-
-XPathParser.productions = [
- [1, 1, 2],
- [2, 1, 3],
- [3, 1, 4],
- [3, 3, 3, -9, 4],
- [4, 1, 5],
- [4, 3, 4, -8, 5],
- [5, 1, 6],
- [5, 3, 5, -22, 6],
- [5, 3, 5, -5, 6],
- [6, 1, 7],
- [6, 3, 6, -23, 7],
- [6, 3, 6, -24, 7],
- [6, 3, 6, -6, 7],
- [6, 3, 6, -7, 7],
- [7, 1, 8],
- [7, 3, 7, -25, 8],
- [7, 3, 7, -26, 8],
- [8, 1, 9],
- [8, 3, 8, -12, 9],
- [8, 3, 8, -11, 9],
- [8, 3, 8, -10, 9],
- [9, 1, 10],
- [9, 2, -26, 9],
- [10, 1, 11],
- [10, 3, 10, -27, 11],
- [11, 1, 12],
- [11, 1, 13],
- [11, 3, 13, -28, 14],
- [11, 3, 13, -4, 14],
- [13, 1, 15],
- [13, 2, 13, 16],
- [15, 1, 17],
- [15, 3, -29, 2, -30],
- [15, 1, -15],
- [15, 1, -16],
- [15, 1, 18],
- [18, 3, -13, -29, -30],
- [18, 4, -13, -29, 19, -30],
- [19, 1, 20],
- [19, 3, 20, -31, 19],
- [20, 1, 2],
- [12, 1, 14],
- [12, 1, 21],
- [21, 1, -28],
- [21, 2, -28, 14],
- [21, 1, 22],
- [14, 1, 23],
- [14, 3, 14, -28, 23],
- [14, 1, 24],
- [23, 2, 25, 26],
- [23, 1, 26],
- [23, 3, 25, 26, 27],
- [23, 2, 26, 27],
- [23, 1, 28],
- [27, 1, 16],
- [27, 2, 16, 27],
- [25, 2, -14, -3],
- [25, 1, -32],
- [26, 1, 29],
- [26, 3, -20, -29, -30],
- [26, 4, -21, -29, -15, -30],
- [16, 3, -33, 30, -34],
- [30, 1, 2],
- [22, 2, -4, 14],
- [24, 3, 14, -4, 23],
- [28, 1, -35],
- [28, 1, -2],
- [17, 2, -36, -18],
- [29, 1, -17],
- [29, 1, -19],
- [29, 1, -18]
-];
-
-XPathParser.DOUBLEDOT = 2;
-XPathParser.DOUBLECOLON = 3;
-XPathParser.DOUBLESLASH = 4;
-XPathParser.NOTEQUAL = 5;
-XPathParser.LESSTHANOREQUAL = 6;
-XPathParser.GREATERTHANOREQUAL = 7;
-XPathParser.AND = 8;
-XPathParser.OR = 9;
-XPathParser.MOD = 10;
-XPathParser.DIV = 11;
-XPathParser.MULTIPLYOPERATOR = 12;
-XPathParser.FUNCTIONNAME = 13;
-XPathParser.AXISNAME = 14;
-XPathParser.LITERAL = 15;
-XPathParser.NUMBER = 16;
-XPathParser.ASTERISKNAMETEST = 17;
-XPathParser.QNAME = 18;
-XPathParser.NCNAMECOLONASTERISK = 19;
-XPathParser.NODETYPE = 20;
-XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL = 21;
-XPathParser.EQUALS = 22;
-XPathParser.LESSTHAN = 23;
-XPathParser.GREATERTHAN = 24;
-XPathParser.PLUS = 25;
-XPathParser.MINUS = 26;
-XPathParser.BAR = 27;
-XPathParser.SLASH = 28;
-XPathParser.LEFTPARENTHESIS = 29;
-XPathParser.RIGHTPARENTHESIS = 30;
-XPathParser.COMMA = 31;
-XPathParser.AT = 32;
-XPathParser.LEFTBRACKET = 33;
-XPathParser.RIGHTBRACKET = 34;
-XPathParser.DOT = 35;
-XPathParser.DOLLAR = 36;
-
-XPathParser.prototype.tokenize = function(s1) {
- var types = [];
- var values = [];
- var s = s1 + '\0';
-
- var pos = 0;
- var c = s.charAt(pos++);
- while (1) {
- while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
- c = s.charAt(pos++);
- }
- if (c == '\0' || pos >= s.length) {
- break;
- }
-
- if (c == '(') {
- types.push(XPathParser.LEFTPARENTHESIS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ')') {
- types.push(XPathParser.RIGHTPARENTHESIS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '[') {
- types.push(XPathParser.LEFTBRACKET);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ']') {
- types.push(XPathParser.RIGHTBRACKET);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '@') {
- types.push(XPathParser.AT);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == ',') {
- types.push(XPathParser.COMMA);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '|') {
- types.push(XPathParser.BAR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '+') {
- types.push(XPathParser.PLUS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '-') {
- types.push(XPathParser.MINUS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '=') {
- types.push(XPathParser.EQUALS);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- if (c == '$') {
- types.push(XPathParser.DOLLAR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
-
- if (c == '.') {
- c = s.charAt(pos++);
- if (c == '.') {
- types.push(XPathParser.DOUBLEDOT);
- values.push("..");
- c = s.charAt(pos++);
- continue;
- }
- if (c >= '0' && c <= '9') {
- var number = "." + c;
- c = s.charAt(pos++);
- while (c >= '0' && c <= '9') {
- number += c;
- c = s.charAt(pos++);
- }
- types.push(XPathParser.NUMBER);
- values.push(number);
- continue;
- }
- types.push(XPathParser.DOT);
- values.push('.');
- continue;
- }
-
- if (c == '\'' || c == '"') {
- var delimiter = c;
- var literal = "";
- while ((c = s.charAt(pos++)) != delimiter) {
- literal += c;
- }
- types.push(XPathParser.LITERAL);
- values.push(literal);
- c = s.charAt(pos++);
- continue;
- }
-
- if (c >= '0' && c <= '9') {
- var number = c;
- c = s.charAt(pos++);
- while (c >= '0' && c <= '9') {
- number += c;
- c = s.charAt(pos++);
- }
- if (c == '.') {
- if (s.charAt(pos) >= '0' && s.charAt(pos) <= '9') {
- number += c;
- number += s.charAt(pos++);
- c = s.charAt(pos++);
- while (c >= '0' && c <= '9') {
- number += c;
- c = s.charAt(pos++);
- }
- }
- }
- types.push(XPathParser.NUMBER);
- values.push(number);
- continue;
- }
-
- if (c == '*') {
- if (types.length > 0) {
- var last = types[types.length - 1];
- if (last != XPathParser.AT
- && last != XPathParser.DOUBLECOLON
- && last != XPathParser.LEFTPARENTHESIS
- && last != XPathParser.LEFTBRACKET
- && last != XPathParser.AND
- && last != XPathParser.OR
- && last != XPathParser.MOD
- && last != XPathParser.DIV
- && last != XPathParser.MULTIPLYOPERATOR
- && last != XPathParser.SLASH
- && last != XPathParser.DOUBLESLASH
- && last != XPathParser.BAR
- && last != XPathParser.PLUS
- && last != XPathParser.MINUS
- && last != XPathParser.EQUALS
- && last != XPathParser.NOTEQUAL
- && last != XPathParser.LESSTHAN
- && last != XPathParser.LESSTHANOREQUAL
- && last != XPathParser.GREATERTHAN
- && last != XPathParser.GREATERTHANOREQUAL) {
- types.push(XPathParser.MULTIPLYOPERATOR);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
- }
- types.push(XPathParser.ASTERISKNAMETEST);
- values.push(c);
- c = s.charAt(pos++);
- continue;
- }
-
- if (c == ':') {
- if (s.charAt(pos) == ':') {
- types.push(XPathParser.DOUBLECOLON);
- values.push("::");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- }
-
- if (c == '/') {
- c = s.charAt(pos++);
- if (c == '/') {
- types.push(XPathParser.DOUBLESLASH);
- values.push("//");
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.SLASH);
- values.push('/');
- continue;
- }
-
- if (c == '!') {
- if (s.charAt(pos) == '=') {
- types.push(XPathParser.NOTEQUAL);
- values.push("!=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- }
-
- if (c == '<') {
- if (s.charAt(pos) == '=') {
- types.push(XPathParser.LESSTHANOREQUAL);
- values.push("<=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.LESSTHAN);
- values.push('<');
- c = s.charAt(pos++);
- continue;
- }
-
- if (c == '>') {
- if (s.charAt(pos) == '=') {
- types.push(XPathParser.GREATERTHANOREQUAL);
- values.push(">=");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- types.push(XPathParser.GREATERTHAN);
- values.push('>');
- c = s.charAt(pos++);
- continue;
- }
-
- if (c == '_' || Utilities.isLetter(c.charCodeAt(0))) {
- var name = c;
- c = s.charAt(pos++);
- while (Utilities.isNCNameChar(c.charCodeAt(0))) {
- name += c;
- c = s.charAt(pos++);
- }
- if (types.length > 0) {
- var last = types[types.length - 1];
- if (last != XPathParser.AT
- && last != XPathParser.DOUBLECOLON
- && last != XPathParser.LEFTPARENTHESIS
- && last != XPathParser.LEFTBRACKET
- && last != XPathParser.AND
- && last != XPathParser.OR
- && last != XPathParser.MOD
- && last != XPathParser.DIV
- && last != XPathParser.MULTIPLYOPERATOR
- && last != XPathParser.SLASH
- && last != XPathParser.DOUBLESLASH
- && last != XPathParser.BAR
- && last != XPathParser.PLUS
- && last != XPathParser.MINUS
- && last != XPathParser.EQUALS
- && last != XPathParser.NOTEQUAL
- && last != XPathParser.LESSTHAN
- && last != XPathParser.LESSTHANOREQUAL
- && last != XPathParser.GREATERTHAN
- && last != XPathParser.GREATERTHANOREQUAL) {
- if (name == "and") {
- types.push(XPathParser.AND);
- values.push(name);
- continue;
- }
- if (name == "or") {
- types.push(XPathParser.OR);
- values.push(name);
- continue;
- }
- if (name == "mod") {
- types.push(XPathParser.MOD);
- values.push(name);
- continue;
- }
- if (name == "div") {
- types.push(XPathParser.DIV);
- values.push(name);
- continue;
- }
- }
- }
- if (c == ':') {
- if (s.charAt(pos) == '*') {
- types.push(XPathParser.NCNAMECOLONASTERISK);
- values.push(name + ":*");
- pos++;
- c = s.charAt(pos++);
- continue;
- }
- if (s.charAt(pos) == '_' || Utilities.isLetter(s.charCodeAt(pos))) {
- name += ':';
- c = s.charAt(pos++);
- while (Utilities.isNCNameChar(c.charCodeAt(0))) {
- name += c;
- c = s.charAt(pos++);
- }
- if (c == '(') {
- types.push(XPathParser.FUNCTIONNAME);
- values.push(name);
- continue;
- }
- types.push(XPathParser.QNAME);
- values.push(name);
- continue;
- }
- if (s.charAt(pos) == ':') {
- types.push(XPathParser.AXISNAME);
- values.push(name);
- continue;
- }
- }
- if (c == '(') {
- if (name == "comment" || name == "text" || name == "node") {
- types.push(XPathParser.NODETYPE);
- values.push(name);
- continue;
- }
- if (name == "processing-instruction") {
- if (s.charAt(pos) == ')') {
- types.push(XPathParser.NODETYPE);
- } else {
- types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
- }
- values.push(name);
- continue;
- }
- types.push(XPathParser.FUNCTIONNAME);
- values.push(name);
- continue;
- }
- types.push(XPathParser.QNAME);
- values.push(name);
- continue;
- }
-
- throw new Error("Unexpected character " + c);
- }
- types.push(1);
- values.push("[EOF]");
- return [types, values];
-};
-
-XPathParser.SHIFT = 's';
-XPathParser.REDUCE = 'r';
-XPathParser.ACCEPT = 'a';
-
-XPathParser.prototype.parse = function(s) {
- var types;
- var values;
- var res = this.tokenize(s);
- if (res == undefined) {
- return undefined;
- }
- types = res[0];
- values = res[1];
- var tokenPos = 0;
- var state = [];
- var tokenType = [];
- var tokenValue = [];
- var s;
- var a;
- var t;
-
- state.push(0);
- tokenType.push(1);
- tokenValue.push("_S");
-
- a = types[tokenPos];
- t = values[tokenPos++];
- while (1) {
- s = state[state.length - 1];
- switch (XPathParser.actionTable[s].charAt(a - 1)) {
- case XPathParser.SHIFT:
- tokenType.push(-a);
- tokenValue.push(t);
- state.push(XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32);
- a = types[tokenPos];
- t = values[tokenPos++];
- break;
- case XPathParser.REDUCE:
- var num = XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][1];
- var rhs = [];
- for (var i = 0; i < num; i++) {
- tokenType.pop();
- rhs.unshift(tokenValue.pop());
- state.pop();
- }
- var s_ = state[state.length - 1];
- tokenType.push(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0]);
- if (this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32] == undefined) {
- tokenValue.push(rhs[0]);
- } else {
- tokenValue.push(this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32](rhs));
- }
- state.push(XPathParser.gotoTable[s_].charCodeAt(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0] - 2) - 33);
- break;
- case XPathParser.ACCEPT:
- return new XPath(tokenValue.pop());
- default:
- throw new Error("XPath parse error");
- }
- }
-};
-
-// XPath /////////////////////////////////////////////////////////////////////
-
-XPath.prototype = new Object();
-XPath.prototype.constructor = XPath;
-XPath.superclass = Object.prototype;
-
-function XPath(e) {
- this.expression = e;
-}
-
-XPath.prototype.toString = function() {
- return this.expression.toString();
-};
-
-XPath.prototype.evaluate = function(c) {
- c.contextNode = c.expressionContextNode;
- c.contextSize = 1;
- c.contextPosition = 1;
- c.caseInsensitive = false;
- if (c.contextNode != null) {
- var doc = c.contextNode;
- if (doc.nodeType != 9 /*Node.DOCUMENT_NODE*/) {
- doc = doc.ownerDocument;
- }
- try {
- c.caseInsensitive = doc.implementation.hasFeature("HTML", "2.0");
- } catch (e) {
- c.caseInsensitive = true;
- }
- }
- return this.expression.evaluate(c);
-};
-
-XPath.XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
-XPath.XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
-
-// Expression ////////////////////////////////////////////////////////////////
-
-Expression.prototype = new Object();
-Expression.prototype.constructor = Expression;
-Expression.superclass = Object.prototype;
-
-function Expression() {
-}
-
-Expression.prototype.init = function() {
-};
-
-Expression.prototype.toString = function() {
- return "<Expression>";
-};
-
-Expression.prototype.evaluate = function(c) {
- throw new Error("Could not evaluate expression.");
-};
-
-// UnaryOperation ////////////////////////////////////////////////////////////
-
-UnaryOperation.prototype = new Expression();
-UnaryOperation.prototype.constructor = UnaryOperation;
-UnaryOperation.superclass = Expression.prototype;
-
-function UnaryOperation(rhs) {
- if (arguments.length > 0) {
- this.init(rhs);
- }
-}
-
-UnaryOperation.prototype.init = function(rhs) {
- this.rhs = rhs;
-};
-
-// UnaryMinusOperation ///////////////////////////////////////////////////////
-
-UnaryMinusOperation.prototype = new UnaryOperation();
-UnaryMinusOperation.prototype.constructor = UnaryMinusOperation;
-UnaryMinusOperation.superclass = UnaryOperation.prototype;
-
-function UnaryMinusOperation(rhs) {
- if (arguments.length > 0) {
- this.init(rhs);
- }
-}
-
-UnaryMinusOperation.prototype.init = function(rhs) {
- UnaryMinusOperation.superclass.init.call(this, rhs);
-};
-
-UnaryMinusOperation.prototype.evaluate = function(c) {
- return this.rhs.evaluate(c).number().negate();
-};
-
-UnaryMinusOperation.prototype.toString = function() {
- return "-" + this.rhs.toString();
-};
-
-// BinaryOperation ///////////////////////////////////////////////////////////
-
-BinaryOperation.prototype = new Expression();
-BinaryOperation.prototype.constructor = BinaryOperation;
-BinaryOperation.superclass = Expression.prototype;
-
-function BinaryOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-BinaryOperation.prototype.init = function(lhs, rhs) {
- this.lhs = lhs;
- this.rhs = rhs;
-};
-
-// OrOperation ///////////////////////////////////////////////////////////////
-
-OrOperation.prototype = new BinaryOperation();
-OrOperation.prototype.constructor = OrOperation;
-OrOperation.superclass = BinaryOperation.prototype;
-
-function OrOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-OrOperation.prototype.init = function(lhs, rhs) {
- OrOperation.superclass.init.call(this, lhs, rhs);
-};
-
-OrOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
-};
-
-OrOperation.prototype.evaluate = function(c) {
- var b = this.lhs.evaluate(c).bool();
- if (b.booleanValue()) {
- return b;
- }
- return this.rhs.evaluate(c).bool();
-};
-
-// AndOperation //////////////////////////////////////////////////////////////
-
-AndOperation.prototype = new BinaryOperation();
-AndOperation.prototype.constructor = AndOperation;
-AndOperation.superclass = BinaryOperation.prototype;
-
-function AndOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-AndOperation.prototype.init = function(lhs, rhs) {
- AndOperation.superclass.init.call(this, lhs, rhs);
-};
-
-AndOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")";
-};
-
-AndOperation.prototype.evaluate = function(c) {
- var b = this.lhs.evaluate(c).bool();
- if (!b.booleanValue()) {
- return b;
- }
- return this.rhs.evaluate(c).bool();
-};
-
-// EqualsOperation ///////////////////////////////////////////////////////////
-
-EqualsOperation.prototype = new BinaryOperation();
-EqualsOperation.prototype.constructor = EqualsOperation;
-EqualsOperation.superclass = BinaryOperation.prototype;
-
-function EqualsOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-EqualsOperation.prototype.init = function(lhs, rhs) {
- EqualsOperation.superclass.init.call(this, lhs, rhs);
-};
-
-EqualsOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")";
-};
-
-EqualsOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
-};
-
-// NotEqualOperation /////////////////////////////////////////////////////////
-
-NotEqualOperation.prototype = new BinaryOperation();
-NotEqualOperation.prototype.constructor = NotEqualOperation;
-NotEqualOperation.superclass = BinaryOperation.prototype;
-
-function NotEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-NotEqualOperation.prototype.init = function(lhs, rhs) {
- NotEqualOperation.superclass.init.call(this, lhs, rhs);
-};
-
-NotEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
-};
-
-NotEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
-};
-
-// LessThanOperation /////////////////////////////////////////////////////////
-
-LessThanOperation.prototype = new BinaryOperation();
-LessThanOperation.prototype.constructor = LessThanOperation;
-LessThanOperation.superclass = BinaryOperation.prototype;
-
-function LessThanOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-LessThanOperation.prototype.init = function(lhs, rhs) {
- LessThanOperation.superclass.init.call(this, lhs, rhs);
-};
-
-LessThanOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
-};
-
-LessThanOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
-};
-
-// GreaterThanOperation //////////////////////////////////////////////////////
-
-GreaterThanOperation.prototype = new BinaryOperation();
-GreaterThanOperation.prototype.constructor = GreaterThanOperation;
-GreaterThanOperation.superclass = BinaryOperation.prototype;
-
-function GreaterThanOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-GreaterThanOperation.prototype.init = function(lhs, rhs) {
- GreaterThanOperation.superclass.init.call(this, lhs, rhs);
-};
-
-GreaterThanOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
-};
-
-GreaterThanOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
-};
-
-// LessThanOrEqualOperation //////////////////////////////////////////////////
-
-LessThanOrEqualOperation.prototype = new BinaryOperation();
-LessThanOrEqualOperation.prototype.constructor = LessThanOrEqualOperation;
-LessThanOrEqualOperation.superclass = BinaryOperation.prototype;
-
-function LessThanOrEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-LessThanOrEqualOperation.prototype.init = function(lhs, rhs) {
- LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
-};
-
-LessThanOrEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
-};
-
-LessThanOrEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
-};
-
-// GreaterThanOrEqualOperation ///////////////////////////////////////////////
-
-GreaterThanOrEqualOperation.prototype = new BinaryOperation();
-GreaterThanOrEqualOperation.prototype.constructor = GreaterThanOrEqualOperation;
-GreaterThanOrEqualOperation.superclass = BinaryOperation.prototype;
-
-function GreaterThanOrEqualOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-GreaterThanOrEqualOperation.prototype.init = function(lhs, rhs) {
- GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
-};
-
-GreaterThanOrEqualOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
-};
-
-GreaterThanOrEqualOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
-};
-
-// PlusOperation /////////////////////////////////////////////////////////////
-
-PlusOperation.prototype = new BinaryOperation();
-PlusOperation.prototype.constructor = PlusOperation;
-PlusOperation.superclass = BinaryOperation.prototype;
-
-function PlusOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-PlusOperation.prototype.init = function(lhs, rhs) {
- PlusOperation.superclass.init.call(this, lhs, rhs);
-};
-
-PlusOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
-};
-
-PlusOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
-};
-
-// MinusOperation ////////////////////////////////////////////////////////////
-
-MinusOperation.prototype = new BinaryOperation();
-MinusOperation.prototype.constructor = MinusOperation;
-MinusOperation.superclass = BinaryOperation.prototype;
-
-function MinusOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-MinusOperation.prototype.init = function(lhs, rhs) {
- MinusOperation.superclass.init.call(this, lhs, rhs);
-};
-
-MinusOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
-};
-
-MinusOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
-};
-
-// MultiplyOperation /////////////////////////////////////////////////////////
-
-MultiplyOperation.prototype = new BinaryOperation();
-MultiplyOperation.prototype.constructor = MultiplyOperation;
-MultiplyOperation.superclass = BinaryOperation.prototype;
-
-function MultiplyOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-MultiplyOperation.prototype.init = function(lhs, rhs) {
- MultiplyOperation.superclass.init.call(this, lhs, rhs);
-};
-
-MultiplyOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
-};
-
-MultiplyOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
-};
-
-// DivOperation //////////////////////////////////////////////////////////////
-
-DivOperation.prototype = new BinaryOperation();
-DivOperation.prototype.constructor = DivOperation;
-DivOperation.superclass = BinaryOperation.prototype;
-
-function DivOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-DivOperation.prototype.init = function(lhs, rhs) {
- DivOperation.superclass.init.call(this, lhs, rhs);
-};
-
-DivOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
-};
-
-DivOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
-};
-
-// ModOperation //////////////////////////////////////////////////////////////
-
-ModOperation.prototype = new BinaryOperation();
-ModOperation.prototype.constructor = ModOperation;
-ModOperation.superclass = BinaryOperation.prototype;
-
-function ModOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-ModOperation.prototype.init = function(lhs, rhs) {
- ModOperation.superclass.init.call(this, lhs, rhs);
-};
-
-ModOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
-};
-
-ModOperation.prototype.toString = function() {
- return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
-};
-
-// BarOperation //////////////////////////////////////////////////////////////
-
-BarOperation.prototype = new BinaryOperation();
-BarOperation.prototype.constructor = BarOperation;
-BarOperation.superclass = BinaryOperation.prototype;
-
-function BarOperation(lhs, rhs) {
- if (arguments.length > 0) {
- this.init(lhs, rhs);
- }
-}
-
-BarOperation.prototype.init = function(lhs, rhs) {
- BarOperation.superclass.init.call(this, lhs, rhs);
-};
-
-BarOperation.prototype.evaluate = function(c) {
- return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset());
-};
-
-BarOperation.prototype.toString = function() {
- return this.lhs.toString() + " | " + this.rhs.toString();
-};
-
-// PathExpr //////////////////////////////////////////////////////////////////
-
-PathExpr.prototype = new Expression();
-PathExpr.prototype.constructor = PathExpr;
-PathExpr.superclass = Expression.prototype;
-
-function PathExpr(filter, filterPreds, locpath) {
- if (arguments.length > 0) {
- this.init(filter, filterPreds, locpath);
- }
-}
-
-PathExpr.prototype.init = function(filter, filterPreds, locpath) {
- PathExpr.superclass.init.call(this);
- this.filter = filter;
- this.filterPredicates = filterPreds;
- this.locationPath = locpath;
-};
-
-PathExpr.prototype.evaluate = function(c) {
- var nodes;
- var xpc = new XPathContext();
- xpc.variableResolver = c.variableResolver;
- xpc.functionResolver = c.functionResolver;
- xpc.namespaceResolver = c.namespaceResolver;
- xpc.expressionContextNode = c.expressionContextNode;
- xpc.virtualRoot = c.virtualRoot;
- xpc.caseInsensitive = c.caseInsensitive;
- if (this.filter == null) {
- nodes = [ c.contextNode ];
- } else {
- var ns = this.filter.evaluate(c);
- if (!Utilities.instance_of(ns, XNodeSet)) {
- if (this.filterPredicates != null && this.filterPredicates.length > 0 || this.locationPath != null) {
- throw new Error("Path expression filter must evaluate to a nodset if predicates or location path are used");
- }
- return ns;
- }
- nodes = ns.toArray();
- if (this.filterPredicates != null) {
- // apply each of the predicates in turn
- for (var j = 0; j < this.filterPredicates.length; j++) {
- var pred = this.filterPredicates[j];
- var newNodes = [];
- xpc.contextSize = nodes.length;
- for (xpc.contextPosition = 1; xpc.contextPosition <= xpc.contextSize; xpc.contextPosition++) {
- xpc.contextNode = nodes[xpc.contextPosition - 1];
- if (this.predicateMatches(pred, xpc)) {
- newNodes.push(xpc.contextNode);
- }
- }
- nodes = newNodes;
- }
- }
- }
- if (this.locationPath != null) {
- if (this.locationPath.absolute) {
- if (nodes[0].nodeType != 9 /*Node.DOCUMENT_NODE*/) {
- if (xpc.virtualRoot != null) {
- nodes = [ xpc.virtualRoot ];
- } else {
- if (nodes[0].ownerDocument == null) {
- // IE 5.5 doesn't have ownerDocument?
- var n = nodes[0];
- while (n.parentNode != null) {
- n = n.parentNode;
- }
- nodes = [ n ];
- } else {
- nodes = [ nodes[0].ownerDocument ];
- }
- }
- } else {
- nodes = [ nodes[0] ];
- }
- }
- for (var i = 0; i < this.locationPath.steps.length; i++) {
- var step = this.locationPath.steps[i];
- var newNodes = [];
- for (var j = 0; j < nodes.length; j++) {
- xpc.contextNode = nodes[j];
- switch (step.axis) {
- case Step.ANCESTOR:
- // look at all the ancestor nodes
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- var m;
- if (xpc.contextNode.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) {
- m = this.getOwnerElement(xpc.contextNode);
- } else {
- m = xpc.contextNode.parentNode;
- }
- while (m != null) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m === xpc.virtualRoot) {
- break;
- }
- m = m.parentNode;
- }
- break;
-
- case Step.ANCESTORORSELF:
- // look at all the ancestor nodes and the current node
- for (var m = xpc.contextNode; m != null; m = m.nodeType == 2 /*Node.ATTRIBUTE_NODE*/ ? this.getOwnerElement(m) : m.parentNode) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m === xpc.virtualRoot) {
- break;
- }
- }
- break;
-
- case Step.ATTRIBUTE:
- // look at the attributes
- var nnm = xpc.contextNode.attributes;
- if (nnm != null) {
- for (var k = 0; k < nnm.length; k++) {
- var m = nnm.item(k);
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- }
- break;
-
- case Step.CHILD:
- // look at all child elements
- for (var m = xpc.contextNode.firstChild; m != null; m = m.nextSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
-
- case Step.DESCENDANT:
- // look at all descendant nodes
- var st = [ xpc.contextNode.firstChild ];
- while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
-
- case Step.DESCENDANTORSELF:
- // look at self
- if (step.nodeTest.matches(xpc.contextNode, xpc)) {
- newNodes.push(xpc.contextNode);
- }
- // look at all descendant nodes
- var st = [ xpc.contextNode.firstChild ];
- while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
-
- case Step.FOLLOWING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- var st = [];
- if (xpc.contextNode.firstChild != null) {
- st.unshift(xpc.contextNode.firstChild);
- } else {
- st.unshift(xpc.contextNode.nextSibling);
- }
- for (var m = xpc.contextNode.parentNode; m != null && m.nodeType != 9 /*Node.DOCUMENT_NODE*/ && m !== xpc.virtualRoot; m = m.parentNode) {
- st.unshift(m.nextSibling);
- }
- do {
- for (var m = st.pop(); m != null; ) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- } while (st.length > 0);
- break;
-
- case Step.FOLLOWINGSIBLING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- for (var m = xpc.contextNode.nextSibling; m != null; m = m.nextSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
-
- case Step.NAMESPACE:
- var n = {};
- if (xpc.contextNode.nodeType == 1 /*Node.ELEMENT_NODE*/) {
- n["xml"] = XPath.XML_NAMESPACE_URI;
- n["xmlns"] = XPath.XMLNS_NAMESPACE_URI;
- for (var m = xpc.contextNode; m != null && m.nodeType == 1 /*Node.ELEMENT_NODE*/; m = m.parentNode) {
- for (var k = 0; k < m.attributes.length; k++) {
- var attr = m.attributes.item(k);
- var nm = String(attr.name);
- if (nm == "xmlns") {
- if (n[""] == undefined) {
- n[""] = attr.value;
- }
- } else if (nm.length > 6 && nm.substring(0, 6) == "xmlns:") {
- var pre = nm.substring(6, nm.length);
- if (n[pre] == undefined) {
- n[pre] = attr.value;
- }
- }
- }
- }
- for (var pre in n) {
- var nsn = new NamespaceNode(pre, n[pre], xpc.contextNode);
- if (step.nodeTest.matches(nsn, xpc)) {
- newNodes.push(nsn);
- }
- }
- }
- break;
-
- case Step.PARENT:
- m = null;
- if (xpc.contextNode !== xpc.virtualRoot) {
- if (xpc.contextNode.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) {
- m = this.getOwnerElement(xpc.contextNode);
- } else {
- m = xpc.contextNode.parentNode;
- }
- }
- if (m != null && step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- break;
-
- case Step.PRECEDING:
- var st;
- if (xpc.virtualRoot != null) {
- st = [ xpc.virtualRoot ];
- } else {
- st = xpc.contextNode.nodeType == 9 /*Node.DOCUMENT_NODE*/
- ? [ xpc.contextNode ]
- : [ xpc.contextNode.ownerDocument ];
- }
- outer: while (st.length > 0) {
- for (var m = st.pop(); m != null; ) {
- if (m == xpc.contextNode) {
- break outer;
- }
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.unshift(m);
- }
- if (m.firstChild != null) {
- st.push(m.nextSibling);
- m = m.firstChild;
- } else {
- m = m.nextSibling;
- }
- }
- }
- break;
-
- case Step.PRECEDINGSIBLING:
- if (xpc.contextNode === xpc.virtualRoot) {
- break;
- }
- for (var m = xpc.contextNode.previousSibling; m != null; m = m.previousSibling) {
- if (step.nodeTest.matches(m, xpc)) {
- newNodes.push(m);
- }
- }
- break;
-
- case Step.SELF:
- if (step.nodeTest.matches(xpc.contextNode, xpc)) {
- newNodes.push(xpc.contextNode);
- }
- break;
-
- default:
- }
- }
- nodes = newNodes;
- // apply each of the predicates in turn
- for (var j = 0; j < step.predicates.length; j++) {
- var pred = step.predicates[j];
- var newNodes = [];
- xpc.contextSize = nodes.length;
- for (xpc.contextPosition = 1; xpc.contextPosition <= xpc.contextSize; xpc.contextPosition++) {
- xpc.contextNode = nodes[xpc.contextPosition - 1];
- if (this.predicateMatches(pred, xpc)) {
- newNodes.push(xpc.contextNode);
- } else {
- }
- }
- nodes = newNodes;
- }
- }
- }
- var ns = new XNodeSet();
- ns.addArray(nodes);
- return ns;
-};
-
-PathExpr.prototype.predicateMatches = function(pred, c) {
- var res = pred.evaluate(c);
- if (Utilities.instance_of(res, XNumber)) {
- return c.contextPosition == res.numberValue();
- }
- return res.booleanValue();
-};
-
-PathExpr.prototype.toString = function() {
- if (this.filter != undefined) {
- var s = this.filter.toString();
- if (Utilities.instance_of(this.filter, XString)) {
- s = "'" + s + "'";
- }
- if (this.filterPredicates != undefined) {
- for (var i = 0; i < this.filterPredicates.length; i++) {
- s = s + "[" + this.filterPredicates[i].toString() + "]";
- }
- }
- if (this.locationPath != undefined) {
- if (!this.locationPath.absolute) {
- s += "/";
- }
- s += this.locationPath.toString();
- }
- return s;
- }
- return this.locationPath.toString();
-};
-
-PathExpr.prototype.getOwnerElement = function(n) {
- // DOM 2 has ownerElement
- if (n.ownerElement) {
- return n.ownerElement;
- }
- // DOM 1 Internet Explorer can use selectSingleNode (ironically)
- try {
- if (n.selectSingleNode) {
- return n.selectSingleNode("..");
- }
- } catch (e) {
- }
- // Other DOM 1 implementations must use this egregious search
- var doc = n.nodeType == 9 /*Node.DOCUMENT_NODE*/
- ? n
- : n.ownerDocument;
- var elts = doc.getElementsByTagName("*");
- for (var i = 0; i < elts.length; i++) {
- var elt = elts.item(i);
- var nnm = elt.attributes;
- for (var j = 0; j < nnm.length; j++) {
- var an = nnm.item(j);
- if (an === n) {
- return elt;
- }
- }
- }
- return null;
-};
-
-// LocationPath //////////////////////////////////////////////////////////////
-
-LocationPath.prototype = new Object();
-LocationPath.prototype.constructor = LocationPath;
-LocationPath.superclass = Object.prototype;
-
-function LocationPath(abs, steps) {
- if (arguments.length > 0) {
- this.init(abs, steps);
- }
-}
-
-LocationPath.prototype.init = function(abs, steps) {
- this.absolute = abs;
- this.steps = steps;
-};
-
-LocationPath.prototype.toString = function() {
- var s;
- if (this.absolute) {
- s = "/";
- } else {
- s = "";
- }
- for (var i = 0; i < this.steps.length; i++) {
- if (i != 0) {
- s += "/";
- }
- s += this.steps[i].toString();
- }
- return s;
-};
-
-// Step //////////////////////////////////////////////////////////////////////
-
-Step.prototype = new Object();
-Step.prototype.constructor = Step;
-Step.superclass = Object.prototype;
-
-function Step(axis, nodetest, preds) {
- if (arguments.length > 0) {
- this.init(axis, nodetest, preds);
- }
-}
-
-Step.prototype.init = function(axis, nodetest, preds) {
- this.axis = axis;
- this.nodeTest = nodetest;
- this.predicates = preds;
-};
-
-Step.prototype.toString = function() {
- var s;
- switch (this.axis) {
- case Step.ANCESTOR:
- s = "ancestor";
- break;
- case Step.ANCESTORORSELF:
- s = "ancestor-or-self";
- break;
- case Step.ATTRIBUTE:
- s = "attribute";
- break;
- case Step.CHILD:
- s = "child";
- break;
- case Step.DESCENDANT:
- s = "descendant";
- break;
- case Step.DESCENDANTORSELF:
- s = "descendant-or-self";
- break;
- case Step.FOLLOWING:
- s = "following";
- break;
- case Step.FOLLOWINGSIBLING:
- s = "following-sibling";
- break;
- case Step.NAMESPACE:
- s = "namespace";
- break;
- case Step.PARENT:
- s = "parent";
- break;
- case Step.PRECEDING:
- s = "preceding";
- break;
- case Step.PRECEDINGSIBLING:
- s = "preceding-sibling";
- break;
- case Step.SELF:
- s = "self";
- break;
- }
- s += "::";
- s += this.nodeTest.toString();
- for (var i = 0; i < this.predicates.length; i++) {
- s += "[" + this.predicates[i].toString() + "]";
- }
- return s;
-};
-
-Step.ANCESTOR = 0;
-Step.ANCESTORORSELF = 1;
-Step.ATTRIBUTE = 2;
-Step.CHILD = 3;
-Step.DESCENDANT = 4;
-Step.DESCENDANTORSELF = 5;
-Step.FOLLOWING = 6;
-Step.FOLLOWINGSIBLING = 7;
-Step.NAMESPACE = 8;
-Step.PARENT = 9;
-Step.PRECEDING = 10;
-Step.PRECEDINGSIBLING = 11;
-Step.SELF = 12;
-
-// NodeTest //////////////////////////////////////////////////////////////////
-
-NodeTest.prototype = new Object();
-NodeTest.prototype.constructor = NodeTest;
-NodeTest.superclass = Object.prototype;
-
-function NodeTest(type, value) {
- if (arguments.length > 0) {
- this.init(type, value);
- }
-}
-
-NodeTest.prototype.init = function(type, value) {
- this.type = type;
- this.value = value;
-};
-
-NodeTest.prototype.toString = function() {
- switch (this.type) {
- case NodeTest.NAMETESTANY:
- return "*";
- case NodeTest.NAMETESTPREFIXANY:
- return this.value + ":*";
- case NodeTest.NAMETESTRESOLVEDANY:
- return "{" + this.value + "}*";
- case NodeTest.NAMETESTQNAME:
- return this.value;
- case NodeTest.NAMETESTRESOLVEDNAME:
- return "{" + this.namespaceURI + "}" + this.value;
- case NodeTest.COMMENT:
- return "comment()";
- case NodeTest.TEXT:
- return "text()";
- case NodeTest.PI:
- if (this.value != undefined) {
- return "processing-instruction(\"" + this.value + "\")";
- }
- return "processing-instruction()";
- case NodeTest.NODE:
- return "node()";
- }
- return "<unknown nodetest type>";
-};
-
-NodeTest.prototype.matches = function(n, xpc) {
- switch (this.type) {
- case NodeTest.NAMETESTANY:
- if (n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/
- || n.nodeType == 1 /*Node.ELEMENT_NODE*/
- || n.nodeType == XPathNamespace.XPATH_NAMESPACE_NODE) {
- return true;
- }
- return false;
- case NodeTest.NAMETESTPREFIXANY:
- if ((n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/ || n.nodeType == 1 /*Node.ELEMENT_NODE*/)) {
- var ns = xpc.namespaceResolver.getNamespace(this.value, xpc.expressionContextNode);
- if (ns == null) {
- throw new Error("Cannot resolve QName " + this.value);
- }
- return true;
- }
- return false;
- case NodeTest.NAMETESTQNAME:
- if (n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/
- || n.nodeType == 1 /*Node.ELEMENT_NODE*/
- || n.nodeType == XPathNamespace.XPATH_NAMESPACE_NODE) {
- var test = Utilities.resolveQName(this.value, xpc.namespaceResolver, xpc.expressionContextNode, false);
- if (test[0] == null) {
- throw new Error("Cannot resolve QName " + this.value);
- }
- test[0] = String(test[0]);
- test[1] = String(test[1]);
- if (test[0] == "") {
- test[0] = null;
- }
- var node = Utilities.resolveQName(n.nodeName, xpc.namespaceResolver, n, n.nodeType == 1 /*Node.ELEMENT_NODE*/);
- node[0] = String(node[0]);
- node[1] = String(node[1]);
- if (node[0] == "") {
- if (n.namespaceURI) {
- node[0] = n.namespaceURI;
- } else {
- node[0] = null;
- }
- }
- if (xpc.caseInsensitive) {
- return test[0] == node[0] && String(test[1]).toLowerCase() == String(node[1]).toLowerCase();
- }
- return test[0] == node[0] && test[1] == node[1];
- }
- return false;
- case NodeTest.COMMENT:
- return n.nodeType == 8 /*Node.COMMENT_NODE*/;
- case NodeTest.TEXT:
- return n.nodeType == 3 /*Node.TEXT_NODE*/ || n.nodeType == 4 /*Node.CDATA_SECTION_NODE*/;
- case NodeTest.PI:
- return n.nodeType == 7 /*Node.PROCESSING_INSTRUCTION_NODE*/
- && (this.value == null || n.nodeName == this.value);
- case NodeTest.NODE:
- return n.nodeType == 9 /*Node.DOCUMENT_NODE*/
- || n.nodeType == 1 /*Node.ELEMENT_NODE*/
- || n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/
- || n.nodeType == 3 /*Node.TEXT_NODE*/
- || n.nodeType == 4 /*Node.CDATA_SECTION_NODE*/
- || n.nodeType == 8 /*Node.COMMENT_NODE*/
- || n.nodeType == 7 /*Node.PROCESSING_INSTRUCTION_NODE*/;
- }
- return false;
-};
-
-NodeTest.NAMETESTANY = 0;
-NodeTest.NAMETESTPREFIXANY = 1;
-NodeTest.NAMETESTQNAME = 2;
-NodeTest.COMMEN