From: phasefx Date: Thu, 7 Jan 2010 22:30:42 +0000 (+0000) Subject: Monster whitespace patch in the same vein of changesets 14577 and 14578. Viewing... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9ddf3230a4c897a40e0214d29e0f1ebf6ea6438d;p=Evergreen.git Monster whitespace patch in the same vein of changesets 14577 and 14578. Viewing the diff in TRAC will take forever :) git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@15273 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/cgi-bin/support/dtree.js b/Open-ILS/src/cgi-bin/support/dtree.js index 57dd30d07c..f4ed6a863c 100644 --- a/Open-ILS/src/cgi-bin/support/dtree.js +++ b/Open-ILS/src/cgi-bin/support/dtree.js @@ -10,315 +10,315 @@ |--------------------------------------------------*/ function Node(id, pid, name, url, title, target, icon, iconOpen, open) { - this.id = id; - this.pid = pid; - this.name = name; - this.url = url; - this.title = title; - this.target = target; - this.icon = icon; - this.iconOpen = iconOpen; - this._io = open || false; - this._is = false; - this._ls = false; - this._hc = false; - this._ai = 0; - this._p; + this.id = id; + this.pid = pid; + this.name = name; + this.url = url; + this.title = title; + this.target = target; + this.icon = icon; + this.iconOpen = iconOpen; + this._io = open || false; + this._is = false; + this._ls = false; + this._hc = false; + this._ai = 0; + this._p; }; function dTree(objName) { - this.config = { - target : null, - folderLinks : true, - useSelection : true, - useCookies : true, - useLines : true, - useIcons : true, - useStatusText : false, - closeSameLevel : false, - inOrder : false - } - this.icon = { - root : 'support/base.gif', - folder : 'support/folder.gif', - folderOpen : 'support/folderopen.gif', - node : 'support/page.gif', - empty : 'support/empty.gif', - line : 'support/line.gif', - join : 'support/join.gif', - joinBottom : 'support/joinbottom.gif', - plus : 'support/plus.gif', - plusBottom : 'support/plusbottom.gif', - minus : 'support/minus.gif', - minusBottom : 'support/minusbottom.gif', - nlPlus : 'support/nolines_plus.gif', - nlMinus : 'support/nolines_minus.gif' - }; - this.obj = objName; - this.aNodes = []; - this.aIndent = []; - this.root = new Node(-1); - this.selectedNode = null; - this.selectedFound = false; - this.completed = false; + this.config = { + target : null, + folderLinks : true, + useSelection : true, + useCookies : true, + useLines : true, + useIcons : true, + useStatusText : false, + closeSameLevel : false, + inOrder : false + } + this.icon = { + root : 'support/base.gif', + folder : 'support/folder.gif', + folderOpen : 'support/folderopen.gif', + node : 'support/page.gif', + empty : 'support/empty.gif', + line : 'support/line.gif', + join : 'support/join.gif', + joinBottom : 'support/joinbottom.gif', + plus : 'support/plus.gif', + plusBottom : 'support/plusbottom.gif', + minus : 'support/minus.gif', + minusBottom : 'support/minusbottom.gif', + nlPlus : 'support/nolines_plus.gif', + nlMinus : 'support/nolines_minus.gif' + }; + this.obj = objName; + this.aNodes = []; + this.aIndent = []; + this.root = new Node(-1); + this.selectedNode = null; + this.selectedFound = false; + this.completed = false; }; dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { - this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); + this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; dTree.prototype.openAll = function() { - this.oAll(true); + this.oAll(true); }; dTree.prototype.closeAll = function() { - this.oAll(false); + this.oAll(false); }; dTree.prototype.toString = function() { - var str = '
\n'; - if (document.getElementById) { - if (this.config.useCookies) this.selectedNode = this.getSelected(); - str += this.addNode(this.root); - } else str += 'Browser not supported.'; - str += '
'; - if (!this.selectedFound) this.selectedNode = null; - this.completed = true; - return str; + var str = '
\n'; + if (document.getElementById) { + if (this.config.useCookies) this.selectedNode = this.getSelected(); + str += this.addNode(this.root); + } else str += 'Browser not supported.'; + str += '
'; + if (!this.selectedFound) this.selectedNode = null; + this.completed = true; + return str; }; dTree.prototype.addNode = function(pNode) { - var str = ''; - var n=0; - if (this.config.inOrder) n = pNode._ai; - for (n; n'; - } - if (node.url) { - str += ''; - str += node.name; - if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; - str += ''; - if (node._hc) { - str += '
'; - str += this.addNode(node); - str += '
'; - } - this.aIndent.pop(); - return str; + var str = '
' + this.indent(node, nodeId); + if (this.config.useIcons) { + if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); + if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; + if (this.root.id == node.pid) { + node.icon = this.icon.root; + node.iconOpen = this.icon.root; + } + str += ''; + } + if (node.url) { + str += ''; + str += node.name; + if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; + str += '
'; + if (node._hc) { + str += '
'; + str += this.addNode(node); + str += '
'; + } + this.aIndent.pop(); + return str; }; dTree.prototype.indent = function(node, nodeId) { - var str = ''; - if (this.root.id != node.pid) { - for (var n=0; n'; - (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); - if (node._hc) { - str += ''; - } else str += ''; - } - return str; + var str = ''; + if (this.root.id != node.pid) { + for (var n=0; n'; + (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); + if (node._hc) { + str += ''; + } else str += ''; + } + return str; }; dTree.prototype.setCS = function(node) { - var lastId; - for (var n=0; n \$split, - 'marc=s' => \$marc, - 'encoding=s' => \$enc, - 'out_dir=s' => \$out, - 'bad=s' => \$bad, + 'split=i' => \$split, + 'marc=s' => \$marc, + 'encoding=s' => \$enc, + 'out_dir=s' => \$out, + 'bad=s' => \$bad, ); if ($enc) { - MARC::Charset->ignore_errors(1); - MARC::Charset->assume_encoding($enc); + MARC::Charset->ignore_errors(1); + MARC::Charset->assume_encoding($enc); } die "gimme some marc!\n" unless $marc; @@ -45,49 +45,49 @@ $marc->strict_off; $marc->warnings_off; while (my $r = $marc->next) { - my $rxml = entityize(MARC::File::XML::record($r)); - $rxml =~ s/[\x00-\x1f]//go; - - try { $doc = $parser->parse_string($rxml); } - catch Error with { - my $e = shift; - warn "arg ... bad record $current, skipping: $e\n"; - $current++; - print $bad $r->as_usmarc if ($bad); - $r = undef; - }; - next unless ($r); - - $xml .= $rxml; - - unless ($current % $split) { - $xml = <<" XML"; - - $xml - - XML - - my $doc; - try { $doc = $parser->parse_string($xml); } - catch Error with { my $e = shift; warn "ARG! Doc failed to parse:\n$e\n-------------------------------------------\n$xml\n"; }; - die unless $doc; - - $xml = ''; - - my $results = $stylesheet->transform($doc, prev => "'$prev'", next => "'$next'"); - $prev++; - $next++; - - open OUT, ">$out/$prev.html"; - print OUT $results->toString; - close OUT; - } - $current++; + my $rxml = entityize(MARC::File::XML::record($r)); + $rxml =~ s/[\x00-\x1f]//go; + + try { $doc = $parser->parse_string($rxml); } + catch Error with { + my $e = shift; + warn "arg ... bad record $current, skipping: $e\n"; + $current++; + print $bad $r->as_usmarc if ($bad); + $r = undef; + }; + next unless ($r); + + $xml .= $rxml; + + unless ($current % $split) { + $xml = <<" XML"; + + $xml + + XML + + my $doc; + try { $doc = $parser->parse_string($xml); } + catch Error with { my $e = shift; warn "ARG! Doc failed to parse:\n$e\n-------------------------------------------\n$xml\n"; }; + die unless $doc; + + $xml = ''; + + my $results = $stylesheet->transform($doc, prev => "'$prev'", next => "'$next'"); + $prev++; + $next++; + + open OUT, ">$out/$prev.html"; + print OUT $results->toString; + close OUT; + } + $current++; } my $doc = $parser->parse_string(< - $xml + $xml XML @@ -117,122 +117,122 @@ sub entityize { __DATA__ - - - - - - - - - - - - - - - - - Previous page - - - | - - - - - - Next page - - -
- - - - - - - Previous page - - - | - - - - - - Next page - - - - -
- - - - - - - - -
- LDR - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - . - - - - - - - - - - - ‡ - - + + + + + + + + + + + + + + + + + Previous page + + + | + + + + + + Next page + + +
+ + + + + + + Previous page + + + | + + + + + + Next page + + + + +
+ + + + + + + + +
+ LDR + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + ‡ + +
diff --git a/Open-ILS/src/extras/opensearchportal.html b/Open-ILS/src/extras/opensearchportal.html index 44ce1adde1..45422a1cf8 100644 --- a/Open-ILS/src/extras/opensearchportal.html +++ b/Open-ILS/src/extras/opensearchportal.html @@ -1,126 +1,126 @@ - - mikers experimental opensearch portal - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
Keyword Search: - - - Hits per Source for each page: - - Display style: - -
Sources: - - - - - - - - - - - - - - - - - -
- - - - - - -
- - - - - -
- - - - - -
-
Total results:
Current page: - ... - -
-
- -
-
- - - - - -
- - - - - -
Merged search results
-
-
-
- - - - - -
Unranked search results
-
-
-
-
-
- + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
Keyword Search: + + + Hits per Source for each page: + + Display style: + +
Sources: + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+
Total results:
Current page: + ... + +
+
+ +
+
+ + + + + +
+ + + + + +
Merged search results
+
+
+
+ + + + + +
Unranked search results
+
+
+
+
+
+ diff --git a/Open-ILS/src/javascript/backend/catalog/biblio_fingerprint.js b/Open-ILS/src/javascript/backend/catalog/biblio_fingerprint.js index 83992c239c..3a061a47f2 100644 --- a/Open-ILS/src/javascript/backend/catalog/biblio_fingerprint.js +++ b/Open-ILS/src/javascript/backend/catalog/biblio_fingerprint.js @@ -21,89 +21,89 @@ 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' ); + // 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; + quality += 10; - log_debug("title: " + t); - log_debug("author: " + a); + 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]; - } + 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; + quality += marcdoc.datafield.length() / 2; } else { - quality += 40 + marcdoc.datafield.length(); + quality += 40 + marcdoc.datafield.length(); } var title = t; if (!title) { - log_debug("no title found"); - title = ''; + log_debug("no title found"); + title = ''; } else { - title = title.toString(); + title = title.toString(); } title = title - .toLowerCase() - .replace(/\[.+?\]/,'') - .replace(/\bthe\b|\ban?d?\b|\W+/g,''); + .toLowerCase() + .replace(/\[.+?\]/,'') + .replace(/\bthe\b|\ban?d?\b|\W+/g,''); var author = a; if (!author) { - author = ''; + author = ''; } else { - author = author.toString(); + author = author.toString(); } author = author.toLowerCase().replace(/^\s*(\w+).*?$/,"$1"); @@ -111,26 +111,26 @@ 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' ); + 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' ); - + 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' ); - + 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' ); + quality += 1; + log_debug( 'got Local source bump' ); } if (extractFixedField(marcdoc, 'Lang') == 'eng') { - quality += 100; - log_debug( 'got language bump for ' + extractFixedField(marcdoc, 'Lang') ); + quality += 100; + log_debug( 'got language bump for ' + extractFixedField(marcdoc, 'Lang') ); } diff --git a/Open-ILS/src/javascript/backend/catalog/fixed_fields.js b/Open-ILS/src/javascript/backend/catalog/fixed_fields.js index 4e7871c882..4eb0321a45 100644 --- a/Open-ILS/src/javascript/backend/catalog/fixed_fields.js +++ b/Open-ILS/src/javascript/backend/catalog/fixed_fields.js @@ -1,277 +1,277 @@ 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}/ } + 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}/ } }; 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' }, - } - }, - 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 : ' ' }, - } - }, - 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 : ' ' }, - } - }, - 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 : ' ' }, - } - }, + 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' }, + } + }, + 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 : ' ' }, + } + }, + 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 : ' ' }, + } + }, + 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 : ' ' }, + } + }, }; diff --git a/Open-ILS/src/javascript/backend/catalog/phys_char.js b/Open-ILS/src/javascript/backend/catalog/phys_char.js index 4a6ba8d1db..7abfb849a4 100644 --- a/Open-ILS/src/javascript/backend/catalog/phys_char.js +++ b/Open-ILS/src/javascript/backend/catalog/phys_char.js @@ -1,1062 +1,1062 @@ 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", - }, - }, - }, - }, + 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", + }, + }, + }, + }, }; diff --git a/Open-ILS/src/javascript/backend/catalog/record_type.js b/Open-ILS/src/javascript/backend/catalog/record_type.js index 0a6988b734..689500bfda 100644 --- a/Open-ILS/src/javascript/backend/catalog/record_type.js +++ b/Open-ILS/src/javascript/backend/catalog/record_type.js @@ -5,86 +5,86 @@ 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 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); + 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; - } - } + 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(); + 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 - ); + 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 physical_characteristics.v.subfields.e.values[ _v_e ]; + } - return null; + 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(); + 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 - ); - } + if (_7.match(/^v/)) { + return _7.substr( + physical_characteristics.v.subfields.e.start, + physical_characteristics.v.subfields.e.len + ); + } - return null; + 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; + 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; } diff --git a/Open-ILS/src/javascript/backend/circ/circ_duration.js b/Open-ILS/src/javascript/backend/circ/circ_duration.js index 6f6a3d4b34..aa5148ab54 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_duration.js +++ b/Open-ILS/src/javascript/backend/circ/circ_duration.js @@ -7,35 +7,35 @@ 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; + 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') : ""; +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. - ----------------------------------------------------------------------------- */ + 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; + 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'; + result.durationRule = 'default'; + result.recurringFinesRule = 'default'; + result.maxFine = 'default'; } diff --git a/Open-ILS/src/javascript/backend/circ/circ_groups.js b/Open-ILS/src/javascript/backend/circ/circ_groups.js index 036d56e0f1..6023eaa416 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_groups.js +++ b/Open-ILS/src/javascript/backend/circ/circ_groups.js @@ -1,21 +1,21 @@ /* --------------------------------------------------------------------- - Set up the limits for the various profiles (aka permission groups). - Values of -1 mean there is no limit + 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 + 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 - --------------------------------------------------------------------- */ + 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 - }, + 'Patron' : { + maxItemsOut : 50, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, } diff --git a/Open-ILS/src/javascript/backend/circ/circ_item_config.js b/Open-ILS/src/javascript/backend/circ/circ_item_config.js index c54d0cc5e2..e6228ca80d 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_item_config.js +++ b/Open-ILS/src/javascript/backend/circ/circ_item_config.js @@ -18,19 +18,19 @@ log_debug('loading circ_item_config.js ...'); */ /* ----------------------------------------------------------------------------- - Configure the duration rules for the various item types and circ modifiers - MARC Fixed Field info: - http://www.oclc.org/bibformats/en/fixedfield/ - ----------------------------------------------------------------------------- */ + 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' - }, + a : { /* Language material [Books] */ + SIPMediaType : '001', + magneticMedia : 'f', + durationRule : 'default', + recurringFinesRule : 'default', + maxFine : 'default' + }, /* add more MARC item type configs as needed... */ } @@ -39,13 +39,13 @@ 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' - }, + 'bestseller' : { + SIPMediaType : '001', + magneticMedia : 'f', + durationRule : 'default', + recurringFinesRule : 'default', + maxFine : 'default' + }, } @@ -56,9 +56,9 @@ result.item_config = getItemConfig(); function getItemConfig() { - var config = null; - var marcType = getMARCItemType(); - var circMod = copy.circ_modifier; + var config = null; + var marcType = getMARCItemType(); + var circMod = copy.circ_modifier; if( circMod ) { config = CIRC_MOD_MAP[circMod]; @@ -67,15 +67,15 @@ function getItemConfig() { } if(!config) - config = MARC_ITEM_TYPE_MAP[marcType]; + config = MARC_ITEM_TYPE_MAP[marcType]; if(!config) { config = {}; - config.SIPMediaType = '001'; - config.magneticMedia = 'f'; - config.durationRule = 'default'; - config.recurringFinesRule = 'default'; - config.maxFine = 'default'; + config.SIPMediaType = '001'; + config.magneticMedia = 'f'; + config.durationRule = 'default'; + config.recurringFinesRule = 'default'; + config.maxFine = 'default'; } return config diff --git a/Open-ILS/src/javascript/backend/circ/circ_lib.js b/Open-ILS/src/javascript/backend/circ/circ_lib.js index 64923ed67e..bd8963eff0 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_lib.js +++ b/Open-ILS/src/javascript/backend/circ/circ_lib.js @@ -4,43 +4,43 @@ 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; - } - } + 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 - ----------------------------------------------------------------------------- */ + 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 = []; + 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 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; @@ -53,18 +53,18 @@ var copyStatus; var marcXMLDoc; if( patron && patron.profile ) - patronProfile = patron.profile.name; + patronProfile = patron.profile.name; if( copy && copy.status ) - copyStatus = copy.status.name; + copyStatus = copy.status.name; if( title && title.marc ) - marcXMLDoc = new XML(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 = {}; +var groupTree = environment.groupTree; +var groupList = {}; +var groupIDList = {}; flattenGroupTree(groupTree); @@ -73,34 +73,34 @@ flattenGroupTree(groupTree); /* ----------------------------------------------------------------------------- - Define all of the utility functions - ----------------------------------------------------------------------------- */ + 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; } +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; + 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]); + for( var i = 0; i < arr.length; i++ ) + callback(arr[i]); } @@ -109,29 +109,29 @@ function iterate( arr, 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; + 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); - } - ); + if(!node) return null; + groupList[node.name] = node; + groupIDList[node.id] = node; + iterate( node.children, + function(n) { + flattenGroupTree(n); + } + ); } @@ -142,17 +142,17 @@ function flattenGroupTree(node) { * @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]); + 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]); + log_debug("checking descendant ID p="+parentName + " c=" + childId); + return __isGroupDescendant( + groupList[parentName], + groupIDList[childId]); } @@ -163,32 +163,32 @@ function isGroupDescendantId( parentName, childId ) { */ 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; + 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') : ""; + 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; + 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 */ @@ -199,11 +199,11 @@ function userHoldCount(userid) { } 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; + 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 */ @@ -216,68 +216,68 @@ function checkoutsByCircModifier(userid) { /* useful for testing */ function die(msg) { - log_error("die(): "+msg); - log_stderr("die(): "+msg); - var foo = null; - var baz = foo.bar; + 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) {} - } + 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; + 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) {} - } + try { + str += ', Circ_Lib=' + copy.circ_lib.shortname; + str += ', Copy_location=' + copy.location.name; + } catch(e) {} + } - if(volume) { + if(volume) { str += ', Item_Owning_lib=' + volume.owning_lib; - str += ', Volume=' + volume.id; + str += ', Volume=' + volume.id; } - if(title) str += ', Record=' + title.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; - } + 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 += ', 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); + log_info(str); } @@ -290,25 +290,25 @@ function log_vars( prefix ) { * @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; + 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); + if(!config) return; + var str = "findGroupConfig('"+name+"'): returning config info for '"+ foundName +"': "; + for( var i in config ) + str += i + '=' + config[i] + ' '; + log_debug(str); } diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js index 053d9b7f43..51cbc4df68 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js @@ -7,18 +7,18 @@ log_vars('circ_permit_copy'); if( ! isTrue(copy.circulate) || !isTrue(copy.location.circulate) ) - result.events.push('COPY_CIRC_NOT_ALLOWED'); + 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'); - } + if(copyStatus != 'Available' && + copyStatus != 'On holds shelf' && copyStatus != 'Reshelving' ) { + result.events.push('COPY_NOT_AVAILABLE'); + } } - + } go(); diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js b/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js index 942aacedd4..c832c37706 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js @@ -7,13 +7,13 @@ log_vars('circ_permit_hold'); if( isTrue(patron.barred) ) - result.events.push('PATRON_BARRED'); + result.events.push('PATRON_BARRED'); if( isTrue(copy.ref) ) - result.events.push('ITEM_NOT_HOLDABLE'); + result.events.push('ITEM_NOT_HOLDABLE'); if( !isTrue(copy.circulate) ) - result.events.push('ITEM_NOT_HOLDABLE'); + result.events.push('ITEM_NOT_HOLDABLE'); var config = findGroupConfig(patronProfile); diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js b/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js index 95496884a2..f13944fbb9 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js @@ -7,7 +7,7 @@ log_vars('circ_permit_patron'); if( isTrue(patron.barred) ) - result.events.push('PATRON_BARRED'); + result.events.push('PATRON_BARRED'); var config = findGroupConfig(patronProfile); diff --git a/Open-ILS/src/javascript/backend/libs/jsDOM.js b/Open-ILS/src/javascript/backend/libs/jsDOM.js index 5b143c0e98..020fb4bfdf 100644 --- a/Open-ILS/src/javascript/backend/libs/jsDOM.js +++ b/Open-ILS/src/javascript/backend/libs/jsDOM.js @@ -1,6 +1,6 @@ try { - load_lib('jsOO.js') - load_lib('xpath.js') + load_lib('jsOO.js') + load_lib('xpath.js') } catch (e) {} function DOMException (c) { this.code = c } @@ -21,66 +21,66 @@ 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; + 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; + 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; + 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; + 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; + 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; + __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'); + this.length = 0; + //log_stdout(' -- NodeList constructor'); } NodeList.method('item', function (idx) { - return this[idx]; + return this[idx]; }); NodeList.method('push', function (node) { - var idx = this.length; - this[idx] = node; - this.length++; - return this[idx]; + var idx = this.length; + this[idx] = node; + this.length++; + return this[idx]; }); @@ -88,89 +88,89 @@ NodeList.method('push', function (node) { // NamedNodeMap interface function NamedNodeMap () { - this.length = 0; - this._nodes = {}; - this._ns_nodes = {}; - //log_stdout(' -- NamedNodeMap constructor'); + this.length = 0; + this._nodes = {}; + this._ns_nodes = {}; + //log_stdout(' -- NamedNodeMap constructor'); } NamedNodeMap.method('item', function (idx) { - return this.getNamedItem(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; + 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; + 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]; + return this._nodes[name]; }); NamedNodeMap.method('getNamedItemNS', function (ns,name) { - return this._ns_nodes[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++; + 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++; + 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'); + 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; @@ -187,442 +187,442 @@ 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; + 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; - } + 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); + 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]; + for (var j = this.childNodes.length; j > i; j--) + this.childNodes[j] = this.childNodes[j - 1]; - this.childNodes[i] = node; + this.childNodes[i] = node; - if (i == 0) { - this.firstChild = node; - } else { - this.childNodes[i - 1].nextSibling = node; - node.previousSibling = this.childNodes[i + 1]; - } + 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[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; + 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.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; - } + 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; - } + 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; + return node; }); Node.method('hasChildNodes', function () { - if (this.childNodes.length) return true; - return false; + if (this.childNodes.length) return true; + return false; }); Node.method('hasAttributes', function () { - if (this.attributes.length) return true; - return false; + 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; + //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) ); - } + 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) ); + for (var i = 0; i < this.attributes.length; i++) + newNode.attributes.setNamedItem( this.attributes.item(i) ); - return newNode; + 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; + 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; + 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; + 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; + 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; + 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'); + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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'); + 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') + 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; + 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); + 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; + this.attributes.removeNamedItem(aname); + return null; }); Element.method('getAttributeNode', function (aname) { - return this.attributes.getNamedItem(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); + 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); - } + 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; + 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); + 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; + this.attributes.removeNamedItemNS(ns,aname); + return null; }); Element.method('getAttributeNodeNS', function (ns, aname) { - return this.attributes.getNamedItemNS(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); + 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 ); + return ( this.getAttribute(name) ? true : false ); }); Element.method('hasAttributeNS', function (ns, name) { - return ( this.getAttributeNS(ns, name) ? true : false ); + 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; + 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; + 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); + 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; + this.data = this.nodeValue = content; + if (this.data) + this.length = this.data.length; }); CharacterData.method('substringData', function (offset,count) { - this.data.substring(offset,count); + this.data.substring(offset,count); }); CharacterData.method('appendData', function (txt) { - this.data = this.nodeValue = this.data + txt; - this.length = this.data.length; + 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; + 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; + 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; + 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); + 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'); + 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'); + this.uber('constructor', '#comment', content); + this.constructor = Comment; + this.nodeType = Node.COMMENT_NODE; + //log_stdout(' -- Comment constructor'); } Comment.inherits(Text); @@ -631,14 +631,14 @@ Comment.inherits(Text); //////////////////////// XPath stuff ///////////////////////// function XPathNamespaceResolver (data) { - this.data = data; + this.data = data; } XPathNamespaceResolver.inherits(NamespaceResolver); XPathNamespaceResolver.method('lookupNamespaceURI', function (prefix) { - return this.data[prefix]; + return this.data[prefix]; }); XPathNamespaceResolver.method('setNamespaceURI', function (prefix, uri) { - this.data[prefix] = uri; + this.data[prefix] = uri; }); diff --git a/Open-ILS/src/javascript/backend/libs/jsOO.js b/Open-ILS/src/javascript/backend/libs/jsOO.js index d40321c35f..9df46e99a8 100644 --- a/Open-ILS/src/javascript/backend/libs/jsOO.js +++ b/Open-ILS/src/javascript/backend/libs/jsOO.js @@ -31,16 +31,16 @@ Function.method('inherits', function (parent) { instance_of = function(o, c) { - while (o != null) { - if (o.constructor === c) { - return true; - } - if (o === Object) { - return false; - } - o = o.superclass; - } - return false; + while (o != null) { + if (o.constructor === c) { + return true; + } + if (o === Object) { + return false; + } + o = o.superclass; + } + return false; }; diff --git a/Open-ILS/src/javascript/backend/libs/jsonopensrfrequest.js b/Open-ILS/src/javascript/backend/libs/jsonopensrfrequest.js index 7f2de1d06b..5f3da75d21 100644 --- a/Open-ILS/src/javascript/backend/libs/jsonopensrfrequest.js +++ b/Open-ILS/src/javascript/backend/libs/jsonopensrfrequest.js @@ -1,6 +1,6 @@ try { - load_lib('jsOO.js'); - load_lib('JSON_v1.js'); + load_lib('jsOO.js'); + load_lib('JSON_v1.js'); } catch (e) {} var __jsonopensrfreqid = 1; @@ -40,60 +40,60 @@ 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"); - } + 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"); - } + 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"); - } + 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"; + 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]; - } + 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"); - } + 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; diff --git a/Open-ILS/src/javascript/backend/libs/xmlhttprequest.js b/Open-ILS/src/javascript/backend/libs/xmlhttprequest.js index 51594e91b0..e9258113e9 100644 --- a/Open-ILS/src/javascript/backend/libs/xmlhttprequest.js +++ b/Open-ILS/src/javascript/backend/libs/xmlhttprequest.js @@ -1,6 +1,6 @@ try { - load_lib('jsOO.js'); - load_lib('jsDOM.js'); + load_lib('jsOO.js'); + load_lib('jsDOM.js'); } catch (e) {} var __xmlhttpreqid = 1; @@ -32,11 +32,11 @@ XMLHttpRequest.method('send', function (data) { __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"); - } + 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; diff --git a/Open-ILS/src/javascript/backend/libs/xpath.js b/Open-ILS/src/javascript/backend/libs/xpath.js index 25bbcfc065..a7418efc79 100644 --- a/Open-ILS/src/javascript/backend/libs/xpath.js +++ b/Open-ILS/src/javascript/backend/libs/xpath.js @@ -117,625 +117,625 @@ XPathParser.prototype.constructor = XPathParser; XPathParser.superclass = Object.prototype; function XPathParser() { - this.init(); + 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]); - }; + 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 " + " 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<<<<<<<< <<<<< >>>>>>>>> >>>>>>> >> >> ", + " 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<<<<<<<< <<<<<?@ 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 ", - " ", - " " + "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] + [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; @@ -775,352 +775,352 @@ 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]; + 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'; @@ -1128,61 +1128,61 @@ 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"); - } - } + 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 ///////////////////////////////////////////////////////////////////// @@ -1192,30 +1192,30 @@ XPath.prototype.constructor = XPath; XPath.superclass = Object.prototype; function XPath(e) { - this.expression = e; + this.expression = e; } XPath.prototype.toString = function() { - return this.expression.toString(); + 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); + 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"; @@ -1234,11 +1234,11 @@ Expression.prototype.init = function() { }; Expression.prototype.toString = function() { - return ""; + return ""; }; Expression.prototype.evaluate = function(c) { - throw new Error("Could not evaluate expression."); + throw new Error("Could not evaluate expression."); }; // UnaryOperation //////////////////////////////////////////////////////////// @@ -1248,13 +1248,13 @@ UnaryOperation.prototype.constructor = UnaryOperation; UnaryOperation.superclass = Expression.prototype; function UnaryOperation(rhs) { - if (arguments.length > 0) { - this.init(rhs); - } + if (arguments.length > 0) { + this.init(rhs); + } } UnaryOperation.prototype.init = function(rhs) { - this.rhs = rhs; + this.rhs = rhs; }; // UnaryMinusOperation /////////////////////////////////////////////////////// @@ -1264,21 +1264,21 @@ UnaryMinusOperation.prototype.constructor = UnaryMinusOperation; UnaryMinusOperation.superclass = UnaryOperation.prototype; function UnaryMinusOperation(rhs) { - if (arguments.length > 0) { - this.init(rhs); - } + if (arguments.length > 0) { + this.init(rhs); + } } UnaryMinusOperation.prototype.init = function(rhs) { - UnaryMinusOperation.superclass.init.call(this, rhs); + UnaryMinusOperation.superclass.init.call(this, rhs); }; UnaryMinusOperation.prototype.evaluate = function(c) { - return this.rhs.evaluate(c).number().negate(); + return this.rhs.evaluate(c).number().negate(); }; UnaryMinusOperation.prototype.toString = function() { - return "-" + this.rhs.toString(); + return "-" + this.rhs.toString(); }; // BinaryOperation /////////////////////////////////////////////////////////// @@ -1288,14 +1288,14 @@ BinaryOperation.prototype.constructor = BinaryOperation; BinaryOperation.superclass = Expression.prototype; function BinaryOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } BinaryOperation.prototype.init = function(lhs, rhs) { - this.lhs = lhs; - this.rhs = rhs; + this.lhs = lhs; + this.rhs = rhs; }; // OrOperation /////////////////////////////////////////////////////////////// @@ -1305,25 +1305,25 @@ OrOperation.prototype.constructor = OrOperation; OrOperation.superclass = BinaryOperation.prototype; function OrOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } OrOperation.prototype.init = function(lhs, rhs) { - OrOperation.superclass.init.call(this, lhs, rhs); + OrOperation.superclass.init.call(this, lhs, rhs); }; OrOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")"; + 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(); + var b = this.lhs.evaluate(c).bool(); + if (b.booleanValue()) { + return b; + } + return this.rhs.evaluate(c).bool(); }; // AndOperation ////////////////////////////////////////////////////////////// @@ -1333,25 +1333,25 @@ AndOperation.prototype.constructor = AndOperation; AndOperation.superclass = BinaryOperation.prototype; function AndOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } AndOperation.prototype.init = function(lhs, rhs) { - AndOperation.superclass.init.call(this, lhs, rhs); + AndOperation.superclass.init.call(this, lhs, rhs); }; AndOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")"; + 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(); + var b = this.lhs.evaluate(c).bool(); + if (!b.booleanValue()) { + return b; + } + return this.rhs.evaluate(c).bool(); }; // EqualsOperation /////////////////////////////////////////////////////////// @@ -1361,21 +1361,21 @@ EqualsOperation.prototype.constructor = EqualsOperation; EqualsOperation.superclass = BinaryOperation.prototype; function EqualsOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } EqualsOperation.prototype.init = function(lhs, rhs) { - EqualsOperation.superclass.init.call(this, lhs, rhs); + EqualsOperation.superclass.init.call(this, lhs, rhs); }; EqualsOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")"; }; EqualsOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).equals(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).equals(this.rhs.evaluate(c)); }; // NotEqualOperation ///////////////////////////////////////////////////////// @@ -1385,21 +1385,21 @@ NotEqualOperation.prototype.constructor = NotEqualOperation; NotEqualOperation.superclass = BinaryOperation.prototype; function NotEqualOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } NotEqualOperation.prototype.init = function(lhs, rhs) { - NotEqualOperation.superclass.init.call(this, lhs, rhs); + NotEqualOperation.superclass.init.call(this, lhs, rhs); }; NotEqualOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")"; }; NotEqualOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c)); }; // LessThanOperation ///////////////////////////////////////////////////////// @@ -1409,21 +1409,21 @@ LessThanOperation.prototype.constructor = LessThanOperation; LessThanOperation.superclass = BinaryOperation.prototype; function LessThanOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } LessThanOperation.prototype.init = function(lhs, rhs) { - LessThanOperation.superclass.init.call(this, lhs, rhs); + LessThanOperation.superclass.init.call(this, lhs, rhs); }; LessThanOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c)); }; LessThanOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")"; }; // GreaterThanOperation ////////////////////////////////////////////////////// @@ -1433,21 +1433,21 @@ GreaterThanOperation.prototype.constructor = GreaterThanOperation; GreaterThanOperation.superclass = BinaryOperation.prototype; function GreaterThanOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } GreaterThanOperation.prototype.init = function(lhs, rhs) { - GreaterThanOperation.superclass.init.call(this, lhs, rhs); + GreaterThanOperation.superclass.init.call(this, lhs, rhs); }; GreaterThanOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c)); }; GreaterThanOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")"; }; // LessThanOrEqualOperation ////////////////////////////////////////////////// @@ -1457,21 +1457,21 @@ LessThanOrEqualOperation.prototype.constructor = LessThanOrEqualOperation; LessThanOrEqualOperation.superclass = BinaryOperation.prototype; function LessThanOrEqualOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } LessThanOrEqualOperation.prototype.init = function(lhs, rhs) { - LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs); + LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs); }; LessThanOrEqualOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c)); }; LessThanOrEqualOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")"; }; // GreaterThanOrEqualOperation /////////////////////////////////////////////// @@ -1481,21 +1481,21 @@ GreaterThanOrEqualOperation.prototype.constructor = GreaterThanOrEqualOperation; GreaterThanOrEqualOperation.superclass = BinaryOperation.prototype; function GreaterThanOrEqualOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } GreaterThanOrEqualOperation.prototype.init = function(lhs, rhs) { - GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs); + GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs); }; GreaterThanOrEqualOperation.prototype.evaluate = function(c) { - return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c)); + return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c)); }; GreaterThanOrEqualOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")"; }; // PlusOperation ///////////////////////////////////////////////////////////// @@ -1505,21 +1505,21 @@ PlusOperation.prototype.constructor = PlusOperation; PlusOperation.superclass = BinaryOperation.prototype; function PlusOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } PlusOperation.prototype.init = function(lhs, rhs) { - PlusOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number()); }; PlusOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")"; }; // MinusOperation //////////////////////////////////////////////////////////// @@ -1529,21 +1529,21 @@ MinusOperation.prototype.constructor = MinusOperation; MinusOperation.superclass = BinaryOperation.prototype; function MinusOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } MinusOperation.prototype.init = function(lhs, rhs) { - MinusOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number()); }; MinusOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")"; }; // MultiplyOperation ///////////////////////////////////////////////////////// @@ -1553,21 +1553,21 @@ MultiplyOperation.prototype.constructor = MultiplyOperation; MultiplyOperation.superclass = BinaryOperation.prototype; function MultiplyOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } MultiplyOperation.prototype.init = function(lhs, rhs) { - MultiplyOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number()); }; MultiplyOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")"; }; // DivOperation ////////////////////////////////////////////////////////////// @@ -1577,21 +1577,21 @@ DivOperation.prototype.constructor = DivOperation; DivOperation.superclass = BinaryOperation.prototype; function DivOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } DivOperation.prototype.init = function(lhs, rhs) { - DivOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number()); }; DivOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")"; }; // ModOperation ////////////////////////////////////////////////////////////// @@ -1601,21 +1601,21 @@ ModOperation.prototype.constructor = ModOperation; ModOperation.superclass = BinaryOperation.prototype; function ModOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } ModOperation.prototype.init = function(lhs, rhs) { - ModOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number()); }; ModOperation.prototype.toString = function() { - return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")"; + return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")"; }; // BarOperation ////////////////////////////////////////////////////////////// @@ -1625,21 +1625,21 @@ BarOperation.prototype.constructor = BarOperation; BarOperation.superclass = BinaryOperation.prototype; function BarOperation(lhs, rhs) { - if (arguments.length > 0) { - this.init(lhs, rhs); - } + if (arguments.length > 0) { + this.init(lhs, rhs); + } } BarOperation.prototype.init = function(lhs, rhs) { - BarOperation.superclass.init.call(this, 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()); + return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset()); }; BarOperation.prototype.toString = function() { - return this.lhs.toString() + " | " + this.rhs.toString(); + return this.lhs.toString() + " | " + this.rhs.toString(); }; // PathExpr ////////////////////////////////////////////////////////////////// @@ -1649,387 +1649,387 @@ PathExpr.prototype.constructor = PathExpr; PathExpr.superclass = Expression.prototype; function PathExpr(filter, filterPreds, locpath) { - if (arguments.length > 0) { - this.init(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.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; + 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(); + 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(); + 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; + // 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 ////////////////////////////////////////////////////////////// @@ -2039,30 +2039,30 @@ LocationPath.prototype.constructor = LocationPath; LocationPath.superclass = Object.prototype; function LocationPath(abs, steps) { - if (arguments.length > 0) { - this.init(abs, steps); - } + if (arguments.length > 0) { + this.init(abs, steps); + } } LocationPath.prototype.init = function(abs, steps) { - this.absolute = abs; - this.steps = 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; + 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 ////////////////////////////////////////////////////////////////////// @@ -2072,66 +2072,66 @@ Step.prototype.constructor = Step; Step.superclass = Object.prototype; function Step(axis, nodetest, preds) { - if (arguments.length > 0) { - this.init(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; + 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; + 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; @@ -2155,107 +2155,107 @@ NodeTest.prototype.constructor = NodeTest; NodeTest.superclass = Object.prototype; function NodeTest(type, value) { - if (arguments.length > 0) { - this.init(type, value); - } + if (arguments.length > 0) { + this.init(type, value); + } } NodeTest.prototype.init = function(type, value) { - this.type = type; - this.value = 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 ""; + 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 ""; }; 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; + 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; @@ -2273,21 +2273,21 @@ VariableReference.prototype.constructor = VariableReference; VariableReference.superclass = Expression.prototype; function VariableReference(v) { - if (arguments.length > 0) { - this.init(v); - } + if (arguments.length > 0) { + this.init(v); + } } VariableReference.prototype.init = function(v) { - this.variable = v; + this.variable = v; }; VariableReference.prototype.toString = function() { - return "$" + this.variable; + return "$" + this.variable; }; VariableReference.prototype.evaluate = function(c) { - return c.variableResolver.getVariable(this.variable, c); + return c.variableResolver.getVariable(this.variable, c); }; // FunctionCall ////////////////////////////////////////////////////////////// @@ -2297,34 +2297,34 @@ FunctionCall.prototype.constructor = FunctionCall; FunctionCall.superclass = Expression.prototype; function FunctionCall(fn, args) { - if (arguments.length > 0) { - this.init(fn, args); - } + if (arguments.length > 0) { + this.init(fn, args); + } } FunctionCall.prototype.init = function(fn, args) { - this.functionName = fn; - this.arguments = args; + this.functionName = fn; + this.arguments = args; }; FunctionCall.prototype.toString = function() { - var s = this.functionName + "("; - for (var i = 0; i < this.arguments.length; i++) { - if (i > 0) { - s += ", "; - } - s += this.arguments[i].toString(); - } - return s + ")"; + var s = this.functionName + "("; + for (var i = 0; i < this.arguments.length; i++) { + if (i > 0) { + s += ", "; + } + s += this.arguments[i].toString(); + } + return s + ")"; }; FunctionCall.prototype.evaluate = function(c) { - var f = c.functionResolver.getFunction(this.functionName, c); - if (f == undefined) { - throw new Error("Unknown function " + this.functionName); - } - var a = [c].concat(this.arguments); - return f.apply(c.functionResolver.thisArg, a); + var f = c.functionResolver.getFunction(this.functionName, c); + if (f == undefined) { + throw new Error("Unknown function " + this.functionName); + } + var a = [c].concat(this.arguments); + return f.apply(c.functionResolver.thisArg, a); }; // XString /////////////////////////////////////////////////////////////////// @@ -2334,103 +2334,103 @@ XString.prototype.constructor = XString; XString.superclass = Expression.prototype; function XString(s) { - if (arguments.length > 0) { - this.init(s); - } + if (arguments.length > 0) { + this.init(s); + } } XString.prototype.init = function(s) { - this.str = s; + this.str = s; }; XString.prototype.toString = function() { - return this.str; + return this.str; }; XString.prototype.evaluate = function(c) { - return this; + return this; }; XString.prototype.string = function() { - return this; + return this; }; XString.prototype.number = function() { - return new XNumber(this.str); + return new XNumber(this.str); }; XString.prototype.bool = function() { - return new XBoolean(this.str); + return new XBoolean(this.str); }; XString.prototype.nodeset = function() { - throw new Error("Cannot convert string to nodeset"); + throw new Error("Cannot convert string to nodeset"); }; XString.prototype.stringValue = function() { - return this.str; + return this.str; }; XString.prototype.numberValue = function() { - return this.number().numberValue(); + return this.number().numberValue(); }; XString.prototype.booleanValue = function() { - return this.bool().booleanValue(); + return this.bool().booleanValue(); }; XString.prototype.equals = function(r) { - if (Utilities.instance_of(r, XBoolean)) { - return this.bool().equals(r); - } - if (Utilities.instance_of(r, XNumber)) { - return this.number().equals(r); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithString(this, Operators.equals); - } - return new XBoolean(this.str == r.str); + if (Utilities.instance_of(r, XBoolean)) { + return this.bool().equals(r); + } + if (Utilities.instance_of(r, XNumber)) { + return this.number().equals(r); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithString(this, Operators.equals); + } + return new XBoolean(this.str == r.str); }; XString.prototype.notequal = function(r) { - if (Utilities.instance_of(r, XBoolean)) { - return this.bool().notequal(r); - } - if (Utilities.instance_of(r, XNumber)) { - return this.number().notequal(r); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithString(this, Operators.notequal); - } - return new XBoolean(this.str != r.str); + if (Utilities.instance_of(r, XBoolean)) { + return this.bool().notequal(r); + } + if (Utilities.instance_of(r, XNumber)) { + return this.number().notequal(r); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithString(this, Operators.notequal); + } + return new XBoolean(this.str != r.str); }; XString.prototype.lessthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.greaterthanorequal); - } - return this.number().lessthan(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.greaterthanorequal); + } + return this.number().lessthan(r.number()); }; XString.prototype.greaterthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.lessthanorequal); - } - return this.number().greaterthan(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.lessthanorequal); + } + return this.number().greaterthan(r.number()); }; XString.prototype.lessthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.greaterthan); - } - return this.number().lessthanorequal(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.greaterthan); + } + return this.number().lessthanorequal(r.number()); }; XString.prototype.greaterthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.lessthan); - } - return this.number().greaterthanorequal(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.lessthan); + } + return this.number().greaterthanorequal(r.number()); }; // XNumber /////////////////////////////////////////////////////////////////// @@ -2440,139 +2440,139 @@ XNumber.prototype.constructor = XNumber; XNumber.superclass = Expression.prototype; function XNumber(n) { - if (arguments.length > 0) { - this.init(n); - } + if (arguments.length > 0) { + this.init(n); + } } XNumber.prototype.init = function(n) { - this.num = Number(n); + this.num = Number(n); }; XNumber.prototype.toString = function() { - return this.num; + return this.num; }; XNumber.prototype.evaluate = function(c) { - return this; + return this; }; XNumber.prototype.string = function() { - return new XString(this.num); + return new XString(this.num); }; XNumber.prototype.number = function() { - return this; + return this; }; XNumber.prototype.bool = function() { - return new XBoolean(this.num); + return new XBoolean(this.num); }; XNumber.prototype.nodeset = function() { - throw new Error("Cannot convert number to nodeset"); + throw new Error("Cannot convert number to nodeset"); }; XNumber.prototype.stringValue = function() { - return this.string().stringValue(); + return this.string().stringValue(); }; XNumber.prototype.numberValue = function() { - return this.num; + return this.num; }; XNumber.prototype.booleanValue = function() { - return this.bool().booleanValue(); + return this.bool().booleanValue(); }; XNumber.prototype.negate = function() { - return new XNumber(-this.num); + return new XNumber(-this.num); }; XNumber.prototype.equals = function(r) { - if (Utilities.instance_of(r, XBoolean)) { - return this.bool().equals(r); - } - if (Utilities.instance_of(r, XString)) { - return this.equals(r.number()); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.equals); - } - return new XBoolean(this.num == r.num); + if (Utilities.instance_of(r, XBoolean)) { + return this.bool().equals(r); + } + if (Utilities.instance_of(r, XString)) { + return this.equals(r.number()); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.equals); + } + return new XBoolean(this.num == r.num); }; XNumber.prototype.notequal = function(r) { - if (Utilities.instance_of(r, XBoolean)) { - return this.bool().notequal(r); - } - if (Utilities.instance_of(r, XString)) { - return this.notequal(r.number()); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.notequal); - } - return new XBoolean(this.num != r.num); + if (Utilities.instance_of(r, XBoolean)) { + return this.bool().notequal(r); + } + if (Utilities.instance_of(r, XString)) { + return this.notequal(r.number()); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.notequal); + } + return new XBoolean(this.num != r.num); }; XNumber.prototype.lessthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.greaterthanorequal); - } - if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { - return this.lessthan(r.number()); - } - return new XBoolean(this.num < r.num); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.greaterthanorequal); + } + if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { + return this.lessthan(r.number()); + } + return new XBoolean(this.num < r.num); }; XNumber.prototype.greaterthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.lessthanorequal); - } - if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { - return this.greaterthan(r.number()); - } - return new XBoolean(this.num > r.num); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.lessthanorequal); + } + if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { + return this.greaterthan(r.number()); + } + return new XBoolean(this.num > r.num); }; XNumber.prototype.lessthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.greaterthan); - } - if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { - return this.lessthanorequal(r.number()); - } - return new XBoolean(this.num <= r.num); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.greaterthan); + } + if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { + return this.lessthanorequal(r.number()); + } + return new XBoolean(this.num <= r.num); }; XNumber.prototype.greaterthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this, Operators.lessthan); - } - if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { - return this.greaterthanorequal(r.number()); - } - return new XBoolean(this.num >= r.num); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this, Operators.lessthan); + } + if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) { + return this.greaterthanorequal(r.number()); + } + return new XBoolean(this.num >= r.num); }; XNumber.prototype.plus = function(r) { - return new XNumber(this.num + r.num); + return new XNumber(this.num + r.num); }; XNumber.prototype.minus = function(r) { - return new XNumber(this.num - r.num); + return new XNumber(this.num - r.num); }; XNumber.prototype.multiply = function(r) { - return new XNumber(this.num * r.num); + return new XNumber(this.num * r.num); }; XNumber.prototype.div = function(r) { - return new XNumber(this.num / r.num); + return new XNumber(this.num / r.num); }; XNumber.prototype.mod = function(r) { - return new XNumber(this.num % r.num); + return new XNumber(this.num % r.num); }; // XBoolean ////////////////////////////////////////////////////////////////// @@ -2582,101 +2582,101 @@ XBoolean.prototype.constructor = XBoolean; XBoolean.superclass = Expression.prototype; function XBoolean(b) { - if (arguments.length > 0) { - this.init(b); - } + if (arguments.length > 0) { + this.init(b); + } } XBoolean.prototype.init = function(b) { - this.b = Boolean(b); + this.b = Boolean(b); }; XBoolean.prototype.toString = function() { - return this.b.toString(); + return this.b.toString(); }; XBoolean.prototype.evaluate = function(c) { - return this; + return this; }; XBoolean.prototype.string = function() { - return new XString(this.b); + return new XString(this.b); }; XBoolean.prototype.number = function() { - return new XNumber(this.b); + return new XNumber(this.b); }; XBoolean.prototype.bool = function() { - return this; + return this; }; XBoolean.prototype.nodeset = function() { - throw new Error("Cannot convert boolean to nodeset"); + throw new Error("Cannot convert boolean to nodeset"); }; XBoolean.prototype.stringValue = function() { - return this.string().stringValue(); + return this.string().stringValue(); }; XBoolean.prototype.numberValue = function() { - return this.num().numberValue(); + return this.num().numberValue(); }; XBoolean.prototype.booleanValue = function() { - return this.b; + return this.b; }; XBoolean.prototype.not = function() { - return new XBoolean(!this.b); + return new XBoolean(!this.b); }; XBoolean.prototype.equals = function(r) { - if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) { - return this.equals(r.bool()); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithBoolean(this, Operators.equals); - } - return new XBoolean(this.b == r.b); + if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) { + return this.equals(r.bool()); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithBoolean(this, Operators.equals); + } + return new XBoolean(this.b == r.b); }; XBoolean.prototype.notequal = function(r) { - if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) { - return this.notequal(r.bool()); - } - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithBoolean(this, Operators.notequal); - } - return new XBoolean(this.b != r.b); + if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) { + return this.notequal(r.bool()); + } + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithBoolean(this, Operators.notequal); + } + return new XBoolean(this.b != r.b); }; XBoolean.prototype.lessthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.greaterthanorequal); - } - return this.number().lessthan(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.greaterthanorequal); + } + return this.number().lessthan(r.number()); }; XBoolean.prototype.greaterthan = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.lessthanorequal); - } - return this.number().greaterthan(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.lessthanorequal); + } + return this.number().greaterthan(r.number()); }; XBoolean.prototype.lessthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.greaterthan); - } - return this.number().lessthanorequal(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.greaterthan); + } + return this.number().lessthanorequal(r.number()); }; XBoolean.prototype.greaterthanorequal = function(r) { - if (Utilities.instance_of(r, XNodeSet)) { - return r.compareWithNumber(this.number(), Operators.lessthan); - } - return this.number().greaterthanorequal(r.number()); + if (Utilities.instance_of(r, XNodeSet)) { + return r.compareWithNumber(this.number(), Operators.lessthan); + } + return this.number().greaterthanorequal(r.number()); }; // AVLTree /////////////////////////////////////////////////////////////////// @@ -2686,21 +2686,21 @@ AVLTree.prototype.constructor = AVLTree; AVLTree.superclass = Object.prototype; function AVLTree(n) { - this.init(n); + this.init(n); } AVLTree.prototype.init = function(n) { - this.left = null; + this.left = null; this.right = null; - this.node = n; - this.depth = 1; + this.node = n; + this.depth = 1; }; AVLTree.prototype.balance = function() { var ldepth = this.left == null ? 0 : this.left.depth; var rdepth = this.right == null ? 0 : this.right.depth; - if (ldepth > rdepth + 1) { + if (ldepth > rdepth + 1) { // LR or LL rotation var lldepth = this.left.left == null ? 0 : this.left.left.depth; var lrdepth = this.left.right == null ? 0 : this.left.right.depth; @@ -2713,16 +2713,16 @@ AVLTree.prototype.balance = function() { this.rotateLL(); } else if (ldepth + 1 < rdepth) { // RR or RL rorarion - var rrdepth = this.right.right == null ? 0 : this.right.right.depth; - var rldepth = this.right.left == null ? 0 : this.right.left.depth; - + var rrdepth = this.right.right == null ? 0 : this.right.right.depth; + var rldepth = this.right.left == null ? 0 : this.right.left.depth; + if (rldepth > rrdepth) { // RR rotation consists of a LL rotation of the right child this.right.rotateLL(); // plus a RR rotation of this node, which happens anyway } this.rotateRR(); - } + } }; AVLTree.prototype.rotateLL = function() { @@ -2752,7 +2752,7 @@ AVLTree.prototype.rotateRR = function() { this.left.updateInNewLocation(); this.updateInNewLocation(); }; - + AVLTree.prototype.updateInNewLocation = function() { this.getDepthFromChildren(); }; @@ -2768,55 +2768,55 @@ AVLTree.prototype.getDepthFromChildren = function() { }; AVLTree.prototype.order = function(n1, n2) { - if (n1 === n2) { - return 0; - } - var d1 = 0; - var d2 = 0; - for (var m1 = n1; m1 != null; m1 = m1.parentNode) { - d1++; - } - for (var m2 = n2; m2 != null; m2 = m2.parentNode) { - d2++; - } - if (d1 > d2) { - while (d1 > d2) { - n1 = n1.parentNode; - d1--; - } - if (n1 == n2) { - return 1; - } - } else if (d2 > d1) { - while (d2 > d1) { - n2 = n2.parentNode; - d2--; - } - if (n1 == n2) { - return -1; - } - } - while (n1.parentNode != n2.parentNode) { - n1 = n1.parentNode; - n2 = n2.parentNode; - } - while (n1.previousSibling != null && n2.previousSibling != null) { - n1 = n1.previousSibling; - n2 = n2.previousSibling; - } - if (n1.previousSibling == null) { - return -1; - } - return 1; + if (n1 === n2) { + return 0; + } + var d1 = 0; + var d2 = 0; + for (var m1 = n1; m1 != null; m1 = m1.parentNode) { + d1++; + } + for (var m2 = n2; m2 != null; m2 = m2.parentNode) { + d2++; + } + if (d1 > d2) { + while (d1 > d2) { + n1 = n1.parentNode; + d1--; + } + if (n1 == n2) { + return 1; + } + } else if (d2 > d1) { + while (d2 > d1) { + n2 = n2.parentNode; + d2--; + } + if (n1 == n2) { + return -1; + } + } + while (n1.parentNode != n2.parentNode) { + n1 = n1.parentNode; + n2 = n2.parentNode; + } + while (n1.previousSibling != null && n2.previousSibling != null) { + n1 = n1.previousSibling; + n2 = n2.previousSibling; + } + if (n1.previousSibling == null) { + return -1; + } + return 1; }; AVLTree.prototype.add = function(n) { - if (n === this.node) { + if (n === this.node) { return false; } - - var o = this.order(n, this.node); - + + var o = this.order(n, this.node); + var ret = false; if (o == -1) { if (this.left == null) { @@ -2839,7 +2839,7 @@ AVLTree.prototype.add = function(n) { } } } - + if (ret) { this.getDepthFromChildren(); } @@ -2853,88 +2853,88 @@ XNodeSet.prototype.constructor = XNodeSet; XNodeSet.superclass = Expression.prototype; function XNodeSet() { - this.init(); + this.init(); } XNodeSet.prototype.init = function() { - this.tree = null; - this.size = 0; + this.tree = null; + this.size = 0; }; XNodeSet.prototype.toString = function() { - var p = this.first(); - if (p == null) { - return ""; - } - return this.stringForNode(p); + var p = this.first(); + if (p == null) { + return ""; + } + return this.stringForNode(p); }; XNodeSet.prototype.evaluate = function(c) { - return this; + return this; }; XNodeSet.prototype.string = function() { - return new XString(this.toString()); + return new XString(this.toString()); }; XNodeSet.prototype.stringValue = function() { - return this.toString(); + return this.toString(); }; XNodeSet.prototype.number = function() { - return new XNumber(this.string()); + return new XNumber(this.string()); }; XNodeSet.prototype.numberValue = function() { - return Number(this.string()); + return Number(this.string()); }; XNodeSet.prototype.bool = function() { - return new XBoolean(this.tree != null); + return new XBoolean(this.tree != null); }; XNodeSet.prototype.booleanValue = function() { - return this.tree != null; + return this.tree != null; }; XNodeSet.prototype.nodeset = function() { - return this; + return this; }; XNodeSet.prototype.stringForNode = function(n) { - if (n.nodeType == 9 /*Node.DOCUMENT_NODE*/) { - n = n.documentElement; - } - if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) { - return this.stringForNodeRec(n); - } - if (n.isNamespaceNode) { - return n.namespace; - } - return n.nodeValue; + if (n.nodeType == 9 /*Node.DOCUMENT_NODE*/) { + n = n.documentElement; + } + if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) { + return this.stringForNodeRec(n); + } + if (n.isNamespaceNode) { + return n.namespace; + } + return n.nodeValue; }; XNodeSet.prototype.stringForNodeRec = function(n) { - var s = ""; - for (var n2 = n.firstChild; n2 != null; n2 = n2.nextSibling) { - if (n2.nodeType == 3 /*Node.TEXT_NODE*/) { - s += n2.nodeValue; - } else if (n2.nodeType == 1 /*Node.ELEMENT_NODE*/) { - s += this.stringForNodeRec(n2); - } - } - return s; + var s = ""; + for (var n2 = n.firstChild; n2 != null; n2 = n2.nextSibling) { + if (n2.nodeType == 3 /*Node.TEXT_NODE*/) { + s += n2.nodeValue; + } else if (n2.nodeType == 1 /*Node.ELEMENT_NODE*/) { + s += this.stringForNodeRec(n2); + } + } + return s; }; XNodeSet.prototype.first = function() { - var p = this.tree; - if (p == null) { - return null; - } - while (p.left != null) { - p = p.left; - } - return p.node; + var p = this.tree; + if (p == null) { + return null; + } + while (p.left != null) { + p = p.left; + } + return p.node; }; XNodeSet.prototype.add = function(n) { @@ -2951,157 +2951,157 @@ XNodeSet.prototype.add = function(n) { }; XNodeSet.prototype.addArray = function(ns) { - for (var i = 0; i < ns.length; i++) { - this.add(ns[i]); - } + for (var i = 0; i < ns.length; i++) { + this.add(ns[i]); + } }; XNodeSet.prototype.toArray = function() { - var a = []; - this.toArrayRec(this.tree, a); - return a; + var a = []; + this.toArrayRec(this.tree, a); + return a; }; XNodeSet.prototype.toArrayRec = function(t, a) { - if (t != null) { - this.toArrayRec(t.left, a); - a.push(t.node); - this.toArrayRec(t.right, a); - } + if (t != null) { + this.toArrayRec(t.left, a); + a.push(t.node); + this.toArrayRec(t.right, a); + } }; XNodeSet.prototype.compareWithString = function(r, o) { - var a = this.toArray(); - for (var i = 0; i < a.length; i++) { - var n = a[i]; - var l = new XString(this.stringForNode(n)); - var res = o(l, r); - if (res.booleanValue()) { - return res; - } - } - return new XBoolean(false); + var a = this.toArray(); + for (var i = 0; i < a.length; i++) { + var n = a[i]; + var l = new XString(this.stringForNode(n)); + var res = o(l, r); + if (res.booleanValue()) { + return res; + } + } + return new XBoolean(false); }; XNodeSet.prototype.compareWithNumber = function(r, o) { - var a = this.toArray(); - for (var i = 0; i < a.length; i++) { - var n = a[i]; - var l = new XNumber(this.stringForNode(n)); - var res = o(l, r); - if (res.booleanValue()) { - return res; - } - } - return new XBoolean(false); + var a = this.toArray(); + for (var i = 0; i < a.length; i++) { + var n = a[i]; + var l = new XNumber(this.stringForNode(n)); + var res = o(l, r); + if (res.booleanValue()) { + return res; + } + } + return new XBoolean(false); }; XNodeSet.prototype.compareWithBoolean = function(r, o) { - return o(this.bool(), r); + return o(this.bool(), r); }; XNodeSet.prototype.compareWithNodeSet = function(r, o) { - var a = this.toArray(); - for (var i = 0; i < a.length; i++) { - var n = a[i]; - var l = new XString(this.stringForNode(n)); - var b = r.toArray(); - for (var j = 0; j < b.length; j++) { - var n2 = b[j]; - var r = new XString(this.stringForNode(n2)); - var res = o(l, r); - if (res.booleanValue()) { - return res; - } - } - } - return new XBoolean(false); + var a = this.toArray(); + for (var i = 0; i < a.length; i++) { + var n = a[i]; + var l = new XString(this.stringForNode(n)); + var b = r.toArray(); + for (var j = 0; j < b.length; j++) { + var n2 = b[j]; + var r = new XString(this.stringForNode(n2)); + var res = o(l, r); + if (res.booleanValue()) { + return res; + } + } + } + return new XBoolean(false); }; XNodeSet.prototype.equals = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithString(r, Operators.equals); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.equals); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.equals); - } - return this.compareWithNodeSet(r, Operators.equals); + if (Utilities.instance_of(r, XString)) { + return this.compareWithString(r, Operators.equals); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.equals); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.equals); + } + return this.compareWithNodeSet(r, Operators.equals); }; XNodeSet.prototype.notequal = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithString(r, Operators.notequal); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.notequal); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.notequal); - } - return this.compareWithNodeSet(r, Operators.notequal); + if (Utilities.instance_of(r, XString)) { + return this.compareWithString(r, Operators.notequal); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.notequal); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.notequal); + } + return this.compareWithNodeSet(r, Operators.notequal); }; XNodeSet.prototype.lessthan = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithNumber(r.number(), Operators.lessthan); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.lessthan); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.lessthan); - } - return this.compareWithNodeSet(r, Operators.lessthan); + if (Utilities.instance_of(r, XString)) { + return this.compareWithNumber(r.number(), Operators.lessthan); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.lessthan); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.lessthan); + } + return this.compareWithNodeSet(r, Operators.lessthan); }; XNodeSet.prototype.greaterthan = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithNumber(r.number(), Operators.greaterthan); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.greaterthan); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.greaterthan); - } - return this.compareWithNodeSet(r, Operators.greaterthan); + if (Utilities.instance_of(r, XString)) { + return this.compareWithNumber(r.number(), Operators.greaterthan); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.greaterthan); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.greaterthan); + } + return this.compareWithNodeSet(r, Operators.greaterthan); }; XNodeSet.prototype.lessthanorequal = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithNumber(r.number(), Operators.lessthanorequal); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.lessthanorequal); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.lessthanorequal); - } - return this.compareWithNodeSet(r, Operators.lessthanorequal); + if (Utilities.instance_of(r, XString)) { + return this.compareWithNumber(r.number(), Operators.lessthanorequal); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.lessthanorequal); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.lessthanorequal); + } + return this.compareWithNodeSet(r, Operators.lessthanorequal); }; XNodeSet.prototype.greaterthanorequal = function(r) { - if (Utilities.instance_of(r, XString)) { - return this.compareWithNumber(r.number(), Operators.greaterthanorequal); - } - if (Utilities.instance_of(r, XNumber)) { - return this.compareWithNumber(r, Operators.greaterthanorequal); - } - if (Utilities.instance_of(r, XBoolean)) { - return this.compareWithBoolean(r, Operators.greaterthanorequal); - } - return this.compareWithNodeSet(r, Operators.greaterthanorequal); + if (Utilities.instance_of(r, XString)) { + return this.compareWithNumber(r.number(), Operators.greaterthanorequal); + } + if (Utilities.instance_of(r, XNumber)) { + return this.compareWithNumber(r, Operators.greaterthanorequal); + } + if (Utilities.instance_of(r, XBoolean)) { + return this.compareWithBoolean(r, Operators.greaterthanorequal); + } + return this.compareWithNodeSet(r, Operators.greaterthanorequal); }; XNodeSet.prototype.union = function(r) { - var ns = new XNodeSet(); - ns.tree = this.tree; - ns.size = this.size; - ns.addArray(r.toArray()); - return ns; + var ns = new XNodeSet(); + ns.tree = this.tree; + ns.size = this.size; + ns.addArray(r.toArray()); + return ns; }; // XPathNamespace //////////////////////////////////////////////////////////// @@ -3111,19 +3111,19 @@ XPathNamespace.prototype.constructor = XPathNamespace; XPathNamespace.superclass = Object.prototype; function XPathNamespace(pre, ns, p) { - this.isXPathNamespace = true; - this.ownerDocument = p.ownerDocument; - this.nodeName = "#namespace"; - this.prefix = pre; - this.localName = pre; - this.namespaceURI = ns; - this.nodeValue = ns; - this.ownerElement = p; - this.nodeType = XPathNamespace.XPATH_NAMESPACE_NODE; + this.isXPathNamespace = true; + this.ownerDocument = p.ownerDocument; + this.nodeName = "#namespace"; + this.prefix = pre; + this.localName = pre; + this.namespaceURI = ns; + this.nodeValue = ns; + this.ownerElement = p; + this.nodeType = XPathNamespace.XPATH_NAMESPACE_NODE; } XPathNamespace.prototype.toString = function() { - return "{ \"" + this.prefix + "\", \"" + this.namespaceURI + "\" }"; + return "{ \"" + this.prefix + "\", \"" + this.namespaceURI + "\" }"; }; // Operators ///////////////////////////////////////////////////////////////// @@ -3131,27 +3131,27 @@ XPathNamespace.prototype.toString = function() { var Operators = new Object(); Operators.equals = function(l, r) { - return l.equals(r); + return l.equals(r); }; Operators.notequal = function(l, r) { - return l.notequal(r); + return l.notequal(r); }; Operators.lessthan = function(l, r) { - return l.lessthan(r); + return l.lessthan(r); }; Operators.greaterthan = function(l, r) { - return l.greaterthan(r); + return l.greaterthan(r); }; Operators.lessthanorequal = function(l, r) { - return l.lessthanorequal(r); + return l.lessthanorequal(r); }; Operators.greaterthanorequal = function(l, r) { - return l.greaterthanorequal(r); + return l.greaterthanorequal(r); }; // XPathContext ////////////////////////////////////////////////////////////// @@ -3161,9 +3161,9 @@ XPathContext.prototype.constructor = XPathContext; XPathContext.superclass = Object.prototype; function XPathContext(vr, nr, fr) { - this.variableResolver = vr != null ? vr : new VariableResolver(); - this.namespaceResolver = nr != null ? nr : new NamespaceResolver(); - this.functionResolver = fr != null ? fr : new FunctionResolver(); + this.variableResolver = vr != null ? vr : new VariableResolver(); + this.namespaceResolver = nr != null ? nr : new NamespaceResolver(); + this.functionResolver = fr != null ? fr : new FunctionResolver(); } // VariableResolver ////////////////////////////////////////////////////////// @@ -3176,18 +3176,18 @@ function VariableResolver() { } VariableResolver.prototype.getVariable = function(vn, c) { - var parts = Utilities.splitQName(vn); - if (parts[0] != null) { - parts[0] = c.namespaceResolver.getNamespace(parts[0], c.expressionContextNode); + var parts = Utilities.splitQName(vn); + if (parts[0] != null) { + parts[0] = c.namespaceResolver.getNamespace(parts[0], c.expressionContextNode); if (parts[0] == null) { throw new Error("Cannot resolve QName " + fn); } - } - return this.getVariableWithName(parts[0], parts[1], c.expressionContextNode); + } + return this.getVariableWithName(parts[0], parts[1], c.expressionContextNode); }; VariableResolver.prototype.getVariableWithName = function(ns, ln, c) { - return null; + return null; }; // FunctionResolver ////////////////////////////////////////////////////////// @@ -3197,55 +3197,55 @@ FunctionResolver.prototype.constructor = FunctionResolver; FunctionResolver.superclass = Object.prototype; function FunctionResolver(thisArg) { - this.thisArg = thisArg != null ? thisArg : Functions; - this.functions = new Object(); - this.addStandardFunctions(); + this.thisArg = thisArg != null ? thisArg : Functions; + this.functions = new Object(); + this.addStandardFunctions(); } FunctionResolver.prototype.addStandardFunctions = function() { - this.functions["{}last"] = Functions.last; - this.functions["{}position"] = Functions.position; - this.functions["{}count"] = Functions.count; - this.functions["{}id"] = Functions.id; - this.functions["{}local-name"] = Functions.localName; - this.functions["{}namespace-uri"] = Functions.namespaceURI; - this.functions["{}name"] = Functions.name; - this.functions["{}string"] = Functions.string; - this.functions["{}concat"] = Functions.concat; - this.functions["{}starts-with"] = Functions.startsWith; - this.functions["{}contains"] = Functions.contains; - this.functions["{}substring-before"] = Functions.substringBefore; - this.functions["{}substring-after"] = Functions.substringAfter; - this.functions["{}substring"] = Functions.substring; - this.functions["{}string-length"] = Functions.stringLength; - this.functions["{}normalize-space"] = Functions.normalizeSpace; - this.functions["{}translate"] = Functions.translate; - this.functions["{}boolean"] = Functions.boolean_; - this.functions["{}not"] = Functions.not; - this.functions["{}true"] = Functions.true_; - this.functions["{}false"] = Functions.false_; - this.functions["{}lang"] = Functions.lang; - this.functions["{}number"] = Functions.number; - this.functions["{}sum"] = Functions.sum; - this.functions["{}floor"] = Functions.floor; - this.functions["{}ceiling"] = Functions.ceiling; - this.functions["{}round"] = Functions.round; + this.functions["{}last"] = Functions.last; + this.functions["{}position"] = Functions.position; + this.functions["{}count"] = Functions.count; + this.functions["{}id"] = Functions.id; + this.functions["{}local-name"] = Functions.localName; + this.functions["{}namespace-uri"] = Functions.namespaceURI; + this.functions["{}name"] = Functions.name; + this.functions["{}string"] = Functions.string; + this.functions["{}concat"] = Functions.concat; + this.functions["{}starts-with"] = Functions.startsWith; + this.functions["{}contains"] = Functions.contains; + this.functions["{}substring-before"] = Functions.substringBefore; + this.functions["{}substring-after"] = Functions.substringAfter; + this.functions["{}substring"] = Functions.substring; + this.functions["{}string-length"] = Functions.stringLength; + this.functions["{}normalize-space"] = Functions.normalizeSpace; + this.functions["{}translate"] = Functions.translate; + this.functions["{}boolean"] = Functions.boolean_; + this.functions["{}not"] = Functions.not; + this.functions["{}true"] = Functions.true_; + this.functions["{}false"] = Functions.false_; + this.functions["{}lang"] = Functions.lang; + this.functions["{}number"] = Functions.number; + this.functions["{}sum"] = Functions.sum; + this.functions["{}floor"] = Functions.floor; + this.functions["{}ceiling"] = Functions.ceiling; + this.functions["{}round"] = Functions.round; }; FunctionResolver.prototype.addFunction = function(ns, ln, f) { - this.functions["{" + ns + "}" + ln] = f; + this.functions["{" + ns + "}" + ln] = f; }; FunctionResolver.prototype.getFunction = function(fn, c) { - var parts = Utilities.resolveQName(fn, c.namespaceResolver, c.contextNode, false); + var parts = Utilities.resolveQName(fn, c.namespaceResolver, c.contextNode, false); if (parts[0] == null) { throw new Error("Cannot resolve QName " + fn); } - return this.getFunctionWithName(parts[0], parts[1], c.contextNode); + return this.getFunctionWithName(parts[0], parts[1], c.contextNode); }; FunctionResolver.prototype.getFunctionWithName = function(ns, ln, c) { - return this.functions["{" + ns + "}" + ln]; + return this.functions["{" + ns + "}" + ln]; }; // NamespaceResolver ///////////////////////////////////////////////////////// @@ -3258,31 +3258,31 @@ function NamespaceResolver() { } NamespaceResolver.prototype.getNamespace = function(prefix, n) { - if (prefix == "xml") { - return XPath.XML_NAMESPACE_URI; - } else if (prefix == "xmlns") { - return XPath.XMLNS_NAMESPACE_URI; - } - if (n.nodeType == 9 /*Node.DOCUMENT_NODE*/) { - n = n.documentElement; - } else if (n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) { - n = PathExpr.prototype.getOwnerElement(n); - } else if (n.nodeType != 1 /*Node.ELEMENT_NODE*/) { - n = n.parentNode; - } - while (n != null && n.nodeType == 1 /*Node.ELEMENT_NODE*/) { - var nnm = n.attributes; - for (var i = 0; i < nnm.length; i++) { - var a = nnm.item(i); - var aname = a.nodeName; - if (aname == "xmlns" && prefix == "" - || aname == "xmlns:" + prefix) { - return String(a.nodeValue); - } - } - n = n.parentNode; - } - return null; + if (prefix == "xml") { + return XPath.XML_NAMESPACE_URI; + } else if (prefix == "xmlns") { + return XPath.XMLNS_NAMESPACE_URI; + } + if (n.nodeType == 9 /*Node.DOCUMENT_NODE*/) { + n = n.documentElement; + } else if (n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) { + n = PathExpr.prototype.getOwnerElement(n); + } else if (n.nodeType != 1 /*Node.ELEMENT_NODE*/) { + n = n.parentNode; + } + while (n != null && n.nodeType == 1 /*Node.ELEMENT_NODE*/) { + var nnm = n.attributes; + for (var i = 0; i < nnm.length; i++) { + var a = nnm.item(i); + var aname = a.nodeName; + if (aname == "xmlns" && prefix == "" + || aname == "xmlns:" + prefix) { + return String(a.nodeValue); + } + } + n = n.parentNode; + } + return null; }; // Functions ///////////////////////////////////////////////////////////////// @@ -3290,370 +3290,370 @@ NamespaceResolver.prototype.getNamespace = function(prefix, n) { Functions = new Object(); Functions.last = function() { - var c = arguments[0]; - if (arguments.length != 1) { - throw new Error("Function last expects ()"); - } - return new XNumber(c.contextSize); + var c = arguments[0]; + if (arguments.length != 1) { + throw new Error("Function last expects ()"); + } + return new XNumber(c.contextSize); }; Functions.position = function() { - var c = arguments[0]; - if (arguments.length != 1) { - throw new Error("Function position expects ()"); - } - return new XNumber(c.contextPosition); + var c = arguments[0]; + if (arguments.length != 1) { + throw new Error("Function position expects ()"); + } + return new XNumber(c.contextPosition); }; Functions.count = function() { - var c = arguments[0]; - var ns; - if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) { - throw new Error("Function count expects (node-set)"); - } - return new XNumber(ns.size); + var c = arguments[0]; + var ns; + if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) { + throw new Error("Function count expects (node-set)"); + } + return new XNumber(ns.size); }; Functions.id = function() { - var c = arguments[0]; - var id; - if (arguments.length != 2) { - throw new Error("Function id expects (object)"); - } - id = arguments[1].evaluate(c); - if (Utilities.instance_of(id, XNodeSet)) { - id = id.toArray().join(" "); - } else { - id = id.stringValue(); - } - var ids = id.split(/[\x0d\x0a\x09\x20]+/); - var count = 0; - var ns = new XNodeSet(); - var doc = c.contextNode.nodeType == 9 /*Node.DOCUMENT_NODE*/ - ? c.contextNode - : c.contextNode.ownerDocument; - for (var i = 0; i < ids.length; i++) { - var n; - if (doc.getElementById) { - n = doc.getElementById(ids[i]); - } else { - n = Utilities.getElementById(doc, ids[i]); - } - if (n != null) { - ns.add(n); - count++; - } - } - return ns; + var c = arguments[0]; + var id; + if (arguments.length != 2) { + throw new Error("Function id expects (object)"); + } + id = arguments[1].evaluate(c); + if (Utilities.instance_of(id, XNodeSet)) { + id = id.toArray().join(" "); + } else { + id = id.stringValue(); + } + var ids = id.split(/[\x0d\x0a\x09\x20]+/); + var count = 0; + var ns = new XNodeSet(); + var doc = c.contextNode.nodeType == 9 /*Node.DOCUMENT_NODE*/ + ? c.contextNode + : c.contextNode.ownerDocument; + for (var i = 0; i < ids.length; i++) { + var n; + if (doc.getElementById) { + n = doc.getElementById(ids[i]); + } else { + n = Utilities.getElementById(doc, ids[i]); + } + if (n != null) { + ns.add(n); + count++; + } + } + return ns; }; Functions.localName = function() { - var c = arguments[0]; - var n; - if (arguments.length == 1) { - n = c.contextNode; - } else if (arguments.length == 2) { - n = arguments[1].evaluate(c).first(); - } else { - throw new Error("Function local-name expects (node-set?)"); - } - if (n == null) { - return new XString(""); - } - return new XString(n.localName ? n.localName : n.baseName); + var c = arguments[0]; + var n; + if (arguments.length == 1) { + n = c.contextNode; + } else if (arguments.length == 2) { + n = arguments[1].evaluate(c).first(); + } else { + throw new Error("Function local-name expects (node-set?)"); + } + if (n == null) { + return new XString(""); + } + return new XString(n.localName ? n.localName : n.baseName); }; Functions.namespaceURI = function() { - var c = arguments[0]; - var n; - if (arguments.length == 1) { - n = c.contextNode; - } else if (arguments.length == 2) { - n = arguments[1].evaluate(c).first(); - } else { - throw new Error("Function namespace-uri expects (node-set?)"); - } - if (n == null) { - return new XString(""); - } - return new XString(n.namespaceURI); + var c = arguments[0]; + var n; + if (arguments.length == 1) { + n = c.contextNode; + } else if (arguments.length == 2) { + n = arguments[1].evaluate(c).first(); + } else { + throw new Error("Function namespace-uri expects (node-set?)"); + } + if (n == null) { + return new XString(""); + } + return new XString(n.namespaceURI); }; Functions.name = function() { - var c = arguments[0]; - var n; - if (arguments.length == 1) { - n = c.contextNode; - } else if (arguments.length == 2) { - n = arguments[1].evaluate(c).first(); - } else { - throw new Error("Function name expects (node-set?)"); - } - if (n == null) { - return new XString(""); - } - if (n.nodeType == 1 /*Node.ELEMENT_NODE*/ || n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) { - return new XString(n.nodeName); - } else if (n.localName == null) { - return new XString(""); - } else { - return new XString(n.localName); - } + var c = arguments[0]; + var n; + if (arguments.length == 1) { + n = c.contextNode; + } else if (arguments.length == 2) { + n = arguments[1].evaluate(c).first(); + } else { + throw new Error("Function name expects (node-set?)"); + } + if (n == null) { + return new XString(""); + } + if (n.nodeType == 1 /*Node.ELEMENT_NODE*/ || n.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) { + return new XString(n.nodeName); + } else if (n.localName == null) { + return new XString(""); + } else { + return new XString(n.localName); + } }; Functions.string = function() { - var c = arguments[0]; - if (arguments.length == 1) { - return XNodeSet.prototype.stringForNode(c.contextNode); - } else if (arguments.length == 2) { - return arguments[1].evaluate(c).string(); - } - throw new Error("Function string expects (object?)"); + var c = arguments[0]; + if (arguments.length == 1) { + return XNodeSet.prototype.stringForNode(c.contextNode); + } else if (arguments.length == 2) { + return arguments[1].evaluate(c).string(); + } + throw new Error("Function string expects (object?)"); }; Functions.concat = function() { - var c = arguments[0]; - if (arguments.length < 3) { - throw new Error("Function concat expects (string, string, string*)"); - } - var s = ""; - for (var i = 1; i < arguments.length; i++) { - s += arguments[i].evaluate(c).stringValue(); - } - return new XString(s); + var c = arguments[0]; + if (arguments.length < 3) { + throw new Error("Function concat expects (string, string, string*)"); + } + var s = ""; + for (var i = 1; i < arguments.length; i++) { + s += arguments[i].evaluate(c).stringValue(); + } + return new XString(s); }; Functions.startsWith = function() { - var c = arguments[0]; - if (arguments.length != 3) { - throw new Error("Function startsWith expects (string, string)"); - } - var s1 = arguments[1].evaluate(c).stringValue(); - var s2 = arguments[2].evaluate(c).stringValue(); - return new XBoolean(s1.substring(0, s2.length) == s2); + var c = arguments[0]; + if (arguments.length != 3) { + throw new Error("Function startsWith expects (string, string)"); + } + var s1 = arguments[1].evaluate(c).stringValue(); + var s2 = arguments[2].evaluate(c).stringValue(); + return new XBoolean(s1.substring(0, s2.length) == s2); }; Functions.contains = function() { - var c = arguments[0]; - if (arguments.length != 3) { - throw new Error("Function contains expects (string, string)"); - } - var s1 = arguments[1].evaluate(c).stringValue(); - var s2 = arguments[2].evaluate(c).stringValue(); - return new XBoolean(s1.indexOf(s2) != -1); + var c = arguments[0]; + if (arguments.length != 3) { + throw new Error("Function contains expects (string, string)"); + } + var s1 = arguments[1].evaluate(c).stringValue(); + var s2 = arguments[2].evaluate(c).stringValue(); + return new XBoolean(s1.indexOf(s2) != -1); }; Functions.substringBefore = function() { - var c = arguments[0]; - if (arguments.length != 3) { - throw new Error("Function substring-before expects (string, string)"); - } - var s1 = arguments[1].evaluate(c).stringValue(); - var s2 = arguments[2].evaluate(c).stringValue(); - return new XString(s1.substring(0, s1.indexOf(s2))); + var c = arguments[0]; + if (arguments.length != 3) { + throw new Error("Function substring-before expects (string, string)"); + } + var s1 = arguments[1].evaluate(c).stringValue(); + var s2 = arguments[2].evaluate(c).stringValue(); + return new XString(s1.substring(0, s1.indexOf(s2))); }; Functions.substringAfter = function() { - var c = arguments[0]; - if (arguments.length != 3) { - throw new Error("Function substring-after expects (string, string)"); - } - var s1 = arguments[1].evaluate(c).stringValue(); - var s2 = arguments[2].evaluate(c).stringValue(); - if (s2.length == 0) { - return new XString(s1); - } - var i = s1.indexOf(s2); - if (i == -1) { - return new XString(""); - } - return new XString(s1.substring(s1.indexOf(s2) + 1)); + var c = arguments[0]; + if (arguments.length != 3) { + throw new Error("Function substring-after expects (string, string)"); + } + var s1 = arguments[1].evaluate(c).stringValue(); + var s2 = arguments[2].evaluate(c).stringValue(); + if (s2.length == 0) { + return new XString(s1); + } + var i = s1.indexOf(s2); + if (i == -1) { + return new XString(""); + } + return new XString(s1.substring(s1.indexOf(s2) + 1)); }; Functions.substring = function() { - var c = arguments[0]; - if (!(arguments.length == 3 || arguments.length == 4)) { - throw new Error("Function substring expects (string, number, number?)"); - } - var s = arguments[1].evaluate(c).stringValue(); - var n1 = Math.round(arguments[2].evaluate(c).numberValue()) - 1; - var n2 = arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : undefined; - return new XString(s.substring(n1, n2)); + var c = arguments[0]; + if (!(arguments.length == 3 || arguments.length == 4)) { + throw new Error("Function substring expects (string, number, number?)"); + } + var s = arguments[1].evaluate(c).stringValue(); + var n1 = Math.round(arguments[2].evaluate(c).numberValue()) - 1; + var n2 = arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : undefined; + return new XString(s.substring(n1, n2)); }; Functions.stringLength = function() { - var c = arguments[0]; - var s; - if (arguments.length == 1) { - s = XNodeSet.prototype.stringForNode(c.contextNode); - } else if (arguments.length == 2) { - s = arguments[1].evaluate(c).stringValue(); - } else { - throw new Error("Function string-length expects (string?)"); - } - return new XNumber(s.length); + var c = arguments[0]; + var s; + if (arguments.length == 1) { + s = XNodeSet.prototype.stringForNode(c.contextNode); + } else if (arguments.length == 2) { + s = arguments[1].evaluate(c).stringValue(); + } else { + throw new Error("Function string-length expects (string?)"); + } + return new XNumber(s.length); }; Functions.normalizeSpace = function() { - var c = arguments[0]; - var s; - if (arguments.length == 1) { - s = XNodeSet.prototype.stringForNode(c.contextNode); - } else if (arguments.length == 2) { - s = arguments[1].evaluate(c).stringValue(); - } else { - throw new Error("Function normalize-space expects (string?)"); - } - var i = 0; - var j = s.length - 1; - while (Utilities.isSpace(s.charCodeAt(j))) { - j--; - } - var t = ""; - while (i <= j && Utilities.isSpace(s.charCodeAt(i))) { - i++; - } - while (i <= j) { - if (Utilities.isSpace(s.charCodeAt(i))) { - t += " "; - while (i <= j && Utilities.isSpace(s.charCodeAt(i))) { - i++; - } - } else { - t += s.charAt(i); - i++; - } - } - return new XString(t); + var c = arguments[0]; + var s; + if (arguments.length == 1) { + s = XNodeSet.prototype.stringForNode(c.contextNode); + } else if (arguments.length == 2) { + s = arguments[1].evaluate(c).stringValue(); + } else { + throw new Error("Function normalize-space expects (string?)"); + } + var i = 0; + var j = s.length - 1; + while (Utilities.isSpace(s.charCodeAt(j))) { + j--; + } + var t = ""; + while (i <= j && Utilities.isSpace(s.charCodeAt(i))) { + i++; + } + while (i <= j) { + if (Utilities.isSpace(s.charCodeAt(i))) { + t += " "; + while (i <= j && Utilities.isSpace(s.charCodeAt(i))) { + i++; + } + } else { + t += s.charAt(i); + i++; + } + } + return new XString(t); }; Functions.translate = function() { - var c = arguments[0]; - if (arguments.length != 4) { - throw new Error("Function translate expects (string, string, string)"); - } - var s1 = arguments[1].evaluate(c).stringValue(); - var s2 = arguments[2].evaluate(c).stringValue(); - var s3 = arguments[3].evaluate(c).stringValue(); - var map = []; - for (var i = 0; i < s2.length; i++) { - var j = s2.charCodeAt(i); - if (map[j] == undefined) { - var k = i > s3.length ? "" : s3.charAt(i); - map[j] = k; - } - } - var t = ""; - for (var i = 0; i < s1.length; i++) { - var c = s1.charCodeAt(i); - var r = map[c]; - if (r == undefined) { - t += s1.charAt(i); - } else { - t += r; - } - } - return new XString(t); + var c = arguments[0]; + if (arguments.length != 4) { + throw new Error("Function translate expects (string, string, string)"); + } + var s1 = arguments[1].evaluate(c).stringValue(); + var s2 = arguments[2].evaluate(c).stringValue(); + var s3 = arguments[3].evaluate(c).stringValue(); + var map = []; + for (var i = 0; i < s2.length; i++) { + var j = s2.charCodeAt(i); + if (map[j] == undefined) { + var k = i > s3.length ? "" : s3.charAt(i); + map[j] = k; + } + } + var t = ""; + for (var i = 0; i < s1.length; i++) { + var c = s1.charCodeAt(i); + var r = map[c]; + if (r == undefined) { + t += s1.charAt(i); + } else { + t += r; + } + } + return new XString(t); }; Functions.boolean_ = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function boolean expects (object)"); - } - return arguments[1].evaluate(c).bool(); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function boolean expects (object)"); + } + return arguments[1].evaluate(c).bool(); }; Functions.not = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function not expects (object)"); - } - return arguments[1].evaluate(c).bool().not(); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function not expects (object)"); + } + return arguments[1].evaluate(c).bool().not(); }; Functions.true_ = function() { - if (arguments.length != 1) { - throw new Error("Function true expects ()"); - } - return new XBoolean(true); + if (arguments.length != 1) { + throw new Error("Function true expects ()"); + } + return new XBoolean(true); }; Functions.false_ = function() { - if (arguments.length != 1) { - throw new Error("Function false expects ()"); - } - return new XBoolean(false); + if (arguments.length != 1) { + throw new Error("Function false expects ()"); + } + return new XBoolean(false); }; Functions.lang = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function lang expects (string)"); - } - var lang; - for (var n = c.contextNode; n != null && n.nodeType != 9 /*Node.DOCUMENT_NODE*/; n = n.parentNode) { - var a = n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang"); - if (a != null) { - lang = String(a); - break; - } - } - if (lang == null) { - return new XBoolean(false); - } - var s = arguments[1].evaluate(c).stringValue(); - return new XBoolean(lang.substring(0, s.length) == s - && (lang.length == s.length || lang.charAt(s.length) == '-')); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function lang expects (string)"); + } + var lang; + for (var n = c.contextNode; n != null && n.nodeType != 9 /*Node.DOCUMENT_NODE*/; n = n.parentNode) { + var a = n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang"); + if (a != null) { + lang = String(a); + break; + } + } + if (lang == null) { + return new XBoolean(false); + } + var s = arguments[1].evaluate(c).stringValue(); + return new XBoolean(lang.substring(0, s.length) == s + && (lang.length == s.length || lang.charAt(s.length) == '-')); }; Functions.number = function() { - var c = arguments[0]; - if (!(arguments.length == 1 || arguments.length == 2)) { - throw new Error("Function number expects (object?)"); - } - if (arguments.length == 1) { - return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode)); - } - return arguments[1].evaluate(c).number(); + var c = arguments[0]; + if (!(arguments.length == 1 || arguments.length == 2)) { + throw new Error("Function number expects (object?)"); + } + if (arguments.length == 1) { + return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode)); + } + return arguments[1].evaluate(c).number(); }; Functions.sum = function() { - var c = arguments[0]; - var ns; - if (arguments.length != 2 || !Utilities.instance_of((ns = arguments[1].evaluate(c)), XNodeSet)) { - throw new Error("Function sum expects (node-set)"); - } - ns = ns.toArray(); - var n = 0; - for (var i = 0; i < ns.length; i++) { - n += new XNumber(XNodeSet.prototype.stringForNode(ns[i])).numberValue(); - } - return new XNumber(n); + var c = arguments[0]; + var ns; + if (arguments.length != 2 || !Utilities.instance_of((ns = arguments[1].evaluate(c)), XNodeSet)) { + throw new Error("Function sum expects (node-set)"); + } + ns = ns.toArray(); + var n = 0; + for (var i = 0; i < ns.length; i++) { + n += new XNumber(XNodeSet.prototype.stringForNode(ns[i])).numberValue(); + } + return new XNumber(n); }; Functions.floor = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function floor expects (number)"); - } - return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue())); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function floor expects (number)"); + } + return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue())); }; Functions.ceiling = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function ceiling expects (number)"); - } - return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue())); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function ceiling expects (number)"); + } + return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue())); }; Functions.round = function() { - var c = arguments[0]; - if (arguments.length != 2) { - throw new Error("Function round expects (number)"); - } - return new XNumber(Math.round(arguments[1].evaluate(c).numberValue())); + var c = arguments[0]; + if (arguments.length != 2) { + throw new Error("Function round expects (number)"); + } + return new XNumber(Math.round(arguments[1].evaluate(c).numberValue())); }; // Utilities ///////////////////////////////////////////////////////////////// @@ -3661,433 +3661,433 @@ Functions.round = function() { Utilities = new Object(); Utilities.splitQName = function(qn) { - var i = qn.indexOf(":"); - if (i == -1) { - return [ null, qn ]; - } - return [ qn.substring(0, i), qn.substring(i + 1) ]; + var i = qn.indexOf(":"); + if (i == -1) { + return [ null, qn ]; + } + return [ qn.substring(0, i), qn.substring(i + 1) ]; }; Utilities.resolveQName = function(qn, nr, n, useDefault) { - var parts = Utilities.splitQName(qn); - if (parts[0] != null) { - parts[0] = nr.getNamespace(parts[0], n); - } else { - if (useDefault) { - parts[0] = nr.getNamespace("", n); - if (parts[0] == null) { - parts[0] = ""; - } - } else { - parts[0] = ""; - } - } - return parts; + var parts = Utilities.splitQName(qn); + if (parts[0] != null) { + parts[0] = nr.getNamespace(parts[0], n); + } else { + if (useDefault) { + parts[0] = nr.getNamespace("", n); + if (parts[0] == null) { + parts[0] = ""; + } + } else { + parts[0] = ""; + } + } + return parts; }; Utilities.isSpace = function(c) { - return c == 0x9 || c == 0xd || c == 0xa || c == 0x20; + return c == 0x9 || c == 0xd || c == 0xa || c == 0x20; }; Utilities.isLetter = function(c) { - return c >= 0x0041 && c <= 0x005A || - c >= 0x0061 && c <= 0x007A || - c >= 0x00C0 && c <= 0x00D6 || - c >= 0x00D8 && c <= 0x00F6 || - c >= 0x00F8 && c <= 0x00FF || - c >= 0x0100 && c <= 0x0131 || - c >= 0x0134 && c <= 0x013E || - c >= 0x0141 && c <= 0x0148 || - c >= 0x014A && c <= 0x017E || - c >= 0x0180 && c <= 0x01C3 || - c >= 0x01CD && c <= 0x01F0 || - c >= 0x01F4 && c <= 0x01F5 || - c >= 0x01FA && c <= 0x0217 || - c >= 0x0250 && c <= 0x02A8 || - c >= 0x02BB && c <= 0x02C1 || - c == 0x0386 || - c >= 0x0388 && c <= 0x038A || - c == 0x038C || - c >= 0x038E && c <= 0x03A1 || - c >= 0x03A3 && c <= 0x03CE || - c >= 0x03D0 && c <= 0x03D6 || - c == 0x03DA || - c == 0x03DC || - c == 0x03DE || - c == 0x03E0 || - c >= 0x03E2 && c <= 0x03F3 || - c >= 0x0401 && c <= 0x040C || - c >= 0x040E && c <= 0x044F || - c >= 0x0451 && c <= 0x045C || - c >= 0x045E && c <= 0x0481 || - c >= 0x0490 && c <= 0x04C4 || - c >= 0x04C7 && c <= 0x04C8 || - c >= 0x04CB && c <= 0x04CC || - c >= 0x04D0 && c <= 0x04EB || - c >= 0x04EE && c <= 0x04F5 || - c >= 0x04F8 && c <= 0x04F9 || - c >= 0x0531 && c <= 0x0556 || - c == 0x0559 || - c >= 0x0561 && c <= 0x0586 || - c >= 0x05D0 && c <= 0x05EA || - c >= 0x05F0 && c <= 0x05F2 || - c >= 0x0621 && c <= 0x063A || - c >= 0x0641 && c <= 0x064A || - c >= 0x0671 && c <= 0x06B7 || - c >= 0x06BA && c <= 0x06BE || - c >= 0x06C0 && c <= 0x06CE || - c >= 0x06D0 && c <= 0x06D3 || - c == 0x06D5 || - c >= 0x06E5 && c <= 0x06E6 || - c >= 0x0905 && c <= 0x0939 || - c == 0x093D || - c >= 0x0958 && c <= 0x0961 || - c >= 0x0985 && c <= 0x098C || - c >= 0x098F && c <= 0x0990 || - c >= 0x0993 && c <= 0x09A8 || - c >= 0x09AA && c <= 0x09B0 || - c == 0x09B2 || - c >= 0x09B6 && c <= 0x09B9 || - c >= 0x09DC && c <= 0x09DD || - c >= 0x09DF && c <= 0x09E1 || - c >= 0x09F0 && c <= 0x09F1 || - c >= 0x0A05 && c <= 0x0A0A || - c >= 0x0A0F && c <= 0x0A10 || - c >= 0x0A13 && c <= 0x0A28 || - c >= 0x0A2A && c <= 0x0A30 || - c >= 0x0A32 && c <= 0x0A33 || - c >= 0x0A35 && c <= 0x0A36 || - c >= 0x0A38 && c <= 0x0A39 || - c >= 0x0A59 && c <= 0x0A5C || - c == 0x0A5E || - c >= 0x0A72 && c <= 0x0A74 || - c >= 0x0A85 && c <= 0x0A8B || - c == 0x0A8D || - c >= 0x0A8F && c <= 0x0A91 || - c >= 0x0A93 && c <= 0x0AA8 || - c >= 0x0AAA && c <= 0x0AB0 || - c >= 0x0AB2 && c <= 0x0AB3 || - c >= 0x0AB5 && c <= 0x0AB9 || - c == 0x0ABD || - c == 0x0AE0 || - c >= 0x0B05 && c <= 0x0B0C || - c >= 0x0B0F && c <= 0x0B10 || - c >= 0x0B13 && c <= 0x0B28 || - c >= 0x0B2A && c <= 0x0B30 || - c >= 0x0B32 && c <= 0x0B33 || - c >= 0x0B36 && c <= 0x0B39 || - c == 0x0B3D || - c >= 0x0B5C && c <= 0x0B5D || - c >= 0x0B5F && c <= 0x0B61 || - c >= 0x0B85 && c <= 0x0B8A || - c >= 0x0B8E && c <= 0x0B90 || - c >= 0x0B92 && c <= 0x0B95 || - c >= 0x0B99 && c <= 0x0B9A || - c == 0x0B9C || - c >= 0x0B9E && c <= 0x0B9F || - c >= 0x0BA3 && c <= 0x0BA4 || - c >= 0x0BA8 && c <= 0x0BAA || - c >= 0x0BAE && c <= 0x0BB5 || - c >= 0x0BB7 && c <= 0x0BB9 || - c >= 0x0C05 && c <= 0x0C0C || - c >= 0x0C0E && c <= 0x0C10 || - c >= 0x0C12 && c <= 0x0C28 || - c >= 0x0C2A && c <= 0x0C33 || - c >= 0x0C35 && c <= 0x0C39 || - c >= 0x0C60 && c <= 0x0C61 || - c >= 0x0C85 && c <= 0x0C8C || - c >= 0x0C8E && c <= 0x0C90 || - c >= 0x0C92 && c <= 0x0CA8 || - c >= 0x0CAA && c <= 0x0CB3 || - c >= 0x0CB5 && c <= 0x0CB9 || - c == 0x0CDE || - c >= 0x0CE0 && c <= 0x0CE1 || - c >= 0x0D05 && c <= 0x0D0C || - c >= 0x0D0E && c <= 0x0D10 || - c >= 0x0D12 && c <= 0x0D28 || - c >= 0x0D2A && c <= 0x0D39 || - c >= 0x0D60 && c <= 0x0D61 || - c >= 0x0E01 && c <= 0x0E2E || - c == 0x0E30 || - c >= 0x0E32 && c <= 0x0E33 || - c >= 0x0E40 && c <= 0x0E45 || - c >= 0x0E81 && c <= 0x0E82 || - c == 0x0E84 || - c >= 0x0E87 && c <= 0x0E88 || - c == 0x0E8A || - c == 0x0E8D || - c >= 0x0E94 && c <= 0x0E97 || - c >= 0x0E99 && c <= 0x0E9F || - c >= 0x0EA1 && c <= 0x0EA3 || - c == 0x0EA5 || - c == 0x0EA7 || - c >= 0x0EAA && c <= 0x0EAB || - c >= 0x0EAD && c <= 0x0EAE || - c == 0x0EB0 || - c >= 0x0EB2 && c <= 0x0EB3 || - c == 0x0EBD || - c >= 0x0EC0 && c <= 0x0EC4 || - c >= 0x0F40 && c <= 0x0F47 || - c >= 0x0F49 && c <= 0x0F69 || - c >= 0x10A0 && c <= 0x10C5 || - c >= 0x10D0 && c <= 0x10F6 || - c == 0x1100 || - c >= 0x1102 && c <= 0x1103 || - c >= 0x1105 && c <= 0x1107 || - c == 0x1109 || - c >= 0x110B && c <= 0x110C || - c >= 0x110E && c <= 0x1112 || - c == 0x113C || - c == 0x113E || - c == 0x1140 || - c == 0x114C || - c == 0x114E || - c == 0x1150 || - c >= 0x1154 && c <= 0x1155 || - c == 0x1159 || - c >= 0x115F && c <= 0x1161 || - c == 0x1163 || - c == 0x1165 || - c == 0x1167 || - c == 0x1169 || - c >= 0x116D && c <= 0x116E || - c >= 0x1172 && c <= 0x1173 || - c == 0x1175 || - c == 0x119E || - c == 0x11A8 || - c == 0x11AB || - c >= 0x11AE && c <= 0x11AF || - c >= 0x11B7 && c <= 0x11B8 || - c == 0x11BA || - c >= 0x11BC && c <= 0x11C2 || - c == 0x11EB || - c == 0x11F0 || - c == 0x11F9 || - c >= 0x1E00 && c <= 0x1E9B || - c >= 0x1EA0 && c <= 0x1EF9 || - c >= 0x1F00 && c <= 0x1F15 || - c >= 0x1F18 && c <= 0x1F1D || - c >= 0x1F20 && c <= 0x1F45 || - c >= 0x1F48 && c <= 0x1F4D || - c >= 0x1F50 && c <= 0x1F57 || - c == 0x1F59 || - c == 0x1F5B || - c == 0x1F5D || - c >= 0x1F5F && c <= 0x1F7D || - c >= 0x1F80 && c <= 0x1FB4 || - c >= 0x1FB6 && c <= 0x1FBC || - c == 0x1FBE || - c >= 0x1FC2 && c <= 0x1FC4 || - c >= 0x1FC6 && c <= 0x1FCC || - c >= 0x1FD0 && c <= 0x1FD3 || - c >= 0x1FD6 && c <= 0x1FDB || - c >= 0x1FE0 && c <= 0x1FEC || - c >= 0x1FF2 && c <= 0x1FF4 || - c >= 0x1FF6 && c <= 0x1FFC || - c == 0x2126 || - c >= 0x212A && c <= 0x212B || - c == 0x212E || - c >= 0x2180 && c <= 0x2182 || - c >= 0x3041 && c <= 0x3094 || - c >= 0x30A1 && c <= 0x30FA || - c >= 0x3105 && c <= 0x312C || - c >= 0xAC00 && c <= 0xD7A3 || - c >= 0x4E00 && c <= 0x9FA5 || - c == 0x3007 || - c >= 0x3021 && c <= 0x3029; + return c >= 0x0041 && c <= 0x005A || + c >= 0x0061 && c <= 0x007A || + c >= 0x00C0 && c <= 0x00D6 || + c >= 0x00D8 && c <= 0x00F6 || + c >= 0x00F8 && c <= 0x00FF || + c >= 0x0100 && c <= 0x0131 || + c >= 0x0134 && c <= 0x013E || + c >= 0x0141 && c <= 0x0148 || + c >= 0x014A && c <= 0x017E || + c >= 0x0180 && c <= 0x01C3 || + c >= 0x01CD && c <= 0x01F0 || + c >= 0x01F4 && c <= 0x01F5 || + c >= 0x01FA && c <= 0x0217 || + c >= 0x0250 && c <= 0x02A8 || + c >= 0x02BB && c <= 0x02C1 || + c == 0x0386 || + c >= 0x0388 && c <= 0x038A || + c == 0x038C || + c >= 0x038E && c <= 0x03A1 || + c >= 0x03A3 && c <= 0x03CE || + c >= 0x03D0 && c <= 0x03D6 || + c == 0x03DA || + c == 0x03DC || + c == 0x03DE || + c == 0x03E0 || + c >= 0x03E2 && c <= 0x03F3 || + c >= 0x0401 && c <= 0x040C || + c >= 0x040E && c <= 0x044F || + c >= 0x0451 && c <= 0x045C || + c >= 0x045E && c <= 0x0481 || + c >= 0x0490 && c <= 0x04C4 || + c >= 0x04C7 && c <= 0x04C8 || + c >= 0x04CB && c <= 0x04CC || + c >= 0x04D0 && c <= 0x04EB || + c >= 0x04EE && c <= 0x04F5 || + c >= 0x04F8 && c <= 0x04F9 || + c >= 0x0531 && c <= 0x0556 || + c == 0x0559 || + c >= 0x0561 && c <= 0x0586 || + c >= 0x05D0 && c <= 0x05EA || + c >= 0x05F0 && c <= 0x05F2 || + c >= 0x0621 && c <= 0x063A || + c >= 0x0641 && c <= 0x064A || + c >= 0x0671 && c <= 0x06B7 || + c >= 0x06BA && c <= 0x06BE || + c >= 0x06C0 && c <= 0x06CE || + c >= 0x06D0 && c <= 0x06D3 || + c == 0x06D5 || + c >= 0x06E5 && c <= 0x06E6 || + c >= 0x0905 && c <= 0x0939 || + c == 0x093D || + c >= 0x0958 && c <= 0x0961 || + c >= 0x0985 && c <= 0x098C || + c >= 0x098F && c <= 0x0990 || + c >= 0x0993 && c <= 0x09A8 || + c >= 0x09AA && c <= 0x09B0 || + c == 0x09B2 || + c >= 0x09B6 && c <= 0x09B9 || + c >= 0x09DC && c <= 0x09DD || + c >= 0x09DF && c <= 0x09E1 || + c >= 0x09F0 && c <= 0x09F1 || + c >= 0x0A05 && c <= 0x0A0A || + c >= 0x0A0F && c <= 0x0A10 || + c >= 0x0A13 && c <= 0x0A28 || + c >= 0x0A2A && c <= 0x0A30 || + c >= 0x0A32 && c <= 0x0A33 || + c >= 0x0A35 && c <= 0x0A36 || + c >= 0x0A38 && c <= 0x0A39 || + c >= 0x0A59 && c <= 0x0A5C || + c == 0x0A5E || + c >= 0x0A72 && c <= 0x0A74 || + c >= 0x0A85 && c <= 0x0A8B || + c == 0x0A8D || + c >= 0x0A8F && c <= 0x0A91 || + c >= 0x0A93 && c <= 0x0AA8 || + c >= 0x0AAA && c <= 0x0AB0 || + c >= 0x0AB2 && c <= 0x0AB3 || + c >= 0x0AB5 && c <= 0x0AB9 || + c == 0x0ABD || + c == 0x0AE0 || + c >= 0x0B05 && c <= 0x0B0C || + c >= 0x0B0F && c <= 0x0B10 || + c >= 0x0B13 && c <= 0x0B28 || + c >= 0x0B2A && c <= 0x0B30 || + c >= 0x0B32 && c <= 0x0B33 || + c >= 0x0B36 && c <= 0x0B39 || + c == 0x0B3D || + c >= 0x0B5C && c <= 0x0B5D || + c >= 0x0B5F && c <= 0x0B61 || + c >= 0x0B85 && c <= 0x0B8A || + c >= 0x0B8E && c <= 0x0B90 || + c >= 0x0B92 && c <= 0x0B95 || + c >= 0x0B99 && c <= 0x0B9A || + c == 0x0B9C || + c >= 0x0B9E && c <= 0x0B9F || + c >= 0x0BA3 && c <= 0x0BA4 || + c >= 0x0BA8 && c <= 0x0BAA || + c >= 0x0BAE && c <= 0x0BB5 || + c >= 0x0BB7 && c <= 0x0BB9 || + c >= 0x0C05 && c <= 0x0C0C || + c >= 0x0C0E && c <= 0x0C10 || + c >= 0x0C12 && c <= 0x0C28 || + c >= 0x0C2A && c <= 0x0C33 || + c >= 0x0C35 && c <= 0x0C39 || + c >= 0x0C60 && c <= 0x0C61 || + c >= 0x0C85 && c <= 0x0C8C || + c >= 0x0C8E && c <= 0x0C90 || + c >= 0x0C92 && c <= 0x0CA8 || + c >= 0x0CAA && c <= 0x0CB3 || + c >= 0x0CB5 && c <= 0x0CB9 || + c == 0x0CDE || + c >= 0x0CE0 && c <= 0x0CE1 || + c >= 0x0D05 && c <= 0x0D0C || + c >= 0x0D0E && c <= 0x0D10 || + c >= 0x0D12 && c <= 0x0D28 || + c >= 0x0D2A && c <= 0x0D39 || + c >= 0x0D60 && c <= 0x0D61 || + c >= 0x0E01 && c <= 0x0E2E || + c == 0x0E30 || + c >= 0x0E32 && c <= 0x0E33 || + c >= 0x0E40 && c <= 0x0E45 || + c >= 0x0E81 && c <= 0x0E82 || + c == 0x0E84 || + c >= 0x0E87 && c <= 0x0E88 || + c == 0x0E8A || + c == 0x0E8D || + c >= 0x0E94 && c <= 0x0E97 || + c >= 0x0E99 && c <= 0x0E9F || + c >= 0x0EA1 && c <= 0x0EA3 || + c == 0x0EA5 || + c == 0x0EA7 || + c >= 0x0EAA && c <= 0x0EAB || + c >= 0x0EAD && c <= 0x0EAE || + c == 0x0EB0 || + c >= 0x0EB2 && c <= 0x0EB3 || + c == 0x0EBD || + c >= 0x0EC0 && c <= 0x0EC4 || + c >= 0x0F40 && c <= 0x0F47 || + c >= 0x0F49 && c <= 0x0F69 || + c >= 0x10A0 && c <= 0x10C5 || + c >= 0x10D0 && c <= 0x10F6 || + c == 0x1100 || + c >= 0x1102 && c <= 0x1103 || + c >= 0x1105 && c <= 0x1107 || + c == 0x1109 || + c >= 0x110B && c <= 0x110C || + c >= 0x110E && c <= 0x1112 || + c == 0x113C || + c == 0x113E || + c == 0x1140 || + c == 0x114C || + c == 0x114E || + c == 0x1150 || + c >= 0x1154 && c <= 0x1155 || + c == 0x1159 || + c >= 0x115F && c <= 0x1161 || + c == 0x1163 || + c == 0x1165 || + c == 0x1167 || + c == 0x1169 || + c >= 0x116D && c <= 0x116E || + c >= 0x1172 && c <= 0x1173 || + c == 0x1175 || + c == 0x119E || + c == 0x11A8 || + c == 0x11AB || + c >= 0x11AE && c <= 0x11AF || + c >= 0x11B7 && c <= 0x11B8 || + c == 0x11BA || + c >= 0x11BC && c <= 0x11C2 || + c == 0x11EB || + c == 0x11F0 || + c == 0x11F9 || + c >= 0x1E00 && c <= 0x1E9B || + c >= 0x1EA0 && c <= 0x1EF9 || + c >= 0x1F00 && c <= 0x1F15 || + c >= 0x1F18 && c <= 0x1F1D || + c >= 0x1F20 && c <= 0x1F45 || + c >= 0x1F48 && c <= 0x1F4D || + c >= 0x1F50 && c <= 0x1F57 || + c == 0x1F59 || + c == 0x1F5B || + c == 0x1F5D || + c >= 0x1F5F && c <= 0x1F7D || + c >= 0x1F80 && c <= 0x1FB4 || + c >= 0x1FB6 && c <= 0x1FBC || + c == 0x1FBE || + c >= 0x1FC2 && c <= 0x1FC4 || + c >= 0x1FC6 && c <= 0x1FCC || + c >= 0x1FD0 && c <= 0x1FD3 || + c >= 0x1FD6 && c <= 0x1FDB || + c >= 0x1FE0 && c <= 0x1FEC || + c >= 0x1FF2 && c <= 0x1FF4 || + c >= 0x1FF6 && c <= 0x1FFC || + c == 0x2126 || + c >= 0x212A && c <= 0x212B || + c == 0x212E || + c >= 0x2180 && c <= 0x2182 || + c >= 0x3041 && c <= 0x3094 || + c >= 0x30A1 && c <= 0x30FA || + c >= 0x3105 && c <= 0x312C || + c >= 0xAC00 && c <= 0xD7A3 || + c >= 0x4E00 && c <= 0x9FA5 || + c == 0x3007 || + c >= 0x3021 && c <= 0x3029; }; Utilities.isNCNameChar = function(c) { - return c >= 0x0030 && c <= 0x0039 - || c >= 0x0660 && c <= 0x0669 - || c >= 0x06F0 && c <= 0x06F9 - || c >= 0x0966 && c <= 0x096F - || c >= 0x09E6 && c <= 0x09EF - || c >= 0x0A66 && c <= 0x0A6F - || c >= 0x0AE6 && c <= 0x0AEF - || c >= 0x0B66 && c <= 0x0B6F - || c >= 0x0BE7 && c <= 0x0BEF - || c >= 0x0C66 && c <= 0x0C6F - || c >= 0x0CE6 && c <= 0x0CEF - || c >= 0x0D66 && c <= 0x0D6F - || c >= 0x0E50 && c <= 0x0E59 - || c >= 0x0ED0 && c <= 0x0ED9 - || c >= 0x0F20 && c <= 0x0F29 - || c == 0x002E - || c == 0x002D - || c == 0x005F - || Utilities.isLetter(c) - || c >= 0x0300 && c <= 0x0345 - || c >= 0x0360 && c <= 0x0361 - || c >= 0x0483 && c <= 0x0486 - || c >= 0x0591 && c <= 0x05A1 - || c >= 0x05A3 && c <= 0x05B9 - || c >= 0x05BB && c <= 0x05BD - || c == 0x05BF - || c >= 0x05C1 && c <= 0x05C2 - || c == 0x05C4 - || c >= 0x064B && c <= 0x0652 - || c == 0x0670 - || c >= 0x06D6 && c <= 0x06DC - || c >= 0x06DD && c <= 0x06DF - || c >= 0x06E0 && c <= 0x06E4 - || c >= 0x06E7 && c <= 0x06E8 - || c >= 0x06EA && c <= 0x06ED - || c >= 0x0901 && c <= 0x0903 - || c == 0x093C - || c >= 0x093E && c <= 0x094C - || c == 0x094D - || c >= 0x0951 && c <= 0x0954 - || c >= 0x0962 && c <= 0x0963 - || c >= 0x0981 && c <= 0x0983 - || c == 0x09BC - || c == 0x09BE - || c == 0x09BF - || c >= 0x09C0 && c <= 0x09C4 - || c >= 0x09C7 && c <= 0x09C8 - || c >= 0x09CB && c <= 0x09CD - || c == 0x09D7 - || c >= 0x09E2 && c <= 0x09E3 - || c == 0x0A02 - || c == 0x0A3C - || c == 0x0A3E - || c == 0x0A3F - || c >= 0x0A40 && c <= 0x0A42 - || c >= 0x0A47 && c <= 0x0A48 - || c >= 0x0A4B && c <= 0x0A4D - || c >= 0x0A70 && c <= 0x0A71 - || c >= 0x0A81 && c <= 0x0A83 - || c == 0x0ABC - || c >= 0x0ABE && c <= 0x0AC5 - || c >= 0x0AC7 && c <= 0x0AC9 - || c >= 0x0ACB && c <= 0x0ACD - || c >= 0x0B01 && c <= 0x0B03 - || c == 0x0B3C - || c >= 0x0B3E && c <= 0x0B43 - || c >= 0x0B47 && c <= 0x0B48 - || c >= 0x0B4B && c <= 0x0B4D - || c >= 0x0B56 && c <= 0x0B57 - || c >= 0x0B82 && c <= 0x0B83 - || c >= 0x0BBE && c <= 0x0BC2 - || c >= 0x0BC6 && c <= 0x0BC8 - || c >= 0x0BCA && c <= 0x0BCD - || c == 0x0BD7 - || c >= 0x0C01 && c <= 0x0C03 - || c >= 0x0C3E && c <= 0x0C44 - || c >= 0x0C46 && c <= 0x0C48 - || c >= 0x0C4A && c <= 0x0C4D - || c >= 0x0C55 && c <= 0x0C56 - || c >= 0x0C82 && c <= 0x0C83 - || c >= 0x0CBE && c <= 0x0CC4 - || c >= 0x0CC6 && c <= 0x0CC8 - || c >= 0x0CCA && c <= 0x0CCD - || c >= 0x0CD5 && c <= 0x0CD6 - || c >= 0x0D02 && c <= 0x0D03 - || c >= 0x0D3E && c <= 0x0D43 - || c >= 0x0D46 && c <= 0x0D48 - || c >= 0x0D4A && c <= 0x0D4D - || c == 0x0D57 - || c == 0x0E31 - || c >= 0x0E34 && c <= 0x0E3A - || c >= 0x0E47 && c <= 0x0E4E - || c == 0x0EB1 - || c >= 0x0EB4 && c <= 0x0EB9 - || c >= 0x0EBB && c <= 0x0EBC - || c >= 0x0EC8 && c <= 0x0ECD - || c >= 0x0F18 && c <= 0x0F19 - || c == 0x0F35 - || c == 0x0F37 - || c == 0x0F39 - || c == 0x0F3E - || c == 0x0F3F - || c >= 0x0F71 && c <= 0x0F84 - || c >= 0x0F86 && c <= 0x0F8B - || c >= 0x0F90 && c <= 0x0F95 - || c == 0x0F97 - || c >= 0x0F99 && c <= 0x0FAD - || c >= 0x0FB1 && c <= 0x0FB7 - || c == 0x0FB9 - || c >= 0x20D0 && c <= 0x20DC - || c == 0x20E1 - || c >= 0x302A && c <= 0x302F - || c == 0x3099 - || c == 0x309A - || c == 0x00B7 - || c == 0x02D0 - || c == 0x02D1 - || c == 0x0387 - || c == 0x0640 - || c == 0x0E46 - || c == 0x0EC6 - || c == 0x3005 - || c >= 0x3031 && c <= 0x3035 - || c >= 0x309D && c <= 0x309E - || c >= 0x30FC && c <= 0x30FE; + return c >= 0x0030 && c <= 0x0039 + || c >= 0x0660 && c <= 0x0669 + || c >= 0x06F0 && c <= 0x06F9 + || c >= 0x0966 && c <= 0x096F + || c >= 0x09E6 && c <= 0x09EF + || c >= 0x0A66 && c <= 0x0A6F + || c >= 0x0AE6 && c <= 0x0AEF + || c >= 0x0B66 && c <= 0x0B6F + || c >= 0x0BE7 && c <= 0x0BEF + || c >= 0x0C66 && c <= 0x0C6F + || c >= 0x0CE6 && c <= 0x0CEF + || c >= 0x0D66 && c <= 0x0D6F + || c >= 0x0E50 && c <= 0x0E59 + || c >= 0x0ED0 && c <= 0x0ED9 + || c >= 0x0F20 && c <= 0x0F29 + || c == 0x002E + || c == 0x002D + || c == 0x005F + || Utilities.isLetter(c) + || c >= 0x0300 && c <= 0x0345 + || c >= 0x0360 && c <= 0x0361 + || c >= 0x0483 && c <= 0x0486 + || c >= 0x0591 && c <= 0x05A1 + || c >= 0x05A3 && c <= 0x05B9 + || c >= 0x05BB && c <= 0x05BD + || c == 0x05BF + || c >= 0x05C1 && c <= 0x05C2 + || c == 0x05C4 + || c >= 0x064B && c <= 0x0652 + || c == 0x0670 + || c >= 0x06D6 && c <= 0x06DC + || c >= 0x06DD && c <= 0x06DF + || c >= 0x06E0 && c <= 0x06E4 + || c >= 0x06E7 && c <= 0x06E8 + || c >= 0x06EA && c <= 0x06ED + || c >= 0x0901 && c <= 0x0903 + || c == 0x093C + || c >= 0x093E && c <= 0x094C + || c == 0x094D + || c >= 0x0951 && c <= 0x0954 + || c >= 0x0962 && c <= 0x0963 + || c >= 0x0981 && c <= 0x0983 + || c == 0x09BC + || c == 0x09BE + || c == 0x09BF + || c >= 0x09C0 && c <= 0x09C4 + || c >= 0x09C7 && c <= 0x09C8 + || c >= 0x09CB && c <= 0x09CD + || c == 0x09D7 + || c >= 0x09E2 && c <= 0x09E3 + || c == 0x0A02 + || c == 0x0A3C + || c == 0x0A3E + || c == 0x0A3F + || c >= 0x0A40 && c <= 0x0A42 + || c >= 0x0A47 && c <= 0x0A48 + || c >= 0x0A4B && c <= 0x0A4D + || c >= 0x0A70 && c <= 0x0A71 + || c >= 0x0A81 && c <= 0x0A83 + || c == 0x0ABC + || c >= 0x0ABE && c <= 0x0AC5 + || c >= 0x0AC7 && c <= 0x0AC9 + || c >= 0x0ACB && c <= 0x0ACD + || c >= 0x0B01 && c <= 0x0B03 + || c == 0x0B3C + || c >= 0x0B3E && c <= 0x0B43 + || c >= 0x0B47 && c <= 0x0B48 + || c >= 0x0B4B && c <= 0x0B4D + || c >= 0x0B56 && c <= 0x0B57 + || c >= 0x0B82 && c <= 0x0B83 + || c >= 0x0BBE && c <= 0x0BC2 + || c >= 0x0BC6 && c <= 0x0BC8 + || c >= 0x0BCA && c <= 0x0BCD + || c == 0x0BD7 + || c >= 0x0C01 && c <= 0x0C03 + || c >= 0x0C3E && c <= 0x0C44 + || c >= 0x0C46 && c <= 0x0C48 + || c >= 0x0C4A && c <= 0x0C4D + || c >= 0x0C55 && c <= 0x0C56 + || c >= 0x0C82 && c <= 0x0C83 + || c >= 0x0CBE && c <= 0x0CC4 + || c >= 0x0CC6 && c <= 0x0CC8 + || c >= 0x0CCA && c <= 0x0CCD + || c >= 0x0CD5 && c <= 0x0CD6 + || c >= 0x0D02 && c <= 0x0D03 + || c >= 0x0D3E && c <= 0x0D43 + || c >= 0x0D46 && c <= 0x0D48 + || c >= 0x0D4A && c <= 0x0D4D + || c == 0x0D57 + || c == 0x0E31 + || c >= 0x0E34 && c <= 0x0E3A + || c >= 0x0E47 && c <= 0x0E4E + || c == 0x0EB1 + || c >= 0x0EB4 && c <= 0x0EB9 + || c >= 0x0EBB && c <= 0x0EBC + || c >= 0x0EC8 && c <= 0x0ECD + || c >= 0x0F18 && c <= 0x0F19 + || c == 0x0F35 + || c == 0x0F37 + || c == 0x0F39 + || c == 0x0F3E + || c == 0x0F3F + || c >= 0x0F71 && c <= 0x0F84 + || c >= 0x0F86 && c <= 0x0F8B + || c >= 0x0F90 && c <= 0x0F95 + || c == 0x0F97 + || c >= 0x0F99 && c <= 0x0FAD + || c >= 0x0FB1 && c <= 0x0FB7 + || c == 0x0FB9 + || c >= 0x20D0 && c <= 0x20DC + || c == 0x20E1 + || c >= 0x302A && c <= 0x302F + || c == 0x3099 + || c == 0x309A + || c == 0x00B7 + || c == 0x02D0 + || c == 0x02D1 + || c == 0x0387 + || c == 0x0640 + || c == 0x0E46 + || c == 0x0EC6 + || c == 0x3005 + || c >= 0x3031 && c <= 0x3035 + || c >= 0x309D && c <= 0x309E + || c >= 0x30FC && c <= 0x30FE; }; Utilities.coalesceText = function(n) { - for (var m = n.firstChild; m != null; m = m.nextSibling) { - if (m.nodeType == 3 /*Node.TEXT_NODE*/ || m.nodeType == 4 /*Node.CDATA_SECTION_NODE*/) { - var s = m.nodeValue; - var first = m; - m = m.nextSibling; - while (m != null && (m.nodeType == 3 /*Node.TEXT_NODE*/ || m.nodeType == 4 /*Node.CDATA_SECTION_NODE*/)) { - s += m.nodeValue; - var del = m; - m = m.nextSibling; - del.parentNode.removeChild(del); - } - if (first.nodeType == 4 /*Node.CDATA_SECTION_NODE*/) { - var p = first.parentNode; - if (first.nextSibling == null) { - p.removeChild(first); - p.appendChild(p.ownerDocument.createTextNode(s)); - } else { - var next = first.nextSibling; - p.removeChild(first); - p.insertBefore(p.ownerDocument.createTextNode(s), next); - } - } else { - first.nodeValue = s; - } - if (m == null) { - break; - } - } else if (m.nodeType == 1 /*Node.ELEMENT_NODE*/) { - Utilities.coalesceText(m); - } - } + for (var m = n.firstChild; m != null; m = m.nextSibling) { + if (m.nodeType == 3 /*Node.TEXT_NODE*/ || m.nodeType == 4 /*Node.CDATA_SECTION_NODE*/) { + var s = m.nodeValue; + var first = m; + m = m.nextSibling; + while (m != null && (m.nodeType == 3 /*Node.TEXT_NODE*/ || m.nodeType == 4 /*Node.CDATA_SECTION_NODE*/)) { + s += m.nodeValue; + var del = m; + m = m.nextSibling; + del.parentNode.removeChild(del); + } + if (first.nodeType == 4 /*Node.CDATA_SECTION_NODE*/) { + var p = first.parentNode; + if (first.nextSibling == null) { + p.removeChild(first); + p.appendChild(p.ownerDocument.createTextNode(s)); + } else { + var next = first.nextSibling; + p.removeChild(first); + p.insertBefore(p.ownerDocument.createTextNode(s), next); + } + } else { + first.nodeValue = s; + } + if (m == null) { + break; + } + } else if (m.nodeType == 1 /*Node.ELEMENT_NODE*/) { + Utilities.coalesceText(m); + } + } }; Utilities.instance_of = function(o, c) { - while (o != null) { - if (o.constructor === c) { - return true; - } - if (o === Object) { - return false; - } - o = o.constructor.superclass; - } - return false; + while (o != null) { + if (o.constructor === c) { + return true; + } + if (o === Object) { + return false; + } + o = o.constructor.superclass; + } + return false; }; Utilities.getElementById = function(n, id) { - // Note that this does not check the DTD to check for actual - // attributes of type ID, so this may be a bit wrong. - if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) { - if (n.getAttribute("id") == id - || n.getAttributeNS(null, "id") == id) { - return n; - } - } - for (var m = n.firstChild; m != null; m = m.nextSibling) { - var res = Utilities.getElementById(m, id); - if (res != null) { - return res; - } - } - return null; + // Note that this does not check the DTD to check for actual + // attributes of type ID, so this may be a bit wrong. + if (n.nodeType == 1 /*Node.ELEMENT_NODE*/) { + if (n.getAttribute("id") == id + || n.getAttributeNS(null, "id") == id) { + return n; + } + } + for (var m = n.firstChild; m != null; m = m.nextSibling) { + var res = Utilities.getElementById(m, id); + if (res != null) { + return res; + } + } + return null; }; // XPathException //////////////////////////////////////////////////////////// @@ -4097,18 +4097,18 @@ XPathException.prototype.constructor = XPathException; XPathException.superclass = Object.prototype; function XPathException(c, e) { - this.code = c; - this.exception = e; + this.code = c; + this.exception = e; } XPathException.prototype.toString = function() { - var msg = this.exception ? ": " + this.exception.toString() : ""; - switch (this.code) { - case XPathException.INVALID_EXPRESSION_ERR: - return "Invalid expression" + msg; - case XPathException.TYPE_ERR: - return "Type error" + msg; - } + var msg = this.exception ? ": " + this.exception.toString() : ""; + switch (this.code) { + case XPathException.INVALID_EXPRESSION_ERR: + return "Invalid expression" + msg; + case XPathException.TYPE_ERR: + return "Type error" + msg; + } }; XPathException.INVALID_EXPRESSION_ERR = 51; @@ -4121,15 +4121,15 @@ XPathExpression.prototype.constructor = XPathExpression; XPathExpression.superclass = Object.prototype; function XPathExpression(e, r, p) { - this.xpath = p.parse(e); - this.context = new XPathContext(); - this.context.namespaceResolver = new XPathNSResolverWrapper(r); + this.xpath = p.parse(e); + this.context = new XPathContext(); + this.context.namespaceResolver = new XPathNSResolverWrapper(r); } XPathExpression.prototype.evaluate = function(n, t, res) { - this.context.expressionContextNode = n; - var result = this.xpath.evaluate(this.context); - return new XPathResult(result, t); + this.context.expressionContextNode = n; + var result = this.xpath.evaluate(this.context); + return new XPathResult(result, t); } // XPathNSResolverWrapper //////////////////////////////////////////////////// @@ -4139,14 +4139,14 @@ XPathNSResolverWrapper.prototype.constructor = XPathNSResolverWrapper; XPathNSResolverWrapper.superclass = Object.prototype; function XPathNSResolverWrapper(r) { - this.xpathNSResolver = r; + this.xpathNSResolver = r; } XPathNSResolverWrapper.prototype.getNamespace = function(prefix, n) { if (this.xpathNSResolver == null) { return null; } - return this.xpathNSResolver.lookupNamespaceURI(prefix); + return this.xpathNSResolver.lookupNamespaceURI(prefix); }; // NodeXPathNSResolver /////////////////////////////////////////////////////// @@ -4156,12 +4156,12 @@ NodeXPathNSResolver.prototype.constructor = NodeXPathNSResolver; NodeXPathNSResolver.superclass = Object.prototype; function NodeXPathNSResolver(n) { - this.node = n; - this.namespaceResolver = new NamespaceResolver(); + this.node = n; + this.namespaceResolver = new NamespaceResolver(); } NodeXPathNSResolver.prototype.lookupNamespaceURI = function(prefix) { - return this.namespaceResolver.getNamespace(prefix, this.node); + return this.namespaceResolver.getNamespace(prefix, this.node); }; // XPathResult /////////////////////////////////////////////////////////////// @@ -4171,70 +4171,70 @@ XPathResult.prototype.constructor = XPathResult; XPathResult.superclass = Object.prototype; function XPathResult(v, t) { - if (t == XPathResult.ANY_TYPE) { - if (v.constructor === XString) { - t = XPathResult.STRING_TYPE; - } else if (v.constructor === XNumber) { - t = XPathResult.NUMBER_TYPE; - } else if (v.constructor === XBoolean) { - t = XPathResult.BOOLEAN_TYPE; - } else if (v.constructor === XNodeSet) { - t = XPathResult.UNORDERED_NODE_ITERATOR_TYPE; - } - } - this.resultType = t; - switch (t) { - case XPathResult.NUMBER_TYPE: - this.numberValue = v.numberValue(); - return; - case XPathResult.STRING_TYPE: - this.stringValue = v.stringValue(); - return; - case XPathResult.BOOLEAN_TYPE: - this.booleanValue = v.booleanValue(); - return; - case XPathResult.ANY_UNORDERED_NODE_TYPE: - case XPathResult.FIRST_UNORDERED_NODE_TYPE: - if (v.constructor === XNodeSet) { - this.singleNodeValue = v.first(); - return; - } - break; - case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: - case XPathResult.ORDERED_NODE_ITERATOR_TYPE: - if (v.constructor === XNodeSet) { - this.invalidIteratorState = false; - this.nodes = v.toArray(); - this.iteratorIndex = 0; - return; - } - break; - case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE: - case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE: - if (v.constructor === XNodeSet) { - this.nodes = v.toArray(); - this.snapshotLength = this.nodes.length; - return; - } - break; - } - throw new XPathException(XPathException.TYPE_ERR); + if (t == XPathResult.ANY_TYPE) { + if (v.constructor === XString) { + t = XPathResult.STRING_TYPE; + } else if (v.constructor === XNumber) { + t = XPathResult.NUMBER_TYPE; + } else if (v.constructor === XBoolean) { + t = XPathResult.BOOLEAN_TYPE; + } else if (v.constructor === XNodeSet) { + t = XPathResult.UNORDERED_NODE_ITERATOR_TYPE; + } + } + this.resultType = t; + switch (t) { + case XPathResult.NUMBER_TYPE: + this.numberValue = v.numberValue(); + return; + case XPathResult.STRING_TYPE: + this.stringValue = v.stringValue(); + return; + case XPathResult.BOOLEAN_TYPE: + this.booleanValue = v.booleanValue(); + return; + case XPathResult.ANY_UNORDERED_NODE_TYPE: + case XPathResult.FIRST_UNORDERED_NODE_TYPE: + if (v.constructor === XNodeSet) { + this.singleNodeValue = v.first(); + return; + } + break; + case XPathResult.UNORDERED_NODE_ITERATOR_TYPE: + case XPathResult.ORDERED_NODE_ITERATOR_TYPE: + if (v.constructor === XNodeSet) { + this.invalidIteratorState = false; + this.nodes = v.toArray(); + this.iteratorIndex = 0; + return; + } + break; + case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE: + case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE: + if (v.constructor === XNodeSet) { + this.nodes = v.toArray(); + this.snapshotLength = this.nodes.length; + return; + } + break; + } + throw new XPathException(XPathException.TYPE_ERR); }; XPathResult.prototype.iterateNext = function() { - if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE - && this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) { - throw new XPathException(XPathException.TYPE_ERR); - } - return this.nodes[this.iteratorIndex++]; + if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE + && this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) { + throw new XPathException(XPathException.TYPE_ERR); + } + return this.nodes[this.iteratorIndex++]; }; XPathResult.prototype.snapshotItem = function(i) { - if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE - && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) { - throw new XPathException(XPathException.TYPE_ERR); - } - return this.nodes[i]; + if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE + && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) { + throw new XPathException(XPathException.TYPE_ERR); + } + return this.nodes[i]; }; XPathResult.ANY_TYPE = 0; @@ -4251,40 +4251,40 @@ XPathResult.FIRST_ORDERED_NODE_TYPE = 9; // DOM 3 XPath support /////////////////////////////////////////////////////// function installDOM3XPathSupport(doc, p) { - doc.createExpression = function(e, r) { - try { - return new XPathExpression(e, r, p); - } catch (e) { - throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e); - } - }; - doc.createNSResolver = function(n) { - return new NodeXPathNSResolver(n); - }; - doc.evaluate = function(e, cn, r, t, res) { - if (!cn) cn = doc; - if (t < 0 || t > 9) { - throw { code: 0, toString: function() { return "Request type not supported"; } }; - } - return doc.createExpression(e, r, p).evaluate(cn, t, res); - }; + doc.createExpression = function(e, r) { + try { + return new XPathExpression(e, r, p); + } catch (e) { + throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e); + } + }; + doc.createNSResolver = function(n) { + return new NodeXPathNSResolver(n); + }; + doc.evaluate = function(e, cn, r, t, res) { + if (!cn) cn = doc; + if (t < 0 || t > 9) { + throw { code: 0, toString: function() { return "Request type not supported"; } }; + } + return doc.createExpression(e, r, p).evaluate(cn, t, res); + }; }; // --------------------------------------------------------------------------- // Install DOM 3 XPath support for the current document. try { - var shouldInstall = true; - try { - if (document.implementation - && document.implementation.hasFeature - && document.implementation.hasFeature("XPath", null)) { - shouldInstall = false; - } - } catch (e) { - } - if (shouldInstall) { - installDOM3XPathSupport(document, new XPathParser()); - } + var shouldInstall = true; + try { + if (document.implementation + && document.implementation.hasFeature + && document.implementation.hasFeature("XPath", null)) { + shouldInstall = false; + } + } catch (e) { + } + if (shouldInstall) { + installDOM3XPathSupport(document, new XPathParser()); + } } catch (e) { } diff --git a/Open-ILS/src/javascript/backend/penalty/patron_penalty.js b/Open-ILS/src/javascript/backend/penalty/patron_penalty.js index 07ed2ee9b1..685e348436 100644 --- a/Open-ILS/src/javascript/backend/penalty/patron_penalty.js +++ b/Open-ILS/src/javascript/backend/penalty/patron_penalty.js @@ -9,16 +9,16 @@ var config = findGroupConfig(patronProfile); if( config ) { - /* check the fine limit */ - if( config.fineThreshold >= 0 && patronFines >= config.fineThreshold ) - result.fatalEvents.push('PATRON_EXCEEDS_FINES'); + /* check the fine limit */ + if( config.fineThreshold >= 0 && patronFines >= config.fineThreshold ) + result.fatalEvents.push('PATRON_EXCEEDS_FINES'); - /* check the overdue limit */ - if( config.overdueThreshold >= 0 && patronOverdueCount >= config.overdueThreshold ) - result.fatalEvents.push('PATRON_EXCEEDS_OVERDUE_COUNT'); + /* check the overdue limit */ + if( config.overdueThreshold >= 0 && patronOverdueCount >= config.overdueThreshold ) + result.fatalEvents.push('PATRON_EXCEEDS_OVERDUE_COUNT'); } else { - log_warn("profile has no configured information: " + patronProfile); + log_warn("profile has no configured information: " + patronProfile); } diff --git a/Open-ILS/src/javascript/backend/test/xmlhttprequest-test.js b/Open-ILS/src/javascript/backend/test/xmlhttprequest-test.js index 6743942f00..9d1fdf699b 100644 --- a/Open-ILS/src/javascript/backend/test/xmlhttprequest-test.js +++ b/Open-ILS/src/javascript/backend/test/xmlhttprequest-test.js @@ -8,8 +8,8 @@ log_stdout("recordID is",params.recordID); // xpath namespace resolver var ns_res = new XPathNamespaceResolver( - { marc : "http://www.loc.gov/MARC21/slim", - mods : "http://www.loc.gov/mods/v3" } + { marc : "http://www.loc.gov/MARC21/slim", + mods : "http://www.loc.gov/mods/v3" } ); // xmlhttprequest uses the perl xml parser to get the xml doc from @@ -26,9 +26,9 @@ var marc = DOMImplementation.parseString(x.responseXML.evaluate('//marc/text()') // and then get the title var res = marc.evaluate( - "/marc:record/marc:datafield[@tag='245']/marc:subfield[@code='a']/text()", - marc, - ns_res + "/marc:record/marc:datafield[@tag='245']/marc:subfield[@code='a']/text()", + marc, + ns_res ); // print the title we just grabbed diff --git a/Open-ILS/web/conify/global/actor/org_unit.html b/Open-ILS/web/conify/global/actor/org_unit.html index b66b7d3f32..47ea18a524 100644 --- a/Open-ILS/web/conify/global/actor/org_unit.html +++ b/Open-ILS/web/conify/global/actor/org_unit.html @@ -13,62 +13,62 @@ # GNU General Public License for more details. --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.org_unit.title; - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- + + + + + + + + + + + + + + + + + +
+ +
+ -
- - +
+ + - - - -
-
- -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +
&conify.org_unit.editor_pane.org_unit_name; - - - - -
&conify.org_unit.editor_pane.org_unit_code; - - - -
&conify.org_unit.editor_pane.main_email; - - - -
&conify.org_unit.editor_pane.main_phone; - - - -
&conify.org_unit.editor_pane.org_unit_type; -
- -
-
&conify.org_unit.editor_pane.parent; -
- + + + +
+ + +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - -
&conify.org_unit.editor_pane.org_unit_name; + + + + +
&conify.org_unit.editor_pane.org_unit_code; + + + +
&conify.org_unit.editor_pane.main_email; + + + +
&conify.org_unit.editor_pane.main_phone; + + + +
&conify.org_unit.editor_pane.org_unit_type; +
+ +
+
&conify.org_unit.editor_pane.parent; +
+ -
-
&conify.org_unit.editor_pane.opac_visible; - -
- -
- - - -
+
&conify.org_unit.editor_pane.opac_visible; + +
+ +
+ + + + - -
- - + +
+ + - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
&conify.org_unit.hoo_pane.open_time;&conify.org_unit.hoo_pane.close_time;
&conify.org_unit.hoo_pane.monday;
&conify.org_unit.hoo_pane.tuesday;
&conify.org_unit.hoo_pane.wednesday;
&conify.org_unit.hoo_pane.thursday;
&conify.org_unit.hoo_pane.friday;
&conify.org_unit.hoo_pane.saturday;
&conify.org_unit.hoo_pane.sunday;
- - + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
&conify.org_unit.hoo_pane.open_time;&conify.org_unit.hoo_pane.close_time;
&conify.org_unit.hoo_pane.monday;
&conify.org_unit.hoo_pane.tuesday;
&conify.org_unit.hoo_pane.wednesday;
&conify.org_unit.hoo_pane.thursday;
&conify.org_unit.hoo_pane.friday;
&conify.org_unit.hoo_pane.saturday;
&conify.org_unit.hoo_pane.sunday;
+ + - -
- -
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - -
&conify.org_unit.addresses_pane.type; - - &conify.org_unit.addresses_pane.valid; - -
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
- - + +
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + +
&conify.org_unit.addresses_pane.type; + + &conify.org_unit.addresses_pane.valid; + +
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
+ + -
- -
- - - - - - - - - - - - - - - - - - - - -
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; - -
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
- - +
+ +
+ + + + + + + + + + + + + + + + + + + + +
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; + +
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
+ + -
- -
- - - - - - - - - - - - - - - - - - - - -
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; - -
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
- - +
+ +
+ + + + + + + + + + + + + + + + + + + + +
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; + +
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
+ + -
- -
- - - - - - - - - - - - - - - - - - - - -
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; - -
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
- - +
+ +
+ + + + + + + + + + + + + + + + + + + + +
&conify.org_unit.addresses_pane.type;&conify.org_unit.addresses_pane.valid; + +
&conify.org_unit.addresses_pane.street1;
&conify.org_unit.addresses_pane.street2;
&conify.org_unit.addresses_pane.city;&conify.org_unit.addresses_pane.state;&conify.org_unit.addresses_pane.zip;
&conify.org_unit.addresses_pane.country;&conify.org_unit.addresses_pane.county;
+ + -
-
-
-
-
-
- -
&conify.org_unit.status_bar;
- + + +
+
+
+
+ + + +
&conify.org_unit.status_bar;
+ diff --git a/Open-ILS/web/conify/global/actor/org_unit_type.html b/Open-ILS/web/conify/global/actor/org_unit_type.html index 0742bb7aaa..7196a412f7 100644 --- a/Open-ILS/web/conify/global/actor/org_unit_type.html +++ b/Open-ILS/web/conify/global/actor/org_unit_type.html @@ -14,64 +14,64 @@ --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.org_unit_type.title; - - - - - - - - - - - - - - + + &conify.org_unit_type.title; + + + + + + + + + + + + + + - + - + - + - + -
+
-
- -
- - +
+ + - - - -
-
- -
- - -
- - - - - - - - - - - - - - + + + + + + + + + +
&conify.org_unit_type.type_name; - - - - -
&conify.org_unit_type.opac_label; - - - - -
&conify.org_unit_type.parent_type; -
- + + + +
+ + +
+ + +
+ + + + + + + + + + + + + + - - - - - - - - - -
&conify.org_unit_type.type_name; + + + + +
&conify.org_unit_type.opac_label; + + + + +
&conify.org_unit_type.parent_type; +
+ -
-
&conify.org_unit_type.can_have_volumes; - -
&conify.org_unit_type.can_have_users; - -
- -
- - - -
+
&conify.org_unit_type.can_have_volumes; + +
&conify.org_unit_type.can_have_users; + +
+ +
+ + + + - -
- - + +
+ + - -
-
-
- + + + +
+ + + diff --git a/Open-ILS/web/conify/global/actor/org_unit_type.js b/Open-ILS/web/conify/global/actor/org_unit_type.js index cf4a97ffb5..be30ad40d6 100644 --- a/Open-ILS/web/conify/global/actor/org_unit_type.js +++ b/Open-ILS/web/conify/global/actor/org_unit_type.js @@ -51,37 +51,37 @@ var highlighter = {}; var aout_strings = dojo.i18n.getLocalization('openils.conify', 'conify'); function status_update (markup) { - if (parent !== window && parent.status_update) parent.status_update( markup ); + if (parent !== window && parent.status_update) parent.status_update( markup ); } function save_type () { - var modified_aout = new aout().fromStoreItem( current_type ); - modified_aout.ischanged( 1 ); + var modified_aout = new aout().fromStoreItem( current_type ); + modified_aout.ischanged( 1 ); - new_kid_button.disabled = false; - save_out_button.disabled = false; - delete_out_button.disabled = false; + new_kid_button.disabled = false; + save_out_button.disabled = false; + delete_out_button.disabled = false; - pCRUD.request({ - method : 'open-ils.permacrud.update.aout', - timeout : 10, - params : [ ses, modified_aout ], - onerror : function (r) { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - ou_type_store.setValue( current_type, 'ischanged', 0 ); - highlighter.editor_pane.green.play(); - status_update( dojo.string.substitute(aout_strings.SUCCESS_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); - } else { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); - } - }, - }).send(); + pCRUD.request({ + method : 'open-ils.permacrud.update.aout', + timeout : 10, + params : [ ses, modified_aout ], + onerror : function (r) { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + ou_type_store.setValue( current_type, 'ischanged', 0 ); + highlighter.editor_pane.green.play(); + status_update( dojo.string.substitute(aout_strings.SUCCESS_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); + } else { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); + } + }, + }).send(); } diff --git a/Open-ILS/web/conify/global/admin.html b/Open-ILS/web/conify/global/admin.html index e5a5bd109b..fd6b31dc21 100644 --- a/Open-ILS/web/conify/global/admin.html +++ b/Open-ILS/web/conify/global/admin.html @@ -14,14 +14,14 @@ --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.admin.title; + + &conify.admin.title; + - + #grid_container { + width: 100%; + height: 100%; + } + - - - - - + + + + + - - - - - + + + + + - + - + - + -
- + -
- &conify.copy_status.new_status.label; -
- -
+ + +
-
-
-
- -
-
+ + + -
- - - - - -
- - - + + + + + + + diff --git a/Open-ILS/web/conify/global/config/copy_status.js b/Open-ILS/web/conify/global/config/copy_status.js index 4b50a96ca9..3d7ec2e79b 100644 --- a/Open-ILS/web/conify/global/config/copy_status.js +++ b/Open-ILS/web/conify/global/config/copy_status.js @@ -46,61 +46,61 @@ var ccs_strings = dojo.i18n.getLocalization('openils.conify', 'conify'); var highlighter = {}; function status_update (markup) { - if (parent !== window && parent.status_update) parent.status_update( markup ); + if (parent !== window && parent.status_update) parent.status_update( markup ); } function save_status () { - var modified_ccs = new ccs().fromStoreItem( current_status ); - modified_ccs.ischanged( 1 ); - - pCRUD.request({ - method : 'open-ils.permacrud.update.ccs', - timeout : 10, - params : [ ses, modified_ccs ], - onerror : function (r) { - highlighter.red.play(); - status_update( dojo.string.substitute(ccs_strings.ERROR_SAVING_STATUS, [status_store.getValue( current_status, 'name' )]) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - status_store.setValue( current_status, 'ischanged', 0 ); - highlighter.green.play(); - status_update( dojo.string.substitute(ccs_strings.SUCCESS_SAVE, [status_store.getValue( current_status, 'name' )]) ); - } else { - highlighter.red.play(); - status_update( dojo.string.substitute(ccs_strings.ERROR_SAVING_STATUS, [status_store.getValue( current_status, 'name' )]) ); - } - }, - }).send(); + var modified_ccs = new ccs().fromStoreItem( current_status ); + modified_ccs.ischanged( 1 ); + + pCRUD.request({ + method : 'open-ils.permacrud.update.ccs', + timeout : 10, + params : [ ses, modified_ccs ], + onerror : function (r) { + highlighter.red.play(); + status_update( dojo.string.substitute(ccs_strings.ERROR_SAVING_STATUS, [status_store.getValue( current_status, 'name' )]) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + status_store.setValue( current_status, 'ischanged', 0 ); + highlighter.green.play(); + status_update( dojo.string.substitute(ccs_strings.SUCCESS_SAVE, [status_store.getValue( current_status, 'name' )]) ); + } else { + highlighter.red.play(); + status_update( dojo.string.substitute(ccs_strings.ERROR_SAVING_STATUS, [status_store.getValue( current_status, 'name' )]) ); + } + }, + }).send(); } function save_them_all (event) { - status_store.fetch({ - query : { ischanged : 1 }, - onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, - scope : status_store - }); + status_store.fetch({ + query : { ischanged : 1 }, + onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, + scope : status_store + }); - var confirmation = true; + var confirmation = true; - if (event && dirtyStore.length > 0) { - confirmation = confirm( - ccs_strings.CONFIRM_EXIT_CCS - ); - } + if (event && dirtyStore.length > 0) { + confirmation = confirm( + ccs_strings.CONFIRM_EXIT_CCS + ); + } - if (confirmation) { - for (var i in window.dirtyStore) { - window.current_status = window.dirtyStore[i]; - save_status(true); - } + if (confirmation) { + for (var i in window.dirtyStore) { + window.current_status = window.dirtyStore[i]; + save_status(true); + } - window.dirtyStore = []; - } + window.dirtyStore = []; + } } dojo.addOnUnload( save_them_all ); diff --git a/Open-ILS/web/conify/global/config/marc_code_maps.html b/Open-ILS/web/conify/global/config/marc_code_maps.html index 7974a4538e..d86089a822 100644 --- a/Open-ILS/web/conify/global/config/marc_code_maps.html +++ b/Open-ILS/web/conify/global/config/marc_code_maps.html @@ -13,62 +13,62 @@ # GNU General Public License for more details. --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.marc_code_maps.title; - - - - - - - - - - - - - + + &conify.marc_code_maps.title; + + + + + + + + + + + + + - + - + - - - - - - -
- -
-
- -
-
&conify.marc_code_maps.audience_map.new.label;
- - - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- -
- -
-
&conify.marc_code_maps.bib_level.new.label;
- - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- -
- -
-
&conify.marc_code_maps.item_form.new.label;
- - - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- - -
- -
-
&conify.marc_code_maps.item_type.new.label;
- - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- - -
- -
-
&conify.marc_code_maps.language.new.label;
- - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- - -
- -
-
&conify.marc_code_maps.literary_form.new.label;
- - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- - -
- -
-
&conify.marc_code_maps.video.new.label;
- - - - - - -
- -
-
-
- -
- -
- -
- -
- -
- - + + + + + + +
+ +
+
+ +
+
&conify.marc_code_maps.audience_map.new.label;
+ + + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
&conify.marc_code_maps.bib_level.new.label;
+ + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
&conify.marc_code_maps.item_form.new.label;
+ + + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
&conify.marc_code_maps.item_type.new.label;
+ + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
&conify.marc_code_maps.language.new.label;
+ + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
&conify.marc_code_maps.literary_form.new.label;
+ + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
&conify.marc_code_maps.video.new.label;
+ + + + + + +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ + diff --git a/Open-ILS/web/conify/global/config/marc_code_maps.js b/Open-ILS/web/conify/global/config/marc_code_maps.js index d8120c4d76..75fa837520 100644 --- a/Open-ILS/web/conify/global/config/marc_code_maps.js +++ b/Open-ILS/web/conify/global/config/marc_code_maps.js @@ -51,8 +51,8 @@ var cam_strings = dojo.i18n.getLocalization('openils.conify', 'conify'); /* var highlighter = { - green : dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } ), - red : dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } ) + green : dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } ), + red : dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } ) }; console.log('highlighters set up'); @@ -61,71 +61,71 @@ console.log('highlighters set up'); var dirtyStore = []; function status_update (markup) { - if (parent !== window && parent.status_update) parent.status_update( markup ); + if (parent !== window && parent.status_update) parent.status_update( markup ); } console.log('local status function built'); function save_code (classname) { - var item = current_item[classname]; - var obj = new fieldmapper[classname]().fromStoreItem( item ); - - obj.ischanged( 1 ); - obj.code( dojo.string.trim( obj.code() ) ); - obj.value( dojo.string.trim( obj.value() ) ); - if(classname == 'cam' || classname == 'clfm') - obj.description( dojo.string.trim( obj.description() ) ); - - pCRUD.request({ - method : 'open-ils.permacrud.update.' + classname, - timeout : 10, - params : [ ses, modified_ppl ], - onerror : function (r) { - //highlighter.red.play(); - status_update( dojo.string.substitute(cam_strings.ERROR_SAVING_DATA_CAM, [classname, obj.code()]) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - stores[classname].setValue( current_item, 'ischanged', 0 ); - //highlighter.green.play(); - status_update( dojo.string.substitute(cam_strings.SUCCESS_SAVE, stores[classname].getValue( item, 'code' )) ); - } else { - //highlighter.red.play(); - status_update( dojo.string.substitute( cam_strings.ERROR_SAVING_DATA_CAM, [classname, stores[classname].getValue( item, 'code' )] ) ); - } - }, - }).send(); + var item = current_item[classname]; + var obj = new fieldmapper[classname]().fromStoreItem( item ); + + obj.ischanged( 1 ); + obj.code( dojo.string.trim( obj.code() ) ); + obj.value( dojo.string.trim( obj.value() ) ); + if(classname == 'cam' || classname == 'clfm') + obj.description( dojo.string.trim( obj.description() ) ); + + pCRUD.request({ + method : 'open-ils.permacrud.update.' + classname, + timeout : 10, + params : [ ses, modified_ppl ], + onerror : function (r) { + //highlighter.red.play(); + status_update( dojo.string.substitute(cam_strings.ERROR_SAVING_DATA_CAM, [classname, obj.code()]) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + stores[classname].setValue( current_item, 'ischanged', 0 ); + //highlighter.green.play(); + status_update( dojo.string.substitute(cam_strings.SUCCESS_SAVE, stores[classname].getValue( item, 'code' )) ); + } else { + //highlighter.red.play(); + status_update( dojo.string.substitute( cam_strings.ERROR_SAVING_DATA_CAM, [classname, stores[classname].getValue( item, 'code' )] ) ); + } + }, + }).send(); } function save_them_all (event) { - for (var classname in stores) { + for (var classname in stores) { - var store = stores[classname]; - store.fetch({ - query : { ischanged : 1 }, - onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, - scope : store - }); + var store = stores[classname]; + store.fetch({ + query : { ischanged : 1 }, + onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, + scope : store + }); - var confirmation = true; + var confirmation = true; - if (event && dirtyStore.length > 0) { - confirmation = confirm( cam_strings.CONFIRM_EXIT_CAM ); - event = null; - } + if (event && dirtyStore.length > 0) { + confirmation = confirm( cam_strings.CONFIRM_EXIT_CAM ); + event = null; + } - if (confirmation) { - for (var i in dirtyStore) { - current_item[classname] = dirtyStore[i]; - save_object(classname); - } + if (confirmation) { + for (var i in dirtyStore) { + current_item[classname] = dirtyStore[i]; + save_object(classname); + } - dirtyStore = []; - } - } + dirtyStore = []; + } + } } dojo.addOnUnload( save_them_all ); @@ -187,16 +187,16 @@ function delete_grid_selection(classname, grid ) { function create_marc_code (data) { - var cl = data.classname; - if (!cl) return false; + var cl = data.classname; + if (!cl) return false; - data.code = dojo.string.trim( data.code ); - data.value = dojo.string.trim( data.value ); + data.code = dojo.string.trim( data.code ); + data.value = dojo.string.trim( data.value ); - if(!data.code || !data.value) return false; + if(!data.code || !data.value) return false; - if(cl == 'cam' || cl == 'clfm') - data.description = dojo.string.trim( data.description ); + if(cl == 'cam' || cl == 'clfm') + data.description = dojo.string.trim( data.description ); var new_fm_obj = new fieldmapper[cl]().fromHash( data ) new_fm_obj.isnew(1); @@ -226,6 +226,6 @@ function create_marc_code (data) { } }).send(); - return false; + return false; } diff --git a/Open-ILS/web/conify/global/permission/grp_tree.html b/Open-ILS/web/conify/global/permission/grp_tree.html index a3f01f80a5..41ecae62c7 100644 --- a/Open-ILS/web/conify/global/permission/grp_tree.html +++ b/Open-ILS/web/conify/global/permission/grp_tree.html @@ -13,38 +13,38 @@ # GNU General Public License for more details. --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.grp_tree.group_tree.title; - - - - + + + - - - - - + + + + + - - - - - + + + + + - + - + - + -
+
-
- -
- - +
+ + - - - -
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - + + + + + +
&conify.grp_tree.group_name.label; - - - - -
&conify.grp_tree.description.label; - - - - -
&conify.grp_tree.permission_interval.label; - - - -
&conify.grp_tree.editing_permission.label; -
- + + + +
+ + +
+ + +
+
+ + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - -
&conify.grp_tree.group_name.label; + + + + +
&conify.grp_tree.description.label; + + + + +
&conify.grp_tree.permission_interval.label; + + + +
&conify.grp_tree.editing_permission.label; +
+ -
-
&conify.grp_tree.parent_group.label; -
- +
+
&conify.grp_tree.parent_group.label; +
+ -
-
&conify.grp_tree.user_group.label; - -
- -
- - - -
+
&conify.grp_tree.user_group.label; + +
+ +
+ + + + - -
- - + +
+ + - -
- -
- -
-
-
- -
- + + +
+ +
+ +
+
+
+ +
+ -
-
- -
- -
- &conify.grp_tree.new_mapping.label; -
- - - - - - - - - - - - - -
&conify.grp_tree.permission.label; -
-
&conify.grp_tree.depth.label; -
-
&conify.grp_tree.grantable.label; - -
- -
+
+ +
+ +
+ &conify.grp_tree.new_mapping.label; +
+ + + + + + + + + + + + + +
&conify.grp_tree.permission.label; +
+
&conify.grp_tree.depth.label; +
+
&conify.grp_tree.grantable.label; + +
+ + -
-
+ + + +
+
-
+
- - -
-
-
-
-
-
- + + + +
+
+
+ + + + diff --git a/Open-ILS/web/conify/global/permission/grp_tree.js b/Open-ILS/web/conify/global/permission/grp_tree.js index b56e1df044..d8c9dd84a8 100644 --- a/Open-ILS/web/conify/global/permission/grp_tree.js +++ b/Open-ILS/web/conify/global/permission/grp_tree.js @@ -56,70 +56,70 @@ var virgin_out_id = -1; var highlighter = {}; function status_update (markup) { - if (parent !== window && parent.status_update) parent.status_update( markup ); + if (parent !== window && parent.status_update) parent.status_update( markup ); } function save_group () { - var modified_pgt = new pgt().fromStoreItem( current_group ); - modified_pgt.ischanged( 1 ); - - new_kid_button.disabled = false; - save_group_button.disabled = false; - delete_group_button.disabled = false; - - server.pCRUD.request({ - method : 'open-ils.permacrud.update.pgt', - timeout : 10, - params : [ ses, modified_pgt ], - onerror : function (r) { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute( pgt_strings.ERROR_SAVING_DATA, [group_store.getValue( current_group, 'name' )]) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - group_store.setValue( current_group, 'ischanged', 0 ); - highlighter.editor_pane.green.play(); - status_update( dojo.string.substitute(pgt_strings.SUCCESS_SAVE, [group_store.getValue( current_group, 'name' )]) ); - } else { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_DATA, [group_store.getValue( current_group, 'name' )]) ); - } - }, - }).send(); + var modified_pgt = new pgt().fromStoreItem( current_group ); + modified_pgt.ischanged( 1 ); + + new_kid_button.disabled = false; + save_group_button.disabled = false; + delete_group_button.disabled = false; + + server.pCRUD.request({ + method : 'open-ils.permacrud.update.pgt', + timeout : 10, + params : [ ses, modified_pgt ], + onerror : function (r) { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute( pgt_strings.ERROR_SAVING_DATA, [group_store.getValue( current_group, 'name' )]) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + group_store.setValue( current_group, 'ischanged', 0 ); + highlighter.editor_pane.green.play(); + status_update( dojo.string.substitute(pgt_strings.SUCCESS_SAVE, [group_store.getValue( current_group, 'name' )]) ); + } else { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_DATA, [group_store.getValue( current_group, 'name' )]) ); + } + }, + }).send(); } function save_perm_map (storeItem) { - var modified_pgpm = new pgpm().fromStoreItem( storeItem ); - modified_pgpm.ischanged( 1 ); - - server.pCRUD.request({ - method : 'open-ils.permacrud.update.pgpm', - timeout : 10, - params : [ ses, modified_pgpm ], - onerror : function (r) { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_PERM_DATA, [group_store.getValue( current_group, 'name' )]) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - perm_map_store.setValue( storeItem, 'ischanged', 0 ); - highlighter.editor_pane.green.play(); - status_update( dojo.string.substitute(pgt_strings.SUCCESS_SAVE_PERM, [group_store.getValue( current_group, 'name' )]) ); - } else { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_PERM_DATA, [group_store.getValue( current_group, 'name' )]) ); - } - }, - }).send(); + var modified_pgpm = new pgpm().fromStoreItem( storeItem ); + modified_pgpm.ischanged( 1 ); + + server.pCRUD.request({ + method : 'open-ils.permacrud.update.pgpm', + timeout : 10, + params : [ ses, modified_pgpm ], + onerror : function (r) { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_PERM_DATA, [group_store.getValue( current_group, 'name' )]) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + perm_map_store.setValue( storeItem, 'ischanged', 0 ); + highlighter.editor_pane.green.play(); + status_update( dojo.string.substitute(pgt_strings.SUCCESS_SAVE_PERM, [group_store.getValue( current_group, 'name' )]) ); + } else { + highlighter.editor_pane.red.play(); + status_update( dojo.string.substitute(pgt_strings.ERROR_SAVING_PERM_DATA, [group_store.getValue( current_group, 'name' )]) ); + } + }, + }).send(); } function save_them_all (event) { - var dirtyMaps = []; + var dirtyMaps = []; perm_map_store.fetch({ query : { ischanged : 1 }, diff --git a/Open-ILS/web/conify/global/permission/perm_list.html b/Open-ILS/web/conify/global/permission/perm_list.html index fad15ade02..0148e211bf 100644 --- a/Open-ILS/web/conify/global/permission/perm_list.html +++ b/Open-ILS/web/conify/global/permission/perm_list.html @@ -13,67 +13,67 @@ # GNU General Public License for more details. --> + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + ]> - - &conify.perm_list.permission_list.title; + + &conify.perm_list.permission_list.title; - + - + #grid_container { + width: 100%; + height: 100%; + } + - - - - - + + + + + - - - - + + + + - + - + - + -
- + -
- &conify.perm_list.new_permission.label; -
- -
+ + +
-
-
-
- -
-
+
+
+
+ +
+
-
- - - - - -
- - - + + + + + + + diff --git a/Open-ILS/web/conify/global/permission/perm_list.js b/Open-ILS/web/conify/global/permission/perm_list.js index ad845ca19d..58c9cbd32a 100644 --- a/Open-ILS/web/conify/global/permission/perm_list.js +++ b/Open-ILS/web/conify/global/permission/perm_list.js @@ -46,61 +46,61 @@ var virgin_out_id = -1; var highlighter = {}; function status_update (markup) { - if (parent !== window && parent.status_update) parent.status_update( markup ); + if (parent !== window && parent.status_update) parent.status_update( markup ); } function save_perm () { - var modified_ppl = new ppl().fromStoreItem( current_perm ); - modified_ppl.ischanged( 1 ); - modified_ppl.description( dojo.string.trim( modified_ppl.description() ) ); - modified_ppl.code( dojo.string.trim( modified_ppl.code() ) ); - - pCRUD.request({ - method : 'open-ils.permacrud.update.ppl', - timeout : 10, - params : [ ses, modified_ppl ], - onerror : function (r) { - highlighter.red.play(); - status_update( dojo.string.substitute(ppl_strings.ERROR_SAVING_DATA, [perm_store.getValue(current_perm, 'code')]) ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - perm_store.setValue( current_perm, 'ischanged', 0 ); - highlighter.green.play(); - status_update( dojo.string.substitute(ppl_strings.SUCCESS_SAVE, [perm_store.getValue(current_perm, 'code')]) ); - } else { - highlighter.red.play(); - status_update( dojo.string.substitute(ppl_strings.ERROR_SAVING_DATA, [perm_store.getValue(current_perm, 'code')]) ); - } - }, - }).send(); + var modified_ppl = new ppl().fromStoreItem( current_perm ); + modified_ppl.ischanged( 1 ); + modified_ppl.description( dojo.string.trim( modified_ppl.description() ) ); + modified_ppl.code( dojo.string.trim( modified_ppl.code() ) ); + + pCRUD.request({ + method : 'open-ils.permacrud.update.ppl', + timeout : 10, + params : [ ses, modified_ppl ], + onerror : function (r) { + highlighter.red.play(); + status_update( dojo.string.substitute(ppl_strings.ERROR_SAVING_DATA, [perm_store.getValue(current_perm, 'code')]) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + perm_store.setValue( current_perm, 'ischanged', 0 ); + highlighter.green.play(); + status_update( dojo.string.substitute(ppl_strings.SUCCESS_SAVE, [perm_store.getValue(current_perm, 'code')]) ); + } else { + highlighter.red.play(); + status_update( dojo.string.substitute(ppl_strings.ERROR_SAVING_DATA, [perm_store.getValue(current_perm, 'code')]) ); + } + }, + }).send(); } function save_them_all (event) { - perm_store.fetch({ - query : { ischanged : 1 }, - onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, - scope : perm_store - }); + perm_store.fetch({ + query : { ischanged : 1 }, + onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, + scope : perm_store + }); - var confirmation = true; + var confirmation = true; - if (event && dirtyStore.length > 0) { - confirmation = confirm( ppl_strings.CONFIRM_EXIT_PPL ); - } + if (event && dirtyStore.length > 0) { + confirmation = confirm( ppl_strings.CONFIRM_EXIT_PPL ); + } - if (confirmation) { - for (var i in window.dirtyStore) { - window.current_perm = window.dirtyStore[i]; - save_perm(true); - } + if (confirmation) { + for (var i in window.dirtyStore) { + window.current_perm = window.dirtyStore[i]; + save_perm(true); + } - window.dirtyStore = []; - } + window.dirtyStore = []; + } } dojo.addOnUnload( save_them_all ); diff --git a/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js b/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js index 901d87d084..8f52e0ff97 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js +++ b/Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js @@ -18,82 +18,82 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){ /* generate fieldmapper javascript classes. This expects a global variable - called 'fmclasses' to be fleshed with the classes we need to build */ - - function FMEX(message) { this.message = message; } - FMEX.toString = function() { return "FieldmapperException: " + this.message + "\n"; } - - - dojo._hasResource["fieldmapper.Fieldmapper"] = true; - dojo.provide("fieldmapper.Fieldmapper"); - dojo.require("DojoSRF"); - - dojo.declare( "fieldmapper.Fieldmapper", null, { - - constructor : function (initArray) { - if (initArray) { - if (dojo.isArray(initArray)) { - this.a = initArray; - } else { - this.a = []; - } - } - }, - - _isfieldmapper : true, - - clone : function() { - var obj = new this.constructor(); - - for( var i in this.a ) { - var thing = this.a[i]; - if(thing == null) continue; - - if( thing._isfieldmapper ) { - obj.a[i] = thing.clone(); - } else { - - if(instanceOf(thing, Array)) { - obj.a[i] = new Array(); - - for( var j in thing ) { - - if( thing[j]._isfieldmapper ) - obj.a[i][j] = thing[j].clone(); - else - obj.a[i][j] = thing[j]; - } - } else { - obj.a[i] = thing; - } - } - } - return obj; - }, - - isnew : function(n) { if(arguments.length == 1) this.a[0] =n; return this.a[0]; }, - ischanged : function(n) { if(arguments.length == 1) this.a[1] =n; return this.a[1]; }, - isdeleted : function(n) { if(arguments.length == 1) this.a[2] =n; return this.a[2]; } - }); - - fieldmapper._request = function ( meth, staff, params ) { - var ses = OpenSRF.CachedClientSession( meth[0] ); - if (!ses) return null; - - var result = null; - var args = {}; - - if (dojo.isArray(params)) { - args.params = params; - } else { - - if (dojo.isObject(params)) { - args = params; - } else { + called 'fmclasses' to be fleshed with the classes we need to build */ + + function FMEX(message) { this.message = message; } + FMEX.toString = function() { return "FieldmapperException: " + this.message + "\n"; } + + + dojo._hasResource["fieldmapper.Fieldmapper"] = true; + dojo.provide("fieldmapper.Fieldmapper"); + dojo.require("DojoSRF"); + + dojo.declare( "fieldmapper.Fieldmapper", null, { + + constructor : function (initArray) { + if (initArray) { + if (dojo.isArray(initArray)) { + this.a = initArray; + } else { + this.a = []; + } + } + }, + + _isfieldmapper : true, + + clone : function() { + var obj = new this.constructor(); + + for( var i in this.a ) { + var thing = this.a[i]; + if(thing == null) continue; + + if( thing._isfieldmapper ) { + obj.a[i] = thing.clone(); + } else { + + if(instanceOf(thing, Array)) { + obj.a[i] = new Array(); + + for( var j in thing ) { + + if( thing[j]._isfieldmapper ) + obj.a[i][j] = thing[j].clone(); + else + obj.a[i][j] = thing[j]; + } + } else { + obj.a[i] = thing; + } + } + } + return obj; + }, + + isnew : function(n) { if(arguments.length == 1) this.a[0] =n; return this.a[0]; }, + ischanged : function(n) { if(arguments.length == 1) this.a[1] =n; return this.a[1]; }, + isdeleted : function(n) { if(arguments.length == 1) this.a[2] =n; return this.a[2]; } + }); + + fieldmapper._request = function ( meth, staff, params ) { + var ses = OpenSRF.CachedClientSession( meth[0] ); + if (!ses) return null; + + var result = null; + var args = {}; + + if (dojo.isArray(params)) { + args.params = params; + } else { + + if (dojo.isObject(params)) { + args = params; + } else { args.params = [].splice.call(arguments, 1, arguments.length - 1); - } + } - } + } if (!args.async && !args.timeout) args.timeout = 10; @@ -109,193 +109,193 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){ } } - if (!args.onerror) { - args.onerror = function (r) { - throw new Error('Request error encountered! ' + r); - } - } + if (!args.onerror) { + args.onerror = function (r) { + throw new Error('Request error encountered! ' + r); + } + } - if (!args.oncomplete) { - args.oncomplete = function (r) { - var x = r.recv(); - if (x) result = x.content(); - } - } + if (!args.oncomplete) { + args.oncomplete = function (r) { + var x = r.recv(); + if (x) result = x.content(); + } + } - args.method = meth[1]; - if (staff && meth[2]) args.method += '.staff'; + args.method = meth[1]; + if (staff && meth[2]) args.method += '.staff'; - ses.request(args).send(); + ses.request(args).send(); - return result; - }; + return result; + }; - fieldmapper.standardRequest = function (meth, params) { return fieldmapper._request(meth, false, params) }; - fieldmapper.Fieldmapper.prototype.standardRequest = fieldmapper.standardRequest; + fieldmapper.standardRequest = function (meth, params) { return fieldmapper._request(meth, false, params) }; + fieldmapper.Fieldmapper.prototype.standardRequest = fieldmapper.standardRequest; - fieldmapper.staffRequest = function (meth, params) { return fieldmapper._request(meth, true, params) }; - fieldmapper.Fieldmapper.prototype.staffRequest = fieldmapper.staffRequest; + fieldmapper.staffRequest = function (meth, params) { return fieldmapper._request(meth, true, params) }; + fieldmapper.Fieldmapper.prototype.staffRequest = fieldmapper.staffRequest; // if we were called by the IDL loader ... if ( fieldmapper.IDL && fieldmapper.IDL.loaded ) { - for( var cl in fieldmapper.IDL.fmclasses ) { - dojo.provide( cl ); - dojo.declare( cl , fieldmapper.Fieldmapper, { - constructor : function () { - if (!this.a) this.a = []; - this.classname = this.declaredClass; + for( var cl in fieldmapper.IDL.fmclasses ) { + dojo.provide( cl ); + dojo.declare( cl , fieldmapper.Fieldmapper, { + constructor : function () { + if (!this.a) this.a = []; + this.classname = this.declaredClass; this._fields = []; this.Structure = fieldmapper.IDL.fmclasses[this.classname] for (var f in fieldmapper.IDL.fmclasses[this.classname].fields) { var field = fieldmapper.IDL.fmclasses[this.classname].fields[f]; var p = field.array_position; - this._fields.push( field.name ); - this[field.name]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];'); + this._fields.push( field.name ); + this[field.name]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];'); } - } - }); - fieldmapper[cl] = window[cl]; // alias into place - fieldmapper[cl].Identifier = fieldmapper.IDL.fmclasses[cl].pkey; - } + } + }); + fieldmapper[cl] = window[cl]; // alias into place + fieldmapper[cl].Identifier = fieldmapper.IDL.fmclasses[cl].pkey; + } // ... otherwise we need to get the oldschool fmall.js stuff, which will lack .structure } else { - if (!window.fmclasses) + if (!window.fmclasses) dojo.require("fieldmapper.fmall", true); - for( var cl in fmclasses ) { - dojo.provide( cl ); - dojo.declare( cl , fieldmapper.Fieldmapper, { - constructor : function () { - if (!this.a) this.a = []; - this.classname = this.declaredClass; - this._fields = fmclasses[this.classname]; - for( var pos = 0; pos < this._fields.length; pos++ ) { - var p = parseInt(pos); - var f = this._fields[pos]; - this[f]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];'); - } - } - }); - fieldmapper[cl] = window[cl]; // alias into place - fieldmapper[cl].Identifier = 'id'; // alias into place - } - - fieldmapper.i18n_l.Identifier = 'code'; - fieldmapper.ccpbt.Identifier = 'code'; - fieldmapper.ccnbt.Identifier = 'code'; - fieldmapper.cbrebt.Identifier = 'code'; - fieldmapper.cubt.Identifier = 'code'; - fieldmapper.ccm.Identifier = 'code'; - fieldmapper.cvrfm.Identifier = 'code'; - fieldmapper.clm.Identifier = 'code'; - fieldmapper.cam.Identifier = 'code'; - fieldmapper.cifm.Identifier = 'code'; - fieldmapper.citm.Identifier = 'code'; - fieldmapper.cblvl.Identifier = 'code'; - fieldmapper.clfm.Identifier = 'code'; - fieldmapper.mous.Identifier = 'usr'; - fieldmapper.moucs.Identifier = 'usr'; - fieldmapper.mucs.Identifier = 'usr'; - fieldmapper.mus.Identifier = 'usr'; - fieldmapper.rxbt.Identifier = 'xact'; - fieldmapper.rxpt.Identifier = 'xact'; - fieldmapper.cxt.Identifier = 'name'; - fieldmapper.amtr.Identifier = 'matchpoint'; + for( var cl in fmclasses ) { + dojo.provide( cl ); + dojo.declare( cl , fieldmapper.Fieldmapper, { + constructor : function () { + if (!this.a) this.a = []; + this.classname = this.declaredClass; + this._fields = fmclasses[this.classname]; + for( var pos = 0; pos < this._fields.length; pos++ ) { + var p = parseInt(pos); + var f = this._fields[pos]; + this[f]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];'); + } + } + }); + fieldmapper[cl] = window[cl]; // alias into place + fieldmapper[cl].Identifier = 'id'; // alias into place + } + + fieldmapper.i18n_l.Identifier = 'code'; + fieldmapper.ccpbt.Identifier = 'code'; + fieldmapper.ccnbt.Identifier = 'code'; + fieldmapper.cbrebt.Identifier = 'code'; + fieldmapper.cubt.Identifier = 'code'; + fieldmapper.ccm.Identifier = 'code'; + fieldmapper.cvrfm.Identifier = 'code'; + fieldmapper.clm.Identifier = 'code'; + fieldmapper.cam.Identifier = 'code'; + fieldmapper.cifm.Identifier = 'code'; + fieldmapper.citm.Identifier = 'code'; + fieldmapper.cblvl.Identifier = 'code'; + fieldmapper.clfm.Identifier = 'code'; + fieldmapper.mous.Identifier = 'usr'; + fieldmapper.moucs.Identifier = 'usr'; + fieldmapper.mucs.Identifier = 'usr'; + fieldmapper.mus.Identifier = 'usr'; + fieldmapper.rxbt.Identifier = 'xact'; + fieldmapper.rxpt.Identifier = 'xact'; + fieldmapper.cxt.Identifier = 'name'; + fieldmapper.amtr.Identifier = 'matchpoint'; } - fieldmapper.OpenSRF = {}; - - /* Methods are defined as [ service, method, have_staff ] - An optional 3rd component is when a method is followed by true, such methods - have a staff counterpart and should have ".staff" appended to the method - before the method is called when in XUL mode */ - fieldmapper.OpenSRF.methods = { - SEARCH_MRS : ['open-ils.search','open-ils.search.metabib.multiclass',true], - SEARCH_RS : ['open-ils.search','open-ils.search.biblio.multiclass',true], - SEARCH_MRS_QUERY : ['open-ils.search','open-ils.search.metabib.multiclass.query',true], - SEARCH_RS_QUERY : ['open-ils.search','open-ils.search.biblio.multiclass.query',true], - FETCH_SEARCH_RIDS : ['open-ils.search','open-ils.search.biblio.record.class.search',true], - FETCH_MRMODS : ['open-ils.search','open-ils.search.biblio.metarecord.mods_slim.retrieve'], - FETCH_MODS_FROM_COPY : ['open-ils.search','open-ils.search.biblio.mods_from_copy'], - FETCH_MR_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.metarecord.copy_count',true], - FETCH_RIDS : ['open-ils.search','open-ils.search.biblio.metarecord_to_records',true], - FETCH_RMODS : ['open-ils.search','open-ils.search.biblio.record.mods_slim.retrieve'], - FETCH_R_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.record.copy_count',true], - FETCH_FLESHED_USER : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve'], - FETCH_SESSION : ['open-ils.auth','open-ils.auth.session.retrieve'], - LOGIN_INIT : ['open-ils.auth','open-ils.auth.authenticate.init'], - LOGIN_COMPLETE : ['open-ils.auth','open-ils.auth.authenticate.complete'], - LOGIN_DELETE : ['open-ils.auth','open-ils.auth.session.delete'], - FETCH_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.retrieve'], - UPDATE_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.update'], - FETCH_COPY_STATUSES : ['open-ils.search','open-ils.search.config.copy_status.retrieve.all'], - FETCH_COPY_COUNTS_SUMMARY : ['open-ils.search','open-ils.search.biblio.copy_counts.summary.retrieve'], - FETCH_MARC_HTML : ['open-ils.search','open-ils.search.biblio.record.html'], - FETCH_CHECKED_OUT_SUM : ['open-ils.actor','open-ils.actor.user.checked_out'], - FETCH_HOLDS : ['open-ils.circ','open-ils.circ.holds.retrieve'], - FETCH_FINES_SUMMARY : ['open-ils.actor','open-ils.actor.user.fines.summary'], - FETCH_TRANSACTIONS : ['open-ils.actor','open-ils.actor.user.transactions.have_charge.fleshed'], - FETCH_MONEY_BILLING : ['open-ils.circ','open-ils.circ.money.billing.retrieve.all'], - FETCH_CROSSREF : ['open-ils.search','open-ils.search.authority.crossref'], - FETCH_CROSSREF_BATCH : ['open-ils.search','open-ils.search.authority.crossref.batch'], - CREATE_HOLD : ['open-ils.circ','open-ils.circ.holds.create'], - CREATE_HOLD_OVERRIDE : ['open-ils.circ','open-ils.circ.holds.create.override'], - CANCEL_HOLD : ['open-ils.circ','open-ils.circ.hold.cancel'], - UPDATE_USERNAME : ['open-ils.actor','open-ils.actor.user.username.update'], - UPDATE_PASSWORD : ['open-ils.actor','open-ils.actor.user.password.update'], - UPDATE_EMAIL : ['open-ils.actor','open-ils.actor.user.email.update'], - RENEW_CIRC : ['open-ils.circ','open-ils.circ.renew'], - CHECK_SPELL : ['open-ils.search','open-ils.search.spellcheck'], - FETCH_REVIEWS : ['open-ils.search','open-ils.search.added_content.review.retrieve.all'], - FETCH_TOC : ['open-ils.search','open-ils.search.added_content.toc.retrieve'], - FETCH_ACONT_SUMMARY : ['open-ils.search','open-ils.search.added_content.summary.retrieve'], - FETCH_USER_BYBARCODE : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve_by_barcode'], - FETCH_ADV_MARC_MRIDS : ['open-ils.search','open-ils.search.biblio.marc',true], - FETCH_ADV_ISBN_RIDS : ['open-ils.search','open-ils.search.biblio.isbn'], - FETCH_ADV_ISSN_RIDS : ['open-ils.search','open-ils.search.biblio.issn'], - FETCH_ADV_TCN_RIDS : ['open-ils.search','open-ils.search.biblio.tcn'], - FETCH_CNBROWSE : ['open-ils.search','open-ils.search.callnumber.browse'], - FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'], - FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'], - CREATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.create'], - DELETE_CONTAINER : ['open-ils.actor','open-ils.actor.container.full_delete'], - CREATE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.create'], - DELETE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.delete'], - FLESH_CONTAINER : ['open-ils.actor','open-ils.actor.container.flesh'], - FLESH_PUBLIC_CONTAINER : ['open-ils.actor','open-ils.actor.container.public.flesh'], - UPDATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.update'], - FETCH_COPY : ['open-ils.search','open-ils.search.asset.copy.retrieve'], - FETCH_FLESHED_COPY : ['open-ils.search','open-ils.search.asset.copy.fleshed2.retrieve'], - CHECK_HOLD_POSSIBLE : ['open-ils.circ','open-ils.circ.title_hold.is_possible'], - UPDATE_HOLD : ['open-ils.circ','open-ils.circ.hold.update'], - FETCH_COPIES_FROM_VOLUME : ['open-ils.search','open-ils.search.asset.copy.retrieve_by_cn_label',true], - FETCH_VOLUME_BY_INFO : ['open-ils.search','open-ils.search.call_number.retrieve_by_info'], /* XXX staff method? */ - FETCH_VOLUME : ['open-ils.search','open-ils.search.asset.call_number.retrieve'], - FETCH_COPY_LOCATIONS : ['open-ils.circ','open-ils.circ.copy_location.retrieve.all'], - FETCH_COPY_NOTES : ['open-ils.circ','open-ils.circ.copy_note.retrieve.all'], - FETCH_COPY_STAT_CATS : ['open-ils.circ','open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'], - FETCH_LIT_FORMS : ['open-ils.search','open-ils.search.biblio.lit_form_map.retrieve.all'], - FETCH_ITEM_FORMS : ['open-ils.search','open-ils.search.biblio.item_form_map.retrieve.all'], - FETCH_ITEM_TYPES : ['open-ils.search','open-ils.search.biblio.item_type_map.retrieve.all'], - FETCH_AUDIENCES : ['open-ils.search','open-ils.search.biblio.audience_map.retrieve.all'], - FETCH_HOLD_STATUS : ['open-ils.circ','open-ils.circ.hold.status.retrieve'], - FETCH_NON_CAT_CIRCS : ['open-ils.circ','open-ils.circ.open_non_cataloged_circulation.user'], - FETCH_NON_CAT_CIRC : ['open-ils.circ','open-ils.circ.non_cataloged_circulation.retrieve'], - FETCH_NON_CAT_TYPES : ['open-ils.circ','open-ils.circ.non_cat_types.retrieve.all'], - FETCH_BRE : ['open-ils.search','open-ils.search.biblio.record_entry.slim.retrieve'], - CHECK_USERNAME : ['open-ils.actor','open-ils.actor.username.exists'], - FETCH_CIRC_BY_ID : ['open-ils.circ','open-ils.circ.retrieve'], - FETCH_MR_DESCRIPTORS : ['open-ils.search','open-ils.search.metabib.record_to_descriptors'], - FETCH_HIGHEST_PERM_ORG : ['open-ils.actor','open-ils.actor.user.perm.highest_org.batch'], - FETCH_USER_NOTES : ['open-ils.actor','open-ils.actor.note.retrieve.all'], - FETCH_ORG_BY_SHORTNAME : ['open-ils.actor','open-ils.actor.org_unit.retrieve_by_shorname'], - FETCH_BIB_ID_BY_BARCODE : ['open-ils.search','open-ils.search.bib_id.by_barcode'], - FETCH_ORG_SETTING : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default'], - FETCH_ORG_SETTING_BATCH : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default.batch'] - }; + fieldmapper.OpenSRF = {}; + + /* Methods are defined as [ service, method, have_staff ] + An optional 3rd component is when a method is followed by true, such methods + have a staff counterpart and should have ".staff" appended to the method + before the method is called when in XUL mode */ + fieldmapper.OpenSRF.methods = { + SEARCH_MRS : ['open-ils.search','open-ils.search.metabib.multiclass',true], + SEARCH_RS : ['open-ils.search','open-ils.search.biblio.multiclass',true], + SEARCH_MRS_QUERY : ['open-ils.search','open-ils.search.metabib.multiclass.query',true], + SEARCH_RS_QUERY : ['open-ils.search','open-ils.search.biblio.multiclass.query',true], + FETCH_SEARCH_RIDS : ['open-ils.search','open-ils.search.biblio.record.class.search',true], + FETCH_MRMODS : ['open-ils.search','open-ils.search.biblio.metarecord.mods_slim.retrieve'], + FETCH_MODS_FROM_COPY : ['open-ils.search','open-ils.search.biblio.mods_from_copy'], + FETCH_MR_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.metarecord.copy_count',true], + FETCH_RIDS : ['open-ils.search','open-ils.search.biblio.metarecord_to_records',true], + FETCH_RMODS : ['open-ils.search','open-ils.search.biblio.record.mods_slim.retrieve'], + FETCH_R_COPY_COUNTS : ['open-ils.search','open-ils.search.biblio.record.copy_count',true], + FETCH_FLESHED_USER : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve'], + FETCH_SESSION : ['open-ils.auth','open-ils.auth.session.retrieve'], + LOGIN_INIT : ['open-ils.auth','open-ils.auth.authenticate.init'], + LOGIN_COMPLETE : ['open-ils.auth','open-ils.auth.authenticate.complete'], + LOGIN_DELETE : ['open-ils.auth','open-ils.auth.session.delete'], + FETCH_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.retrieve'], + UPDATE_USER_PREFS : ['open-ils.actor','open-ils.actor.patron.settings.update'], + FETCH_COPY_STATUSES : ['open-ils.search','open-ils.search.config.copy_status.retrieve.all'], + FETCH_COPY_COUNTS_SUMMARY : ['open-ils.search','open-ils.search.biblio.copy_counts.summary.retrieve'], + FETCH_MARC_HTML : ['open-ils.search','open-ils.search.biblio.record.html'], + FETCH_CHECKED_OUT_SUM : ['open-ils.actor','open-ils.actor.user.checked_out'], + FETCH_HOLDS : ['open-ils.circ','open-ils.circ.holds.retrieve'], + FETCH_FINES_SUMMARY : ['open-ils.actor','open-ils.actor.user.fines.summary'], + FETCH_TRANSACTIONS : ['open-ils.actor','open-ils.actor.user.transactions.have_charge.fleshed'], + FETCH_MONEY_BILLING : ['open-ils.circ','open-ils.circ.money.billing.retrieve.all'], + FETCH_CROSSREF : ['open-ils.search','open-ils.search.authority.crossref'], + FETCH_CROSSREF_BATCH : ['open-ils.search','open-ils.search.authority.crossref.batch'], + CREATE_HOLD : ['open-ils.circ','open-ils.circ.holds.create'], + CREATE_HOLD_OVERRIDE : ['open-ils.circ','open-ils.circ.holds.create.override'], + CANCEL_HOLD : ['open-ils.circ','open-ils.circ.hold.cancel'], + UPDATE_USERNAME : ['open-ils.actor','open-ils.actor.user.username.update'], + UPDATE_PASSWORD : ['open-ils.actor','open-ils.actor.user.password.update'], + UPDATE_EMAIL : ['open-ils.actor','open-ils.actor.user.email.update'], + RENEW_CIRC : ['open-ils.circ','open-ils.circ.renew'], + CHECK_SPELL : ['open-ils.search','open-ils.search.spellcheck'], + FETCH_REVIEWS : ['open-ils.search','open-ils.search.added_content.review.retrieve.all'], + FETCH_TOC : ['open-ils.search','open-ils.search.added_content.toc.retrieve'], + FETCH_ACONT_SUMMARY : ['open-ils.search','open-ils.search.added_content.summary.retrieve'], + FETCH_USER_BYBARCODE : ['open-ils.actor','open-ils.actor.user.fleshed.retrieve_by_barcode'], + FETCH_ADV_MARC_MRIDS : ['open-ils.search','open-ils.search.biblio.marc',true], + FETCH_ADV_ISBN_RIDS : ['open-ils.search','open-ils.search.biblio.isbn'], + FETCH_ADV_ISSN_RIDS : ['open-ils.search','open-ils.search.biblio.issn'], + FETCH_ADV_TCN_RIDS : ['open-ils.search','open-ils.search.biblio.tcn'], + FETCH_CNBROWSE : ['open-ils.search','open-ils.search.callnumber.browse'], + FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'], + FETCH_CONTAINERS : ['open-ils.actor','open-ils.actor.container.retrieve_by_class'], + CREATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.create'], + DELETE_CONTAINER : ['open-ils.actor','open-ils.actor.container.full_delete'], + CREATE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.create'], + DELETE_CONTAINER_ITEM : ['open-ils.actor','open-ils.actor.container.item.delete'], + FLESH_CONTAINER : ['open-ils.actor','open-ils.actor.container.flesh'], + FLESH_PUBLIC_CONTAINER : ['open-ils.actor','open-ils.actor.container.public.flesh'], + UPDATE_CONTAINER : ['open-ils.actor','open-ils.actor.container.update'], + FETCH_COPY : ['open-ils.search','open-ils.search.asset.copy.retrieve'], + FETCH_FLESHED_COPY : ['open-ils.search','open-ils.search.asset.copy.fleshed2.retrieve'], + CHECK_HOLD_POSSIBLE : ['open-ils.circ','open-ils.circ.title_hold.is_possible'], + UPDATE_HOLD : ['open-ils.circ','open-ils.circ.hold.update'], + FETCH_COPIES_FROM_VOLUME : ['open-ils.search','open-ils.search.asset.copy.retrieve_by_cn_label',true], + FETCH_VOLUME_BY_INFO : ['open-ils.search','open-ils.search.call_number.retrieve_by_info'], /* XXX staff method? */ + FETCH_VOLUME : ['open-ils.search','open-ils.search.asset.call_number.retrieve'], + FETCH_COPY_LOCATIONS : ['open-ils.circ','open-ils.circ.copy_location.retrieve.all'], + FETCH_COPY_NOTES : ['open-ils.circ','open-ils.circ.copy_note.retrieve.all'], + FETCH_COPY_STAT_CATS : ['open-ils.circ','open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'], + FETCH_LIT_FORMS : ['open-ils.search','open-ils.search.biblio.lit_form_map.retrieve.all'], + FETCH_ITEM_FORMS : ['open-ils.search','open-ils.search.biblio.item_form_map.retrieve.all'], + FETCH_ITEM_TYPES : ['open-ils.search','open-ils.search.biblio.item_type_map.retrieve.all'], + FETCH_AUDIENCES : ['open-ils.search','open-ils.search.biblio.audience_map.retrieve.all'], + FETCH_HOLD_STATUS : ['open-ils.circ','open-ils.circ.hold.status.retrieve'], + FETCH_NON_CAT_CIRCS : ['open-ils.circ','open-ils.circ.open_non_cataloged_circulation.user'], + FETCH_NON_CAT_CIRC : ['open-ils.circ','open-ils.circ.non_cataloged_circulation.retrieve'], + FETCH_NON_CAT_TYPES : ['open-ils.circ','open-ils.circ.non_cat_types.retrieve.all'], + FETCH_BRE : ['open-ils.search','open-ils.search.biblio.record_entry.slim.retrieve'], + CHECK_USERNAME : ['open-ils.actor','open-ils.actor.username.exists'], + FETCH_CIRC_BY_ID : ['open-ils.circ','open-ils.circ.retrieve'], + FETCH_MR_DESCRIPTORS : ['open-ils.search','open-ils.search.metabib.record_to_descriptors'], + FETCH_HIGHEST_PERM_ORG : ['open-ils.actor','open-ils.actor.user.perm.highest_org.batch'], + FETCH_USER_NOTES : ['open-ils.actor','open-ils.actor.note.retrieve.all'], + FETCH_ORG_BY_SHORTNAME : ['open-ils.actor','open-ils.actor.org_unit.retrieve_by_shorname'], + FETCH_BIB_ID_BY_BARCODE : ['open-ils.search','open-ils.search.bib_id.by_barcode'], + FETCH_ORG_SETTING : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default'], + FETCH_ORG_SETTING_BATCH : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default.batch'] + }; } diff --git a/Open-ILS/web/js/dojo/fieldmapper/IDL.js b/Open-ILS/web/js/dojo/fieldmapper/IDL.js index 87af3e3650..6004489911 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/IDL.js +++ b/Open-ILS/web/js/dojo/fieldmapper/IDL.js @@ -115,13 +115,13 @@ if(!dojo._hasResource["fieldmapper.IDL"]) { var obj = { field : field, - name : name, + name : name, label : field.getAttributeNS(this.NS_REPORTS,'label'), datatype : field.getAttributeNS(this.NS_REPORTS,'datatype'), primitive : field.getAttributeNS(this.NS_PERSIST,'primitive'), selector : field.getAttributeNS(this.NS_REPORTS,'selector'), array_position : position++, - type : 'field', + type : 'field', virtual : (fields[i].getAttributeNS(this.NS_PERSIST, 'virtual') == 'true') }; diff --git a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js index 5b81cf30fd..e2fd719618 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js +++ b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js @@ -17,191 +17,191 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){ - dojo._hasResource["fieldmapper.OrgUtils"] = true; - dojo.provide("fieldmapper.OrgUtils"); - dojo.require("fieldmapper.Fieldmapper"); - dojo.require("fieldmapper.hash"); - dojo.require("fieldmapper.OrgTree", true); - dojo.require("fieldmapper.OrgLasso", true); - - fieldmapper.aou.slim_ok = true; - fieldmapper.aou.globalOrgTree = {}; - fieldmapper.aou.OrgCache = {}; - fieldmapper.aou.OrgCacheSN = {}; - fieldmapper.aout.OrgTypeCache = {}; - - fieldmapper.aout.LoadOrgTypes = function () { - for (var i in fieldmapper.aout.OrgTypeCache) { - return; - } - - var types = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_types.retrieve']); - - for (var i in types) { - fieldmapper.aout.OrgTypeCache[types[i].id()] = { - loaded : true, - type : types[i] - }; - } - } - - fieldmapper.aou.LoadOrg = function (id, slim_ok) { - if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok; - var slim_o = fieldmapper.aou.OrgCache[id]; - - if (slim_o && (slim_ok || slim_o.loaded)) - return fieldmapper.aou.OrgCache[id].org; - - var o = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,id]); + dojo._hasResource["fieldmapper.OrgUtils"] = true; + dojo.provide("fieldmapper.OrgUtils"); + dojo.require("fieldmapper.Fieldmapper"); + dojo.require("fieldmapper.hash"); + dojo.require("fieldmapper.OrgTree", true); + dojo.require("fieldmapper.OrgLasso", true); + + fieldmapper.aou.slim_ok = true; + fieldmapper.aou.globalOrgTree = {}; + fieldmapper.aou.OrgCache = {}; + fieldmapper.aou.OrgCacheSN = {}; + fieldmapper.aout.OrgTypeCache = {}; + + fieldmapper.aout.LoadOrgTypes = function () { + for (var i in fieldmapper.aout.OrgTypeCache) { + return; + } + + var types = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_types.retrieve']); + + for (var i in types) { + fieldmapper.aout.OrgTypeCache[types[i].id()] = { + loaded : true, + type : types[i] + }; + } + } + + fieldmapper.aou.LoadOrg = function (id, slim_ok) { + if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok; + var slim_o = fieldmapper.aou.OrgCache[id]; + + if (slim_o && (slim_ok || slim_o.loaded)) + return fieldmapper.aou.OrgCache[id].org; + + var o = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,id]); if(!(o && o.id)) { throw new Error("fieldmapper.aou.LoadOrg(): No org unit found with ID " + id); } - o.children = fieldmapper.aou.OrgCache[o.id()].children; - fieldmapper.aou.OrgCache[o.id()] = { loaded : true, org : o }; - return o; - } - fieldmapper.aou.findOrgUnit = fieldmapper.aou.LoadOrg; - - if (window._l) { - for (var i in _l) { - fieldmapper.aou.OrgCache[_l[i][0]] = { - loaded: false, - org : new fieldmapper.aou().fromHash({ - id : _l[i][0], - ou_type : _l[i][1], - parent_ou : _l[i][2], - name : _l[i][3], - opac_visible : _l[i][4], - shortname : _l[i][5] - }) - }; - - } - - for (var i in fieldmapper.aou.OrgCache) { - var x = fieldmapper.aou.OrgCache[i].org; - if (x.parent_ou() == null || x.parent_ou() == '') { - fieldmapper.aou.globalOrgTree = x; - continue; - } - - var par = fieldmapper.aou.findOrgUnit(x.parent_ou(),true); - if (!par.children()) par.children([]); - par.children().push(x); - fieldmapper.aou.OrgCache[x.id()].treePtr = x; - } - - for (var i in globalOrgTypes) { - fieldmapper.aout.OrgTypeCache[globalOrgTypes[i].id()] = { - loaded : true, - type : globalOrgTypes[i] - }; - } - } + o.children = fieldmapper.aou.OrgCache[o.id()].children; + fieldmapper.aou.OrgCache[o.id()] = { loaded : true, org : o }; + return o; + } + fieldmapper.aou.findOrgUnit = fieldmapper.aou.LoadOrg; + + if (window._l) { + for (var i in _l) { + fieldmapper.aou.OrgCache[_l[i][0]] = { + loaded: false, + org : new fieldmapper.aou().fromHash({ + id : _l[i][0], + ou_type : _l[i][1], + parent_ou : _l[i][2], + name : _l[i][3], + opac_visible : _l[i][4], + shortname : _l[i][5] + }) + }; + + } + + for (var i in fieldmapper.aou.OrgCache) { + var x = fieldmapper.aou.OrgCache[i].org; + if (x.parent_ou() == null || x.parent_ou() == '') { + fieldmapper.aou.globalOrgTree = x; + continue; + } + + var par = fieldmapper.aou.findOrgUnit(x.parent_ou(),true); + if (!par.children()) par.children([]); + par.children().push(x); + fieldmapper.aou.OrgCache[x.id()].treePtr = x; + } + + for (var i in globalOrgTypes) { + fieldmapper.aout.OrgTypeCache[globalOrgTypes[i].id()] = { + loaded : true, + type : globalOrgTypes[i] + }; + } + } /* ---------------------------------------------------------------------- */ - fieldmapper.aou.prototype.fetchOrgSettingDefault = function (name) { - return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [this.id(), name] ); - } - - fieldmapper.aou.prototype.fetchOrgSettingBatch = function (nameList) { - return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [this.id(), nameList] ); - } - - fieldmapper.aou.fetchOrgSettingDefault = function (orgId, name) { - return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [orgId, name] ); - } - - fieldmapper.aou.fetchOrgSettingBatch = function (orgId, nameList) { - return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [orgId, nameList] ); - } - - fieldmapper.aout.findOrgType = function (id) { - fieldmapper.aout.LoadOrgTypes(); - return fieldmapper.aout.OrgTypeCache[id].type; - } - - fieldmapper.aou.prototype.findOrgDepth = function (id) { - if (!id) id = this.id; - if (!id) return null; - - var org = fieldmapper.aou.findOrgUnit(id); - return fieldmapper.aout.findOrgType( - fieldmapper.aou.findOrgUnit(id).ou_type() - ).depth(); - } - fieldmapper.aou.findOrgDepth = fieldmapper.aou.prototype.findOrgDepth; - - fieldmapper.aout.findOrgTypeFromDepth = function (depth) { - if( depth == null ) return null; - fieldmapper.aout.LoadOrgTypes(); - for( var i in fieldmapper.aout.OrgTypeCache ) { - var t = fieldmapper.aout.OrgTypeCache[i].type; - if( t.depth() == depth ) return t; - } - return null; - } - - fieldmapper.aou.findOrgUnitSN = function (sn, slim_ok) { - if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok; - var org = fieldmapper.aou.OrgCacheSN[sn]; - if (!org) { - for (var i in fieldmapper.aou.OrgCache) { - var o = fieldmapper.aou.OrgCache[i]; - if (o.org.shortname() == sn) { - fieldmapper.aou.OrgCacheSN[o.org.shortname()] = o; - org = o; - } - } - - if (!slim_ok && !fieldmapper.aou.OrgCache[org.id()].loaded) { - org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn); - - org.children = fieldmapper.aou.OrgCache[org.id()].children; - fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org }; - fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org }; - } - - } - - return org; - } - - fieldmapper.aou.prototype.orgNodeTrail = function (node) { - if (!node) node = this; - if (!node) return []; - - var na = []; - - while( node ) { - na.push(node); - if (node.parent_ou()) - node = fieldmapper.aou.findOrgUnit(node.parent_ou()); - else - node = null; - } - - return na.reverse(); - } - fieldmapper.aou.orgNodeTrail = fieldmapper.aou.prototype.orgNodeTrail; - - fieldmapper.aou.prototype.orgIsMine = function (me, org) { - if (this._isfieldmapper) { - org = me; - me = this; - } - - if(!me || !org) return false; - - if(me.id() == org.id()) return true; - - for( var i in me.children() ) { - if(me.children()[i].orgIsMine(org)) return true; - } - return false; - } + fieldmapper.aou.prototype.fetchOrgSettingDefault = function (name) { + return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [this.id(), name] ); + } + + fieldmapper.aou.prototype.fetchOrgSettingBatch = function (nameList) { + return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [this.id(), nameList] ); + } + + fieldmapper.aou.fetchOrgSettingDefault = function (orgId, name) { + return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [orgId, name] ); + } + + fieldmapper.aou.fetchOrgSettingBatch = function (orgId, nameList) { + return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [orgId, nameList] ); + } + + fieldmapper.aout.findOrgType = function (id) { + fieldmapper.aout.LoadOrgTypes(); + return fieldmapper.aout.OrgTypeCache[id].type; + } + + fieldmapper.aou.prototype.findOrgDepth = function (id) { + if (!id) id = this.id; + if (!id) return null; + + var org = fieldmapper.aou.findOrgUnit(id); + return fieldmapper.aout.findOrgType( + fieldmapper.aou.findOrgUnit(id).ou_type() + ).depth(); + } + fieldmapper.aou.findOrgDepth = fieldmapper.aou.prototype.findOrgDepth; + + fieldmapper.aout.findOrgTypeFromDepth = function (depth) { + if( depth == null ) return null; + fieldmapper.aout.LoadOrgTypes(); + for( var i in fieldmapper.aout.OrgTypeCache ) { + var t = fieldmapper.aout.OrgTypeCache[i].type; + if( t.depth() == depth ) return t; + } + return null; + } + + fieldmapper.aou.findOrgUnitSN = function (sn, slim_ok) { + if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok; + var org = fieldmapper.aou.OrgCacheSN[sn]; + if (!org) { + for (var i in fieldmapper.aou.OrgCache) { + var o = fieldmapper.aou.OrgCache[i]; + if (o.org.shortname() == sn) { + fieldmapper.aou.OrgCacheSN[o.org.shortname()] = o; + org = o; + } + } + + if (!slim_ok && !fieldmapper.aou.OrgCache[org.id()].loaded) { + org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn); + + org.children = fieldmapper.aou.OrgCache[org.id()].children; + fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org }; + fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org }; + } + + } + + return org; + } + + fieldmapper.aou.prototype.orgNodeTrail = function (node) { + if (!node) node = this; + if (!node) return []; + + var na = []; + + while( node ) { + na.push(node); + if (node.parent_ou()) + node = fieldmapper.aou.findOrgUnit(node.parent_ou()); + else + node = null; + } + + return na.reverse(); + } + fieldmapper.aou.orgNodeTrail = fieldmapper.aou.prototype.orgNodeTrail; + + fieldmapper.aou.prototype.orgIsMine = function (me, org) { + if (this._isfieldmapper) { + org = me; + me = this; + } + + if(!me || !org) return false; + + if(me.id() == org.id()) return true; + + for( var i in me.children() ) { + if(me.children()[i].orgIsMine(org)) return true; + } + return false; + } /** Given an org id, returns an array of org units including * the org for the ID provided and all descendant orgs */ @@ -220,20 +220,20 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){ return list; } - dojo.addOnUnload( function () { - for (var i in fieldmapper.aou.OrgCache) { - x=fieldmapper.aou.OrgCache[i].treePtr; - if (!x) continue; - - x.children(null); - x.parent_ou(null); - fieldmapper.aou.OrgCache[i]=null; - } - fieldmapper.aou.globalOrgTree = null; - fieldmapper.aou.OrgCache = null; - fieldmapper.aou.OrgCacheSN = null; - fieldmapper.aout.OrgTypeCache = null; - }); + dojo.addOnUnload( function () { + for (var i in fieldmapper.aou.OrgCache) { + x=fieldmapper.aou.OrgCache[i].treePtr; + if (!x) continue; + + x.children(null); + x.parent_ou(null); + fieldmapper.aou.OrgCache[i]=null; + } + fieldmapper.aou.globalOrgTree = null; + fieldmapper.aou.OrgCache = null; + fieldmapper.aou.OrgCacheSN = null; + fieldmapper.aout.OrgTypeCache = null; + }); } diff --git a/Open-ILS/web/js/dojo/fieldmapper/dojoData.js b/Open-ILS/web/js/dojo/fieldmapper/dojoData.js index 597e9b127e..9eb03c002f 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/dojoData.js +++ b/Open-ILS/web/js/dojo/fieldmapper/dojoData.js @@ -17,111 +17,111 @@ if(!dojo._hasResource['fieldmapper.dojoData']){ - dojo._hasResource['fieldmapper.dojoData'] = true; - dojo.provide('fieldmapper.dojoData'); - dojo.require('fieldmapper.Fieldmapper'); - dojo.require('fieldmapper.hash'); + dojo._hasResource['fieldmapper.dojoData'] = true; + dojo.provide('fieldmapper.dojoData'); + dojo.require('fieldmapper.Fieldmapper'); + dojo.require('fieldmapper.hash'); - function _fromStoreItem (data) { - this.fromHash(data); + function _fromStoreItem (data) { + this.fromHash(data); - for (var i in this._ignore_fields) - this[this._ignore_fields[i]](null); + for (var i in this._ignore_fields) + this[this._ignore_fields[i]](null); - for ( var i=0; i < this._fields.length; i++) { - if (dojo.isArray( this[this._fields[i]]() )) - this[this._fields[i]]( this[this._fields[i]]()[0] ); - } - return this; - } + for ( var i=0; i < this._fields.length; i++) { + if (dojo.isArray( this[this._fields[i]]() )) + this[this._fields[i]]( this[this._fields[i]]()[0] ); + } + return this; + } function _initStoreData(label, params) { - if (!params) params = {}; - if (!params.identifier) params.identifier = this.Identifier; - if (!label) label = params.label; - if (!label) label = params.identifier; - return { label : label, identifier : params.identifier, items : [] }; + if (!params) params = {}; + if (!params.identifier) params.identifier = this.Identifier; + if (!label) label = params.label; + if (!label) label = params.identifier; + return { label : label, identifier : params.identifier, items : [] }; } function _toStoreItem(fmObj, params) { - if (!params) params = {}; + if (!params) params = {}; return fmObj.toHash(true, params.virtualFields); } - function _toStoreData (list, label, params) { - if (!params) params = {}; + function _toStoreData (list, label, params) { + if (!params) params = {}; var data = this.initStoreData(label, params); - for (var i in list) data.items.push( list[i].toHash(true, params.virtualFields) ); - - if (params.children && params.parent) { - var _hash_list = data.items; - - var _find_root = {}; - for (var i in _hash_list) { - _find_root[_hash_list[i][params.identifier]] = _hash_list[i]; - } - - var item_data = []; - for (var i in _hash_list) { - var obj = _hash_list[i] - obj[params.children] = []; - - for (var j in _hash_list) { - var kid = _hash_list[j]; - if (kid[params.parent] == obj[params.identifier]) { - obj[params.children].push( { _reference : kid[params.identifier] } ); - kid._iskid = true; - if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]]; - } - } - - item_data.push( obj ); - } - - for (var j in _find_root) { - _find_root[j]['_top'] = 'true'; - if (!_find_root[j][params.parent]) - _find_root[j]['_trueRoot'] = 'true'; - } - - data.items = item_data; - } - - return data; - } - - for (var i in fmclasses) fieldmapper[i].prototype.fromStoreItem = _fromStoreItem; - for (var i in fmclasses) fieldmapper[i].toStoreData = _toStoreData; - for (var i in fmclasses) fieldmapper[i].toStoreItem = _toStoreItem; - for (var i in fmclasses) fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) }; - for (var i in fmclasses) fieldmapper[i].initStoreData = _initStoreData; - - fieldmapper.aou.prototype._ignore_fields = ['children']; - fieldmapper.aout.prototype._ignore_fields = ['children']; - fieldmapper.pgt.prototype._ignore_fields = ['children']; - - fieldmapper.aou.toStoreData = function (list, label) { - if (!label) label = 'shortname'; - return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' }); - } - - fieldmapper.aout.toStoreData = function (list, label) { - if (!label) label = 'name'; - return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' }); - } - - fieldmapper.pgt.toStoreData = function (list, label) { - if (!label) label = 'name'; - return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' }); - } - - /* - ppl.toStoreData = function (list, label) { - if (!label) label = 'code'; - return _toStoreData(list, label, {}); - } - */ + for (var i in list) data.items.push( list[i].toHash(true, params.virtualFields) ); + + if (params.children && params.parent) { + var _hash_list = data.items; + + var _find_root = {}; + for (var i in _hash_list) { + _find_root[_hash_list[i][params.identifier]] = _hash_list[i]; + } + + var item_data = []; + for (var i in _hash_list) { + var obj = _hash_list[i] + obj[params.children] = []; + + for (var j in _hash_list) { + var kid = _hash_list[j]; + if (kid[params.parent] == obj[params.identifier]) { + obj[params.children].push( { _reference : kid[params.identifier] } ); + kid._iskid = true; + if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]]; + } + } + + item_data.push( obj ); + } + + for (var j in _find_root) { + _find_root[j]['_top'] = 'true'; + if (!_find_root[j][params.parent]) + _find_root[j]['_trueRoot'] = 'true'; + } + + data.items = item_data; + } + + return data; + } + + for (var i in fmclasses) fieldmapper[i].prototype.fromStoreItem = _fromStoreItem; + for (var i in fmclasses) fieldmapper[i].toStoreData = _toStoreData; + for (var i in fmclasses) fieldmapper[i].toStoreItem = _toStoreItem; + for (var i in fmclasses) fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) }; + for (var i in fmclasses) fieldmapper[i].initStoreData = _initStoreData; + + fieldmapper.aou.prototype._ignore_fields = ['children']; + fieldmapper.aout.prototype._ignore_fields = ['children']; + fieldmapper.pgt.prototype._ignore_fields = ['children']; + + fieldmapper.aou.toStoreData = function (list, label) { + if (!label) label = 'shortname'; + return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' }); + } + + fieldmapper.aout.toStoreData = function (list, label) { + if (!label) label = 'name'; + return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' }); + } + + fieldmapper.pgt.toStoreData = function (list, label) { + if (!label) label = 'name'; + return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' }); + } + + /* + ppl.toStoreData = function (list, label) { + if (!label) label = 'code'; + return _toStoreData(list, label, {}); + } + */ } diff --git a/Open-ILS/web/js/dojo/fieldmapper/hash.js b/Open-ILS/web/js/dojo/fieldmapper/hash.js index d3a62568c6..18f6683e70 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/hash.js +++ b/Open-ILS/web/js/dojo/fieldmapper/hash.js @@ -17,42 +17,42 @@ if(!dojo._hasResource['fieldmapper.hash']){ - dojo._hasResource['fieldmapper.hash'] = true; - dojo.provide('fieldmapper.hash'); - dojo.require('fieldmapper.Fieldmapper'); - - function _fromHash (_hash) { - for ( var i=0; i < this._fields.length; i++) { - if (_hash[this._fields[i]] != null) - this[this._fields[i]]( _hash[this._fields[i]] ); - } - return this; - } - - function _toHash (includeNulls, virtFields) { - var _hash = {}; - for ( var i=0; i < this._fields.length; i++) { - if (includeNulls || this[this._fields[i]]() != null) { - if (this[this._fields[i]]() == null) + dojo._hasResource['fieldmapper.hash'] = true; + dojo.provide('fieldmapper.hash'); + dojo.require('fieldmapper.Fieldmapper'); + + function _fromHash (_hash) { + for ( var i=0; i < this._fields.length; i++) { + if (_hash[this._fields[i]] != null) + this[this._fields[i]]( _hash[this._fields[i]] ); + } + return this; + } + + function _toHash (includeNulls, virtFields) { + var _hash = {}; + for ( var i=0; i < this._fields.length; i++) { + if (includeNulls || this[this._fields[i]]() != null) { + if (this[this._fields[i]]() == null) _hash[this._fields[i]] = null; else - _hash[this._fields[i]] = '' + this[this._fields[i]](); + _hash[this._fields[i]] = '' + this[this._fields[i]](); } - } - - if (virtFields && virtFields.length > 0) { - for (var i in virtFields) { - if (!_hash[virtFields[i]]) - _hash[virtFields[i]] = null; - } - } - - return _hash; - } - - for (var i in fmclasses) { - window[i].prototype.fromHash = _fromHash; - window[i].prototype.toHash = _toHash; - } + } + + if (virtFields && virtFields.length > 0) { + for (var i in virtFields) { + if (!_hash[virtFields[i]]) + _hash[virtFields[i]] = null; + } + } + + return _hash; + } + + for (var i in fmclasses) { + window[i].prototype.fromHash = _fromHash; + window[i].prototype.toHash = _toHash; + } } diff --git a/Open-ILS/web/js/dojo/openils/CGI.js b/Open-ILS/web/js/dojo/openils/CGI.js index d63576e0f2..280104b1d5 100644 --- a/Open-ILS/web/js/dojo/openils/CGI.js +++ b/Open-ILS/web/js/dojo/openils/CGI.js @@ -37,7 +37,7 @@ if(!dojo._hasResource["openils.CGI"]) { var c = string.charAt(idx); - if( c == "=" ) { + if( c == "=" ) { invalue = true; inkey = false; continue; diff --git a/Open-ILS/web/js/dojo/openils/DojoPatch.js b/Open-ILS/web/js/dojo/openils/DojoPatch.js index 54b44131ad..6e7e936b65 100644 --- a/Open-ILS/web/js/dojo/openils/DojoPatch.js +++ b/Open-ILS/web/js/dojo/openils/DojoPatch.js @@ -9,7 +9,7 @@ if(!dojo._hasResource["openils.DojoPatch"]) { // lots of useful doc comments snipped for brevity dojo.create = function(tag, attrs, refNode, pos) { var doc = d.doc; - if(refNode){ + if(refNode){ refNode = d.byId(refNode); doc = refNode.ownerDocument; } diff --git a/Open-ILS/web/js/dojo/openils/I18N.js b/Open-ILS/web/js/dojo/openils/I18N.js index 12e1a7abf2..c03863f0cd 100644 --- a/Open-ILS/web/js/dojo/openils/I18N.js +++ b/Open-ILS/web/js/dojo/openils/I18N.js @@ -21,13 +21,13 @@ if(!dojo._hasResource["openils.I18N"]) { dojo.provide("openils.I18N"); dojo.require("fieldmapper.dojoData"); dojo.require("DojoSRF"); - dojo.require("dojo.data.ItemFileWriteStore"); + dojo.require("dojo.data.ItemFileWriteStore"); dojo.declare('openils.I18N', null, {}); - openils.I18N.BaseLocales = fieldmapper.standardRequest( [ 'open-ils.fielder', 'open-ils.fielder.i18n_l.atomic'], [ { query : { code : { '!=' : null } } } ] ); - openils.I18N.localeStore = new dojo.data.ItemFileWriteStore( { data : {identifier : 'locale', label : 'label', items : [] } } ); - openils.I18N.BaseLocales = openils.I18N.BaseLocales.sort( + openils.I18N.BaseLocales = fieldmapper.standardRequest( [ 'open-ils.fielder', 'open-ils.fielder.i18n_l.atomic'], [ { query : { code : { '!=' : null } } } ] ); + openils.I18N.localeStore = new dojo.data.ItemFileWriteStore( { data : {identifier : 'locale', label : 'label', items : [] } } ); + openils.I18N.BaseLocales = openils.I18N.BaseLocales.sort( function(a, b) { if(a.name > b.name) return 1; if(a.name < b.name) return -1; @@ -35,26 +35,26 @@ if(!dojo._hasResource["openils.I18N"]) { } ); - for (var i in openils.I18N.BaseLocales) { - openils.I18N.localeStore.newItem({ locale : openils.I18N.BaseLocales[i].code, label : openils.I18N.BaseLocales[i].name }); - } + for (var i in openils.I18N.BaseLocales) { + openils.I18N.localeStore.newItem({ locale : openils.I18N.BaseLocales[i].code, label : openils.I18N.BaseLocales[i].name }); + } - openils.I18N.getTranslations = function ( obj /* Fieldmapper object */, field /* Field to translate */, locale /* optional locale */) { - var classname = obj.classname; + openils.I18N.getTranslations = function ( obj /* Fieldmapper object */, field /* Field to translate */, locale /* optional locale */) { + var classname = obj.classname; - // XXX need to derive identity field from IDL... - var ident_field = fieldmapper[classname].Identifier; - var ident_value = obj[ident_field](); + // XXX need to derive identity field from IDL... + var ident_field = fieldmapper[classname].Identifier; + var ident_value = obj[ident_field](); - var fielder_args = { query : { fq_field : classname + '.' + field, identity_value : ident_value } }; - if (locale) fielder_args.translation = locale; + var fielder_args = { query : { fq_field : classname + '.' + field, identity_value : ident_value } }; + if (locale) fielder_args.translation = locale; - var hash_list = fieldmapper.standardRequest( [ 'open-ils.fielder', 'open-ils.fielder.i18n.atomic'], [ fielder_args ] ); - var obj_list = dojo.map( hash_list, function (t) { return new fieldmapper.i18n().fromHash( t ) } ); + var hash_list = fieldmapper.standardRequest( [ 'open-ils.fielder', 'open-ils.fielder.i18n.atomic'], [ fielder_args ] ); + var obj_list = dojo.map( hash_list, function (t) { return new fieldmapper.i18n().fromHash( t ) } ); - if (locale) return obj_list[0]; - return obj_list; - } + if (locale) return obj_list[0]; + return obj_list; + } } diff --git a/Open-ILS/web/js/dojo/openils/PermaCrud.js b/Open-ILS/web/js/dojo/openils/PermaCrud.js index 0d5ab77b48..de4a946cdf 100644 --- a/Open-ILS/web/js/dojo/openils/PermaCrud.js +++ b/Open-ILS/web/js/dojo/openils/PermaCrud.js @@ -300,10 +300,10 @@ if(!dojo._hasResource["openils.PermaCrud"]) { this._CUD( 'delete', list, opts ); }, - /* - * 'delete' is a reserved keyword in JavaScript and can't be used - * in browsers like IE or Chrome, so we define a safe synonym - */ + /* + * 'delete' is a reserved keyword in JavaScript and can't be used + * in browsers like IE or Chrome, so we define a safe synonym + */ eliminate: function ( list, opts ) { this._CUD( 'delete', list, opts ); }, diff --git a/Open-ILS/web/js/dojo/openils/User.js b/Open-ILS/web/js/dojo/openils/User.js index 11ca1a5df7..b9fdef4638 100644 --- a/Open-ILS/web/js/dojo/openils/User.js +++ b/Open-ILS/web/js/dojo/openils/User.js @@ -66,7 +66,7 @@ if(!dojo._hasResource["openils.User"]) { if(this.sessionCache[this.authtoken]) { this.user = this.sessionCache[this.authtoken]; - if (!openils.User.user) + if (!openils.User.user) openils.User.user = this.user; return this.user; } @@ -80,7 +80,7 @@ if(!dojo._hasResource["openils.User"]) { var user = r.recv().content(); _u.user = user; _u.sessionCache[_u.authtoken] = user; - if (!openils.User.user) openils.User.user = _u.user; + if (!openils.User.user) openils.User.user = _u.user; if(onComplete) onComplete(user); } @@ -88,7 +88,7 @@ if(!dojo._hasResource["openils.User"]) { ); } else { _u.user = fieldmapper.standardRequest(req, params); - if (!openils.User.user) openils.User.user = _u.user; + if (!openils.User.user) openils.User.user = _u.user; _u.sessionCache[_u.authtoken] = _u.user; return _u.user; } @@ -138,9 +138,9 @@ if(!dojo._hasResource["openils.User"]) { authReq.oncomplete = function(rr) { var data = rr.recv().content(); _u.authtoken = data.payload.authtoken; - if (!openils.User.authtoken) openils.User.authtoken = _u.authtoken; + if (!openils.User.authtoken) openils.User.authtoken = _u.authtoken; _u.authtime = data.payload.authtime; - if (!openils.User.authtime) openils.User.authtime = _u.authtime; + if (!openils.User.authtime) openils.User.authtime = _u.authtime; _u.getBySession(onComplete); if(_u.authcookie) { dojo.require('dojo.cookie'); @@ -277,16 +277,16 @@ if(!dojo._hasResource["openils.User"]) { _u.permOrgStoreCache[perm] = store; } - if (_u.permOrgStoreCache[perm]) - hookupStore(_u.permOrgStoreCache[perm]); - else + if (_u.permOrgStoreCache[perm]) + hookupStore(_u.permOrgStoreCache[perm]); + else _u.getPermOrgList(perm, buildTreePicker, true); }, }); - openils.User.user = null; - openils.User.authtoken = null; - openils.User.authtime = null; + openils.User.user = null; + openils.User.authtoken = null; + openils.User.authtime = null; openils.User.authcookie = null; } diff --git a/Open-ILS/web/js/dojo/openils/Util.js b/Open-ILS/web/js/dojo/openils/Util.js index 9d160367cd..3b32d3aa1d 100644 --- a/Open-ILS/web/js/dojo/openils/Util.js +++ b/Open-ILS/web/js/dojo/openils/Util.js @@ -83,13 +83,13 @@ if(!dojo._hasResource["openils.Util"]) { * the provided DOM node has focus. */ openils.Util.registerEnterHandler = function(domNode, func) { - if(!(domNode && func)) return; - domNode.onkeydown = function(evt) { + if(!(domNode && func)) return; + domNode.onkeydown = function(evt) { var code = openils.Util.getCharCode(evt); if(code == 13 || code == 3) func(); } - } + } /** diff --git a/Open-ILS/web/js/dojo/openils/XUL.js b/Open-ILS/web/js/dojo/openils/XUL.js index c9cde521cb..ac63bf72bf 100644 --- a/Open-ILS/web/js/dojo/openils/XUL.js +++ b/Open-ILS/web/js/dojo/openils/XUL.js @@ -16,8 +16,8 @@ if(!dojo._hasResource["openils.XUL"]) { if(openils.XUL.isXUL()) { try { if(openils.XUL.enableXPConnect()) { - var CacheClass = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - return new CacheClass().wrappedJSObject.OpenILS.prototype.data; + var CacheClass = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + return new CacheClass().wrappedJSObject.OpenILS.prototype.data; } } catch(e) { console.log("Error loading XUL stash: " + e); diff --git a/Open-ILS/web/js/dojo/openils/acq/Fund.js b/Open-ILS/web/js/dojo/openils/acq/Fund.js index 6786569695..f516a3f735 100644 --- a/Open-ILS/web/js/dojo/openils/acq/Fund.js +++ b/Open-ILS/web/js/dojo/openils/acq/Fund.js @@ -40,7 +40,7 @@ openils.acq.Fund.createStore = function(onComplete, limitPerm) { openils.acq.Fund.cache[src.id()] = src; items.push(src); } - openils.acq.Fund._cachecomplete = true; + openils.acq.Fund._cachecomplete = true; onComplete(acqf.toStoreData(items)); } @@ -148,18 +148,18 @@ openils.acq.Fund.nameMapping = function(oncomplete) { var ids = []; var names = []; var buildMap = function() { - for (var i in openils.acq.Fund.cache) { - var item = openils.acq.Fund.cache[i]; - ids.push(item.id()); - names.push(item.name()); - oncomplete(ids, names); - } + for (var i in openils.acq.Fund.cache) { + var item = openils.acq.Fund.cache[i]; + ids.push(item.id()); + names.push(item.name()); + oncomplete(ids, names); + } }; if (openils.acq.Fund._cachecomplete) { - buildMap(oncomplete); + buildMap(oncomplete); } else { - openils.acq.Fund.createStore(buildMap); + openils.acq.Fund.createStore(buildMap); } }; @@ -176,35 +176,35 @@ openils.acq.Fund.buildPermFundSelector = function(perm, selector) { dojo.require('dojo.data.ItemFileReadStore'); function hookupStore(store) { - selector.store = store; + selector.store = store; selector.startup(); } function buildPicker(r) { - var msg; - var fundList = []; - while (msg = r.recv()) { - var fund = msg.content(); - fundList.push(fund); - } + var msg; + var fundList = []; + while (msg = r.recv()) { + var fund = msg.content(); + fundList.push(fund); + } - var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData(fundList)}); + var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData(fundList)}); - hookupStore(store); - openils.acq.Fund.storeCache[perm] = store; + hookupStore(store); + openils.acq.Fund.storeCache[perm] = store; } if (openils.acq.Fund.storeCache[perm]) { - hookupStore(openils.acq.Fund.storeCache[perm]); + hookupStore(openils.acq.Fund.storeCache[perm]); } else { - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.fund.org.retrieve'], + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.fund.org.retrieve'], { params: [openils.User.authtoken, null, - {flesh_summary:1, limit_perm:perm}], - oncomplete: buildPicker, - async: true + {flesh_summary:1, limit_perm:perm}], + oncomplete: buildPicker, + async: true } - ) + ) } } diff --git a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js index d7d3958f21..9c34bc39c4 100644 --- a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js +++ b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js @@ -81,25 +81,25 @@ dojo.declare('openils.acq.Lineitem', null, { { async: true, params: [openils.User.authtoken, this.lineitem], oncomplete: function(r) { - oncomplete(openils.Event.parse(r.recv().content())); + oncomplete(openils.Event.parse(r.recv().content())); } } ); }, approve: function(oncomplete) { - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.lineitem.approve'], - { async: true, - params: [openils.User.authtoken, this.lineitem.id()], - oncomplete: function(r) { - oncomplete(openils.Event.parse(r.recv().content())); - } - }); + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.lineitem.approve'], + { async: true, + params: [openils.User.authtoken, this.lineitem.id()], + oncomplete: function(r) { + oncomplete(openils.Event.parse(r.recv().content())); + } + }); }, id: function() { - return this.lineitem.id(); + return this.lineitem.id(); }, }); @@ -129,74 +129,74 @@ openils.acq.Lineitem.createLIDStore = function(li_id, onComplete) { // Fetches the details of a lineitem and builds a grid function mkStore(r) { - var msg; - var items = []; - while (msg = r.recv()) { - var data = msg.content(); - for (i in data.lineitem_details()) { - var lid = data.lineitem_details()[i]; - items.push(lid); - openils.acq.Lineitem.acqlidCache[lid.id()] = lid; - } - } - - onComplete(acqlid.toStoreData(items)); + var msg; + var items = []; + while (msg = r.recv()) { + var data = msg.content(); + for (i in data.lineitem_details()) { + var lid = data.lineitem_details()[i]; + items.push(lid); + openils.acq.Lineitem.acqlidCache[lid.id()] = lid; + } + } + + onComplete(acqlid.toStoreData(items)); } fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.lineitem.retrieve'], - { async: true, - params: [openils.User.authtoken, li_id, - {flesh_attrs:1, flesh_li_details:1}], - oncomplete: mkStore - }); + ['open-ils.acq', 'open-ils.acq.lineitem.retrieve'], + { async: true, + params: [openils.User.authtoken, li_id, + {flesh_attrs:1, flesh_li_details:1}], + oncomplete: mkStore + }); }; openils.acq.Lineitem.alertOnLIDSet = function(griditem, attr, oldVal, newVal) { var item; var updateDone = function(r) { - var stat = r.recv().content(); - var evt = openils.Event.parse(stat); - - if (evt) { - alert("Error: "+evt.desc); - console.dir(evt); - if (attr == "fund") { - item.fund(oldVal); - griditem.fund = oldVal; - } else if (attr == "owning_lib") { - item.owning_lib(oldVal); - griditem.owning_lib = oldVal; - } - } + var stat = r.recv().content(); + var evt = openils.Event.parse(stat); + + if (evt) { + alert("Error: "+evt.desc); + console.dir(evt); + if (attr == "fund") { + item.fund(oldVal); + griditem.fund = oldVal; + } else if (attr == "owning_lib") { + item.owning_lib(oldVal); + griditem.owning_lib = oldVal; + } + } }; if (oldVal == newVal) { - return; + return; } item = openils.acq.Lineitem.acqlidCache[griditem.id]; if (attr == "fund") { - item.fund(newVal); + item.fund(newVal); } else if (attr == "owning_lib") { - item.owning_lib(newVal); + item.owning_lib(newVal); } else if (attr == "cn_label") { - item.cn_label(newVal); + item.cn_label(newVal); } else if (attr == "barcode") { - item.barcode(newVal); + item.barcode(newVal); } else if (attr == "location") { - item.location(newVal); + item.location(newVal); } else { - alert("Unexpected attr in Lineitem.alertOnSet: '"+attr+"'"); - return; + alert("Unexpected attr in Lineitem.alertOnSet: '"+attr+"'"); + return; } fieldmapper.standardRequest( - ["open-ils.acq", "open-ils.acq.lineitem_detail.update"], - { params: [openils.User.authtoken, item], - oncomplete: updateDone - }); + ["open-ils.acq", "open-ils.acq.lineitem_detail.update"], + { params: [openils.User.authtoken, item], + oncomplete: updateDone + }); }; openils.acq.Lineitem.deleteLID = function(id, onComplete) { @@ -207,7 +207,7 @@ openils.acq.Lineitem.deleteLID = function(id, onComplete) { oncomplete: function(r) { msg = r.recv() stat = msg.content(); - onComplete(openils.Event.parse(stat)); + onComplete(openils.Event.parse(stat)); } }); }; @@ -215,45 +215,45 @@ openils.acq.Lineitem.deleteLID = function(id, onComplete) { openils.acq.Lineitem.createLID = function(fields, onCreateComplete) { var lid = new acqlid() for (var field in fields) { - lid[field](fields[field]); + lid[field](fields[field]); } fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.lineitem_detail.create'], - { async: true, - params: [openils.User.authtoken, lid, {return_obj:1}], - oncomplete: function(r) { - var msg = r.recv(); + ['open-ils.acq', 'open-ils.acq.lineitem_detail.create'], + { async: true, + params: [openils.User.authtoken, lid, {return_obj:1}], + oncomplete: function(r) { + var msg = r.recv(); var obj = msg.content(); openils.Event.parse_and_raise(obj); - if (onCreateComplete) { - onCreateComplete(obj); - } - } - }); + if (onCreateComplete) { + onCreateComplete(obj); + } + } + }); }; openils.acq.Lineitem.loadLIDGrid = function(domNode, id, layout) { if (!openils.acq.Lineitem.ModelCache[id]) { - openils.acq.Lineitem.createLIDStore(id, - function(storeData) { - var store = new dojo.data.ItemFileWriteStore({data:storeData}); - var model = new dojox.grid.data.DojoData(null, store, - {rowsPerPage: 20, clientSort:true, query:{id:'*'}}); - - dojo.connect(store, "onSet", - openils.acq.Lineitem.alertOnLIDSet); - openils.acq.Lineitem.ModelCache[id] = model; - - domNode.setStructure(layout); - domNode.setModel(model); - domNode.update(); - }); + openils.acq.Lineitem.createLIDStore(id, + function(storeData) { + var store = new dojo.data.ItemFileWriteStore({data:storeData}); + var model = new dojox.grid.data.DojoData(null, store, + {rowsPerPage: 20, clientSort:true, query:{id:'*'}}); + + dojo.connect(store, "onSet", + openils.acq.Lineitem.alertOnLIDSet); + openils.acq.Lineitem.ModelCache[id] = model; + + domNode.setStructure(layout); + domNode.setModel(model); + domNode.update(); + }); } else { - domNode.setModel(openils.acq.Lineitem.ModelCache[id]); - domNode.setStructure(layout); - domNode.update(); - domNode.refresh(); + domNode.setModel(openils.acq.Lineitem.ModelCache[id]); + domNode.setStructure(layout); + domNode.update(); + domNode.refresh(); } }; } diff --git a/Open-ILS/web/js/dojo/openils/acq/Picklist.js b/Open-ILS/web/js/dojo/openils/acq/Picklist.js index 504b9691a0..356fe3dcc5 100644 --- a/Open-ILS/web/js/dojo/openils/acq/Picklist.js +++ b/Open-ILS/web/js/dojo/openils/acq/Picklist.js @@ -30,7 +30,7 @@ dojo.declare('openils.acq.Picklist', null, { constructor: function (pl_id, onComplete, args) { - var pl_this = this; // 'this' doesn't exist inside callbacks + var pl_this = this; // 'this' doesn't exist inside callbacks var liArgs = (args && args.liArgs) ? args.liArgs : {flesh_attrs:1, clear_marc:1}; var mkStore = function (r) { var storeData; @@ -78,19 +78,19 @@ dojo.declare('openils.acq.Picklist', null, { }, id: function () { - return this._id; + return this._id; }, name: function() { - return this._plist.name(); + return this._plist.name(); }, owner: function() { - return this._plist.owner(); + return this._plist.owner(); }, create_time: function() { - return this._plist.create_time(); + return this._plist.create_time(); }, edit_time: function() { - return this._plist.edit_time(); + return this._plist.edit_time(); }, find_attr: function(id, at_name, at_type) { diff --git a/Open-ILS/web/js/dojo/openils/acq/Provider.js b/Open-ILS/web/js/dojo/openils/acq/Provider.js index 9803bd00e3..4742a74d1b 100644 --- a/Open-ILS/web/js/dojo/openils/acq/Provider.js +++ b/Open-ILS/web/js/dojo/openils/acq/Provider.js @@ -140,35 +140,35 @@ openils.acq.Provider.buildPermProviderSelector = function(perm, selector) { dojo.require('dojo.data.ItemFileReadStore'); function hookupStore(store) { - selector.store = store; - selector.startup(); + selector.store = store; + selector.startup(); } function buildPicker(r) { - var msg; - var providerList = []; - while (msg = r.recv()) { - var provider = msg.content(); - providerList.push(provider); - } + var msg; + var providerList = []; + while (msg = r.recv()) { + var provider = msg.content(); + providerList.push(provider); + } - var store = new dojo.data.ItemFileReadStore({data:acqpro.toStoreData(providerList)}); + var store = new dojo.data.ItemFileReadStore({data:acqpro.toStoreData(providerList)}); - hookupStore(store); - openils.acq.Provider.storeCache[perm] = store; + hookupStore(store); + openils.acq.Provider.storeCache[perm] = store; } if (openils.acq.Provider.storeCache[perm]) { - hookupStore(openils.acq.Provider.storeCache[perm]); + hookupStore(openils.acq.Provider.storeCache[perm]); } else { - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.provider.org.retrieve'], + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.provider.org.retrieve'], { params: [openils.User.authtoken, null, - {flesh_summary:1, limit_perm:perm}], - oncomplete: buildPicker, - async: true + {flesh_summary:1, limit_perm:perm}], + oncomplete: buildPicker, + async: true } - ) + ) } } } diff --git a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js index eea305da1e..f975905576 100644 --- a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js +++ b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js @@ -1,78 +1,78 @@ { - "CONFIRM_DELETE": "Are you sure you want to delete ${0}?", - "CONFIRM_EXIT_AOU": "There are unsaved changes to one or more organizational units. Click OK to save these changes, or Cancel to abandon them.", - "CONFIRM_EXIT_CAM": "There are unsaved changes to one or more ${0} codes. Click OK to save these changes, or Cancel to abandon them.", - "CONFIRM_EXIT_CCS": "There are unsaved changes to one or more copy statuses. Click OK to save these changes, or Cancel to abandon them.", - "CONFIRM_EXIT_PGT": "There are unsaved modified permission maps. Click OK to save these changes, or Cancel to abandon them.", - "CONFIRM_EXIT_PPL": "There are unsaved modified permissions. Click OK to save these changes, or Cancel to abandon them.", - "CONFIRM_UNSAVED_CHANGES": "There are unsaved changes to one or more organization types. Click OK to save these changes, or Cancel to abandon them.", - "ERROR_CALLING_METHOD_AOUT": "Problem calling method to create child organization type", - "ERROR_CALLING_METHOD_CAM": "Problem calling method to create new ${0}", - "ERROR_CALLING_METHOD_CCS": "Problem calling method to create new copy status", - "ERROR_CALLING_METHOD_PERM_MAP": "Problem calling method to create new permission map", - "ERROR_CALLING_METHOD_PGT": "Problem calling method to create child Group", - "ERROR_CALLING_METHOD_PPL": "Problem calling method to create new permission", - "ERROR_CREATING_CHILD_AOU": "Problem creating child organizational unit", - "ERROR_CREATING_CHILD_AOUT": "Problem creating child organization type", - "ERROR_CREATING_CHILD_GROUP": "Problem creating child Group", - "ERROR_CREATING_PERMISSION": "Problem creating new Permission", - "ERROR_CREATING_PERM_MAP": "Problem creating new Permission Map", - "ERROR_CREATING_STATUS": "Problem creating new Status", - "ERROR_DELETING_LAST_AOU": "Cannot delete ${0}, you need at least one organization unit.", - "ERROR_DELETING_LAST_AOUT": "Cannot delete ${0}. You need at least one organization type.", - "ERROR_DELETING_PERM_MAPPING": "Problem deleting permission mapping ${0}", - "ERROR_DELETING": "Problem deleting ${0}", - "ERROR_FETCHING_GROUPS": "Problem fetching groups", - "ERROR_FETCHING_HOLDS": "Problem fetching Holds Address for ${0}", - "ERROR_FETCHING_HOURS": "Problem fetching hours of operation for ${0}", - "ERROR_FETCHING_ILL": "Problem fetching ILL Address for ${0}", - "ERROR_FETCHING_MAILING": "Problem fetching Mailing Address for ${0}", - "ERROR_FETCHING_ORGS": "Problem fetching organizational unit data", - "ERROR_FETCHING_PERM_MAPS": "Problem fetching perm maps", - "ERROR_FETCHING_PERMS": "Problem fetching perms", - "ERROR_FETCHING_PHYSICAL": "Problem fetching Physical Address for ${0}", - "ERROR_FETCHING_STATUSES": "Problem fetching statuses", - "ERROR_FETCHING_TYPES_AOUT": "Problem fetching organizational unit types", - "ERROR_ORPHANS": "Cannot delete ${0}, ${1} subordinates still exist.", - "ERROR_SAVING_DATA": "Problem saving data for ${0}", - "ERROR_SAVING_DATA_CAM": "Problem saving data for ${0} ${1}", - "ERROR_SAVING_HOLDS": "Problem saving Holds Address data for ${0}", - "ERROR_SAVING_HOO": "Problem saving Hours of Operation data for ${0}", - "ERROR_SAVING_ILL": "Problem saving ILL Address data for ${0}", - "ERROR_SAVING_MAILING": "Problem saving Mailing Address data for ${0}", - "ERROR_SAVING_PERM_DATA": "Problem saving permission data for ${0}", - "ERROR_SAVING_PHYSICAL": "Problem saving Physical Address data for ${0}", - "ERROR_SAVING_STATUS": "Problem saving ${0}", - "HOLDABLE": "Holdable", - "ID": "ID", - "LABEL_CODE": "Code", - "LABEL_DEPTH": "Depth", - "LABEL_DESCRIPTION": "Description", - "LABEL_GRANTABLE": "Grantable", - "LABEL_NEW_BRANCH": "New Branch", - "LABEL_NEW_GROUP": "New Group", - "LABEL_NEW_TYPE": "New Type", - "LABEL_TRANSLATION": "Translation", - "LABEL_VALUE": "Value", - "NAME": "Name", - "OPAC_VISIBLE": "OPAC Visible", - "STATUS_DELETED": "${0} deleted", - "STATUS_EDITING": "Now editing ${0}", - "SUCCESS_CREATING_CHILD_AOU": "New child Organizational Unit created for ${0}", - "SUCCESS_CREATING_CHILD_AOUT": "New child Organization Type created for ${0}", - "SUCCESS_CREATING_CODE": "New ${0} ${1} created", - "SUCCESS_CREATING_PERMISSION": "New ${0} permission created", - "SUCCESS_CREATING_STATUS": "New ${0} status created", - "SUCCESS_DELETED_PERM_MAP": "Permission mapping deleted", - "SUCCESS_NEW_CHILD_GROUP": "New child Group created for ${0}", - "SUCCESS_NEW_PERM_MAP": "New permission map created", - "SUCCESS_SAVE_PERM": "Saved permission changes to ${0}", - "SUCCESS_SAVE": "Saved changes to ${0}", - "SUCCESS_SAVING_DATA": "Saved changes to ${0}", - "SUCCESS_SAVING_HOLDS": "Saved changes to the Holds Address of ${0}", - "SUCCESS_SAVING_HOO": "Hours of Operation updated for ${0}", - "SUCCESS_SAVING_ILL": "Saved changes to the ILL Address of ${0}", - "SUCCESS_SAVING_MAILING": "Saved changes to the Mailing Address of ${0}", + "CONFIRM_DELETE": "Are you sure you want to delete ${0}?", + "CONFIRM_EXIT_AOU": "There are unsaved changes to one or more organizational units. Click OK to save these changes, or Cancel to abandon them.", + "CONFIRM_EXIT_CAM": "There are unsaved changes to one or more ${0} codes. Click OK to save these changes, or Cancel to abandon them.", + "CONFIRM_EXIT_CCS": "There are unsaved changes to one or more copy statuses. Click OK to save these changes, or Cancel to abandon them.", + "CONFIRM_EXIT_PGT": "There are unsaved modified permission maps. Click OK to save these changes, or Cancel to abandon them.", + "CONFIRM_EXIT_PPL": "There are unsaved modified permissions. Click OK to save these changes, or Cancel to abandon them.", + "CONFIRM_UNSAVED_CHANGES": "There are unsaved changes to one or more organization types. Click OK to save these changes, or Cancel to abandon them.", + "ERROR_CALLING_METHOD_AOUT": "Problem calling method to create child organization type", + "ERROR_CALLING_METHOD_CAM": "Problem calling method to create new ${0}", + "ERROR_CALLING_METHOD_CCS": "Problem calling method to create new copy status", + "ERROR_CALLING_METHOD_PERM_MAP": "Problem calling method to create new permission map", + "ERROR_CALLING_METHOD_PGT": "Problem calling method to create child Group", + "ERROR_CALLING_METHOD_PPL": "Problem calling method to create new permission", + "ERROR_CREATING_CHILD_AOU": "Problem creating child organizational unit", + "ERROR_CREATING_CHILD_AOUT": "Problem creating child organization type", + "ERROR_CREATING_CHILD_GROUP": "Problem creating child Group", + "ERROR_CREATING_PERMISSION": "Problem creating new Permission", + "ERROR_CREATING_PERM_MAP": "Problem creating new Permission Map", + "ERROR_CREATING_STATUS": "Problem creating new Status", + "ERROR_DELETING_LAST_AOU": "Cannot delete ${0}, you need at least one organization unit.", + "ERROR_DELETING_LAST_AOUT": "Cannot delete ${0}. You need at least one organization type.", + "ERROR_DELETING_PERM_MAPPING": "Problem deleting permission mapping ${0}", + "ERROR_DELETING": "Problem deleting ${0}", + "ERROR_FETCHING_GROUPS": "Problem fetching groups", + "ERROR_FETCHING_HOLDS": "Problem fetching Holds Address for ${0}", + "ERROR_FETCHING_HOURS": "Problem fetching hours of operation for ${0}", + "ERROR_FETCHING_ILL": "Problem fetching ILL Address for ${0}", + "ERROR_FETCHING_MAILING": "Problem fetching Mailing Address for ${0}", + "ERROR_FETCHING_ORGS": "Problem fetching organizational unit data", + "ERROR_FETCHING_PERM_MAPS": "Problem fetching perm maps", + "ERROR_FETCHING_PERMS": "Problem fetching perms", + "ERROR_FETCHING_PHYSICAL": "Problem fetching Physical Address for ${0}", + "ERROR_FETCHING_STATUSES": "Problem fetching statuses", + "ERROR_FETCHING_TYPES_AOUT": "Problem fetching organizational unit types", + "ERROR_ORPHANS": "Cannot delete ${0}, ${1} subordinates still exist.", + "ERROR_SAVING_DATA": "Problem saving data for ${0}", + "ERROR_SAVING_DATA_CAM": "Problem saving data for ${0} ${1}", + "ERROR_SAVING_HOLDS": "Problem saving Holds Address data for ${0}", + "ERROR_SAVING_HOO": "Problem saving Hours of Operation data for ${0}", + "ERROR_SAVING_ILL": "Problem saving ILL Address data for ${0}", + "ERROR_SAVING_MAILING": "Problem saving Mailing Address data for ${0}", + "ERROR_SAVING_PERM_DATA": "Problem saving permission data for ${0}", + "ERROR_SAVING_PHYSICAL": "Problem saving Physical Address data for ${0}", + "ERROR_SAVING_STATUS": "Problem saving ${0}", + "HOLDABLE": "Holdable", + "ID": "ID", + "LABEL_CODE": "Code", + "LABEL_DEPTH": "Depth", + "LABEL_DESCRIPTION": "Description", + "LABEL_GRANTABLE": "Grantable", + "LABEL_NEW_BRANCH": "New Branch", + "LABEL_NEW_GROUP": "New Group", + "LABEL_NEW_TYPE": "New Type", + "LABEL_TRANSLATION": "Translation", + "LABEL_VALUE": "Value", + "NAME": "Name", + "OPAC_VISIBLE": "OPAC Visible", + "STATUS_DELETED": "${0} deleted", + "STATUS_EDITING": "Now editing ${0}", + "SUCCESS_CREATING_CHILD_AOU": "New child Organizational Unit created for ${0}", + "SUCCESS_CREATING_CHILD_AOUT": "New child Organization Type created for ${0}", + "SUCCESS_CREATING_CODE": "New ${0} ${1} created", + "SUCCESS_CREATING_PERMISSION": "New ${0} permission created", + "SUCCESS_CREATING_STATUS": "New ${0} status created", + "SUCCESS_DELETED_PERM_MAP": "Permission mapping deleted", + "SUCCESS_NEW_CHILD_GROUP": "New child Group created for ${0}", + "SUCCESS_NEW_PERM_MAP": "New permission map created", + "SUCCESS_SAVE_PERM": "Saved permission changes to ${0}", + "SUCCESS_SAVE": "Saved changes to ${0}", + "SUCCESS_SAVING_DATA": "Saved changes to ${0}", + "SUCCESS_SAVING_HOLDS": "Saved changes to the Holds Address of ${0}", + "SUCCESS_SAVING_HOO": "Hours of Operation updated for ${0}", + "SUCCESS_SAVING_ILL": "Saved changes to the ILL Address of ${0}", + "SUCCESS_SAVING_MAILING": "Saved changes to the Mailing Address of ${0}", "SUCCESS_SAVING_PHYSICAL": "Saved changes to the Physical Address of ${0}", "TRANSLATION": "Translation", "END_SURVEY": "End Survey Now", diff --git a/Open-ILS/web/js/dojo/openils/editors.js b/Open-ILS/web/js/dojo/openils/editors.js index ca3a1d1284..56ebb9c4b0 100644 --- a/Open-ILS/web/js/dojo/openils/editors.js +++ b/Open-ILS/web/js/dojo/openils/editors.js @@ -17,47 +17,47 @@ dojo.declare("openils.editors.NumberSpinner", dojox.grid.editors.Dijit, { editorClass: "dijit.form.NumberSpinner", getvalue: function() { - var e = this.editor; - // make sure to apply the displayed value - e.setDisplayedValue(e.getDisplayedValue()); - return e.getValue(); + var e = this.editor; + // make sure to apply the displayed value + e.setDisplayedValue(e.getDisplayedValue()); + return e.getValue(); }, getEditorProps: function(inDatum){ - return dojo.mixin({}, this.cell.editorProps||{}, { - constraints: dojo.mixin({}, this.cell.constraints) || {}, - value: inDatum - }); + return dojo.mixin({}, this.cell.editorProps||{}, { + constraints: dojo.mixin({}, this.cell.constraints) || {}, + value: inDatum + }); }, }); dojo.declare('openils.editors.FundSelectEditor', dojox.grid.editors.Dijit, { editorClass: "openils.widget.FundSelector", createEditor: function(inNode, inDatum, inRowIndex) { - var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); - openils.acq.Fund.buildPermFundSelector(this.cell.perm || this.perm, - editor); - return editor; + var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); + openils.acq.Fund.buildPermFundSelector(this.cell.perm || this.perm, + editor); + return editor; }, }); dojo.declare('openils.editors.ProviderSelectEditor', dojox.grid.editors.Dijit, { editorClass: "openils.widget.ProviderSelector", createEditor: function(inNode, inDatum, inRowIndex) { - var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); - openils.acq.Provider.buildPermProviderSelector(this.cell.perm || this.perm, - editor); - return editor; + var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); + openils.acq.Provider.buildPermProviderSelector(this.cell.perm || this.perm, + editor); + return editor; }, }); dojo.declare('openils.editors.OrgUnitSelectEditor', dojox.grid.editors.Dijit, { editorClass: "openils.widget.OrgUnitFilteringSelect", createEditor: function(inNode, inDatum, inRowIndex) { - var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); - new openils.User().buildPermOrgSelector(this.cell.perm || this.perm, editor); - editor.setValue(inDatum); - return editor; + var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); + new openils.User().buildPermOrgSelector(this.cell.perm || this.perm, editor); + editor.setValue(inDatum); + return editor; }, }); @@ -65,7 +65,7 @@ dojo.declare('openils.editors.CopyLocationSelectEditor', dojox.grid.editors.Diji editorClass: "dijit.form.FilteringSelect", createEditor: function(inNode, inDatum, inRowIndex) { dojo.require('openils.CopyLocation'); - var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); + var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); openils.CopyLocation.createStore(1, /* XXX how do we propagate arguments to the editor?? */ function(store) { editor.store = new dojo.data.ItemFileReadStore({data:store}); @@ -74,7 +74,7 @@ dojo.declare('openils.editors.CopyLocationSelectEditor', dojox.grid.editors.Diji editor.setValue(inDatum); } ); - return editor; + return editor; }, }); diff --git a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js index c1978605e0..f0ba84bb96 100644 --- a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js +++ b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js @@ -1,20 +1,20 @@ { - "CREATE_MFHD": "Add MFHD Record", - "CREATED_MFHD_RECORD": "Created MFHD record for ${0}", - "DELETE_MFHD": "Delete Record", - "DELETED_MFHD_RECORD": "Deleted MFHD record ${0}", - "EDIT_MFHD_RECORD": "Edit Record", - "EDIT_MFHD_MENU": "Edit Holdings", - "EDIT_PROPERTIES": "Edit Propeties", - "HOLDINGS": "Previous volumes", - "INDEXES": "Previous indexes", - "CURRENT_HOLDINGS": "Current volume", - "CURRENT_INDEXES": "Current indexes", - "CURRENT_SUPPLEMENTS": "Current supplements", - "HOLDINGS_TABLE_CAPTION": "Holdings summary (${0})", - "INCOMPLETE_VOLUMES": "Incomplete volumes", - "MISSING_VOLUMES": "Missing volumes", - "ONLINE_VOLUMES": "Online volumes", - "SAVE_MFHD_LABEL": "Save MFHD", - "SUPPLEMENTS": "Previous supplements" + "CREATE_MFHD": "Add MFHD Record", + "CREATED_MFHD_RECORD": "Created MFHD record for ${0}", + "DELETE_MFHD": "Delete Record", + "DELETED_MFHD_RECORD": "Deleted MFHD record ${0}", + "EDIT_MFHD_RECORD": "Edit Record", + "EDIT_MFHD_MENU": "Edit Holdings", + "EDIT_PROPERTIES": "Edit Propeties", + "HOLDINGS": "Previous volumes", + "INDEXES": "Previous indexes", + "CURRENT_HOLDINGS": "Current volume", + "CURRENT_INDEXES": "Current indexes", + "CURRENT_SUPPLEMENTS": "Current supplements", + "HOLDINGS_TABLE_CAPTION": "Holdings summary (${0})", + "INCOMPLETE_VOLUMES": "Incomplete volumes", + "MISSING_VOLUMES": "Missing volumes", + "ONLINE_VOLUMES": "Online volumes", + "SAVE_MFHD_LABEL": "Save MFHD", + "SUPPLEMENTS": "Previous supplements" } diff --git a/Open-ILS/web/js/dojo/openils/reports/nls/reports.js b/Open-ILS/web/js/dojo/openils/reports/nls/reports.js index f9b72e551a..d242885b8f 100644 --- a/Open-ILS/web/js/dojo/openils/reports/nls/reports.js +++ b/Open-ILS/web/js/dojo/openils/reports/nls/reports.js @@ -1,166 +1,166 @@ { - "RPT_BUILDER_CONFIRM_SAVE": "Name : ${0}\nDescription: ${1}\nSave Template?", + "RPT_BUILDER_CONFIRM_SAVE": "Name : ${0}\nDescription: ${1}\nSave Template?", "LINK_NULLABLE_DEFAULT": "Default", "LINK_NULLABLE_RIGHT": "Parent", "LINK_NULLABLE_LEFT": "Child", "LINK_NULLABLE_NONE": "None", - - "FILTERS_LABEL_EQUALS":"Equals", - "FILTERS_LABEL_LIKE": "Contains Matching substring", - "FILTERS_LABEL_ILIKE": "Contains Matching substring (ignore case)", - "FILTERS_LABEL_GREATER_THAN": "Greater than", - "FILTERS_LABEL_GT_TIME": "After (Date/Time)", - "FILTERS_LABEL_GT_EQUAL": "Greater than or equal to", - "FILTERS_LABEL_GTE_TIME": "On or After (Date/Time)", - "FILTERS_LABEL_LESS_THAN": "Less than", - "FILTERS_LABEL_LT_TIME": "Before (Date/Time)", - "FILTERS_LABEL_LT_EQUAL": "Less than or equal to", - "FILTERS_LABEL_LSE_TIME": "On or Before (Date/Time)", - "FILTERS_LABEL_IN": "In list", - "FILTERS_LABEL_NOT_IN": "Not in list", - "FILTERS_LABEL_BETWEEN": "Between", - "FILTERS_LABEL_NOT_BETWEEN": "Not between", - "FILTERS_LABEL_NULL": "Is NULL", - "FILTERS_LABEL_NOT_NULL": "Is not NULL", - "FILTERS_LABEL_NULL_BLANK": "Is NULL or Blank", - "FILTERS_LABEL_NOT_NULL_BLANK": "Is not NULL or Blank", - - "FOLDERS_TEMPLATES": "Templates", - "FOLDERS_TEMPLATE": "Template", - "FOLDERS_REPORTS": "Reports", - "FOLDERS_REPORT": "Report", - "FOLDERS_OUTPUT": "Output", - - "FOLDER_WINDOW_SELECT_ITEM": "Please select an item from the list", - "FOLDER_WINDOW_CHANGE_FOLDERS": "Change Folders", - "FOLDER_WINDOW_REPORT_OUTPUT": "Report Output: ${0}", - "FOLDER_WINDOW_COLNAME_SELECT": "Select", - "FOLDER_WINDOW_COLNAME_ALL": "All", - "FOLDER_WINDOW_COLNAME_NONE": "None", - - "REPORT_EDITOR_REPORT_FOLDERS": "Report Folders", - "REPORT_EDITOR_OUTPUT_FOLDERS": "Output Folders", - "REPORT_EDITOR_PROVIDE_FOLDER_ALERT": "Please provide a report folder", - "REPORT_EDITOR_ENTER_NAME_ALERT": "Please enter a report name", - "REPORT_EDITOR_INVALID_DATE_ALERT": "invalid start date - YYYY-MM-DD", - "REPORT_EDITOR_PROVIDE_OUTPUT_ALERT": "Please provide an output folder", - - "TFORMS_LABEL_RAW_DATA": "Raw Data", - "TFORMS_LABEL_FIRST": "First Value", - "TFORMS_LABEL_LAST": "Last Value", - "TFORMS_LABEL_COUNT": "Count", - "TFORMS_LABEL_COUNT_DISTINCT": "Count Distinct", - "TFORMS_LABEL_MIN": "Min", - "TFORMS_LABEL_MAX": "Max", - "TFORMS_LABEL_LOWER": "Lower case", - "TFORMS_LABEL_UPPER": "Upper case", - "TFORMS_LABEL_FIRST5": "First 5 characters (for US ZIP code)", - "TFORMS_LABEL_FIRST_WORD": "First contiguous non-space string", - "TFORMS_LABEL_DOW": "Day of Week", - "TFORMS_LABEL_DOM": "Day of Month", - "TFORMS_LABEL_DOY": "Day of Year", - "TFORMS_LABEL_WOY": "Week of Year", - "TFORMS_LABEL_MOY": "Month of Year", - "TFORMS_LABEL_QOY": "Quarter of Year", - "TFORMS_LABEL_HOD": "Hour of day", - "TFORMS_LABEL_DATE": "Date", - "TFORMS_LABEL_MONTH_TRUNC": "Year + Month", - "TFORMS_LABEL_YEAR_TRUNC": "Year", - "TFORMS_LABEL_HOUR_TRUNC": "Hour", - "TFORMS_LABEL_DAY_NAME": "Day Name", - "TFORMS_LABEL_MONTH_NAME": "Month Name'", - "TFORMS_LABEL_AGE": "Age", - "TFORMS_LABEL_MONTHS_AGO": "Months ago", - "TFORMS_LABEL_QUARTERS_AGO": "Quarters ago", - "TFORMS_LABEL_SUM": "Sum", - "TFORMS_LABEL_AVERAGE": "Average", - "TFORMS_LABEL_ROUND": "Round", - "TFORMS_LABEL_INT": "Drop trailing decimals", - - "WIDGET_DAYS": "Day(s)", - "WIDGET_MONTHS": "Month(s)", - "WIDGET_YEARS": "Year(s)", - "WIDGET_QUARTERS": "Quarter(s)", - "WIDGET_REAL_DATE": "Real Date", - "WIDGET_RELATIVE_DATE": "Relative Date", - - "OPERATORS_EQUALS": "Equals", - "OPERATORS_LIKE": "Contains Matching substring", - "OPERATORS_ILIKE": "Contains Matching substring (ignore case)", - "OPERATORS_GREATER_THAN": "Greater than", - "OPERATORS_GT_TIME": "After (Date/Time)", - "OPERATORS_GT_EQUAL": "Greater than or equal to", - "OPERATORS_GTE_TIME": "On or After (Date/Time)", - "OPERATORS_LESS_THAN": "Less than", - "OPERATORS_LT_TIME": "Before (Date/Time)", - "OPERATORS_LT_EQUAL": "Less than or equal to", - "OPERATORS_LTE_TIME": "On or Before (Date/Time)", - "OPERATORS_IN_LIST": "In list", - "OPERATORS_NOT_IN_LIST": "Not in list", - "OPERATORS_BETWEEN": "Between", - "OPERATORS_NOT_BETWEEN": "Not between", - "OPERATORS_IS_NULL": "Is NULL", - "OPERATORS_IS_NOT_NULL": "Is not NULL", - "OPERATORS_NULL_BLANK": "Is NULL or Blank", - "OPERATORS_NOT_NULL_BLANK": "Is not NULL or Blank", - - "SOURCE_BROWSE_AGGREGATE": "Aggregate", - "SOURCE_BROWSE_NON_AGGREGATE": "Non-Aggregate", - - "SOURCE_SETUP_CONFIRM_EXIT": "You have started building a template!\n Selecting a new starting source will destroy the current template and start over. Is this OK?", - "SOURCE_SETUP_CORE_SOURCES": "Core Sources", - "SOURCE_SETUP_ALL_AVAIL_SOURCES": "All Available Sources", - - "TEMPLATE_CONF_BARE": "Bare", - "TEMPLATE_CONF_RAW_DATA": "Raw Data", - "TEMPLATE_CONF_EQUALS": "Equals", - "TEMPLATE_CONF_CONFIRM_RESET": "You have already added the [${0}] field\nfrom the [${1}] source. Click OK if you\nwould like to reset this field.", - "TEMPLATE_CONF_PROMPT_CHANGE": "Change the column header to: ${0}", - "TEMPLATE_CONF_BOOLEAN_VALUE": "Boolean Value", - "TEMPLATE_CONF_SELECT_CANCEL": "Select the value, or cancel:", - "TEMPLATE_CONF_TRUE": "True", - "TEMPLATE_CONF_FALSE": "False", - "TEMPLATE_CONF_CONFIRM_STATE": "Click OK for TRUE and Cancel for FALSE.", - "TEMPLATE_CONF_NO_MATCH": "Field does not match one of list (comma separated):", - "TEMPLATE_CONF_NOT_BETWEEN": "Field value is not between (comma separated):", - "TEMPLATE_CONF_BETWEEN": "Field value is between (comma separated):", - "TEMPLATE_CONF_NOT_IN": "Field does not match one of list (comma separated):", - "TEMPLATE_CONF_IN": "Field matches one of list (comma separated):", - "TEMPLATE_CONF_DEFAULT": "Value ${0}:", - "TEMPLATE_CONF_CONFIRM_SAVE": "Name : ${0}\nDescription: ${1}\nSave Template?", - "TEMPLATE_CONF_SUCCESS_SAVE": "Template ${0} was successfully saved.", - - "TRANSFORMS_BARE": "Raw Data", - "TRANSFORMS_FIRST": "First Value", - "TRANSFORMS_LAST": "Last Value", - "TRANSFORMS_COUNT": "Count", - "TRANSFORMS_COUNT_DISTINCT": "Count Distinct", - "TRANSFORMS_MIN": "Min", - "TRANSFORMS_MAX": "Max", - "TRANSFORMS_SUBSTRING": "Substring", - "TRANSFORMS_LOWER": "Lower case", - "TRANSFORMS_UPPER": "Upper case", - "TRANSFORMS_FIRST5": "First 5 characters (for US ZIP code)", - "TRANSFORMS_FIRST_WORD": "First contiguous non-space string", - "TRANSFORMS_DOW": "Day of Week", - "TRANSFORMS_DOM": "Day of Month", - "TRANSFORMS_DOY": "Day of Year", - "TRANSFORMS_WOY": "Week of Year", - "TRANSFORMS_MOY": "Month of Year", - "TRANSFORMS_QOY": "Quarter of Year", - "TRANSFORMS_HOD": "Hour of day", - "TRANSFORMS_DATE": "Date", - "TRANSFORMS_MONTH_TRUNC": "Year + Month", - "TRANSFORMS_YEAR_TRUNC": "Year", - "TRANSFORMS_HOUR_TRUNC": "Hour", - "TRANSFORMS_DAY_NAME": "Day Name", - "TRANSFORMS_MONTH_NAME": "Month Name", - "TRANSFORMS_AGE": "Age", - "TRANSFORMS_MONTHS_AGO": "Months ago", - "TRANSFORMS_QUARTERS_AGO": "Quarters ago", - "TRANSFORMS_SUM": "Sum", - "TRANSFORMS_AVERAGE": "Average", - "TRANSFORMS_ROUND": "Round", - "TRANSFORMS_INT": "Drop trailing decimals" + + "FILTERS_LABEL_EQUALS":"Equals", + "FILTERS_LABEL_LIKE": "Contains Matching substring", + "FILTERS_LABEL_ILIKE": "Contains Matching substring (ignore case)", + "FILTERS_LABEL_GREATER_THAN": "Greater than", + "FILTERS_LABEL_GT_TIME": "After (Date/Time)", + "FILTERS_LABEL_GT_EQUAL": "Greater than or equal to", + "FILTERS_LABEL_GTE_TIME": "On or After (Date/Time)", + "FILTERS_LABEL_LESS_THAN": "Less than", + "FILTERS_LABEL_LT_TIME": "Before (Date/Time)", + "FILTERS_LABEL_LT_EQUAL": "Less than or equal to", + "FILTERS_LABEL_LSE_TIME": "On or Before (Date/Time)", + "FILTERS_LABEL_IN": "In list", + "FILTERS_LABEL_NOT_IN": "Not in list", + "FILTERS_LABEL_BETWEEN": "Between", + "FILTERS_LABEL_NOT_BETWEEN": "Not between", + "FILTERS_LABEL_NULL": "Is NULL", + "FILTERS_LABEL_NOT_NULL": "Is not NULL", + "FILTERS_LABEL_NULL_BLANK": "Is NULL or Blank", + "FILTERS_LABEL_NOT_NULL_BLANK": "Is not NULL or Blank", + + "FOLDERS_TEMPLATES": "Templates", + "FOLDERS_TEMPLATE": "Template", + "FOLDERS_REPORTS": "Reports", + "FOLDERS_REPORT": "Report", + "FOLDERS_OUTPUT": "Output", + + "FOLDER_WINDOW_SELECT_ITEM": "Please select an item from the list", + "FOLDER_WINDOW_CHANGE_FOLDERS": "Change Folders", + "FOLDER_WINDOW_REPORT_OUTPUT": "Report Output: ${0}", + "FOLDER_WINDOW_COLNAME_SELECT": "Select", + "FOLDER_WINDOW_COLNAME_ALL": "All", + "FOLDER_WINDOW_COLNAME_NONE": "None", + + "REPORT_EDITOR_REPORT_FOLDERS": "Report Folders", + "REPORT_EDITOR_OUTPUT_FOLDERS": "Output Folders", + "REPORT_EDITOR_PROVIDE_FOLDER_ALERT": "Please provide a report folder", + "REPORT_EDITOR_ENTER_NAME_ALERT": "Please enter a report name", + "REPORT_EDITOR_INVALID_DATE_ALERT": "invalid start date - YYYY-MM-DD", + "REPORT_EDITOR_PROVIDE_OUTPUT_ALERT": "Please provide an output folder", + + "TFORMS_LABEL_RAW_DATA": "Raw Data", + "TFORMS_LABEL_FIRST": "First Value", + "TFORMS_LABEL_LAST": "Last Value", + "TFORMS_LABEL_COUNT": "Count", + "TFORMS_LABEL_COUNT_DISTINCT": "Count Distinct", + "TFORMS_LABEL_MIN": "Min", + "TFORMS_LABEL_MAX": "Max", + "TFORMS_LABEL_LOWER": "Lower case", + "TFORMS_LABEL_UPPER": "Upper case", + "TFORMS_LABEL_FIRST5": "First 5 characters (for US ZIP code)", + "TFORMS_LABEL_FIRST_WORD": "First contiguous non-space string", + "TFORMS_LABEL_DOW": "Day of Week", + "TFORMS_LABEL_DOM": "Day of Month", + "TFORMS_LABEL_DOY": "Day of Year", + "TFORMS_LABEL_WOY": "Week of Year", + "TFORMS_LABEL_MOY": "Month of Year", + "TFORMS_LABEL_QOY": "Quarter of Year", + "TFORMS_LABEL_HOD": "Hour of day", + "TFORMS_LABEL_DATE": "Date", + "TFORMS_LABEL_MONTH_TRUNC": "Year + Month", + "TFORMS_LABEL_YEAR_TRUNC": "Year", + "TFORMS_LABEL_HOUR_TRUNC": "Hour", + "TFORMS_LABEL_DAY_NAME": "Day Name", + "TFORMS_LABEL_MONTH_NAME": "Month Name'", + "TFORMS_LABEL_AGE": "Age", + "TFORMS_LABEL_MONTHS_AGO": "Months ago", + "TFORMS_LABEL_QUARTERS_AGO": "Quarters ago", + "TFORMS_LABEL_SUM": "Sum", + "TFORMS_LABEL_AVERAGE": "Average", + "TFORMS_LABEL_ROUND": "Round", + "TFORMS_LABEL_INT": "Drop trailing decimals", + + "WIDGET_DAYS": "Day(s)", + "WIDGET_MONTHS": "Month(s)", + "WIDGET_YEARS": "Year(s)", + "WIDGET_QUARTERS": "Quarter(s)", + "WIDGET_REAL_DATE": "Real Date", + "WIDGET_RELATIVE_DATE": "Relative Date", + + "OPERATORS_EQUALS": "Equals", + "OPERATORS_LIKE": "Contains Matching substring", + "OPERATORS_ILIKE": "Contains Matching substring (ignore case)", + "OPERATORS_GREATER_THAN": "Greater than", + "OPERATORS_GT_TIME": "After (Date/Time)", + "OPERATORS_GT_EQUAL": "Greater than or equal to", + "OPERATORS_GTE_TIME": "On or After (Date/Time)", + "OPERATORS_LESS_THAN": "Less than", + "OPERATORS_LT_TIME": "Before (Date/Time)", + "OPERATORS_LT_EQUAL": "Less than or equal to", + "OPERATORS_LTE_TIME": "On or Before (Date/Time)", + "OPERATORS_IN_LIST": "In list", + "OPERATORS_NOT_IN_LIST": "Not in list", + "OPERATORS_BETWEEN": "Between", + "OPERATORS_NOT_BETWEEN": "Not between", + "OPERATORS_IS_NULL": "Is NULL", + "OPERATORS_IS_NOT_NULL": "Is not NULL", + "OPERATORS_NULL_BLANK": "Is NULL or Blank", + "OPERATORS_NOT_NULL_BLANK": "Is not NULL or Blank", + + "SOURCE_BROWSE_AGGREGATE": "Aggregate", + "SOURCE_BROWSE_NON_AGGREGATE": "Non-Aggregate", + + "SOURCE_SETUP_CONFIRM_EXIT": "You have started building a template!\n Selecting a new starting source will destroy the current template and start over. Is this OK?", + "SOURCE_SETUP_CORE_SOURCES": "Core Sources", + "SOURCE_SETUP_ALL_AVAIL_SOURCES": "All Available Sources", + + "TEMPLATE_CONF_BARE": "Bare", + "TEMPLATE_CONF_RAW_DATA": "Raw Data", + "TEMPLATE_CONF_EQUALS": "Equals", + "TEMPLATE_CONF_CONFIRM_RESET": "You have already added the [${0}] field\nfrom the [${1}] source. Click OK if you\nwould like to reset this field.", + "TEMPLATE_CONF_PROMPT_CHANGE": "Change the column header to: ${0}", + "TEMPLATE_CONF_BOOLEAN_VALUE": "Boolean Value", + "TEMPLATE_CONF_SELECT_CANCEL": "Select the value, or cancel:", + "TEMPLATE_CONF_TRUE": "True", + "TEMPLATE_CONF_FALSE": "False", + "TEMPLATE_CONF_CONFIRM_STATE": "Click OK for TRUE and Cancel for FALSE.", + "TEMPLATE_CONF_NO_MATCH": "Field does not match one of list (comma separated):", + "TEMPLATE_CONF_NOT_BETWEEN": "Field value is not between (comma separated):", + "TEMPLATE_CONF_BETWEEN": "Field value is between (comma separated):", + "TEMPLATE_CONF_NOT_IN": "Field does not match one of list (comma separated):", + "TEMPLATE_CONF_IN": "Field matches one of list (comma separated):", + "TEMPLATE_CONF_DEFAULT": "Value ${0}:", + "TEMPLATE_CONF_CONFIRM_SAVE": "Name : ${0}\nDescription: ${1}\nSave Template?", + "TEMPLATE_CONF_SUCCESS_SAVE": "Template ${0} was successfully saved.", + + "TRANSFORMS_BARE": "Raw Data", + "TRANSFORMS_FIRST": "First Value", + "TRANSFORMS_LAST": "Last Value", + "TRANSFORMS_COUNT": "Count", + "TRANSFORMS_COUNT_DISTINCT": "Count Distinct", + "TRANSFORMS_MIN": "Min", + "TRANSFORMS_MAX": "Max", + "TRANSFORMS_SUBSTRING": "Substring", + "TRANSFORMS_LOWER": "Lower case", + "TRANSFORMS_UPPER": "Upper case", + "TRANSFORMS_FIRST5": "First 5 characters (for US ZIP code)", + "TRANSFORMS_FIRST_WORD": "First contiguous non-space string", + "TRANSFORMS_DOW": "Day of Week", + "TRANSFORMS_DOM": "Day of Month", + "TRANSFORMS_DOY": "Day of Year", + "TRANSFORMS_WOY": "Week of Year", + "TRANSFORMS_MOY": "Month of Year", + "TRANSFORMS_QOY": "Quarter of Year", + "TRANSFORMS_HOD": "Hour of day", + "TRANSFORMS_DATE": "Date", + "TRANSFORMS_MONTH_TRUNC": "Year + Month", + "TRANSFORMS_YEAR_TRUNC": "Year", + "TRANSFORMS_HOUR_TRUNC": "Hour", + "TRANSFORMS_DAY_NAME": "Day Name", + "TRANSFORMS_MONTH_NAME": "Month Name", + "TRANSFORMS_AGE": "Age", + "TRANSFORMS_MONTHS_AGO": "Months ago", + "TRANSFORMS_QUARTERS_AGO": "Quarters ago", + "TRANSFORMS_SUM": "Sum", + "TRANSFORMS_AVERAGE": "Average", + "TRANSFORMS_ROUND": "Round", + "TRANSFORMS_INT": "Drop trailing decimals" } diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 1d56b17937..42bfa79470 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -4,7 +4,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { dojo.require('openils.User'); dojo.require('fieldmapper.IDL'); dojo.require('openils.PermaCrud'); - dojo.requireLocalization("openils.widget", "AutoFieldWidget"); + dojo.requireLocalization("openils.widget", "AutoFieldWidget"); dojo.declare('openils.widget.AutoFieldWidget', null, { diff --git a/Open-ILS/web/js/dojo/openils/widget/FundSelector.js b/Open-ILS/web/js/dojo/openils/widget/FundSelector.js index 38442cd494..0ed2622dd6 100644 --- a/Open-ILS/web/js/dojo/openils/widget/FundSelector.js +++ b/Open-ILS/web/js/dojo/openils/widget/FundSelector.js @@ -12,7 +12,7 @@ if(!dojo._hasResource["openils.widget.FundSelector"]){ */ dojo.declare( - "openils.widget.FundSelector", [dijit.form.FilteringSelect], - { - }); + "openils.widget.FundSelector", [dijit.form.FilteringSelect], + { + }); } diff --git a/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js b/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js index 460bf2b5d7..52e39fe522 100644 --- a/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js +++ b/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js @@ -12,9 +12,9 @@ if(!dojo._hasResource["openils.widget.ProviderSelector"]){ */ dojo.declare( - "openils.widget.ProviderSelector", [dijit.form.FilteringSelect], - { + "openils.widget.ProviderSelector", [dijit.form.FilteringSelect], + { labelAttr: 'code', searchAttr: 'code' - }); + }); } diff --git a/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js index 519c2ceeaa..24d2f2d8c9 100644 --- a/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js +++ b/Open-ILS/web/js/dojo/openils/widget/TranslatorPopup.js @@ -22,231 +22,231 @@ if(!dojo._hasResource["openils.widget.TranslatorPopup"]) { dojo.require("openils.I18N"); dojo.require("fieldmapper.dojoData"); dojo.require("DojoSRF"); - dojo.require("dojo.data.ItemFileWriteStore"); - dojo.require("dijit._Widget"); - dojo.require("dijit._Templated"); - dojo.require("dijit.layout.ContentPane"); - dojo.require("dijit.Dialog"); - dojo.require("dijit.form.Button"); - dojo.require("dijit.form.TextBox"); - dojo.require("dijit.form.FilteringSelect"); - dojo.require("dojox.jsonPath"); - dojo.requireLocalization("openils.widget", "TranslatorPopup"); + dojo.require("dojo.data.ItemFileWriteStore"); + dojo.require("dijit._Widget"); + dojo.require("dijit._Templated"); + dojo.require("dijit.layout.ContentPane"); + dojo.require("dijit.Dialog"); + dojo.require("dijit.form.Button"); + dojo.require("dijit.form.TextBox"); + dojo.require("dijit.form.FilteringSelect"); + dojo.require("dojox.jsonPath"); + dojo.requireLocalization("openils.widget", "TranslatorPopup"); dojo.declare( - 'openils.widget.TranslatorPopup', - [dijit._Widget, dijit._Templated], - { - - templateString : "
Translate
", - - widgetsInTemplate: true, - field : "", - targetObject : "", - unique : "", - - postMixInProperties : function () { - if (!this.unique) this.unique = openils.widget.TranslatorPopup._unique++; - }, - - postCreate : function () { - - dojo.connect(this.tooltipDialog, 'onOpen', this, 'renderTranslatorPopup'); - - this.nls = dojo.i18n.getLocalization("openils.widget", "TranslatorPopup"); - - this.translateLabelNode.setLabel(this.nls.translate); - - this.localeLabelNode.textContent = this.nls.locale; - this.translationLabelNode.textContent = this.nls.translation; - - this.createButtonNode.textContent = this.nls.create; - this.updateButtonNode.textContent = this.nls.update; - this.removeButtonNode.textContent = this.nls.remove; - }, - - renderTranslatorPopup : function () { - - var _trans_dijit = this; - - this._targetObject = dojox.jsonPath.query(window, '$.' + this.targetObject, {evalType:"RESULT"}); - - var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique); - - var trans_list = openils.I18N.getTranslations( this._targetObject, this.field ); - - var trans_template = dojo.query('.translation_tbody_template', node)[0]; - var trans_tbody = dojo.query('.translation_tbody', node)[0]; - - // Empty it - while (trans_tbody.lastChild) trans_tbody.removeChild( trans_tbody.lastChild ); - - for (var i in trans_list) { - if (!trans_list[i]) continue; - - var trans_obj = trans_list[i]; - var trans_id = trans_obj.id(); - - var trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); - trans_row.id = 'translation_row_' + trans_id; - - var old_dijit = dijit.byId('locale_' + trans_id); - if (old_dijit) old_dijit.destroy(); - - old_dijit = dijit.byId('translation_' + trans_id); - if (old_dijit) old_dijit.destroy(); - - dojo.query('.locale_combobox',trans_row).instantiate( - dijit.form.FilteringSelect, - { store:openils.I18N.localeStore, - searchAttr:'locale', - labelAttr:'label', - lowercase:false, - required:true, - id:'locale_' + trans_id, - value: trans_obj.translation(), - invalidMessage:'Specify locale as {languageCode}-{countryCode}, as in en-US', - regExp:'[a-z_]+' - } - ); - - dojo.query('.translation_textbox',trans_row).instantiate( - dijit.form.TextBox, - { required : true, - id:'translation_' + trans_id, - value: trans_obj.string() - } - ); - - dojo.query('.update_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( - dijit.form.Button, - { onClick : dojo.hitch( _trans_dijit, 'updateTranslation', trans_id) } - ); - - dojo.query('.delete_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( - dijit.form.Button, - { onClick : dojo.hitch( _trans_dijit, 'removeTranslation', trans_id) } - ); - - trans_tbody.appendChild( trans_row ); - - } - - old_dijit = dijit.byId('i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique); - if (old_dijit) old_dijit.destroy(); - - old_dijit = dijit.byId('i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique); - if (old_dijit) old_dijit.destroy(); - - trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); - - dojo.query('.locale_combobox',trans_row).instantiate( - dijit.form.FilteringSelect, - { store:openils.I18N.localeStore, - searchAttr:'locale', - labelAttr:'label', - id:'i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique, - lowercase:false, - required:true, - invalidMessage:'Specify locale as {languageCode}_{countryCode}, as in en-US', - regExp:'[a-z_]+' - } - ); - - dojo.query('.translation_textbox',trans_row).addClass('new_translation').instantiate( - dijit.form.TextBox, - { required : true, - id:'i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique - } - ); - - dojo.query('.create_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( - dijit.form.Button, - { onClick : dojo.hitch( _trans_dijit, 'createTranslation') } - ); - - trans_tbody.appendChild( trans_row ); - - }, - - updateTranslation : function (t) { - return this.changeTranslation('update',t); - }, - - removeTranslation : function (t) { - return this.changeTranslation('delete',t); - }, - - changeTranslation : function (method, trans_id) { - - var trans_obj = new i18n().fromHash({ - ischanged : method == 'update' ? 1 : 0, - isdeleted : method == 'delete' ? 1 : 0, - id : trans_id, - fq_field : this._targetObject.classname + '.' + this.field, - identity_value : this._targetObject[fieldmapper[this._targetObject.classname].Identifier](), - translation : dijit.byId('locale_' + trans_id).getValue(), - string : dijit.byId('translation_' + trans_id).getValue() - }); - - this.writeTranslation(method, trans_obj); - }, - - createTranslation : function () { - var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique); - - var trans_obj = new i18n().fromHash({ - isnew : 1, - fq_field : this._targetObject.classname + '.' + this.field, - identity_value : this._targetObject[fieldmapper[this._targetObject.classname].Identifier](), - translation : dijit.byId('i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique).getValue(), - string : dijit.byId('i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique).getValue() - }); - - this.writeTranslation('create', trans_obj); - }, - - writeTranslation : function (method, trans_obj) { - - var _trans_dijit = this; - - OpenSRF.CachedClientSession('open-ils.permacrud').request({ - method : 'open-ils.permacrud.' + method + '.i18n', - timeout: 10, - params : [ ses, trans_obj ], - onerror: function (r) { - //highlighter.editor_pane.red.play(); - if (status_update) status_update( 'Problem saving translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); - }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - //highlighter.editor_pane.green.play(); - if (status_update) status_update( 'Saved changes to translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); - - if (method == 'delete') { - dojo.NodeList(dojo.byId('translation_row_' + trans_obj.id())).orphan(); - } else if (method == 'create') { - var node = dojo.byId(_trans_dijit.field + '_translation_tooltip_' + _trans_dijit.unique); - dijit.byId('i18n_new_locale_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null); - dijit.byId('i18n_new_translation_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null); - _trans_dijit.renderTranslatorPopup(); - } - - } else { - //highlighter.editor_pane.red.play(); - if (status_update) status_update( 'Problem saving translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); - } - }, - }).send(); - } - - } - - ); - - openils.widget.TranslatorPopup._unique = 1; + 'openils.widget.TranslatorPopup', + [dijit._Widget, dijit._Templated], + { + + templateString : "
Translate
", + + widgetsInTemplate: true, + field : "", + targetObject : "", + unique : "", + + postMixInProperties : function () { + if (!this.unique) this.unique = openils.widget.TranslatorPopup._unique++; + }, + + postCreate : function () { + + dojo.connect(this.tooltipDialog, 'onOpen', this, 'renderTranslatorPopup'); + + this.nls = dojo.i18n.getLocalization("openils.widget", "TranslatorPopup"); + + this.translateLabelNode.setLabel(this.nls.translate); + + this.localeLabelNode.textContent = this.nls.locale; + this.translationLabelNode.textContent = this.nls.translation; + + this.createButtonNode.textContent = this.nls.create; + this.updateButtonNode.textContent = this.nls.update; + this.removeButtonNode.textContent = this.nls.remove; + }, + + renderTranslatorPopup : function () { + + var _trans_dijit = this; + + this._targetObject = dojox.jsonPath.query(window, '$.' + this.targetObject, {evalType:"RESULT"}); + + var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique); + + var trans_list = openils.I18N.getTranslations( this._targetObject, this.field ); + + var trans_template = dojo.query('.translation_tbody_template', node)[0]; + var trans_tbody = dojo.query('.translation_tbody', node)[0]; + + // Empty it + while (trans_tbody.lastChild) trans_tbody.removeChild( trans_tbody.lastChild ); + + for (var i in trans_list) { + if (!trans_list[i]) continue; + + var trans_obj = trans_list[i]; + var trans_id = trans_obj.id(); + + var trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); + trans_row.id = 'translation_row_' + trans_id; + + var old_dijit = dijit.byId('locale_' + trans_id); + if (old_dijit) old_dijit.destroy(); + + old_dijit = dijit.byId('translation_' + trans_id); + if (old_dijit) old_dijit.destroy(); + + dojo.query('.locale_combobox',trans_row).instantiate( + dijit.form.FilteringSelect, + { store:openils.I18N.localeStore, + searchAttr:'locale', + labelAttr:'label', + lowercase:false, + required:true, + id:'locale_' + trans_id, + value: trans_obj.translation(), + invalidMessage:'Specify locale as {languageCode}-{countryCode}, as in en-US', + regExp:'[a-z_]+' + } + ); + + dojo.query('.translation_textbox',trans_row).instantiate( + dijit.form.TextBox, + { required : true, + id:'translation_' + trans_id, + value: trans_obj.string() + } + ); + + dojo.query('.update_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( + dijit.form.Button, + { onClick : dojo.hitch( _trans_dijit, 'updateTranslation', trans_id) } + ); + + dojo.query('.delete_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( + dijit.form.Button, + { onClick : dojo.hitch( _trans_dijit, 'removeTranslation', trans_id) } + ); + + trans_tbody.appendChild( trans_row ); + + } + + old_dijit = dijit.byId('i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique); + if (old_dijit) old_dijit.destroy(); + + old_dijit = dijit.byId('i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique); + if (old_dijit) old_dijit.destroy(); + + trans_row = dojo.query('tr',trans_template)[0].cloneNode(true); + + dojo.query('.locale_combobox',trans_row).instantiate( + dijit.form.FilteringSelect, + { store:openils.I18N.localeStore, + searchAttr:'locale', + labelAttr:'label', + id:'i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique, + lowercase:false, + required:true, + invalidMessage:'Specify locale as {languageCode}_{countryCode}, as in en-US', + regExp:'[a-z_]+' + } + ); + + dojo.query('.translation_textbox',trans_row).addClass('new_translation').instantiate( + dijit.form.TextBox, + { required : true, + id:'i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique + } + ); + + dojo.query('.create_button',trans_row).style({ visibility : 'visible', display : 'inline'}).instantiate( + dijit.form.Button, + { onClick : dojo.hitch( _trans_dijit, 'createTranslation') } + ); + + trans_tbody.appendChild( trans_row ); + + }, + + updateTranslation : function (t) { + return this.changeTranslation('update',t); + }, + + removeTranslation : function (t) { + return this.changeTranslation('delete',t); + }, + + changeTranslation : function (method, trans_id) { + + var trans_obj = new i18n().fromHash({ + ischanged : method == 'update' ? 1 : 0, + isdeleted : method == 'delete' ? 1 : 0, + id : trans_id, + fq_field : this._targetObject.classname + '.' + this.field, + identity_value : this._targetObject[fieldmapper[this._targetObject.classname].Identifier](), + translation : dijit.byId('locale_' + trans_id).getValue(), + string : dijit.byId('translation_' + trans_id).getValue() + }); + + this.writeTranslation(method, trans_obj); + }, + + createTranslation : function () { + var node = dojo.byId(this.field + '_translation_tooltip_' + this.unique); + + var trans_obj = new i18n().fromHash({ + isnew : 1, + fq_field : this._targetObject.classname + '.' + this.field, + identity_value : this._targetObject[fieldmapper[this._targetObject.classname].Identifier](), + translation : dijit.byId('i18n_new_locale_' + this._targetObject.classname + '.' + this.field + this.unique).getValue(), + string : dijit.byId('i18n_new_translation_' + this._targetObject.classname + '.' + this.field + this.unique).getValue() + }); + + this.writeTranslation('create', trans_obj); + }, + + writeTranslation : function (method, trans_obj) { + + var _trans_dijit = this; + + OpenSRF.CachedClientSession('open-ils.permacrud').request({ + method : 'open-ils.permacrud.' + method + '.i18n', + timeout: 10, + params : [ ses, trans_obj ], + onerror: function (r) { + //highlighter.editor_pane.red.play(); + if (status_update) status_update( 'Problem saving translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + //highlighter.editor_pane.green.play(); + if (status_update) status_update( 'Saved changes to translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); + + if (method == 'delete') { + dojo.NodeList(dojo.byId('translation_row_' + trans_obj.id())).orphan(); + } else if (method == 'create') { + var node = dojo.byId(_trans_dijit.field + '_translation_tooltip_' + _trans_dijit.unique); + dijit.byId('i18n_new_locale_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null); + dijit.byId('i18n_new_translation_' + _trans_dijit._targetObject.classname + '.' + _trans_dijit.field + _trans_dijit.unique).setValue(null); + _trans_dijit.renderTranslatorPopup(); + } + + } else { + //highlighter.editor_pane.red.play(); + if (status_update) status_update( 'Problem saving translation for ' + _trans_dijit._targetObject[_trans_dijit.field]() ); + } + }, + }).send(); + } + + } + + ); + + openils.widget.TranslatorPopup._unique = 1; diff --git a/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js index 7fc07a47bd..78f3235a17 100644 --- a/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js +++ b/Open-ILS/web/js/dojo/openils/widget/nls/TranslatorPopup.js @@ -1,8 +1,8 @@ ({ - locale : 'Locale', - translation : 'Translation', - translate : 'Translate', - create : 'Create', - update : 'Update', - remove : 'Remove' + locale : 'Locale', + translation : 'Translation', + translate : 'Translate', + create : 'Create', + update : 'Update', + remove : 'Remove' }) diff --git a/Open-ILS/web/js/dojo/openils/widget/nls/es/TranslatorPopup.js b/Open-ILS/web/js/dojo/openils/widget/nls/es/TranslatorPopup.js index b976c60395..77971701af 100644 --- a/Open-ILS/web/js/dojo/openils/widget/nls/es/TranslatorPopup.js +++ b/Open-ILS/web/js/dojo/openils/widget/nls/es/TranslatorPopup.js @@ -1,8 +1,8 @@ ({ - locale : 'Escena', - translation : 'Traduccion', - translate : 'Traducir', - create : 'Crear', - update : 'Actualizacion', - remove : 'Quitar' + locale : 'Escena', + translation : 'Traduccion', + translate : 'Traducir', + create : 'Crear', + update : 'Actualizacion', + remove : 'Quitar' }) diff --git a/Open-ILS/web/js/ui/default/acq/common/jubgrid.js b/Open-ILS/web/js/ui/default/acq/common/jubgrid.js index 6a0c451aef..23527db43b 100644 --- a/Open-ILS/web/js/ui/default/acq/common/jubgrid.js +++ b/Open-ILS/web/js/ui/default/acq/common/jubgrid.js @@ -57,7 +57,7 @@ var JUBGrid = { getJUBEstimatedPrice : function(rowIndex) { var data = JUBGrid.jubGrid.model.getRow(rowIndex); if (!data) return ''; - var price = new openils.acq.Lineitem( + var price = new openils.acq.Lineitem( {lineitem:JUBGrid.getLi(data.id)}).getEstimatedPrice(); if(price) return price.price; return '' @@ -204,15 +204,15 @@ var JUBGrid = { var deleted = false; for(var i = 0; i < selected.length; i++) { var rowIdx = selected[i]; - var jubid = JUBGrid.jubGrid.model.getRow(rowIdx).id; + var jubid = JUBGrid.jubGrid.model.getRow(rowIdx).id; if(jubid == id) { - if (lineitems[id].state() == 'new') { - deleteMe.push(lineitems[id]); - deleted = true; - } else { - alert("Can not delete line item "+id+ - ": item is "+lineitems[id].state()); - } + if (lineitems[id].state() == 'new') { + deleteMe.push(lineitems[id]); + deleted = true; + } else { + alert("Can not delete line item "+id+ + ": item is "+lineitems[id].state()); + } } } if(!deleted) @@ -229,36 +229,36 @@ var JUBGrid = { }, deleteLID: function(evt) { - var list =[]; - var selected = JUBGrid.jubDetailGrid.selection.getSelected(); - for (var idx = 0; idx < selected.length; idx++) { - var rowIdx = selected[idx]; - var lid = JUBGrid.jubDetailGrid.model.getRow(rowIdx); - var deleteFromStore = function (evt) { - - if (evt) { - // something bad happened - alert("Error: "+evt.desc); - } else { - var deleteItem = function(item, rq) { - JUBGrid.jubDetailGrid.model.store.deleteItem(item); - }; - var updateCount = function(item) { - var newval = JUBGrid.jubGrid.model.store.getValue(item, "item_count"); - JUBGrid.jubGrid.model.store.setValue(item, "item_count", newval-1); - JUBGrid.jubGrid.update(); - }; - - JUBGrid.jubDetailGrid.model.store.fetch({query:{id:lid.id}, - onItem: deleteItem}); - JUBGrid.jubGrid.model.store.fetch({query:{id:JUBGrid.jubDetailGrid.lineitemID}, - onItem: updateCount}); - } - JUBGrid.jubDetailGrid.update(); - }; - - openils.acq.Lineitem.deleteLID(lid.id, deleteFromStore); - } + var list =[]; + var selected = JUBGrid.jubDetailGrid.selection.getSelected(); + for (var idx = 0; idx < selected.length; idx++) { + var rowIdx = selected[idx]; + var lid = JUBGrid.jubDetailGrid.model.getRow(rowIdx); + var deleteFromStore = function (evt) { + + if (evt) { + // something bad happened + alert("Error: "+evt.desc); + } else { + var deleteItem = function(item, rq) { + JUBGrid.jubDetailGrid.model.store.deleteItem(item); + }; + var updateCount = function(item) { + var newval = JUBGrid.jubGrid.model.store.getValue(item, "item_count"); + JUBGrid.jubGrid.model.store.setValue(item, "item_count", newval-1); + JUBGrid.jubGrid.update(); + }; + + JUBGrid.jubDetailGrid.model.store.fetch({query:{id:lid.id}, + onItem: deleteItem}); + JUBGrid.jubGrid.model.store.fetch({query:{id:JUBGrid.jubDetailGrid.lineitemID}, + onItem: updateCount}); + } + JUBGrid.jubDetailGrid.update(); + }; + + openils.acq.Lineitem.deleteLID(lid.id, deleteFromStore); + } }, createLID: function(fields) { @@ -273,11 +273,11 @@ var JUBGrid = { }, receiveLID: function(evt) { - var list =[]; - var selected = JUBGrid.jubDetailGrid.selection.getSelected(); - for (var idx = 0; idx < selected.length; idx++) { - var rowIdx = selected[idx]; - var lid = JUBGrid.jubDetailGrid.model.getRow(rowIdx); + var list =[]; + var selected = JUBGrid.jubDetailGrid.selection.getSelected(); + for (var idx = 0; idx < selected.length; idx++) { + var rowIdx = selected[idx]; + var lid = JUBGrid.jubDetailGrid.model.getRow(rowIdx); list.push(lid.id); } if(lid != null) { // is at least one selected? diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 3fa3643e2e..6269862c20 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -443,10 +443,10 @@ function AcqLiTable() { if(openils.XUL.isXUL()) { var makeRecTab = function() { - xulG.new_tab( + xulG.new_tab( XUL_OPAC_WRAPPER, - {tab_name: localeStrings.XUL_RECORD_DETAIL_PAGE, browser:false}, - { + {tab_name: localeStrings.XUL_RECORD_DETAIL_PAGE, browser:false}, + { no_xulG : false, show_nav_buttons : true, show_print_button : true, diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 3dffc85873..29007d7ced 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -48,14 +48,14 @@ function load() { var userId = cgi.param('usr'); if(xulG) { - if(xulG.ses) openils.User.authtoken = xulG.ses; - if(xulG.clone !== null) cloneUser = xulG.clone; + if(xulG.ses) openils.User.authtoken = xulG.ses; + if(xulG.clone !== null) cloneUser = xulG.clone; if(xulG.usr !== null) userId = xulG.usr if(xulG.params) { var parms = xulG.params; - if(parms.ses) + if(parms.ses) openils.User.authtoken = parms.ses; - if(parms.clone) + if(parms.clone) cloneUser = parms.clone; if(parms.usr !== null) userId = parms.usr @@ -630,22 +630,22 @@ function uEditFinishSave(newPatron, doClone) { if(doClone &&cloneUser == null) cloneUser = newPatron.id(); - if( doClone ) { + if( doClone ) { - if(xulG && typeof xulG.spawn_editor == 'function' && !patron.isnew() ) { + if(xulG && typeof xulG.spawn_editor == 'function' && !patron.isnew() ) { window.xulG.spawn_editor({ses:openils.User.authtoken,clone:cloneUser}); uEditRefresh(); - } else { - location.href = href.replace(/\?.*/, '') + '?clone=' + cloneUser; - } + } else { + location.href = href.replace(/\?.*/, '') + '?clone=' + cloneUser; + } - } else { + } else { - uEditRefresh(); - } + uEditRefresh(); + } - uEditRefreshXUL(newPatron); + uEditRefreshXUL(newPatron); } function uEditRefresh() { @@ -656,8 +656,8 @@ function uEditRefresh() { } function uEditRefreshXUL(newuser) { - if (window.xulG && typeof window.xulG.on_save == 'function') - window.xulG.on_save(newuser); + if (window.xulG && typeof window.xulG.on_save == 'function') + window.xulG.on_save(newuser); } @@ -748,11 +748,11 @@ function uEditApproveAddress(addr) { // remove the replaced address if(oldId != addr.id()) { - patron.addresses( + patron.addresses( patron.addresses().filter( - function(i) { return (i.id() != oldId); } - ) - ); + function(i) { return (i.id() != oldId); } + ) + ); } // fix the the new address diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 92e8981042..02d79ac647 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -282,7 +282,7 @@ function uploadMARC(onload){ onload(content); } }); -} +} /** * Creates a new vandelay queue @@ -1006,9 +1006,9 @@ function vlLoadMarcEditor(type, recId, postReloadHTMLHandler) { // attribute-editor global variables -var ATTR_EDITOR_IN_UPDATE_MODE = false; // true on 'edit', false on 'create' -var ATTR_EDIT_ID = null; // id of current 'edit' attribute -var ATTR_EDIT_GROUP = 'bib'; // bib-attrs or auth-attrs +var ATTR_EDITOR_IN_UPDATE_MODE = false; // true on 'edit', false on 'create' +var ATTR_EDIT_ID = null; // id of current 'edit' attribute +var ATTR_EDIT_GROUP = 'bib'; // bib-attrs or auth-attrs function vlAttrEditorInit() { // set up tooltips on the edit form @@ -1025,8 +1025,8 @@ function vlShowAttrEditor() { function setAttrEditorGroup(groupName) { // put us into 'bib'-attr or 'auth'-attr mode. if (ATTR_EDIT_GROUP != groupName) { - ATTR_EDIT_GROUP = groupName; - loadAttrEditorGrid(); + ATTR_EDIT_GROUP = groupName; + loadAttrEditorGrid(); } } @@ -1035,14 +1035,14 @@ function onAttrEditorOpen() { var create_bar = document.getElementById('attr-editor-create-bar'); var update_bar = document.getElementById('attr-editor-update-bar'); if (ATTR_EDITOR_IN_UPDATE_MODE) { - update_bar.style.display='table-row'; - create_bar.style.display='none'; - // hide the dropdown-button - idStyle('vl-create-attr-editor-button', 'visibility', 'hidden'); + update_bar.style.display='table-row'; + create_bar.style.display='none'; + // hide the dropdown-button + idStyle('vl-create-attr-editor-button', 'visibility', 'hidden'); } else { - dijit.byId('attr-editor-dialog').reset(); - create_bar.style.display='table-row'; - update_bar.style.display='none'; + dijit.byId('attr-editor-dialog').reset(); + create_bar.style.display='table-row'; + update_bar.style.display='none'; } } @@ -1055,7 +1055,7 @@ function onAttrEditorClose() { function loadAttrEditorGrid() { var _data = (ATTR_EDIT_GROUP == 'auth') ? - vqarad.toStoreData(authAttrDefs) : vqbrad.toStoreData(bibAttrDefs) ; + vqarad.toStoreData(authAttrDefs) : vqbrad.toStoreData(bibAttrDefs) ; var store = new dojo.data.ItemFileReadStore({data:_data}); attrEditorGrid.setStore(store); @@ -1101,8 +1101,8 @@ function vlSaveAttrDefinition(data) { // this ought to honour custom xpaths, but overwrite xpaths // derived from tags/subfields. if (data.xpath == '' || looksLikeDerivedXpath(data.xpath)) { - var _xpath = tagAndSubFieldsToXpath(data.tag, data.subfield); - data.xpath = _xpath; + var _xpath = tagAndSubFieldsToXpath(data.tag, data.subfield); + data.xpath = _xpath; } // build up our permacrud params. Key variables here are @@ -1112,7 +1112,7 @@ function vlSaveAttrDefinition(data) { var isCreate = (ATTR_EDIT_ID == null); var rad = isAuth ? new vqarad() : new vqbrad() ; var method = 'open-ils.permacrud' + (isCreate ? '.create.' : '.update.') - + (isAuth ? 'vqarad' : 'vqbrad'); + + (isAuth ? 'vqarad' : 'vqbrad'); var _data = rad.fromStoreItem(data); _data.ischanged(1); @@ -1121,14 +1121,14 @@ function vlSaveAttrDefinition(data) { ['open-ils.permacrud', method], { async: true, params: [authtoken, _data ], - onresponse: function(r) { }, + onresponse: function(r) { }, oncomplete: function(r) { - attrEditorFetchAttrDefs(vlShowAttrEditor); - ATTR_EDIT_ID = null; - }, - onerror: function(r) { - alert('vlSaveAttrDefinition comms error: ' + r); - } + attrEditorFetchAttrDefs(vlShowAttrEditor); + ATTR_EDIT_ID = null; + }, + onerror: function(r) { + alert('vlSaveAttrDefinition comms error: ' + r); + } } ); } @@ -1148,15 +1148,15 @@ function vlAttrDelete() { fieldmapper.standardRequest( ['open-ils.permacrud', method], { async: true, - params: [authtoken, rad.fromHash({ id : ATTR_EDIT_ID }), ], - oncomplete: function() { - dijit.byId('attr-editor-dialog').onCancel(); // close the dialog - attrEditorFetchAttrDefs(vlShowAttrEditor); - ATTR_EDIT_ID = null; - }, - onerror: function(r) { - alert('vlAttrDelete comms error: ' + r); - } + params: [authtoken, rad.fromHash({ id : ATTR_EDIT_ID }), ], + oncomplete: function() { + dijit.byId('attr-editor-dialog').onCancel(); // close the dialog + attrEditorFetchAttrDefs(vlShowAttrEditor); + ATTR_EDIT_ID = null; + }, + onerror: function(r) { + alert('vlAttrDelete comms error: ' + r); + } } ); } @@ -1166,9 +1166,9 @@ function vlAttrDelete() { // dom utilities (maybe dojo does these, and these should be replaced) -function idStyle(obId, k, v) { document.getElementById(obId).style[k] = v; } -function idShow(obId) { idStyle(obId, 'display', 'block'); } -function idHide(obId) { idStyle(obId, 'display' , 'none'); } +function idStyle(obId, k, v) { document.getElementById(obId).style[k] = v; } +function idShow(obId) { idStyle(obId, 'display', 'block'); } +function idHide(obId) { idStyle(obId, 'display' , 'none'); } function connectTooltip(fieldId) { // Given an element id, look up a tooltip element in the doc (same @@ -1177,7 +1177,7 @@ function connectTooltip(fieldId) { var fld = dojo.byId(fieldId); var tip = dojo.byId(fieldId + '-tip'); dojo.connect(fld, 'onfocus', function(evt) { - dijit.showTooltip(tip.innerHTML, fld, ['below', 'after']); }); + dijit.showTooltip(tip.innerHTML, fld, ['below', 'after']); }); dojo.connect(fld, 'onblur', function(evt) { dijit.hideTooltip(fld); }); } @@ -1188,12 +1188,12 @@ var xpathParser = new openils.MarcXPathParser(); function tagAndSubFieldsToXpath(tags, subfields) { // given tags, and subfields, build up an XPath. try { - var parts = { - 'tags':tags.match(/[\d]+/g), - 'subfields':subfields.match(/[a-zA-z]/g) }; - return xpathParser.compile(parts); + var parts = { + 'tags':tags.match(/[\d]+/g), + 'subfields':subfields.match(/[a-zA-z]/g) }; + return xpathParser.compile(parts); } catch (err) { - return {'parts':null, 'tags':null, 'error':err}; + return {'parts':null, 'tags':null, 'error':err}; } } @@ -1201,11 +1201,11 @@ function looksLikeDerivedXpath(path) { // Does this path look like it was derived from tags and subfields? var parsed = xpathParser.parse(path); if (parsed.tags == null) - return false; + return false; var compiled = xpathParser.compile(parsed); return (path == compiled); } // amazing xpath-util unit-tests -if (!looksLikeDerivedXpath('//*[@tag="901"]/*[@code="c"]')) alert('vandelay xpath-utility error'); -if ( looksLikeDerivedXpath('ba-boo-ba-boo!')) alert('vandelay xpath-utility error'); +if (!looksLikeDerivedXpath('//*[@tag="901"]/*[@code="c"]')) alert('vandelay xpath-utility error'); +if ( looksLikeDerivedXpath('ba-boo-ba-boo!')) alert('vandelay xpath-utility error'); diff --git a/Open-ILS/web/opac/common/css/dtree.css b/Open-ILS/web/opac/common/css/dtree.css index b201c2fd60..ba5343ce5e 100644 --- a/Open-ILS/web/opac/common/css/dtree.css +++ b/Open-ILS/web/opac/common/css/dtree.css @@ -5,30 +5,30 @@ |--------------------------------------------------*/ .dtree { - font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; - font-size: 11px; - color: #666; - white-space: nowrap; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #666; + white-space: nowrap; } .dtree img { - border: 0px; - vertical-align: middle; + border: 0px; + vertical-align: middle; } .dtree a { - color: #333; - text-decoration: none; + color: #333; + text-decoration: none; } .dtree a.node, .dtree a.nodeSel { - white-space: nowrap; - padding: 1px 2px 1px 2px; + white-space: nowrap; + padding: 1px 2px 1px 2px; } .dtree a.node:hover, .dtree a.nodeSel:hover { - color: #333; - text-decoration: underline; + color: #333; + text-decoration: underline; } .dtree a.nodeSel { - background-color: #c0d2ec; + background-color: #c0d2ec; } .dtree .clip { - overflow: hidden; + overflow: hidden; } \ No newline at end of file diff --git a/Open-ILS/web/opac/common/css/largefont.css b/Open-ILS/web/opac/common/css/largefont.css index 18c86dde48..a4b6a80b97 100644 --- a/Open-ILS/web/opac/common/css/largefont.css +++ b/Open-ILS/web/opac/common/css/largefont.css @@ -1,5 +1,5 @@ -body { font-family: Helvetica, Arial, Tahoma, sans-serif; font-size: 1.5em; } -body table { font-size: inherit; } +body { font-family: Helvetica, Arial, Tahoma, sans-serif; font-size: 1.5em; } +body table { font-size: inherit; } .org_link { font-size: 92%; } .sidebar_extra_item { font-size: 95%; } diff --git a/Open-ILS/web/opac/common/css/mediumfont.css b/Open-ILS/web/opac/common/css/mediumfont.css index 925b0eeac4..22f163d443 100644 --- a/Open-ILS/web/opac/common/css/mediumfont.css +++ b/Open-ILS/web/opac/common/css/mediumfont.css @@ -3,8 +3,8 @@ table { font-size: 9pt; } table tr { font-size: 9pt; } table tr td { font-size: 9pt; } -body table tr td { font-size: inherit; } -/*body table tr td { font-size: 95%;}*/ +body table tr td { font-size: inherit; } +/*body table tr td { font-size: 95%;}*/ .org_link { font-size: 9pt; } .sidebar_extra_item { font-size: 9pt; } diff --git a/Open-ILS/web/opac/common/css/smallfont.css b/Open-ILS/web/opac/common/css/smallfont.css index 594aac12de..996969cf6a 100644 --- a/Open-ILS/web/opac/common/css/smallfont.css +++ b/Open-ILS/web/opac/common/css/smallfont.css @@ -1,5 +1,5 @@ -body { font-family: Helvetica, Arial, Tahoma, sans-serif; font-size: 50%; } -body table { font-size: inherit; } +body { font-family: Helvetica, Arial, Tahoma, sans-serif; font-size: 50%; } +body table { font-size: inherit; } .org_link { font-size: 92%; } .sidebar_extra_item { font-size: 95%; } diff --git a/Open-ILS/web/opac/common/js/CGI.js b/Open-ILS/web/opac/common/js/CGI.js index 28e9e6d26d..4d74b138e1 100644 --- a/Open-ILS/web/opac/common/js/CGI.js +++ b/Open-ILS/web/opac/common/js/CGI.js @@ -1,76 +1,76 @@ function CGI() { - /* load up the url parameters */ - - this._keys = new Array(); - this.data = new Object(); - - var string = location.search.replace(/^\?/,""); - this.server_name = location.href.replace(/^https?:\/\/([^\/]+).+$/,"$1"); - - var key = ""; - var value = ""; - var inkey = true; - var invalue = false; - - for( var idx = 0; idx!= string.length; idx++ ) { - - var c = string.charAt(idx); - - if( c == "=" ) { - invalue = true; - inkey = false; - continue; - } - - if(c == "&" || c == ";") { - inkey = 1; - invalue = 0; - if( ! this.data[key] ) this.data[key] = []; - this.data[key].push(decodeURIComponent(value)); - this._keys.push(key); - key = ""; value = ""; - continue; - } - - if(inkey) key += c; - else if(invalue) value += c; - } - - if( ! this.data[key] ) this.data[key] = []; - this.data[key].push(decodeURIComponent(value)); - this._keys.push(key); + /* load up the url parameters */ + + this._keys = new Array(); + this.data = new Object(); + + var string = location.search.replace(/^\?/,""); + this.server_name = location.href.replace(/^https?:\/\/([^\/]+).+$/,"$1"); + + var key = ""; + var value = ""; + var inkey = true; + var invalue = false; + + for( var idx = 0; idx!= string.length; idx++ ) { + + var c = string.charAt(idx); + + if( c == "=" ) { + invalue = true; + inkey = false; + continue; + } + + if(c == "&" || c == ";") { + inkey = 1; + invalue = 0; + if( ! this.data[key] ) this.data[key] = []; + this.data[key].push(decodeURIComponent(value)); + this._keys.push(key); + key = ""; value = ""; + continue; + } + + if(inkey) key += c; + else if(invalue) value += c; + } + + if( ! this.data[key] ) this.data[key] = []; + this.data[key].push(decodeURIComponent(value)); + this._keys.push(key); } /* returns the value for the given param. If there is only one value for the given param, it returns that value. Otherwise it returns an array of values */ CGI.prototype.param = function(p) { - if(this.data[p] == null) return null; - if(this.data[p].length == 1) - return this.data[p][0]; - return this.data[p]; + if(this.data[p] == null) return null; + if(this.data[p].length == 1) + return this.data[p][0]; + return this.data[p]; } /* returns an array of param names */ CGI.prototype.keys = function() { - return this._keys; + return this._keys; } /* debuggin method */ CGI.prototype.toString = function() { - var string = ""; - var keys = this.keys(); - - for( var k in keys ) { - string += keys[k] + " : "; - var params = this.param(keys[k]); - - for( var p in params ) { - string += params[p] + " "; - } - string += "\n"; - } - return string; + var string = ""; + var keys = this.keys(); + + for( var k in keys ) { + string += keys[k] + " : "; + var params = this.param(keys[k]); + + for( var p in params ) { + string += params[p] + " "; + } + string += "\n"; + } + return string; } diff --git a/Open-ILS/web/opac/common/js/Cookies.js b/Open-ILS/web/opac/common/js/Cookies.js index 21b8dc8e5e..7f071ab1bf 100644 --- a/Open-ILS/web/opac/common/js/Cookies.js +++ b/Open-ILS/web/opac/common/js/Cookies.js @@ -55,7 +55,7 @@ HTTP.Cookies.prototype.date = new HTTP.Cookies.Date; // date object instance HTTP.Cookies.prototype.read = function (name) { var value = ''; if(!this.JAR) { - this.JAR = {}; + this.JAR = {}; var array = document.cookie.split(';'); for (var x = 0; x < array.length; x++) { var pair = array[x].split('='); @@ -70,7 +70,7 @@ HTTP.Cookies.prototype.read = function (name) { if(cookie == name) { value = this.JAR[cookie]; } - } + } } return value ? unescape(value) : ''; } diff --git a/Open-ILS/web/opac/common/js/DP_DateExtensions.js b/Open-ILS/web/opac/common/js/DP_DateExtensions.js index db96365749..80dcaa1727 100644 --- a/Open-ILS/web/opac/common/js/DP_DateExtensions.js +++ b/Open-ILS/web/opac/common/js/DP_DateExtensions.js @@ -21,8 +21,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND CHANGES: -------------------------------------------------------------------------------- - 2008-07-26 / dscott@laurentian.ca - - Comment out Date.parseIso8601 as we move to Dojo + 2008-07-26 / dscott@laurentian.ca + - Comment out Date.parseIso8601 as we move to Dojo 2007-02-02 / billserickson@gmail.com - chopped out some utility methods to trim file size @@ -35,62 +35,62 @@ CHANGES: ----------------------------------------------------------------------- /* Date.parseIso8601 = function(CurDate) { - // Check the input parameters - if ( typeof CurDate != "string" ) { - return null; - }; - // Set the fragment expressions - var S = "[\\-/:.]"; - var Yr = "((?:1[6-9]|[2-9][0-9])[0-9]{2})"; - var Mo = S + "((?:1[012])|(?:0[1-9])|[1-9])"; - var Dy = S + "((?:3[01])|(?:[12][0-9])|(?:0[1-9])|[1-9])"; - var Hr = "(2[0-4]|[01]?[0-9])"; - var Mn = S + "([0-5]?[0-9])"; - var Sd = "(?:" + S + "([0-5]?[0-9])(?:[.,]([0-9]+))?)?"; - var TZ = "(?:(Z)|(?:([\+\-])(1[012]|[0]?[0-9])(?::?([0-5]?[0-9]))?))?"; - // RegEx the input - // First check: Just date parts (month and day are optional) - // Second check: Full date plus time (seconds, milliseconds and TimeZone info are optional) - var TF; - - if ( TF = new RegExp("^" + Yr + "(?:" + Mo + "(?:" + Dy + ")?)?" + "$").exec(CurDate) ) { + // Check the input parameters + if ( typeof CurDate != "string" ) { + return null; + }; + // Set the fragment expressions + var S = "[\\-/:.]"; + var Yr = "((?:1[6-9]|[2-9][0-9])[0-9]{2})"; + var Mo = S + "((?:1[012])|(?:0[1-9])|[1-9])"; + var Dy = S + "((?:3[01])|(?:[12][0-9])|(?:0[1-9])|[1-9])"; + var Hr = "(2[0-4]|[01]?[0-9])"; + var Mn = S + "([0-5]?[0-9])"; + var Sd = "(?:" + S + "([0-5]?[0-9])(?:[.,]([0-9]+))?)?"; + var TZ = "(?:(Z)|(?:([\+\-])(1[012]|[0]?[0-9])(?::?([0-5]?[0-9]))?))?"; + // RegEx the input + // First check: Just date parts (month and day are optional) + // Second check: Full date plus time (seconds, milliseconds and TimeZone info are optional) + var TF; + + if ( TF = new RegExp("^" + Yr + "(?:" + Mo + "(?:" + Dy + ")?)?" + "$").exec(CurDate) ) { } else if ( TF = new RegExp("^" + Yr + Mo + Dy + "[Tt ]" + Hr + Mn + Sd + TZ + "$").exec(CurDate) ) {}; - // If the date couldn't be parsed, return null - if ( !TF ) { return null }; - // Default the Time Fragments if they're not present - if ( !TF[2] ) { TF[2] = 1 } else { TF[2] = TF[2] - 1 }; - if ( !TF[3] ) { TF[3] = 1 }; - if ( !TF[4] ) { TF[4] = 0 }; - if ( !TF[5] ) { TF[5] = 0 }; - if ( !TF[6] ) { TF[6] = 0 }; - if ( !TF[7] ) { TF[7] = 0 }; - if ( !TF[8] ) { TF[8] = null }; - if ( TF[9] != "-" && TF[9] != "+" ) { TF[9] = null }; - if ( !TF[10] ) { TF[10] = 0 } else { TF[10] = TF[9] + TF[10] }; - if ( !TF[11] ) { TF[11] = 0 } else { TF[11] = TF[9] + TF[11] }; - // If there's no timezone info the data is local time + // If the date couldn't be parsed, return null + if ( !TF ) { return null }; + // Default the Time Fragments if they're not present + if ( !TF[2] ) { TF[2] = 1 } else { TF[2] = TF[2] - 1 }; + if ( !TF[3] ) { TF[3] = 1 }; + if ( !TF[4] ) { TF[4] = 0 }; + if ( !TF[5] ) { TF[5] = 0 }; + if ( !TF[6] ) { TF[6] = 0 }; + if ( !TF[7] ) { TF[7] = 0 }; + if ( !TF[8] ) { TF[8] = null }; + if ( TF[9] != "-" && TF[9] != "+" ) { TF[9] = null }; + if ( !TF[10] ) { TF[10] = 0 } else { TF[10] = TF[9] + TF[10] }; + if ( !TF[11] ) { TF[11] = 0 } else { TF[11] = TF[9] + TF[11] }; + // If there's no timezone info the data is local time TF[7] = 0; - if ( !TF[8] && !TF[9] ) { - return new Date(TF[1], TF[2], TF[3], TF[4], TF[5], TF[6], TF[7]); - }; - // If the UTC indicator is set the date is UTC - if ( TF[8] == "Z" ) { - return new Date(Date.UTC(TF[1], TF[2], TF[3], TF[4], TF[5], TF[6], TF[7])); - }; - // If the date has a timezone offset - if ( TF[9] == "-" || TF[9] == "+" ) { - // Get current Timezone information - var CurTZ = new Date().getTimezoneOffset(); - var CurTZh = TF[10] - ((CurTZ >= 0 ? "-" : "+") + Math.floor(Math.abs(CurTZ) / 60)) - var CurTZm = TF[11] - ((CurTZ >= 0 ? "-" : "+") + (Math.abs(CurTZ) % 60)) - // Return the date - return new Date(TF[1], TF[2], TF[3], TF[4] - CurTZh, TF[5] - CurTZm, TF[6], TF[7]); - }; - // If we've reached here we couldn't deal with the input, return null - return null; + if ( !TF[8] && !TF[9] ) { + return new Date(TF[1], TF[2], TF[3], TF[4], TF[5], TF[6], TF[7]); + }; + // If the UTC indicator is set the date is UTC + if ( TF[8] == "Z" ) { + return new Date(Date.UTC(TF[1], TF[2], TF[3], TF[4], TF[5], TF[6], TF[7])); + }; + // If the date has a timezone offset + if ( TF[9] == "-" || TF[9] == "+" ) { + // Get current Timezone information + var CurTZ = new Date().getTimezoneOffset(); + var CurTZh = TF[10] - ((CurTZ >= 0 ? "-" : "+") + Math.floor(Math.abs(CurTZ) / 60)) + var CurTZm = TF[11] - ((CurTZ >= 0 ? "-" : "+") + (Math.abs(CurTZ) % 60)) + // Return the date + return new Date(TF[1], TF[2], TF[3], TF[4] - CurTZh, TF[5] - CurTZm, TF[6], TF[7]); + }; + // If we've reached here we couldn't deal with the input, return null + return null; }; @@ -103,211 +103,211 @@ Date.parseIso8601 = function(CurDate) { Date.prototype.dateFormat = function(Mask) { - var FormattedDate = ""; - var Ref_MonthFullName = ["January", "February", "March", "April", "May", + var FormattedDate = ""; + var Ref_MonthFullName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; - var Ref_MonthAbbreviation = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - var Ref_DayFullName = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; - var Ref_DayAbbreviation = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - - // Convert any supported simple masks into "real" masks - switch (Mask) { - case "short": - Mask = "m/d/yy"; - break; - case "medium": - Mask = "mmm d, yyyy"; - break; - case "long": - Mask = "mmmm d, yyyy"; - break; - case "full": - Mask = "dddd, mmmm d, yyyy"; - break; - }; - - // Tack a temporary space at the end of the mask to ensure that the last character isn't a mask character - Mask += " "; - - // Parse the Mask - var CurChar; - var MaskPart = ""; - for ( var Cnt = 0; Cnt < Mask.length; Cnt++ ) { - // Get the character - CurChar = Mask.charAt(Cnt); - // Determine if the character is a mask element - if ( (CurChar != "d") && (CurChar != "m") && (CurChar != "y") ) { - // Determine if we need to parse a MaskPart or not - if ( MaskPart != "" ) { - // Convert the mask part to the date value - switch (MaskPart) { - case "d": - FormattedDate += this.getDate(); - break; - case "dd": - FormattedDate += ("0" + this.getDate()).slice(-2); - break; - case "ddd": - FormattedDate += Ref_DayAbbreviation[this.getDay()]; - break; - case "dddd": - FormattedDate += Ref_DayFullName[this.getDay()]; - break; - case "m": - FormattedDate += this.getMonth() + 1; - break; - case "mm": - FormattedDate += ("0" + (this.getMonth() + 1)).slice(-2); - break; - case "mmm": - FormattedDate += Ref_MonthAbbreviation[this.getMonth()]; - break; - case "mmmm": - FormattedDate += Ref_MonthFullName[this.getMonth()]; - break; - case "yy": - FormattedDate += ("0" + this.getFullYear()).slice(-2); - break; - case "yyyy": - FormattedDate += ("000" + this.getFullYear()).slice(-4); - break; - }; - // Reset the MaskPart to nothing - MaskPart = ""; - }; - // Add the character to the output - FormattedDate += CurChar; - } else { - // Add the current mask character to the MaskPart - MaskPart += CurChar; - }; - }; - - // Remove the temporary space from the end of the formatted date - FormattedDate = FormattedDate.substring(0,FormattedDate.length - 1); - - // Return the formatted date - return FormattedDate; + var Ref_MonthAbbreviation = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var Ref_DayFullName = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; + var Ref_DayAbbreviation = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + + // Convert any supported simple masks into "real" masks + switch (Mask) { + case "short": + Mask = "m/d/yy"; + break; + case "medium": + Mask = "mmm d, yyyy"; + break; + case "long": + Mask = "mmmm d, yyyy"; + break; + case "full": + Mask = "dddd, mmmm d, yyyy"; + break; + }; + + // Tack a temporary space at the end of the mask to ensure that the last character isn't a mask character + Mask += " "; + + // Parse the Mask + var CurChar; + var MaskPart = ""; + for ( var Cnt = 0; Cnt < Mask.length; Cnt++ ) { + // Get the character + CurChar = Mask.charAt(Cnt); + // Determine if the character is a mask element + if ( (CurChar != "d") && (CurChar != "m") && (CurChar != "y") ) { + // Determine if we need to parse a MaskPart or not + if ( MaskPart != "" ) { + // Convert the mask part to the date value + switch (MaskPart) { + case "d": + FormattedDate += this.getDate(); + break; + case "dd": + FormattedDate += ("0" + this.getDate()).slice(-2); + break; + case "ddd": + FormattedDate += Ref_DayAbbreviation[this.getDay()]; + break; + case "dddd": + FormattedDate += Ref_DayFullName[this.getDay()]; + break; + case "m": + FormattedDate += this.getMonth() + 1; + break; + case "mm": + FormattedDate += ("0" + (this.getMonth() + 1)).slice(-2); + break; + case "mmm": + FormattedDate += Ref_MonthAbbreviation[this.getMonth()]; + break; + case "mmmm": + FormattedDate += Ref_MonthFullName[this.getMonth()]; + break; + case "yy": + FormattedDate += ("0" + this.getFullYear()).slice(-2); + break; + case "yyyy": + FormattedDate += ("000" + this.getFullYear()).slice(-4); + break; + }; + // Reset the MaskPart to nothing + MaskPart = ""; + }; + // Add the character to the output + FormattedDate += CurChar; + } else { + // Add the current mask character to the MaskPart + MaskPart += CurChar; + }; + }; + + // Remove the temporary space from the end of the formatted date + FormattedDate = FormattedDate.substring(0,FormattedDate.length - 1); + + // Return the formatted date + return FormattedDate; }; Date.prototype.timeFormat = function(Mask) { - var FormattedTime = ""; - - // Convert any supported simple masks into "real" masks - switch (Mask) { - case "short": - Mask = "h:mm tt"; - break; - case "medium": - Mask = "h:mm:ss tt"; - break; - case "long": - Mask = "h:mm:ss.l tt"; - break; - case "full": - Mask = "h:mm:ss.l tt"; - break; - }; - - // Tack a temporary space at the end of the mask to ensure that the last character isn't a mask character - Mask += " "; - - // Parse the Mask - var CurChar; - var MaskPart = ""; - for ( var Cnt = 0; Cnt < Mask.length; Cnt++ ) { - // Get the character - CurChar = Mask.charAt(Cnt); - // Determine if the character is a mask element - if ( (CurChar != "h") && (CurChar != "H") && (CurChar != "m") && + var FormattedTime = ""; + + // Convert any supported simple masks into "real" masks + switch (Mask) { + case "short": + Mask = "h:mm tt"; + break; + case "medium": + Mask = "h:mm:ss tt"; + break; + case "long": + Mask = "h:mm:ss.l tt"; + break; + case "full": + Mask = "h:mm:ss.l tt"; + break; + }; + + // Tack a temporary space at the end of the mask to ensure that the last character isn't a mask character + Mask += " "; + + // Parse the Mask + var CurChar; + var MaskPart = ""; + for ( var Cnt = 0; Cnt < Mask.length; Cnt++ ) { + // Get the character + CurChar = Mask.charAt(Cnt); + // Determine if the character is a mask element + if ( (CurChar != "h") && (CurChar != "H") && (CurChar != "m") && (CurChar != "s") && (CurChar != "l") && (CurChar != "t") && (CurChar != "T") ) { - // Determine if we need to parse a MaskPart or not - if ( MaskPart != "" ) { - // Convert the mask part to the date value - switch (MaskPart) { - case "h": - var CurValue = this.getHours(); - if ( CurValue > 12 ) { - CurValue = CurValue - 12; - }; - FormattedTime += CurValue; - break; - case "hh": - var CurValue = this.getHours(); - if ( CurValue > 12 ) { - CurValue = CurValue - 12; - }; - FormattedTime += ("0" + CurValue).slice(-2); - break; - case "H": - FormattedTime += ("0" + this.getHours()).slice(-2); - break; - case "HH": - FormattedTime += ("0" + this.getHours()).slice(-2); - break; - case "m": - FormattedTime += this.getMinutes(); - break; - case "mm": - FormattedTime += ("0" + this.getMinutes()).slice(-2); - break; - case "s": - FormattedTime += this.getSeconds(); - break; - case "ss": - FormattedTime += ("0" + this.getSeconds()).slice(-2); - break; - case "l": - FormattedTime += ("00" + this.getMilliseconds()).slice(-3); - break; - case "t": - if ( this.getHours() > 12 ) { - FormattedTime += "p"; - } else { - FormattedTime += "a"; - }; - break; - case "tt": - if ( this.getHours() > 12 ) { - FormattedTime += "pm"; - } else { - FormattedTime += "am"; - }; - break; - case "T": - if ( this.getHours() > 12 ) { - FormattedTime += "P"; - } else { - FormattedTime += "A"; - }; - break; - case "TT": - if ( this.getHours() > 12 ) { - FormattedTime += "PM"; - } else { - FormattedTime += "AM"; - }; - break; - }; - // Reset the MaskPart to nothing - MaskPart = ""; - }; - // Add the character to the output - FormattedTime += CurChar; - } else { - // Add the current mask character to the MaskPart - MaskPart += CurChar; - }; - }; - - // Remove the temporary space from the end of the formatted date - FormattedTime = FormattedTime.substring(0,FormattedTime.length - 1); - - // Return the formatted date - return FormattedTime; + // Determine if we need to parse a MaskPart or not + if ( MaskPart != "" ) { + // Convert the mask part to the date value + switch (MaskPart) { + case "h": + var CurValue = this.getHours(); + if ( CurValue > 12 ) { + CurValue = CurValue - 12; + }; + FormattedTime += CurValue; + break; + case "hh": + var CurValue = this.getHours(); + if ( CurValue > 12 ) { + CurValue = CurValue - 12; + }; + FormattedTime += ("0" + CurValue).slice(-2); + break; + case "H": + FormattedTime += ("0" + this.getHours()).slice(-2); + break; + case "HH": + FormattedTime += ("0" + this.getHours()).slice(-2); + break; + case "m": + FormattedTime += this.getMinutes(); + break; + case "mm": + FormattedTime += ("0" + this.getMinutes()).slice(-2); + break; + case "s": + FormattedTime += this.getSeconds(); + break; + case "ss": + FormattedTime += ("0" + this.getSeconds()).slice(-2); + break; + case "l": + FormattedTime += ("00" + this.getMilliseconds()).slice(-3); + break; + case "t": + if ( this.getHours() > 12 ) { + FormattedTime += "p"; + } else { + FormattedTime += "a"; + }; + break; + case "tt": + if ( this.getHours() > 12 ) { + FormattedTime += "pm"; + } else { + FormattedTime += "am"; + }; + break; + case "T": + if ( this.getHours() > 12 ) { + FormattedTime += "P"; + } else { + FormattedTime += "A"; + }; + break; + case "TT": + if ( this.getHours() > 12 ) { + FormattedTime += "PM"; + } else { + FormattedTime += "AM"; + }; + break; + }; + // Reset the MaskPart to nothing + MaskPart = ""; + }; + // Add the character to the output + FormattedTime += CurChar; + } else { + // Add the current mask character to the MaskPart + MaskPart += CurChar; + }; + }; + + // Remove the temporary space from the end of the formatted date + FormattedTime = FormattedTime.substring(0,FormattedTime.length - 1); + + // Return the formatted date + return FormattedTime; }; @@ -318,44 +318,44 @@ Date.prototype.timeFormat = function(Mask) { */ Date.prototype.iso8601Format = function(Style, isUTC, dropTZ, useSpace) { - var FormattedDate = ""; - - switch (Style) { - case "Y": - FormattedDate += this.dateFormat("yyyy"); - break; - case "YM": - FormattedDate += this.dateFormat("yyyy-mm"); - break; - case "YMD": - FormattedDate += this.dateFormat("yyyy-mm-dd"); - break; - case "YMDHM": - FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm"); - break; - case "YMDHMS": - FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm:ss"); - break; - case "YMDHMSM": - FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm:ss.l"); - break; - }; - - if ( !dropTZ && (Style == "YMDHM" || Style == "YMDHMS" || Style == "YMDHMSM") ) { - if ( isUTC ) { - FormattedDate += "Z"; - } else { - // Get TimeZone Information - var TimeZoneOffset = this.getTimezoneOffset(); - var TimeZoneInfo = (TimeZoneOffset >= 0 ? "-" : "+") + + var FormattedDate = ""; + + switch (Style) { + case "Y": + FormattedDate += this.dateFormat("yyyy"); + break; + case "YM": + FormattedDate += this.dateFormat("yyyy-mm"); + break; + case "YMD": + FormattedDate += this.dateFormat("yyyy-mm-dd"); + break; + case "YMDHM": + FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm"); + break; + case "YMDHMS": + FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm:ss"); + break; + case "YMDHMSM": + FormattedDate += this.dateFormat("yyyy-mm-dd") + ((useSpace) ? " " : "T") + this.timeFormat("HH:mm:ss.l"); + break; + }; + + if ( !dropTZ && (Style == "YMDHM" || Style == "YMDHMS" || Style == "YMDHMSM") ) { + if ( isUTC ) { + FormattedDate += "Z"; + } else { + // Get TimeZone Information + var TimeZoneOffset = this.getTimezoneOffset(); + var TimeZoneInfo = (TimeZoneOffset >= 0 ? "-" : "+") + ("0" + (Math.floor(Math.abs(TimeZoneOffset) / 60))).slice(-2) + ":" + ("00" + (Math.abs(TimeZoneOffset) % 60)).slice(-2); - FormattedDate += TimeZoneInfo; - }; - }; + FormattedDate += TimeZoneInfo; + }; + }; - // Return the date - return FormattedDate; + // Return the date + return FormattedDate; }; diff --git a/Open-ILS/web/opac/common/js/RemoteRequest.js b/Open-ILS/web/opac/common/js/RemoteRequest.js index aff59b4734..9a9c8e14f5 100644 --- a/Open-ILS/web/opac/common/js/RemoteRequest.js +++ b/Open-ILS/web/opac/common/js/RemoteRequest.js @@ -4,14 +4,14 @@ var XML_HTTP_SERVER = ""; /* This object is thrown when network failures occur */ function NetworkFailure(stat, url) { - this._status = stat; - this._url = url; + this._status = stat; + this._url = url; } NetworkFailure.prototype.status = function() { return this._status; } NetworkFailure.prototype.url = function() { return this._url; } NetworkFailure.prototype.toString = function() { - return "Network Failure: status = " + this.status() +'\n'+this.url(); + return "Network Failure: status = " + this.status() +'\n'+this.url(); } @@ -27,31 +27,31 @@ if(isXUL()) { */ function cleanRemoteRequests() { - for( var i in _allrequests ) - destroyRequest(_allrequests[i]); + for( var i in _allrequests ) + destroyRequest(_allrequests[i]); } function abortAllRequests() { - for( var i in _allrequests ) { - var r = _allrequests[i]; - if(r) { - r.abort(); - destroyRequest(r); - } - } + for( var i in _allrequests ) { + var r = _allrequests[i]; + if(r) { + r.abort(); + destroyRequest(r); + } + } } function destroyRequest(r) { - if(r == null) return; + if(r == null) return; - if( r.xmlhttp ) { - r.xmlhttp.onreadystatechange = function(){}; - r.xmlhttp = null; - } + if( r.xmlhttp ) { + r.xmlhttp.onreadystatechange = function(){}; + r.xmlhttp = null; + } - r.callback = null; - r.userdata = null; - _allrequests[r.id] = null; + r.callback = null; + r.userdata = null; + _allrequests[r.id] = null; } /* ----------------------------------------------------------------------- */ @@ -59,319 +59,319 @@ function destroyRequest(r) { var rrId = 0; function RemoteRequest( service, method ) { - /* dojo is currently only available in the OPAC */ - try { - /* We want OpenSRF.locale for xx-YY format */ - this.locale = OpenSRF.locale; - } - catch (e) { - this.locale = null; - } - this.service = service; - this.method = method; - this.xmlhttp = false; - this.name = null; - this.alertEvent = true; /* only used when isXUL is false */ - - this.type = "POST"; /* default */ - this.id = rrId++; - this.cancelled = false; - - this.setSecure(false); - if(isXUL()) this.setSecure(true); - - _allrequests[this.id] = this; - - var i = 2; - this.params = ""; - - while(i < arguments.length) { - var object = js2JSON(arguments[i++]); - this.params += "¶m=" + encodeURIComponent(object); - } - - if(!this.params) { this.params = ""; } - - this.param_string = "service=" + service + "&method=" + method + this.params; - if (this.locale != null) { - this.param_string = this.param_string + "&locale=" + this.locale; - } - if( this.buildXMLRequest() == null ) alert("Browser is not supported!"); + /* dojo is currently only available in the OPAC */ + try { + /* We want OpenSRF.locale for xx-YY format */ + this.locale = OpenSRF.locale; + } + catch (e) { + this.locale = null; + } + this.service = service; + this.method = method; + this.xmlhttp = false; + this.name = null; + this.alertEvent = true; /* only used when isXUL is false */ + + this.type = "POST"; /* default */ + this.id = rrId++; + this.cancelled = false; + + this.setSecure(false); + if(isXUL()) this.setSecure(true); + + _allrequests[this.id] = this; + + var i = 2; + this.params = ""; + + while(i < arguments.length) { + var object = js2JSON(arguments[i++]); + this.params += "¶m=" + encodeURIComponent(object); + } + + if(!this.params) { this.params = ""; } + + this.param_string = "service=" + service + "&method=" + method + this.params; + if (this.locale != null) { + this.param_string = this.param_string + "&locale=" + this.locale; + } + if( this.buildXMLRequest() == null ) alert("Browser is not supported!"); } RemoteRequest.prototype.timeout = function(t) { - t *= 1000 - var req = this; - req.timeoutFunc = setTimeout( - function() { - if( req && req.xmlhttp ) { - req.cancelled = true; - req.abort(); - if( req.abtCallback ) { - req.abtCallback(req); - } - } - }, - t - ); + t *= 1000 + var req = this; + req.timeoutFunc = setTimeout( + function() { + if( req && req.xmlhttp ) { + req.cancelled = true; + req.abort(); + if( req.abtCallback ) { + req.abtCallback(req); + } + } + }, + t + ); } RemoteRequest.prototype.abortCallback = function(func) { - this.abtCallback = func; + this.abtCallback = func; } RemoteRequest.prototype.event = function(evt) { - if( arguments.length > 0 ) - this.evt = evt; - return this.evt; + if( arguments.length > 0 ) + this.evt = evt; + return this.evt; } RemoteRequest.prototype.abort = function() { - if( this.xmlhttp ) { - /* this has to come before abort() or IE will puke on you */ - this.xmlhttp.onreadystatechange = function(){}; - this.xmlhttp.abort(); - } + if( this.xmlhttp ) { + /* this has to come before abort() or IE will puke on you */ + this.xmlhttp.onreadystatechange = function(){}; + this.xmlhttp.abort(); + } } /* constructs our XMLHTTPRequest object */ RemoteRequest.prototype.buildXMLRequest = function() { - this.xmlhttp = buildXMLRequest(); - return true; + this.xmlhttp = buildXMLRequest(); + return true; } function buildXMLRequest() { try { - return new XMLHttpRequest(); + return new XMLHttpRequest(); } catch(e) { - try { - return new ActiveXObject("Msxml2.XMLHTTP"); - } catch (e2) { - try { - return new ActiveXObject("Microsoft.XMLHTTP"); - } catch (e3) { - alert("NEEDS NEWER JAVASCRIPT for XMLHTTPRequest()"); + try { + return new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e2) { + try { + return new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e3) { + alert("NEEDS NEWER JAVASCRIPT for XMLHTTPRequest()"); return null; - } - } + } + } } } function _remoteRequestCallback(id) { - var object = _allrequests[id]; - if(object.cancelled) return; + var object = _allrequests[id]; + if(object.cancelled) return; - if( object.xmlhttp.readyState == 4 ) { + if( object.xmlhttp.readyState == 4 ) { try { object.duration = new Date().getTime() - object.sendTime; dump('request ' + object.id + ': duration = ' + object.duration + ' ms\n'); } catch(ee){} - try { - object.callback(object); - } catch(E) { + try { + object.callback(object); + } catch(E) { throw E - } finally { - destroyRequest(object); - object = null; - } - } + } finally { + destroyRequest(object); + object = null; + } + } } /* define the callback we use when this request has received - all of its data */ + all of its data */ RemoteRequest.prototype.setCompleteCallback = function(callback) { - if(this.cancelled) return; - this.callback = callback; - var id = this.id; - this.xmlhttp.onreadystatechange = function() { _remoteRequestCallback(id); } + if(this.cancelled) return; + this.callback = callback; + var id = this.id; + this.xmlhttp.onreadystatechange = function() { _remoteRequestCallback(id); } } /* http by default. This makes it https. *ONLY works when - embedded in a XUL app. */ + embedded in a XUL app. */ RemoteRequest.prototype.setSecure = function(bool) { - this.secure = bool; + this.secure = bool; } RemoteRequest.prototype.send = function(blocking) { - if(this.cancelled) return; + if(this.cancelled) return; - /* determine the xmlhttp server dynamically */ - var url = location.protocol + "//" + location.host + "/" + XML_HTTP_GATEWAY; + /* determine the xmlhttp server dynamically */ + var url = location.protocol + "//" + location.host + "/" + XML_HTTP_GATEWAY; - if(isXUL()) { - if( XML_HTTP_SERVER ) - url = 'http://'+XML_HTTP_SERVER+'/'+XML_HTTP_GATEWAY; + if(isXUL()) { + if( XML_HTTP_SERVER ) + url = 'http://'+XML_HTTP_SERVER+'/'+XML_HTTP_GATEWAY; - if( url.match(/^http:/) && - (this.secure || location.href.match(/^https:/)) ) { - netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); - url = url.replace(/^http:/, 'https:'); - } - } + if( url.match(/^http:/) && + (this.secure || location.href.match(/^https:/)) ) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); + url = url.replace(/^http:/, 'https:'); + } + } - var data = null; - if( this.type == 'GET' ) url += "?" + this.param_string; + var data = null; + if( this.type == 'GET' ) url += "?" + this.param_string; - this.url = url; + this.url = url; //if( isXUL() ) dump('request URL = ' + url + '?' + this.param_string + '\n'); - try { + try { - if(blocking) this.xmlhttp.open(this.type, url, false); - else this.xmlhttp.open(this.type, url, true); - - } catch(E) { - alert("Fatal error opening XMLHTTPRequest for URL:\n" + url + '\n' + E); - return; - } + if(blocking) this.xmlhttp.open(this.type, url, false); + else this.xmlhttp.open(this.type, url, true); + + } catch(E) { + alert("Fatal error opening XMLHTTPRequest for URL:\n" + url + '\n' + E); + return; + } - if( this.type == 'POST' ) { - data = this.param_string; - this.xmlhttp.setRequestHeader('Content-Type', - 'application/x-www-form-urlencoded'); - } + if( this.type == 'POST' ) { + data = this.param_string; + this.xmlhttp.setRequestHeader('Content-Type', + 'application/x-www-form-urlencoded'); + } - try { - var auth; - try { auth = cookieManager.read(COOKIE_SES) } catch(ee) {} - if( isXUL() ) auth = fetchXULStash().session.key; - if( auth ) - this.xmlhttp.setRequestHeader('X-OILS-Authtoken', auth); + try { + var auth; + try { auth = cookieManager.read(COOKIE_SES) } catch(ee) {} + if( isXUL() ) auth = fetchXULStash().session.key; + if( auth ) + this.xmlhttp.setRequestHeader('X-OILS-Authtoken', auth); - } catch(e) {} + } catch(e) {} - if(data && data.match(/param=undefined/)) { - /* we get a bogus param .. replace with NULL */ - try{dump('!+! UNDEFINED PARAM IN QUERY: ' + this.service + ' : ' + this.method+'\n');}catch(r){} - data = data.replace(/param=undefined/g,'param=null'); - } + if(data && data.match(/param=undefined/)) { + /* we get a bogus param .. replace with NULL */ + try{dump('!+! UNDEFINED PARAM IN QUERY: ' + this.service + ' : ' + this.method+'\n');}catch(r){} + data = data.replace(/param=undefined/g,'param=null'); + } this.sendTime = new Date().getTime(); - try{ this.xmlhttp.send( data ); } catch(e){} + try{ this.xmlhttp.send( data ); } catch(e){} - return this; + return this; } /* returns the actual response text from the request */ RemoteRequest.prototype.getText = function() { - return this.xmlhttp.responseText; + return this.xmlhttp.responseText; } RemoteRequest.prototype.isReady = function() { - return this.xmlhttp.readyState == 4; + return this.xmlhttp.readyState == 4; } /* returns the JSON->js result object */ RemoteRequest.prototype.getResultObject = function() { - if(this.cancelled) return null; - if(!this.xmlhttp) return null; - - var failed = false; - var status = null; - this.event(null); - - /* - try { - dump(this.url + '?' + this.param_string + '\n' + - 'Returned with \n\tstatus = ' + this.xmlhttp.status + - '\n\tpayload= ' + this.xmlhttp.responseText + '\n'); - } catch(e) {} - */ - - try { - status = this.xmlhttp.status; - if( status != 200 ) failed = true; - } catch(e) { failed = true; } - - if( failed ) { - if(!status) status = ''; - try{dump('! NETWORK FAILURE. HTTP STATUS = ' +status+'\n'+this.param_string+'\n');}catch(e){} - if(isXUL()) - throw new NetworkFailure(status, this.param_string); - else return null; - } - - var text = this.xmlhttp.responseText; - - //try{if(getDebug()) _debug('response: ' + text + '\n')}catch(e){} - - if(text == "" || text == " " || text == null) { - try { dump('dbg: Request returned no text!\n'); } catch(E) {} - if(isXUL()) - throw new NetworkFailure(status, this.param_string); - return null; - } - - var obj = JSON2js(text); - if(!obj) return null; - - if( obj.status != 200 ) { - - var str = 'A server error occurred. Debug information follows: ' + - '\ncode = ' + obj.status + - '\ndebug: ' + obj.debug + - '\npayload: ' + js2JSON(obj.payload); - - if(isXUL()) { - dump(str); - throw obj; - - } else { - _debug(str); - throw str; - } - } - - var payload = obj.payload; - if(!payload || payload.length == 0) return null; - payload = (payload.length == 1) ? payload[0] : payload; - - if(!isXUL()) { - if( checkILSEvent(payload) ) { - this.event(payload); - if( this.alertEvent ) { - alertILSEvent(payload); - return null; - } - } - } - - return payload; + if(this.cancelled) return null; + if(!this.xmlhttp) return null; + + var failed = false; + var status = null; + this.event(null); + + /* + try { + dump(this.url + '?' + this.param_string + '\n' + + 'Returned with \n\tstatus = ' + this.xmlhttp.status + + '\n\tpayload= ' + this.xmlhttp.responseText + '\n'); + } catch(e) {} + */ + + try { + status = this.xmlhttp.status; + if( status != 200 ) failed = true; + } catch(e) { failed = true; } + + if( failed ) { + if(!status) status = ''; + try{dump('! NETWORK FAILURE. HTTP STATUS = ' +status+'\n'+this.param_string+'\n');}catch(e){} + if(isXUL()) + throw new NetworkFailure(status, this.param_string); + else return null; + } + + var text = this.xmlhttp.responseText; + + //try{if(getDebug()) _debug('response: ' + text + '\n')}catch(e){} + + if(text == "" || text == " " || text == null) { + try { dump('dbg: Request returned no text!\n'); } catch(E) {} + if(isXUL()) + throw new NetworkFailure(status, this.param_string); + return null; + } + + var obj = JSON2js(text); + if(!obj) return null; + + if( obj.status != 200 ) { + + var str = 'A server error occurred. Debug information follows: ' + + '\ncode = ' + obj.status + + '\ndebug: ' + obj.debug + + '\npayload: ' + js2JSON(obj.payload); + + if(isXUL()) { + dump(str); + throw obj; + + } else { + _debug(str); + throw str; + } + } + + var payload = obj.payload; + if(!payload || payload.length == 0) return null; + payload = (payload.length == 1) ? payload[0] : payload; + + if(!isXUL()) { + if( checkILSEvent(payload) ) { + this.event(payload); + if( this.alertEvent ) { + alertILSEvent(payload); + return null; + } + } + } + + return payload; } /* adds a new parameter to the request */ RemoteRequest.prototype.addParam = function(param) { - var string = encodeURIComponent(js2JSON(param)); - this.param_string += "¶m=" + string; + var string = encodeURIComponent(js2JSON(param)); + this.param_string += "¶m=" + string; } function fetchXULStash() { - if( isXUL() ) { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var __OILS = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - var data_cache = new __OILS( ); - return data_cache.wrappedJSObject.OpenILS.prototype.data; - - } catch(E) { - _debug('Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); - } - } - return {}; + if( isXUL() ) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var __OILS = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + var data_cache = new __OILS( ); + return data_cache.wrappedJSObject.OpenILS.prototype.data; + + } catch(E) { + _debug('Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); + } + } + return {}; } diff --git a/Open-ILS/web/opac/common/js/added_content.js b/Open-ILS/web/opac/common/js/added_content.js index 4e2074ce8a..9ac82b05a7 100644 --- a/Open-ILS/web/opac/common/js/added_content.js +++ b/Open-ILS/web/opac/common/js/added_content.js @@ -4,61 +4,61 @@ function buildISBNSrc(isbn, size) { - size = (size) ? size : 'small'; - var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol; + size = (size) ? size : 'small'; + var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol; if(OILS_OPAC_IMAGES_HOST) return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn; - return '../../../../extras/ac/jacket/'+size+'/'+isbn; + return '../../../../extras/ac/jacket/'+size+'/'+isbn; } function acMakeURL(type, key) { - return '../../../../extras/ac/' + type + '/html/' + key; + return '../../../../extras/ac/' + type + '/html/' + key; } function acCollectData( key, callback ) { - var context = { key : key, callback: callback, data : {} }; - acCollectItem(context, 'reviews'); - acCollectItem(context, 'toc'); - acCollectItem(context, 'excerpt'); - acCollectItem(context, 'anotes'); + var context = { key : key, callback: callback, data : {} }; + acCollectItem(context, 'reviews'); + acCollectItem(context, 'toc'); + acCollectItem(context, 'excerpt'); + acCollectItem(context, 'anotes'); } function acCheckDone(context) { - if( context.data.reviews && context.data.reviews.done && - context.data.toc && context.data.toc.done && - context.data.excerpt && context.data.excerpt.done && - context.data.anotes && context.data.anotes.done ) { + if( context.data.reviews && context.data.reviews.done && + context.data.toc && context.data.toc.done && + context.data.excerpt && context.data.excerpt.done && + context.data.anotes && context.data.anotes.done ) { - if(context.callback) context.callback(context.data); - } + if(context.callback) context.callback(context.data); + } } function acCollectItem(context, type) { - var req = buildXMLRequest(); - req.open('GET', acMakeURL(type, context.key), true); - req.onreadystatechange = function() { - if( req.readyState == 4 ) { - context.data[type] = { done : true } + var req = buildXMLRequest(); + req.open('GET', acMakeURL(type, context.key), true); + req.onreadystatechange = function() { + if( req.readyState == 4 ) { + context.data[type] = { done : true } - if(IE) { + if(IE) { - /* Someone please explain why IE treats status 404 as status 200?? - On second thought, don't bother. - */ - if( ! req.responseText.match( - /The requested URL.*was not found on this server/) ) - context.data[type].html = req.responseText; + /* Someone please explain why IE treats status 404 as status 200?? + On second thought, don't bother. + */ + if( ! req.responseText.match( + /The requested URL.*was not found on this server/) ) + context.data[type].html = req.responseText; - } else { - if( req.status != 404 ) - context.data[type].html = req.responseText; - } - acCheckDone(context); - } - } - req.send(null); + } else { + if( req.status != 404 ) + context.data[type].html = req.responseText; + } + acCheckDone(context); + } + } + req.send(null); } diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 382ed22825..f7db487db1 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -6,37 +6,37 @@ var SHOW_MR_DEFAULT = false; /* true if we show metarecords by default */ var DO_AUTHORITY_LOOKUPS = true; /* URL param names */ -var PARAM_TERM = "t"; /* search term */ -var PARAM_STYPE = "tp"; /* search type */ -var PARAM_LOCATION = "l"; /* current location */ -var PARAM_LASSO = "sg"; /* current location */ -var PARAM_DEPTH = "d"; /* search depth */ -var PARAM_FORM = "f"; /* search format */ -var PARAM_OFFSET = "o"; /* search offset */ -var PARAM_COUNT = "c"; /* hits per page */ -var PARAM_HITCOUNT = "hc"; /* hits per page */ -var PARAM_MRID = "m"; /* metarecord id */ -var PARAM_RID = "r"; /* record id */ -var PARAM_RLIST = "rl"; -var PARAM_ORIGLOC = "ol"; /* the original location */ -var PARAM_AUTHTIME = "at"; /* inactivity timeout in seconds */ -var PARAM_ADVTERM = "adv"; /* advanced search term */ -var PARAM_ADVTYPE = "adt"; /* the advanced search type */ -var PARAM_RTYPE = "rt"; -var PARAM_SORT = "s"; -var PARAM_SORT_DIR = "sd"; -var PARAM_DEBUG = "dbg"; -var PARAM_CN = "cn"; -var PARAM_LITFORM = 'lf'; -var PARAM_ITEMFORM = 'if'; -var PARAM_ITEMTYPE = 'it'; -var PARAM_BIBLEVEL = 'bl'; -var PARAM_AUDIENCE = 'a'; -var PARAM_SEARCHES = 'ss'; -var PARAM_LANGUAGE = 'la'; -var PARAM_TFORM = 'tf'; /* temporary format for title result pages */ -var PARAM_RDEPTH = 'rd'; -var PARAM_REDIR = 're'; /* true if we have been redirected by IP (we're at a real lib) */ +var PARAM_TERM = "t"; /* search term */ +var PARAM_STYPE = "tp"; /* search type */ +var PARAM_LOCATION = "l"; /* current location */ +var PARAM_LASSO = "sg"; /* current location */ +var PARAM_DEPTH = "d"; /* search depth */ +var PARAM_FORM = "f"; /* search format */ +var PARAM_OFFSET = "o"; /* search offset */ +var PARAM_COUNT = "c"; /* hits per page */ +var PARAM_HITCOUNT = "hc"; /* hits per page */ +var PARAM_MRID = "m"; /* metarecord id */ +var PARAM_RID = "r"; /* record id */ +var PARAM_RLIST = "rl"; +var PARAM_ORIGLOC = "ol"; /* the original location */ +var PARAM_AUTHTIME = "at"; /* inactivity timeout in seconds */ +var PARAM_ADVTERM = "adv"; /* advanced search term */ +var PARAM_ADVTYPE = "adt"; /* the advanced search type */ +var PARAM_RTYPE = "rt"; +var PARAM_SORT = "s"; +var PARAM_SORT_DIR = "sd"; +var PARAM_DEBUG = "dbg"; +var PARAM_CN = "cn"; +var PARAM_LITFORM = 'lf'; +var PARAM_ITEMFORM = 'if'; +var PARAM_ITEMTYPE = 'it'; +var PARAM_BIBLEVEL = 'bl'; +var PARAM_AUDIENCE = 'a'; +var PARAM_SEARCHES = 'ss'; +var PARAM_LANGUAGE = 'la'; +var PARAM_TFORM = 'tf'; /* temporary format for title result pages */ +var PARAM_RDEPTH = 'rd'; +var PARAM_REDIR = 're'; /* true if we have been redirected by IP (we're at a real lib) */ var PARAM_AVAIL = 'av'; /* limit search results to available items */ var PARAM_COPYLOCS = 'cl'; // copy (shelving) locations var PARAM_PUBD_BEFORE = 'pdb'; @@ -90,72 +90,72 @@ var SBEXTRAS; var SKIN; /* cookies */ -var COOKIE_SB = "sbe"; -var COOKIE_SES = "ses"; -//var COOKIE_IDS = "ids"; /* list of mrecord ids */ -//var COOKIE_SRIDS = "srids"; /* record ids cached from a search */ -var COOKIE_FONT = "fnt"; -var COOKIE_SKIN = "skin"; -var COOKIE_RIDS = "rids"; /* list of record ids */ +var COOKIE_SB = "sbe"; +var COOKIE_SES = "ses"; +//var COOKIE_IDS = "ids"; /* list of mrecord ids */ +//var COOKIE_SRIDS = "srids"; /* record ids cached from a search */ +var COOKIE_FONT = "fnt"; +var COOKIE_SKIN = "skin"; +var COOKIE_RIDS = "rids"; /* list of record ids */ var COOKIE_SEARCH = 'sr'; /* pages */ -var MRESULT = "mresult"; -var RRESULT = "rresult"; -var RDETAIL = "rdetail"; -var MYOPAC = "myopac"; -var ADVANCED = "advanced"; -var HOME = "home"; -var BBAGS = "bbags"; -var REQITEMS = "reqitems"; -var CNBROWSE = "cnbrowse"; +var MRESULT = "mresult"; +var RRESULT = "rresult"; +var RDETAIL = "rdetail"; +var MYOPAC = "myopac"; +var ADVANCED = "advanced"; +var HOME = "home"; +var BBAGS = "bbags"; +var REQITEMS = "reqitems"; +var CNBROWSE = "cnbrowse"; /* search type (STYPE) options */ -var STYPE_AUTHOR = "author"; -var STYPE_TITLE = "title"; -var STYPE_SUBJECT = "subject"; -var STYPE_SERIES = "series"; -var STYPE_KEYWORD = "keyword"; +var STYPE_AUTHOR = "author"; +var STYPE_TITLE = "title"; +var STYPE_SUBJECT = "subject"; +var STYPE_SERIES = "series"; +var STYPE_KEYWORD = "keyword"; /* record-level search types */ -var RTYPE_MRID = "mrid"; -var RTYPE_COOKIE = "cookie"; -var RTYPE_AUTHOR = STYPE_AUTHOR; -var RTYPE_SUBJECT = STYPE_SUBJECT; -var RTYPE_TITLE = STYPE_TITLE; -var RTYPE_SERIES = STYPE_SERIES; -var RTYPE_KEYWORD = STYPE_KEYWORD; -var RTYPE_LIST = "list"; -var RTYPE_MULTI = 'multi'; -var RTYPE_MARC = 'marc'; -var RTYPE_ISBN = 'isbn'; -var RTYPE_ISSN = 'issn'; -var RTYPE_TCN = 'tcn'; - -var SORT_TYPE_REL = "rel"; -var SORT_TYPE_AUTHOR = STYPE_AUTHOR; -var SORT_TYPE_TITLE = STYPE_TITLE; -var SORT_TYPE_PUBDATE = "pubdate"; -var SORT_DIR_ASC = "asc"; -var SORT_DIR_DESC = "desc"; +var RTYPE_MRID = "mrid"; +var RTYPE_COOKIE = "cookie"; +var RTYPE_AUTHOR = STYPE_AUTHOR; +var RTYPE_SUBJECT = STYPE_SUBJECT; +var RTYPE_TITLE = STYPE_TITLE; +var RTYPE_SERIES = STYPE_SERIES; +var RTYPE_KEYWORD = STYPE_KEYWORD; +var RTYPE_LIST = "list"; +var RTYPE_MULTI = 'multi'; +var RTYPE_MARC = 'marc'; +var RTYPE_ISBN = 'isbn'; +var RTYPE_ISSN = 'issn'; +var RTYPE_TCN = 'tcn'; + +var SORT_TYPE_REL = "rel"; +var SORT_TYPE_AUTHOR = STYPE_AUTHOR; +var SORT_TYPE_TITLE = STYPE_TITLE; +var SORT_TYPE_PUBDATE = "pubdate"; +var SORT_DIR_ASC = "asc"; +var SORT_DIR_DESC = "desc"; /* types of advanced search */ var ADVTYPE_MULTI = 'ml'; -var ADVTYPE_MARC = 'ma'; +var ADVTYPE_MARC = 'ma'; /* -var ADVTYPE_ISBN = 'isbn'; -var ADVTYPE_ISSN = 'issn'; +var ADVTYPE_ISBN = 'isbn'; +var ADVTYPE_ISSN = 'issn'; */ var LOGOUT_WARNING_TIME = 30; /* "head up" for session timeout */ /* user preferences */ -var PREF_HITS_PER = 'opac.hits_per_page'; -var PREF_DEF_FONT = 'opac.default_font'; +var PREF_HITS_PER = 'opac.hits_per_page'; +var PREF_DEF_FONT = 'opac.default_font'; var PREF_HOLD_NOTIFY = 'opac.hold_notify'; var PREF_DEF_LOCATION = 'opac.default_search_location'; -var PREF_DEF_DEPTH = 'opac.default_search_depth'; +var PREF_DEF_DEPTH = 'opac.default_search_depth'; /** If enabled, added content attribution links will be @@ -166,9 +166,9 @@ var ENABLE_ADDED_CONTENT_ATTRIB_LINKS = false; /* container for global variables shared accross pages */ -var G = {}; -G.user = null; /* global user object */ -G.ui = {} /* cache of UI components */ +var G = {}; +G.user = null; /* global user object */ +G.ui = {} /* cache of UI components */ /* regexes */ @@ -177,50 +177,50 @@ var REGEX_PHONE = /^\d{3}-\d{3}-\d{4}$/; /* 111-222-3333 */ /* call me after page init and I will load references - to all of the ui object id's defined below - They will be stored in G.ui.. + to all of the ui object id's defined below + They will be stored in G.ui.. */ function loadUIObjects() { - for( var p in config.ids ) { - G.ui[p] = {}; - for( var o in config.ids[p] ) - G.ui[p][o] = getId(config.ids[p][o]); - } + for( var p in config.ids ) { + G.ui[p] = {}; + for( var o in config.ids[p] ) + G.ui[p][o] = getId(config.ids[p][o]); + } } /* try our best to free memory */ function clearUIObjects() { - for( var p in config.ids ) { - for( var o in config.ids[p] ) { - if(G.ui[p][o]) { - G.ui[p][o].onclick = null; - G.ui[p][o].onkeydown = null; - G.ui[p][o] = null; - } - } - G.ui[p] = null; - } + for( var p in config.ids ) { + for( var o in config.ids[p] ) { + if(G.ui[p][o]) { + G.ui[p][o].onclick = null; + G.ui[p][o].onkeydown = null; + G.ui[p][o] = null; + } + } + G.ui[p] = null; + } } /* ---------------------------------------------------------------------------- - Set up ID's and CSS classes - Any new ids, css, etc. may be added by giving the unique names and putting - them into the correct scope + Set up ID's and CSS classes + Any new ids, css, etc. may be added by giving the unique names and putting + them into the correct scope /* ---------------------------------------------------------------------------- */ var config = {}; /* Set up the page names */ config.page = {}; -config.page[HOME] = "index.xml"; -config.page[ADVANCED] = "advanced.xml"; -config.page[MRESULT] = "mresult.xml"; -config.page[RRESULT] = "rresult.xml"; -config.page[MYOPAC] = "myopac.xml"; -config.page[RDETAIL] = "rdetail.xml"; -config.page[BBAGS] = "bbags.xml"; -config.page[REQITEMS] = "reqitems.xml"; -config.page[CNBROWSE] = "cnbrowse.xml"; +config.page[HOME] = "index.xml"; +config.page[ADVANCED] = "advanced.xml"; +config.page[MRESULT] = "mresult.xml"; +config.page[RRESULT] = "rresult.xml"; +config.page[MYOPAC] = "myopac.xml"; +config.page[RDETAIL] = "rdetail.xml"; +config.page[BBAGS] = "bbags.xml"; +config.page[REQITEMS] = "reqitems.xml"; +config.page[CNBROWSE] = "cnbrowse.xml"; /* themes */ config.themes = {}; @@ -231,38 +231,38 @@ config.images.logo = "main_logo.jpg"; /* set up ID's, CSS, and node names */ -config.ids = {}; -config.ids.result = {}; -config.ids.mresult = {}; -config.ids.advanced = {}; -config.ids.rresult = {}; -config.ids.myopac = {}; -config.ids.rdetail = {}; - -config.css = {}; -config.css.result = {}; -config.css.mresult = {}; -config.css.advanced = {}; -config.css.rresult = {}; -config.css.myopac = {}; -config.css.rdetail = {}; - -config.names = {}; -config.names.result = {}; +config.ids = {}; +config.ids.result = {}; +config.ids.mresult = {}; +config.ids.advanced = {}; +config.ids.rresult = {}; +config.ids.myopac = {}; +config.ids.rdetail = {}; + +config.css = {}; +config.css.result = {}; +config.css.mresult = {}; +config.css.advanced = {}; +config.css.rresult = {}; +config.css.myopac = {}; +config.css.rdetail = {}; + +config.names = {}; +config.names.result = {}; config.names.mresult = {}; config.names.advanced = {}; config.names.rresult = {}; -config.names.myopac = {}; +config.names.myopac = {}; config.names.rdetail = {}; /* id's shared accross skins. These *must* be defined */ config.ids.common = {}; -config.ids.common.loading = "loading_div"; -config.ids.common.canvas = "canvas"; -config.ids.common.canvas_main = "canvas_main"; -config.ids.common.org_tree = "org_tree"; -config.ids.common.org_container = "org_container"; +config.ids.common.loading = "loading_div"; +config.ids.common.canvas = "canvas"; +config.ids.common.canvas_main = "canvas_main"; +config.ids.common.org_tree = "org_tree"; +config.ids.common.org_container = "org_container"; config.ids.xul = {}; @@ -282,96 +282,96 @@ config.ids.altcanvas = {}; /* ---------------------------------------------------------------------------- */ /* Methods are defined as service:method - An optional 3rd component is when a method is followed by a :1, such methods - have a staff counterpart and should have ".staff" appended to the method - before the method is called when in XUL mode */ + An optional 3rd component is when a method is followed by a :1, such methods + have a staff counterpart and should have ".staff" appended to the method + before the method is called when in XUL mode */ -var SEARCH_MRS = 'open-ils.search:open-ils.search.metabib.multiclass:1'; -var SEARCH_RS = 'open-ils.search:open-ils.search.biblio.multiclass:1'; -var SEARCH_MRS_QUERY = 'open-ils.search:open-ils.search.metabib.multiclass.query:1'; +var SEARCH_MRS = 'open-ils.search:open-ils.search.metabib.multiclass:1'; +var SEARCH_RS = 'open-ils.search:open-ils.search.biblio.multiclass:1'; +var SEARCH_MRS_QUERY = 'open-ils.search:open-ils.search.metabib.multiclass.query:1'; var SEARCH_RS_QUERY = 'open-ils.search:open-ils.search.biblio.multiclass.query:1'; -var FETCH_SEARCH_RIDS = "open-ils.search:open-ils.search.biblio.record.class.search:1"; -var CREATE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.xml.create"; -var DELETE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.delete"; -var FETCH_MFHD_SUMMARY = "open-ils.search:open-ils.search.serial.record.bib.retrieve"; -var FETCH_MRMODS = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve"; -var FETCH_MODS_FROM_COPY = "open-ils.search:open-ils.search.biblio.mods_from_copy"; -var FETCH_MR_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1"; -var FETCH_RIDS = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1"; -var FETCH_RMODS = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve"; -var FETCH_R_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.record.copy_count:1"; -var FETCH_FLESHED_USER = "open-ils.actor:open-ils.actor.user.fleshed.retrieve"; -var FETCH_SESSION = "open-ils.auth:open-ils.auth.session.retrieve"; -var LOGIN_INIT = "open-ils.auth:open-ils.auth.authenticate.init"; -var LOGIN_COMPLETE = "open-ils.auth:open-ils.auth.authenticate.complete"; -var LOGIN_DELETE = "open-ils.auth:open-ils.auth.session.delete"; -var FETCH_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.retrieve"; -var UPDATE_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.update"; -var FETCH_COPY_STATUSES = "open-ils.search:open-ils.search.config.copy_status.retrieve.all"; -var FETCH_COPY_LOCATION_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_location_counts.summary.retrieve"; -var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve"; -//var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.location.summary.retrieve"; -var FETCH_MARC_HTML = "open-ils.search:open-ils.search.biblio.record.html"; -var FETCH_CHECKED_OUT_SUM = "open-ils.actor:open-ils.actor.user.checked_out"; -var FETCH_HOLDS = "open-ils.circ:open-ils.circ.holds.retrieve"; -var FETCH_FINES_SUMMARY = "open-ils.actor:open-ils.actor.user.fines.summary"; -var FETCH_TRANSACTIONS = "open-ils.actor:open-ils.actor.user.transactions.have_charge.fleshed"; -var FETCH_MONEY_BILLING = 'open-ils.circ:open-ils.circ.money.billing.retrieve.all'; -var FETCH_CROSSREF = "open-ils.search:open-ils.search.authority.crossref"; -var FETCH_CROSSREF_BATCH = "open-ils.search:open-ils.search.authority.crossref.batch"; -var CREATE_HOLD = "open-ils.circ:open-ils.circ.holds.create"; -var CREATE_HOLD_OVERRIDE = "open-ils.circ:open-ils.circ.holds.create.override"; -var CANCEL_HOLD = "open-ils.circ:open-ils.circ.hold.cancel"; -var UPDATE_USERNAME = "open-ils.actor:open-ils.actor.user.username.update"; -var UPDATE_PASSWORD = "open-ils.actor:open-ils.actor.user.password.update"; -var UPDATE_EMAIL = "open-ils.actor:open-ils.actor.user.email.update"; -var RENEW_CIRC = "open-ils.circ:open-ils.circ.renew"; -var CHECK_SPELL = "open-ils.search:open-ils.search.spellcheck"; -var FETCH_REVIEWS = "open-ils.search:open-ils.search.added_content.review.retrieve.all"; -var FETCH_TOC = "open-ils.search:open-ils.search.added_content.toc.retrieve"; -var FETCH_ACONT_SUMMARY = "open-ils.search:open-ils.search.added_content.summary.retrieve"; -var FETCH_USER_BYBARCODE = "open-ils.actor:open-ils.actor.user.fleshed.retrieve_by_barcode"; -var FETCH_ADV_MARC_MRIDS = "open-ils.search:open-ils.search.biblio.marc:1"; -var FETCH_ADV_ISBN_RIDS = "open-ils.search:open-ils.search.biblio.isbn"; -var FETCH_ADV_ISSN_RIDS = "open-ils.search:open-ils.search.biblio.issn"; -var FETCH_ADV_TCN_RIDS = "open-ils.search:open-ils.search.biblio.tcn"; -var FETCH_CNBROWSE = 'open-ils.search:open-ils.search.callnumber.browse'; -var FETCH_CONTAINERS = 'open-ils.actor:open-ils.actor.container.retrieve_by_class'; -var FETCH_CONTAINERS = 'open-ils.actor:open-ils.actor.container.retrieve_by_class'; -var CREATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.create'; -var DELETE_CONTAINER = 'open-ils.actor:open-ils.actor.container.full_delete'; -var CREATE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.create'; -var DELETE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.delete'; -var FLESH_CONTAINER = 'open-ils.actor:open-ils.actor.container.flesh'; -var FLESH_PUBLIC_CONTAINER = 'open-ils.actor:open-ils.actor.container.public.flesh'; -var UPDATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.update'; -var FETCH_COPY = 'open-ils.search:open-ils.search.asset.copy.retrieve'; -var FETCH_FLESHED_COPY = 'open-ils.search:open-ils.search.asset.copy.fleshed2.retrieve'; -var CHECK_HOLD_POSSIBLE = 'open-ils.circ:open-ils.circ.title_hold.is_possible'; -var UPDATE_HOLD = 'open-ils.circ:open-ils.circ.hold.update'; -var FETCH_COPIES_FROM_VOLUME = 'open-ils.search:open-ils.search.asset.copy.retrieve_by_cn_label:1'; -var FETCH_VOLUME_BY_INFO = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */ -var FETCH_VOLUME = 'open-ils.search:open-ils.search.asset.call_number.retrieve'; -var FETCH_COPY_LOCATIONS = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all'; -var FETCH_COPY_NOTES = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all'; -var FETCH_COPY_STAT_CATS = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'; -var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all'; -var FETCH_ITEM_FORMS = 'open-ils.search:open-ils.search.biblio.item_form_map.retrieve.all'; -var FETCH_ITEM_TYPES = 'open-ils.search:open-ils.search.biblio.item_type_map.retrieve.all'; -var FETCH_BIB_LEVELS = 'open-ils.search:open-ils.search.biblio.bib_level_map.retrieve.all'; -var FETCH_AUDIENCES = 'open-ils.search:open-ils.search.biblio.audience_map.retrieve.all'; -//var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.status.retrieve'; -var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.queue_stats.retrieve'; -var FETCH_NON_CAT_CIRCS = 'open-ils.circ:open-ils.circ.open_non_cataloged_circulation.user'; -var FETCH_NON_CAT_CIRC = 'open-ils.circ:open-ils.circ.non_cataloged_circulation.retrieve'; -var FETCH_NON_CAT_TYPES = "open-ils.circ:open-ils.circ.non_cat_types.retrieve.all"; -var FETCH_BRE = 'open-ils.search:open-ils.search.biblio.record_entry.slim.retrieve'; -var CHECK_USERNAME = 'open-ils.actor:open-ils.actor.username.exists'; -var FETCH_CIRC_BY_ID = 'open-ils.circ:open-ils.circ.retrieve'; -var FETCH_MR_DESCRIPTORS = 'open-ils.search:open-ils.search.metabib.record_to_descriptors'; -var FETCH_HIGHEST_PERM_ORG = 'open-ils.actor:open-ils.actor.user.perm.highest_org.batch'; -var FETCH_USER_NOTES = 'open-ils.actor:open-ils.actor.note.retrieve.all'; -var FETCH_ORG_BY_SHORTNAME = 'open-ils.actor:open-ils.actor.org_unit.retrieve_by_shorname'; +var FETCH_SEARCH_RIDS = "open-ils.search:open-ils.search.biblio.record.class.search:1"; +var CREATE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.xml.create"; +var DELETE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.delete"; +var FETCH_MFHD_SUMMARY = "open-ils.search:open-ils.search.serial.record.bib.retrieve"; +var FETCH_MRMODS = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve"; +var FETCH_MODS_FROM_COPY = "open-ils.search:open-ils.search.biblio.mods_from_copy"; +var FETCH_MR_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1"; +var FETCH_RIDS = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1"; +var FETCH_RMODS = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve"; +var FETCH_R_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.record.copy_count:1"; +var FETCH_FLESHED_USER = "open-ils.actor:open-ils.actor.user.fleshed.retrieve"; +var FETCH_SESSION = "open-ils.auth:open-ils.auth.session.retrieve"; +var LOGIN_INIT = "open-ils.auth:open-ils.auth.authenticate.init"; +var LOGIN_COMPLETE = "open-ils.auth:open-ils.auth.authenticate.complete"; +var LOGIN_DELETE = "open-ils.auth:open-ils.auth.session.delete"; +var FETCH_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.retrieve"; +var UPDATE_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.update"; +var FETCH_COPY_STATUSES = "open-ils.search:open-ils.search.config.copy_status.retrieve.all"; +var FETCH_COPY_LOCATION_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_location_counts.summary.retrieve"; +var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve"; +//var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.location.summary.retrieve"; +var FETCH_MARC_HTML = "open-ils.search:open-ils.search.biblio.record.html"; +var FETCH_CHECKED_OUT_SUM = "open-ils.actor:open-ils.actor.user.checked_out"; +var FETCH_HOLDS = "open-ils.circ:open-ils.circ.holds.retrieve"; +var FETCH_FINES_SUMMARY = "open-ils.actor:open-ils.actor.user.fines.summary"; +var FETCH_TRANSACTIONS = "open-ils.actor:open-ils.actor.user.transactions.have_charge.fleshed"; +var FETCH_MONEY_BILLING = 'open-ils.circ:open-ils.circ.money.billing.retrieve.all'; +var FETCH_CROSSREF = "open-ils.search:open-ils.search.authority.crossref"; +var FETCH_CROSSREF_BATCH = "open-ils.search:open-ils.search.authority.crossref.batch"; +var CREATE_HOLD = "open-ils.circ:open-ils.circ.holds.create"; +var CREATE_HOLD_OVERRIDE = "open-ils.circ:open-ils.circ.holds.create.override"; +var CANCEL_HOLD = "open-ils.circ:open-ils.circ.hold.cancel"; +var UPDATE_USERNAME = "open-ils.actor:open-ils.actor.user.username.update"; +var UPDATE_PASSWORD = "open-ils.actor:open-ils.actor.user.password.update"; +var UPDATE_EMAIL = "open-ils.actor:open-ils.actor.user.email.update"; +var RENEW_CIRC = "open-ils.circ:open-ils.circ.renew"; +var CHECK_SPELL = "open-ils.search:open-ils.search.spellcheck"; +var FETCH_REVIEWS = "open-ils.search:open-ils.search.added_content.review.retrieve.all"; +var FETCH_TOC = "open-ils.search:open-ils.search.added_content.toc.retrieve"; +var FETCH_ACONT_SUMMARY = "open-ils.search:open-ils.search.added_content.summary.retrieve"; +var FETCH_USER_BYBARCODE = "open-ils.actor:open-ils.actor.user.fleshed.retrieve_by_barcode"; +var FETCH_ADV_MARC_MRIDS = "open-ils.search:open-ils.search.biblio.marc:1"; +var FETCH_ADV_ISBN_RIDS = "open-ils.search:open-ils.search.biblio.isbn"; +var FETCH_ADV_ISSN_RIDS = "open-ils.search:open-ils.search.biblio.issn"; +var FETCH_ADV_TCN_RIDS = "open-ils.search:open-ils.search.biblio.tcn"; +var FETCH_CNBROWSE = 'open-ils.search:open-ils.search.callnumber.browse'; +var FETCH_CONTAINERS = 'open-ils.actor:open-ils.actor.container.retrieve_by_class'; +var FETCH_CONTAINERS = 'open-ils.actor:open-ils.actor.container.retrieve_by_class'; +var CREATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.create'; +var DELETE_CONTAINER = 'open-ils.actor:open-ils.actor.container.full_delete'; +var CREATE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.create'; +var DELETE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.delete'; +var FLESH_CONTAINER = 'open-ils.actor:open-ils.actor.container.flesh'; +var FLESH_PUBLIC_CONTAINER = 'open-ils.actor:open-ils.actor.container.public.flesh'; +var UPDATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.update'; +var FETCH_COPY = 'open-ils.search:open-ils.search.asset.copy.retrieve'; +var FETCH_FLESHED_COPY = 'open-ils.search:open-ils.search.asset.copy.fleshed2.retrieve'; +var CHECK_HOLD_POSSIBLE = 'open-ils.circ:open-ils.circ.title_hold.is_possible'; +var UPDATE_HOLD = 'open-ils.circ:open-ils.circ.hold.update'; +var FETCH_COPIES_FROM_VOLUME = 'open-ils.search:open-ils.search.asset.copy.retrieve_by_cn_label:1'; +var FETCH_VOLUME_BY_INFO = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */ +var FETCH_VOLUME = 'open-ils.search:open-ils.search.asset.call_number.retrieve'; +var FETCH_COPY_LOCATIONS = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all'; +var FETCH_COPY_NOTES = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all'; +var FETCH_COPY_STAT_CATS = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'; +var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all'; +var FETCH_ITEM_FORMS = 'open-ils.search:open-ils.search.biblio.item_form_map.retrieve.all'; +var FETCH_ITEM_TYPES = 'open-ils.search:open-ils.search.biblio.item_type_map.retrieve.all'; +var FETCH_BIB_LEVELS = 'open-ils.search:open-ils.search.biblio.bib_level_map.retrieve.all'; +var FETCH_AUDIENCES = 'open-ils.search:open-ils.search.biblio.audience_map.retrieve.all'; +//var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.status.retrieve'; +var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.queue_stats.retrieve'; +var FETCH_NON_CAT_CIRCS = 'open-ils.circ:open-ils.circ.open_non_cataloged_circulation.user'; +var FETCH_NON_CAT_CIRC = 'open-ils.circ:open-ils.circ.non_cataloged_circulation.retrieve'; +var FETCH_NON_CAT_TYPES = "open-ils.circ:open-ils.circ.non_cat_types.retrieve.all"; +var FETCH_BRE = 'open-ils.search:open-ils.search.biblio.record_entry.slim.retrieve'; +var CHECK_USERNAME = 'open-ils.actor:open-ils.actor.username.exists'; +var FETCH_CIRC_BY_ID = 'open-ils.circ:open-ils.circ.retrieve'; +var FETCH_MR_DESCRIPTORS = 'open-ils.search:open-ils.search.metabib.record_to_descriptors'; +var FETCH_HIGHEST_PERM_ORG = 'open-ils.actor:open-ils.actor.user.perm.highest_org.batch'; +var FETCH_USER_NOTES = 'open-ils.actor:open-ils.actor.note.retrieve.all'; +var FETCH_ORG_BY_SHORTNAME = 'open-ils.actor:open-ils.actor.org_unit.retrieve_by_shorname'; var FETCH_BIB_ID_BY_BARCODE = 'open-ils.search:open-ils.search.bib_id.by_barcode'; var FETCH_ORG_SETTING = 'open-ils.actor:open-ils.actor.ou_setting.ancestor_default'; @@ -380,57 +380,57 @@ var FETCH_ORG_SETTING = 'open-ils.actor:open-ils.actor.ou_setting.ancestor_defau /* ---------------------------------------------------------------------------- */ /* event callback functions. Other functions may be appended to these vars to - for added functionality. */ + for added functionality. */ -G.evt = {}; /* events container */ +G.evt = {}; /* events container */ function runEvt(scope, name, a, b, c, d, e, f, g) { - var evt = G.evt[scope][name]; - for( var i in evt ) { - evt[i](a, b, c, d, e, f, g); - } + var evt = G.evt[scope][name]; + for( var i in evt ) { + evt[i](a, b, c, d, e, f, g); + } } /* creates a new event if it doesn't already exist */ function createEvt(scope, name) { - if(!G.evt[scope]) G.evt[scope] = {}; - if(G.evt[scope][name] == null) - G.evt[scope][name] = []; + if(!G.evt[scope]) G.evt[scope] = {}; + if(G.evt[scope][name] == null) + G.evt[scope][name] = []; } function attachEvt(scope, name, action) { - createEvt(scope, name); - G.evt[scope][name].push(action); + createEvt(scope, name); + G.evt[scope][name].push(action); } function detachAllEvt(scope, name) { - G.evt[scope][name] = []; + G.evt[scope][name] = []; } -createEvt("common", "init"); /* f() : what happens on page init */ -createEvt("common", "pageRendered"); /* f() : what happens when the page is done (up to the skin to call this even)*/ -createEvt("common", "unload"); /* f() : what happens on window unload (clean memory, etc.)*/ -createEvt("common", "locationChanged"); /* f() : what happens when the location has changed */ -createEvt("common", "locationUpdated"); /* f() : what happens when the location has updated by the code */ +createEvt("common", "init"); /* f() : what happens on page init */ +createEvt("common", "pageRendered"); /* f() : what happens when the page is done (up to the skin to call this even)*/ +createEvt("common", "unload"); /* f() : what happens on window unload (clean memory, etc.)*/ +createEvt("common", "locationChanged"); /* f() : what happens when the location has changed */ +createEvt("common", "locationUpdated"); /* f() : what happens when the location has updated by the code */ -createEvt("common", "run"); /* f() : make the page do stuff */ -createEvt("result", "idsReceived"); /* f(ids) */ -createEvt("rresult", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */ -createEvt("result", "preCollectRecords"); /* f() we're about to go and grab the recs */ +createEvt("common", "run"); /* f() : make the page do stuff */ +createEvt("result", "idsReceived"); /* f(ids) */ +createEvt("rresult", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */ +createEvt("result", "preCollectRecords"); /* f() we're about to go and grab the recs */ -createEvt("result", "hitCountReceived"); /* f() : display hit info, pagination, etc. */ -createEvt("result", "recordReceived"); /* f(mvr, pagePosition, isMr) : display the record*/ -createEvt("result", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */ -createEvt("result", "copyCountsReceived"); /* f(mvr, pagePosition, copyCountInfo) : display copy counts*/ -createEvt("result", "allRecordsReceived"); /* f(mvrsArray) : add other page stuff, sidebars, etc.*/ +createEvt("result", "hitCountReceived"); /* f() : display hit info, pagination, etc. */ +createEvt("result", "recordReceived"); /* f(mvr, pagePosition, isMr) : display the record*/ +createEvt("result", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */ +createEvt("result", "copyCountsReceived"); /* f(mvr, pagePosition, copyCountInfo) : display copy counts*/ +createEvt("result", "allRecordsReceived"); /* f(mvrsArray) : add other page stuff, sidebars, etc.*/ -createEvt("rdetail", "recordDrawn"); /* f() : the record has been drawn */ +createEvt("rdetail", "recordDrawn"); /* f() : the record has been drawn */ -createEvt("common", "loggedIn"); /* f() : user has just logged in */ +createEvt("common", "loggedIn"); /* f() : user has just logged in */ createEvt('result', 'zeroHits'); createEvt('result', 'lowHits'); -createEvt('rdetail', 'recordRetrieved'); /* we are about to draw the rdetail page */ +createEvt('rdetail', 'recordRetrieved'); /* we are about to draw the rdetail page */ createEvt('common', 'depthChanged'); createEvt('common', 'holdUpdated'); createEvt('common', 'holdUpdateCanceled'); diff --git a/Open-ILS/web/opac/common/js/dtree.js b/Open-ILS/web/opac/common/js/dtree.js index 8f95cb030f..289ed98d1b 100644 --- a/Open-ILS/web/opac/common/js/dtree.js +++ b/Open-ILS/web/opac/common/js/dtree.js @@ -10,315 +10,315 @@ |--------------------------------------------------*/ function Node(id, pid, name, url, title, target, icon, iconOpen, open) { - this.id = id; - this.pid = pid; - this.name = name; - this.url = url; - this.title = title; - this.target = target; - this.icon = icon; - this.iconOpen = iconOpen; - this._io = open || false; - this._is = false; - this._ls = false; - this._hc = false; - this._ai = 0; - this._p; + this.id = id; + this.pid = pid; + this.name = name; + this.url = url; + this.title = title; + this.target = target; + this.icon = icon; + this.iconOpen = iconOpen; + this._io = open || false; + this._is = false; + this._ls = false; + this._hc = false; + this._ai = 0; + this._p; }; function dTree(objName) { - this.config = { - target : null, - folderLinks : true, - useSelection : true, - useCookies : true, - useLines : true, - useIcons : true, - useStatusText : false, - closeSameLevel : false, - inOrder : false - } - this.icon = { - root : '../../../images/orgtree/base.gif', - folder : '../../../images/orgtree/folder.gif', - folderOpen : '../../../images/orgtree/folderopen.gif', - node : '../../../images/orgtree/page.gif', - empty : '../../../images/orgtree/empty.gif', - line : '../../../images/orgtree/line.gif', - join : '../../../images/orgtree/join.gif', - joinBottom : '../../../images/orgtree/joinbottom.gif', - plus : '../../../images/orgtree/plus.gif', - plusBottom : '../../../images/orgtree/plusbottom.gif', - minus : '../../../images/orgtree/minus.gif', - minusBottom : '../../../images/orgtree/minusbottom.gif', - nlPlus : '../../../images/orgtree/nolines_plus.gif', - nlMinus : '../../../images/orgtree/nolines_minus.gif' - }; - this.obj = objName; - this.aNodes = []; - this.aIndent = []; - this.root = new Node(-1); - this.selectedNode = null; - this.selectedFound = false; - this.completed = false; + this.config = { + target : null, + folderLinks : true, + useSelection : true, + useCookies : true, + useLines : true, + useIcons : true, + useStatusText : false, + closeSameLevel : false, + inOrder : false + } + this.icon = { + root : '../../../images/orgtree/base.gif', + folder : '../../../images/orgtree/folder.gif', + folderOpen : '../../../images/orgtree/folderopen.gif', + node : '../../../images/orgtree/page.gif', + empty : '../../../images/orgtree/empty.gif', + line : '../../../images/orgtree/line.gif', + join : '../../../images/orgtree/join.gif', + joinBottom : '../../../images/orgtree/joinbottom.gif', + plus : '../../../images/orgtree/plus.gif', + plusBottom : '../../../images/orgtree/plusbottom.gif', + minus : '../../../images/orgtree/minus.gif', + minusBottom : '../../../images/orgtree/minusbottom.gif', + nlPlus : '../../../images/orgtree/nolines_plus.gif', + nlMinus : '../../../images/orgtree/nolines_minus.gif' + }; + this.obj = objName; + this.aNodes = []; + this.aIndent = []; + this.root = new Node(-1); + this.selectedNode = null; + this.selectedFound = false; + this.completed = false; }; dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { - this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); + this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); }; dTree.prototype.openAll = function() { - this.oAll(true); + this.oAll(true); }; dTree.prototype.closeAll = function() { - this.oAll(false); + this.oAll(false); }; dTree.prototype.toString = function() { - var str = '
\n'; - if (document.getElementById) { - if (this.config.useCookies) this.selectedNode = this.getSelected(); - str += this.addNode(this.root); - } else str += 'Browser not supported.'; - str += '
'; - if (!this.selectedFound) this.selectedNode = null; - this.completed = true; - return str; + var str = '
\n'; + if (document.getElementById) { + if (this.config.useCookies) this.selectedNode = this.getSelected(); + str += this.addNode(this.root); + } else str += 'Browser not supported.'; + str += '
'; + if (!this.selectedFound) this.selectedNode = null; + this.completed = true; + return str; }; dTree.prototype.addNode = function(pNode) { - var str = ''; - var n=0; - if (this.config.inOrder) n = pNode._ai; - for (n; n'; - } - if (node.url) { - str += ''; - str += node.name; - if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; - str += ''; - if (node._hc) { - str += '
'; - str += this.addNode(node); - str += '
'; - } - this.aIndent.pop(); - return str; + var str = '
' + this.indent(node, nodeId); + if (this.config.useIcons) { + if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node); + if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node; + if (this.root.id == node.pid) { + node.icon = this.icon.root; + node.iconOpen = this.icon.root; + } + str += ''; + } + if (node.url) { + str += ''; + str += node.name; + if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; + str += '
'; + if (node._hc) { + str += '
'; + str += this.addNode(node); + str += '
'; + } + this.aIndent.pop(); + return str; }; dTree.prototype.indent = function(node, nodeId) { - var str = ''; - if (this.root.id != node.pid) { - for (var n=0; n'; - (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); - if (node._hc) { - str += ''; - } else str += ''; - } - return str; + var str = ''; + if (this.root.id != node.pid) { + for (var n=0; n'; + (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); + if (node._hc) { + str += ''; + } else str += ''; + } + return str; }; dTree.prototype.setCS = function(node) { - var lastId; - for (var n=0; n= 0;) { - var d = params.multiple[i]; - var ds = d.print("%Y%m%d"); - cal.multiple[ds] = d; - } - } - cal.showsOtherMonths = params.showOthers; - cal.yearStep = params.step; - cal.setRange(params.range[0], params.range[1]); - cal.params = params; - cal.setDateStatusHandler(params.dateStatusFunc); - cal.getDateText = params.dateText; - cal.setDateFormat(dateFmt); - if (mustCreate) - cal.create(); - cal.refresh(); - if (!params.position) - cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); - else - cal.showAt(params.position[0], params.position[1]); - return false; - }; + var triggerEl = params.button || params.displayArea || params.inputField; + triggerEl["on" + params.eventName] = function() { + var dateEl = params.inputField || params.displayArea; + var dateFmt = params.inputField ? params.ifFormat : params.daFormat; + var mustCreate = false; + var cal = window.calendar; + if (dateEl) + params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); + if (!(cal && params.cache)) { + window.calendar = cal = new Calendar(params.firstDay, + params.date, + params.onSelect || onSelect, + params.onClose || function(cal) { cal.hide(); }); + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.weekNumbers = params.weekNumbers; + mustCreate = true; + } else { + if (params.date) + cal.setDate(params.date); + cal.hide(); + } + if (params.multiple) { + cal.multiple = {}; + for (var i = params.multiple.length; --i >= 0;) { + var d = params.multiple[i]; + var ds = d.print("%Y%m%d"); + cal.multiple[ds] = d; + } + } + cal.showsOtherMonths = params.showOthers; + cal.yearStep = params.step; + cal.setRange(params.range[0], params.range[1]); + cal.params = params; + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + cal.setDateFormat(dateFmt); + if (mustCreate) + cal.create(); + cal.refresh(); + if (!params.position) + cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); + else + cal.showAt(params.position[0], params.position[1]); + return false; + }; - return cal; + return cal; }; diff --git a/Open-ILS/web/opac/common/js/jscalendar/calendar-tas.css b/Open-ILS/web/opac/common/js/jscalendar/calendar-tas.css index c2f872168c..79effdf3cc 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/calendar-tas.css +++ b/Open-ILS/web/opac/common/js/jscalendar/calendar-tas.css @@ -38,7 +38,7 @@ progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff, .calendar thead .headrow { /* Row containing navigation buttons */ /*background: #3B86A0;*/ color: #363636; - font-weight: bold; + font-weight: bold; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0); } @@ -150,7 +150,7 @@ progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC, background: #dcb; color: #363636; font-weight: bold; - filter: + filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC); } .calendar tfoot .hilite { /* Hover style for buttons in footer */ diff --git a/Open-ILS/web/opac/common/js/jscalendar/calendar.js b/Open-ILS/web/opac/common/js/jscalendar/calendar.js index 28283c2bef..aecdb9ead6 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/calendar.js +++ b/Open-ILS/web/opac/common/js/jscalendar/calendar.js @@ -16,66 +16,66 @@ /** The Calendar object constructor. */ Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { - // member variables - this.activeDiv = null; - this.currentDateEl = null; - this.getDateStatus = null; - this.getDateToolTip = null; - this.getDateText = null; - this.timeout = null; - this.onSelected = onSelected || null; - this.onClose = onClose || null; - this.dragging = false; - this.hidden = false; - this.minYear = 1970; - this.maxYear = 2050; - this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; - this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; - this.isPopup = true; - this.weekNumbers = true; - this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. - this.showsOtherMonths = false; - this.dateStr = dateStr; - this.ar_days = null; - this.showsTime = false; - this.time24 = true; - this.yearStep = 2; - this.hiliteToday = true; - this.multiple = null; - // HTML elements - this.table = null; - this.element = null; - this.tbody = null; - this.firstdayname = null; - // Combo boxes - this.monthsCombo = null; - this.yearsCombo = null; - this.hilitedMonth = null; - this.activeMonth = null; - this.hilitedYear = null; - this.activeYear = null; - // Information - this.dateClicked = false; - - // one-time initializations - if (typeof Calendar._SDN == "undefined") { - // table of short day names - if (typeof Calendar._SDN_len == "undefined") - Calendar._SDN_len = 3; - var ar = new Array(); - for (var i = 8; i > 0;) { - ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); - } - Calendar._SDN = ar; - // table of short month names - if (typeof Calendar._SMN_len == "undefined") - Calendar._SMN_len = 3; - ar = new Array(); - for (var i = 12; i > 0;) { - ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); - } - Calendar._SMN = ar; - } + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.getDateStatus = null; + this.getDateToolTip = null; + this.getDateText = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.hidden = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.weekNumbers = true; + this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. + this.showsOtherMonths = false; + this.dateStr = dateStr; + this.ar_days = null; + this.showsTime = false; + this.time24 = true; + this.yearStep = 2; + this.hiliteToday = true; + this.multiple = null; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.firstdayname = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + // Information + this.dateClicked = false; + + // one-time initializations + if (typeof Calendar._SDN == "undefined") { + // table of short day names + if (typeof Calendar._SDN_len == "undefined") + Calendar._SDN_len = 3; + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); + } + Calendar._SDN = ar; + // table of short month names + if (typeof Calendar._SMN_len == "undefined") + Calendar._SMN_len = 3; + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); + } + Calendar._SMN = ar; + } }; // ** constants @@ -85,7 +85,7 @@ Calendar._C = null; /// detect a special case of "web browser" Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && - !/opera/i.test(navigator.userAgent) ); + !/opera/i.test(navigator.userAgent) ); Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); @@ -99,119 +99,119 @@ Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); // library, at some point. Calendar.getAbsolutePos = function(el) { - var SL = 0, ST = 0; - var is_div = /^div$/i.test(el.tagName); - if (is_div && el.scrollLeft) - SL = el.scrollLeft; - if (is_div && el.scrollTop) - ST = el.scrollTop; - var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; - if (el.offsetParent) { - var tmp = this.getAbsolutePos(el.offsetParent); - r.x += tmp.x; - r.y += tmp.y; - } - return r; + var SL = 0, ST = 0; + var is_div = /^div$/i.test(el.tagName); + if (is_div && el.scrollLeft) + SL = el.scrollLeft; + if (is_div && el.scrollTop) + ST = el.scrollTop; + var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; + if (el.offsetParent) { + var tmp = this.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; }; Calendar.isRelated = function (el, evt) { - var related = evt.relatedTarget; - if (!related) { - var type = evt.type; - if (type == "mouseover") { - related = evt.fromElement; - } else if (type == "mouseout") { - related = evt.toElement; - } - } - while (related) { - if (related == el) { - return true; - } - related = related.parentNode; - } - return false; + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; }; Calendar.removeClass = function(el, className) { - if (!(el && el.className)) { - return; - } - var cls = el.className.split(" "); - var ar = new Array(); - for (var i = cls.length; i > 0;) { - if (cls[--i] != className) { - ar[ar.length] = cls[i]; - } - } - el.className = ar.join(" "); + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); }; Calendar.addClass = function(el, className) { - Calendar.removeClass(el, className); - el.className += " " + className; + Calendar.removeClass(el, className); + el.className += " " + className; }; // FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. Calendar.getElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; - while (f.nodeType != 1 || /^div$/i.test(f.tagName)) - f = f.parentNode; - return f; + var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; + while (f.nodeType != 1 || /^div$/i.test(f.tagName)) + f = f.parentNode; + return f; }; Calendar.getTargetElement = function(ev) { - var f = Calendar.is_ie ? window.event.srcElement : ev.target; - while (f.nodeType != 1) - f = f.parentNode; - return f; + var f = Calendar.is_ie ? window.event.srcElement : ev.target; + while (f.nodeType != 1) + f = f.parentNode; + return f; }; Calendar.stopEvent = function(ev) { - ev || (ev = window.event); - if (Calendar.is_ie) { - ev.cancelBubble = true; - ev.returnValue = false; - } else { - ev.preventDefault(); - ev.stopPropagation(); - } - return false; + ev || (ev = window.event); + if (Calendar.is_ie) { + ev.cancelBubble = true; + ev.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } + return false; }; Calendar.addEvent = function(el, evname, func) { - if (el.attachEvent) { // IE - el.attachEvent("on" + evname, func); - } else if (el.addEventListener) { // Gecko / W3C - el.addEventListener(evname, func, true); - } else { - el["on" + evname] = func; - } + if (el.attachEvent) { // IE + el.attachEvent("on" + evname, func); + } else if (el.addEventListener) { // Gecko / W3C + el.addEventListener(evname, func, true); + } else { + el["on" + evname] = func; + } }; Calendar.removeEvent = function(el, evname, func) { - if (el.detachEvent) { // IE - el.detachEvent("on" + evname, func); - } else if (el.removeEventListener) { // Gecko / W3C - el.removeEventListener(evname, func, true); - } else { - el["on" + evname] = null; - } + if (el.detachEvent) { // IE + el.detachEvent("on" + evname, func); + } else if (el.removeEventListener) { // Gecko / W3C + el.removeEventListener(evname, func, true); + } else { + el["on" + evname] = null; + } }; Calendar.createElement = function(type, parent) { - var el = null; - if (document.createElementNS) { - // use the XHTML namespace; IE won't normally get here unless - // _they_ "fix" the DOM2 implementation. - el = document.createElementNS("http://www.w3.org/1999/xhtml", type); - } else { - el = document.createElement(type); - } - if (typeof parent != "undefined") { - parent.appendChild(el); - } - return el; + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; }; // END: UTILITY FUNCTIONS @@ -220,355 +220,355 @@ Calendar.createElement = function(type, parent) { /** Internal -- adds a set of events to make some element behave like a button. */ Calendar._add_evs = function(el) { - with (Calendar) { - addEvent(el, "mouseover", dayMouseOver); - addEvent(el, "mousedown", dayMouseDown); - addEvent(el, "mouseout", dayMouseOut); - if (is_ie) { - addEvent(el, "dblclick", dayMouseDblClick); - el.setAttribute("unselectable", true); - } - } + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } }; Calendar.findMonth = function(el) { - if (typeof el.month != "undefined") { - return el; - } else if (typeof el.parentNode.month != "undefined") { - return el.parentNode; - } - return null; + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; }; Calendar.findYear = function(el) { - if (typeof el.year != "undefined") { - return el; - } else if (typeof el.parentNode.year != "undefined") { - return el.parentNode; - } - return null; + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; }; Calendar.showMonthsCombo = function () { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var mc = cal.monthsCombo; - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - if (cal.activeMonth) { - Calendar.removeClass(cal.activeMonth, "active"); - } - var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; - Calendar.addClass(mon, "active"); - cal.activeMonth = mon; - var s = mc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var mcw = mc.offsetWidth; - if (typeof mcw == "undefined") - // Konqueror brain-dead techniques - mcw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + var s = mc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var mcw = mc.offsetWidth; + if (typeof mcw == "undefined") + // Konqueror brain-dead techniques + mcw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; }; Calendar.showYearsCombo = function (fwd) { - var cal = Calendar._C; - if (!cal) { - return false; - } - var cal = cal; - var cd = cal.activeDiv; - var yc = cal.yearsCombo; - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - if (cal.activeYear) { - Calendar.removeClass(cal.activeYear, "active"); - } - cal.activeYear = null; - var Y = cal.date.getFullYear() + (fwd ? 1 : -1); - var yr = yc.firstChild; - var show = false; - for (var i = 12; i > 0; --i) { - if (Y >= cal.minYear && Y <= cal.maxYear) { - yr.innerHTML = Y; - yr.year = Y; - yr.style.display = "block"; - show = true; - } else { - yr.style.display = "none"; - } - yr = yr.nextSibling; - Y += fwd ? cal.yearStep : -cal.yearStep; - } - if (show) { - var s = yc.style; - s.display = "block"; - if (cd.navtype < 0) - s.left = cd.offsetLeft + "px"; - else { - var ycw = yc.offsetWidth; - if (typeof ycw == "undefined") - // Konqueror brain-dead techniques - ycw = 50; - s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; - } - s.top = (cd.offsetTop + cd.offsetHeight) + "px"; - } + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.innerHTML = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? cal.yearStep : -cal.yearStep; + } + if (show) { + var s = yc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var ycw = yc.offsetWidth; + if (typeof ycw == "undefined") + // Konqueror brain-dead techniques + ycw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; + } }; // event handlers Calendar.tableMouseUp = function(ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - if (cal.timeout) { - clearTimeout(cal.timeout); - } - var el = cal.activeDiv; - if (!el) { - return false; - } - var target = Calendar.getTargetElement(ev); - ev || (ev = window.event); - Calendar.removeClass(el, "active"); - if (target == el || target.parentNode == el) { - Calendar.cellClick(el, ev); - } - var mon = Calendar.findMonth(target); - var date = null; - if (mon) { - date = new Date(cal.date); - if (mon.month != date.getMonth()) { - date.setMonth(mon.month); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } else { - var year = Calendar.findYear(target); - if (year) { - date = new Date(cal.date); - if (year.year != date.getFullYear()) { - date.setFullYear(year.year); - cal.setDate(date); - cal.dateClicked = false; - cal.callHandler(); - } - } - } - with (Calendar) { - removeEvent(document, "mouseup", tableMouseUp); - removeEvent(document, "mouseover", tableMouseOver); - removeEvent(document, "mousemove", tableMouseOver); - cal._hideCombos(); - _C = null; - return stopEvent(ev); - } + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + ev || (ev = window.event); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el, ev); + } + var mon = Calendar.findMonth(target); + var date = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + _C = null; + return stopEvent(ev); + } }; Calendar.tableMouseOver = function (ev) { - var cal = Calendar._C; - if (!cal) { - return; - } - var el = cal.activeDiv; - var target = Calendar.getTargetElement(ev); - if (target == el || target.parentNode == el) { - Calendar.addClass(el, "hilite active"); - Calendar.addClass(el.parentNode, "rowhilite"); - } else { - if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) - Calendar.removeClass(el, "active"); - Calendar.removeClass(el, "hilite"); - Calendar.removeClass(el.parentNode, "rowhilite"); - } - ev || (ev = window.event); - if (el.navtype == 50 && target != el) { - var pos = Calendar.getAbsolutePos(el); - var w = el.offsetWidth; - var x = ev.clientX; - var dx; - var decrease = true; - if (x > pos.x + w) { - dx = x - pos.x - w; - decrease = false; - } else - dx = pos.x - x; - - if (dx < 0) dx = 0; - var range = el._range; - var current = el._current; - var count = Math.floor(dx / 10) % range.length; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - while (count-- > 0) - if (decrease) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - - cal.onUpdateTime(); - } - var mon = Calendar.findMonth(target); - if (mon) { - if (mon.month != cal.date.getMonth()) { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - Calendar.addClass(mon, "hilite"); - cal.hilitedMonth = mon; - } else if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - } else { - if (cal.hilitedMonth) { - Calendar.removeClass(cal.hilitedMonth, "hilite"); - } - var year = Calendar.findYear(target); - if (year) { - if (year.year != cal.date.getFullYear()) { - if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - Calendar.addClass(year, "hilite"); - cal.hilitedYear = year; - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } else if (cal.hilitedYear) { - Calendar.removeClass(cal.hilitedYear, "hilite"); - } - } - return Calendar.stopEvent(ev); + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + Calendar.addClass(el.parentNode, "rowhilite"); + } else { + if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + Calendar.removeClass(el.parentNode, "rowhilite"); + } + ev || (ev = window.event); + if (el.navtype == 50 && target != el) { + var pos = Calendar.getAbsolutePos(el); + var w = el.offsetWidth; + var x = ev.clientX; + var dx; + var decrease = true; + if (x > pos.x + w) { + dx = x - pos.x - w; + decrease = false; + } else + dx = pos.x - x; + + if (dx < 0) dx = 0; + var range = el._range; + var current = el._current; + var count = Math.floor(dx / 10) % range.length; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + while (count-- > 0) + if (decrease) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + + cal.onUpdateTime(); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + return Calendar.stopEvent(ev); }; Calendar.tableMouseDown = function (ev) { - if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { - return Calendar.stopEvent(ev); - } + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + return Calendar.stopEvent(ev); + } }; Calendar.calDragIt = function (ev) { - var cal = Calendar._C; - if (!(cal && cal.dragging)) { - return false; - } - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posX = ev.pageX; - posY = ev.pageY; - } - cal.hideShowCovered(); - var st = cal.element.style; - st.left = (posX - cal.xOffs) + "px"; - st.top = (posY - cal.yOffs) + "px"; - return Calendar.stopEvent(ev); + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + return Calendar.stopEvent(ev); }; Calendar.calDragEnd = function (ev) { - var cal = Calendar._C; - if (!cal) { - return false; - } - cal.dragging = false; - with (Calendar) { - removeEvent(document, "mousemove", calDragIt); - removeEvent(document, "mouseup", calDragEnd); - tableMouseUp(ev); - } - cal.hideShowCovered(); + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); }; Calendar.dayMouseDown = function(ev) { - var el = Calendar.getElement(ev); - if (el.disabled) { - return false; - } - var cal = el.calendar; - cal.activeDiv = el; - Calendar._C = cal; - if (el.navtype != 300) with (Calendar) { - if (el.navtype == 50) { - el._current = el.innerHTML; - addEvent(document, "mousemove", tableMouseOver); - } else - addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); - addClass(el, "hilite active"); - addEvent(document, "mouseup", tableMouseUp); - } else if (cal.isPopup) { - cal._dragStart(ev); - } - if (el.navtype == -1 || el.navtype == 1) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); - } else if (el.navtype == -2 || el.navtype == 2) { - if (cal.timeout) clearTimeout(cal.timeout); - cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); - } else { - cal.timeout = null; - } - return Calendar.stopEvent(ev); + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + if (el.navtype == 50) { + el._current = el.innerHTML; + addEvent(document, "mousemove", tableMouseOver); + } else + addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); + addClass(el, "hilite active"); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + if (el.navtype == -1 || el.navtype == 1) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } + return Calendar.stopEvent(ev); }; Calendar.dayMouseDblClick = function(ev) { - Calendar.cellClick(Calendar.getElement(ev), ev || window.event); - if (Calendar.is_ie) { - document.selection.empty(); - } + Calendar.cellClick(Calendar.getElement(ev), ev || window.event); + if (Calendar.is_ie) { + document.selection.empty(); + } }; Calendar.dayMouseOver = function(ev) { - var el = Calendar.getElement(ev); - if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { - return false; - } - if (el.ttip) { - if (el.ttip.substr(0, 1) == "_") { - el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); - } - el.calendar.tooltips.innerHTML = el.ttip; - } - if (el.navtype != 300) { - Calendar.addClass(el, "hilite"); - if (el.caldate) { - Calendar.addClass(el.parentNode, "rowhilite"); - } - } - return Calendar.stopEvent(ev); + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.innerHTML = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + if (el.caldate) { + Calendar.addClass(el.parentNode, "rowhilite"); + } + } + return Calendar.stopEvent(ev); }; Calendar.dayMouseOut = function(ev) { - with (Calendar) { - var el = getElement(ev); - if (isRelated(el, ev) || _C || el.disabled) - return false; - removeClass(el, "hilite"); - if (el.caldate) - removeClass(el.parentNode, "rowhilite"); - if (el.calendar) - el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; - return stopEvent(ev); - } + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) + return false; + removeClass(el, "hilite"); + if (el.caldate) + removeClass(el.parentNode, "rowhilite"); + if (el.calendar) + el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; + return stopEvent(ev); + } }; /** @@ -576,135 +576,135 @@ Calendar.dayMouseOut = function(ev) { * calendar. */ Calendar.cellClick = function(el, ev) { - var cal = el.calendar; - var closing = false; - var newdate = false; - var date = null; - if (typeof el.navtype == "undefined") { - if (cal.currentDateEl) { - Calendar.removeClass(cal.currentDateEl, "selected"); - Calendar.addClass(el, "selected"); - closing = (cal.currentDateEl == el); - if (!closing) { - cal.currentDateEl = el; - } - } - cal.date.setDateOnly(el.caldate); - date = cal.date; - var other_month = !(cal.dateClicked = !el.otherMonth); - if (!other_month && !cal.currentDateEl) - cal._toggleMultipleDate(new Date(date)); - else - newdate = !el.disabled; - // a date was clicked - if (other_month) - cal._init(cal.firstDayOfWeek, date); - } else { - if (el.navtype == 200) { - Calendar.removeClass(el, "hilite"); - cal.callCloseHandler(); - return; - } - date = new Date(cal.date); - if (el.navtype == 0) - date.setDateOnly(new Date()); // TODAY - // unless "today" was clicked, we assume no date was clicked so - // the selected handler will know not to close the calenar when - // in single-click mode. - // cal.dateClicked = (el.navtype == 0); - cal.dateClicked = false; - var year = date.getFullYear(); - var mon = date.getMonth(); - function setMonth(m) { - var day = date.getDate(); - var max = date.getMonthDays(m); - if (day > max) { - date.setDate(max); - } - date.setMonth(m); - }; - switch (el.navtype) { - case 400: - Calendar.removeClass(el, "hilite"); - var text = Calendar._TT["ABOUT"]; - if (typeof text != "undefined") { - text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; - } else { - // FIXME: this should be removed as soon as lang files get updated! - text = "Help and about box text is not translated into this language.\n" + - "If you know this language and you feel generous please update\n" + - "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + - "and send it back to to get it into the distribution ;-)\n\n" + - "Thank you!\n" + - "http://dynarch.com/mishoo/calendar.epl\n"; - } - alert(text); - return; - case -2: - if (year > cal.minYear) { - date.setFullYear(year - 1); - } - break; - case -1: - if (mon > 0) { - setMonth(mon - 1); - } else if (year-- > cal.minYear) { - date.setFullYear(year); - setMonth(11); - } - break; - case 1: - if (mon < 11) { - setMonth(mon + 1); - } else if (year < cal.maxYear) { - date.setFullYear(year + 1); - setMonth(0); - } - break; - case 2: - if (year < cal.maxYear) { - date.setFullYear(year + 1); - } - break; - case 100: - cal.setFirstDayOfWeek(el.fdow); - return; - case 50: - var range = el._range; - var current = el.innerHTML; - for (var i = range.length; --i >= 0;) - if (range[i] == current) - break; - if (ev && ev.shiftKey) { - if (--i < 0) - i = range.length - 1; - } else if ( ++i >= range.length ) - i = 0; - var newval = range[i]; - el.innerHTML = newval; - cal.onUpdateTime(); - return; - case 0: - // TODAY will bring us here - if ((typeof cal.getDateStatus == "function") && - cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { - return false; - } - break; - } - if (!date.equalsTo(cal.date)) { - cal.setDate(date); - newdate = true; - } else if (el.navtype == 0) - newdate = closing = true; - } - if (newdate) { - ev && cal.callHandler(); - } - if (closing) { - Calendar.removeClass(el, "hilite"); - ev && cal.callCloseHandler(); - } + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + if (typeof el.navtype == "undefined") { + if (cal.currentDateEl) { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + } + cal.date.setDateOnly(el.caldate); + date = cal.date; + var other_month = !(cal.dateClicked = !el.otherMonth); + if (!other_month && !cal.currentDateEl) + cal._toggleMultipleDate(new Date(date)); + else + newdate = !el.disabled; + // a date was clicked + if (other_month) + cal._init(cal.firstDayOfWeek, date); + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = new Date(cal.date); + if (el.navtype == 0) + date.setDateOnly(new Date()); // TODAY + // unless "today" was clicked, we assume no date was clicked so + // the selected handler will know not to close the calenar when + // in single-click mode. + // cal.dateClicked = (el.navtype == 0); + cal.dateClicked = false; + var year = date.getFullYear(); + var mon = date.getMonth(); + function setMonth(m) { + var day = date.getDate(); + var max = date.getMonthDays(m); + if (day > max) { + date.setDate(max); + } + date.setMonth(m); + }; + switch (el.navtype) { + case 400: + Calendar.removeClass(el, "hilite"); + var text = Calendar._TT["ABOUT"]; + if (typeof text != "undefined") { + text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; + } else { + // FIXME: this should be removed as soon as lang files get updated! + text = "Help and about box text is not translated into this language.\n" + + "If you know this language and you feel generous please update\n" + + "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + + "and send it back to to get it into the distribution ;-)\n\n" + + "Thank you!\n" + + "http://dynarch.com/mishoo/calendar.epl\n"; + } + alert(text); + return; + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setFirstDayOfWeek(el.fdow); + return; + case 50: + var range = el._range; + var current = el.innerHTML; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + if (ev && ev.shiftKey) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + cal.onUpdateTime(); + return; + case 0: + // TODAY will bring us here + if ((typeof cal.getDateStatus == "function") && + cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { + return false; + } + break; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = true; + } else if (el.navtype == 0) + newdate = closing = true; + } + if (newdate) { + ev && cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + ev && cal.callCloseHandler(); + } }; // END: CALENDAR STATIC FUNCTIONS @@ -718,512 +718,512 @@ Calendar.cellClick = function(el, ev) { * hidden). Some properties need to be set before calling this function. */ Calendar.prototype.create = function (_par) { - var parent = null; - if (! _par) { - // default parent is the document body, in which case we create - // a popup calendar. - parent = document.getElementsByTagName("body")[0]; - this.isPopup = true; - } else { - parent = _par; - this.isPopup = false; - } - this.date = this.dateStr ? new Date(this.dateStr) : new Date(); - - var table = Calendar.createElement("table"); - this.table = table; - table.cellSpacing = 0; - table.cellPadding = 0; - table.calendar = this; - Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); - - var div = Calendar.createElement("div"); - this.element = div; - div.className = "calendar"; - if (this.isPopup) { - div.style.position = "absolute"; - div.style.display = "none"; - } - div.appendChild(table); - - var thead = Calendar.createElement("thead", table); - var cell = null; - var row = null; - - var cal = this; - var hh = function (text, cs, navtype) { - cell = Calendar.createElement("td", row); - cell.colSpan = cs; - cell.className = "button"; - if (navtype != 0 && Math.abs(navtype) <= 2) - cell.className += " nav"; - Calendar._add_evs(cell); - cell.calendar = cal; - cell.navtype = navtype; - cell.innerHTML = "
" + text + "
"; - return cell; - }; - - row = Calendar.createElement("tr", thead); - var title_length = 6; - (this.isPopup) && --title_length; - (this.weekNumbers) && ++title_length; - - hh("?", 1, 400).ttip = Calendar._TT["INFO"]; - this.title = hh("", title_length, 300); - this.title.className = "title"; - if (this.isPopup) { - this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; - this.title.style.cursor = "move"; - hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; - } - - row = Calendar.createElement("tr", thead); - row.className = "headrow"; - - this._nav_py = hh("«", 1, -2); - this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; - - this._nav_pm = hh("‹", 1, -1); - this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; - - this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); - this._nav_now.ttip = Calendar._TT["GO_TODAY"]; - - this._nav_nm = hh("›", 1, 1); - this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; - - this._nav_ny = hh("»", 1, 2); - this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; - - // day names - row = Calendar.createElement("tr", thead); - row.className = "daynames"; - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - cell.className = "name wn"; - cell.innerHTML = Calendar._TT["WK"]; - } - for (var i = 7; i > 0; --i) { - cell = Calendar.createElement("td", row); - if (!i) { - cell.navtype = 100; - cell.calendar = this; - Calendar._add_evs(cell); - } - } - this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; - this._displayWeekdays(); - - var tbody = Calendar.createElement("tbody", table); - this.tbody = tbody; - - for (i = 6; i > 0; --i) { - row = Calendar.createElement("tr", tbody); - if (this.weekNumbers) { - cell = Calendar.createElement("td", row); - } - for (var j = 7; j > 0; --j) { - cell = Calendar.createElement("td", row); - cell.calendar = this; - Calendar._add_evs(cell); - } - } - - if (this.showsTime) { - row = Calendar.createElement("tr", tbody); - row.className = "time"; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - cell.innerHTML = Calendar._TT["TIME"] || " "; - - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = this.weekNumbers ? 4 : 3; - - (function(){ - function makeTimePart(className, init, range_start, range_end) { - var part = Calendar.createElement("span", cell); - part.className = className; - part.innerHTML = init; - part.calendar = cal; - part.ttip = Calendar._TT["TIME_PART"]; - part.navtype = 50; - part._range = []; - if (typeof range_start != "number") - part._range = range_start; - else { - for (var i = range_start; i <= range_end; ++i) { - var txt; - if (i < 10 && range_end >= 10) txt = '0' + i; - else txt = '' + i; - part._range[part._range.length] = txt; - } - } - Calendar._add_evs(part); - return part; - }; - var hrs = cal.date.getHours(); - var mins = cal.date.getMinutes(); - var t12 = !cal.time24; - var pm = (hrs > 12); - if (t12 && pm) hrs -= 12; - var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); - var span = Calendar.createElement("span", cell); - span.innerHTML = ":"; - span.className = "colon"; - var M = makeTimePart("minute", mins, 0, 59); - var AP = null; - cell = Calendar.createElement("td", row); - cell.className = "time"; - cell.colSpan = 2; - if (t12) - AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); - else - cell.innerHTML = " "; - - cal.onSetTime = function() { - var pm, hrs = this.date.getHours(), - mins = this.date.getMinutes(); - if (t12) { - pm = (hrs >= 12); - if (pm) hrs -= 12; - if (hrs == 0) hrs = 12; - AP.innerHTML = pm ? "pm" : "am"; - } - H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; - M.innerHTML = (mins < 10) ? ("0" + mins) : mins; - }; - - cal.onUpdateTime = function() { - var date = this.date; - var h = parseInt(H.innerHTML, 10); - if (t12) { - if (/pm/i.test(AP.innerHTML) && h < 12) - h += 12; - else if (/am/i.test(AP.innerHTML) && h == 12) - h = 0; - } - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); - date.setHours(h); - date.setMinutes(parseInt(M.innerHTML, 10)); - date.setFullYear(y); - date.setMonth(m); - date.setDate(d); - this.dateClicked = false; - this.callHandler(); - }; - })(); - } else { - this.onSetTime = this.onUpdateTime = function() {}; - } - - var tfoot = Calendar.createElement("tfoot", table); - - row = Calendar.createElement("tr", tfoot); - row.className = "footrow"; - - cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); - cell.className = "ttip"; - if (this.isPopup) { - cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; - cell.style.cursor = "move"; - } - this.tooltips = cell; - - div = Calendar.createElement("div", this.element); - this.monthsCombo = div; - div.className = "combo"; - for (i = 0; i < Calendar._MN.length; ++i) { - var mn = Calendar.createElement("div"); - mn.className = Calendar.is_ie ? "label-IEfix" : "label"; - mn.month = i; - mn.innerHTML = Calendar._SMN[i]; - div.appendChild(mn); - } - - div = Calendar.createElement("div", this.element); - this.yearsCombo = div; - div.className = "combo"; - for (i = 12; i > 0; --i) { - var yr = Calendar.createElement("div"); - yr.className = Calendar.is_ie ? "label-IEfix" : "label"; - div.appendChild(yr); - } - - this._init(this.firstDayOfWeek, this.date); - parent.appendChild(this.element); + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + if (navtype != 0 && Math.abs(navtype) <= 2) + cell.className += " nav"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + cell.innerHTML = "
" + text + "
"; + return cell; + }; + + row = Calendar.createElement("tr", thead); + var title_length = 6; + (this.isPopup) && --title_length; + (this.weekNumbers) && ++title_length; + + hh("?", 1, 400).ttip = Calendar._TT["INFO"]; + this.title = hh("", title_length, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + this._nav_py = hh("«", 1, -2); + this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; + + this._nav_pm = hh("‹", 1, -1); + this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; + + this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); + this._nav_now.ttip = Calendar._TT["GO_TODAY"]; + + this._nav_nm = hh("›", 1, 1); + this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; + + this._nav_ny = hh("»", 1, 2); + this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + cell.className = "name wn"; + cell.innerHTML = Calendar._TT["WK"]; + } + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + } + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + if (this.showsTime) { + row = Calendar.createElement("tr", tbody); + row.className = "time"; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + cell.innerHTML = Calendar._TT["TIME"] || " "; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = this.weekNumbers ? 4 : 3; + + (function(){ + function makeTimePart(className, init, range_start, range_end) { + var part = Calendar.createElement("span", cell); + part.className = className; + part.innerHTML = init; + part.calendar = cal; + part.ttip = Calendar._TT["TIME_PART"]; + part.navtype = 50; + part._range = []; + if (typeof range_start != "number") + part._range = range_start; + else { + for (var i = range_start; i <= range_end; ++i) { + var txt; + if (i < 10 && range_end >= 10) txt = '0' + i; + else txt = '' + i; + part._range[part._range.length] = txt; + } + } + Calendar._add_evs(part); + return part; + }; + var hrs = cal.date.getHours(); + var mins = cal.date.getMinutes(); + var t12 = !cal.time24; + var pm = (hrs > 12); + if (t12 && pm) hrs -= 12; + var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); + var span = Calendar.createElement("span", cell); + span.innerHTML = ":"; + span.className = "colon"; + var M = makeTimePart("minute", mins, 0, 59); + var AP = null; + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + if (t12) + AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); + else + cell.innerHTML = " "; + + cal.onSetTime = function() { + var pm, hrs = this.date.getHours(), + mins = this.date.getMinutes(); + if (t12) { + pm = (hrs >= 12); + if (pm) hrs -= 12; + if (hrs == 0) hrs = 12; + AP.innerHTML = pm ? "pm" : "am"; + } + H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; + M.innerHTML = (mins < 10) ? ("0" + mins) : mins; + }; + + cal.onUpdateTime = function() { + var date = this.date; + var h = parseInt(H.innerHTML, 10); + if (t12) { + if (/pm/i.test(AP.innerHTML) && h < 12) + h += 12; + else if (/am/i.test(AP.innerHTML) && h == 12) + h = 0; + } + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + date.setHours(h); + date.setMinutes(parseInt(M.innerHTML, 10)); + date.setFullYear(y); + date.setMonth(m); + date.setDate(d); + this.dateClicked = false; + this.callHandler(); + }; + })(); + } else { + this.onSetTime = this.onUpdateTime = function() {}; + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = Calendar.is_ie ? "label-IEfix" : "label"; + mn.month = i; + mn.innerHTML = Calendar._SMN[i]; + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = Calendar.is_ie ? "label-IEfix" : "label"; + div.appendChild(yr); + } + + this._init(this.firstDayOfWeek, this.date); + parent.appendChild(this.element); }; /** keyboard navigation, only for popup calendars */ Calendar._keyEvent = function(ev) { - var cal = window._dynarch_popupCalendar; - if (!cal || cal.multiple) - return false; - (Calendar.is_ie) && (ev = window.event); - var act = (Calendar.is_ie || ev.type == "keypress"), - K = ev.keyCode; - if (ev.ctrlKey) { - switch (K) { - case 37: // KEY left - act && Calendar.cellClick(cal._nav_pm); - break; - case 38: // KEY up - act && Calendar.cellClick(cal._nav_py); - break; - case 39: // KEY right - act && Calendar.cellClick(cal._nav_nm); - break; - case 40: // KEY down - act && Calendar.cellClick(cal._nav_ny); - break; - default: - return false; - } - } else switch (K) { - case 32: // KEY space (now) - Calendar.cellClick(cal._nav_now); - break; - case 27: // KEY esc - act && cal.callCloseHandler(); - break; - case 37: // KEY left - case 38: // KEY up - case 39: // KEY right - case 40: // KEY down - if (act) { - var prev, x, y, ne, el, step; - prev = K == 37 || K == 38; - step = (K == 37 || K == 39) ? 1 : 7; - function setVars() { - el = cal.currentDateEl; - var p = el.pos; - x = p & 15; - y = p >> 4; - ne = cal.ar_days[y][x]; - };setVars(); - function prevMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() - step); - cal.setDate(date); - }; - function nextMonth() { - var date = new Date(cal.date); - date.setDate(date.getDate() + step); - cal.setDate(date); - }; - while (1) { - switch (K) { - case 37: // KEY left - if (--x >= 0) - ne = cal.ar_days[y][x]; - else { - x = 6; - K = 38; - continue; - } - break; - case 38: // KEY up - if (--y >= 0) - ne = cal.ar_days[y][x]; - else { - prevMonth(); - setVars(); - } - break; - case 39: // KEY right - if (++x < 7) - ne = cal.ar_days[y][x]; - else { - x = 0; - K = 40; - continue; - } - break; - case 40: // KEY down - if (++y < cal.ar_days.length) - ne = cal.ar_days[y][x]; - else { - nextMonth(); - setVars(); - } - break; - } - break; - } - if (ne) { - if (!ne.disabled) - Calendar.cellClick(ne); - else if (prev) - prevMonth(); - else - nextMonth(); - } - } - break; - case 13: // KEY enter - if (act) - Calendar.cellClick(cal.currentDateEl, ev); - break; - default: - return false; - } - return Calendar.stopEvent(ev); + var cal = window._dynarch_popupCalendar; + if (!cal || cal.multiple) + return false; + (Calendar.is_ie) && (ev = window.event); + var act = (Calendar.is_ie || ev.type == "keypress"), + K = ev.keyCode; + if (ev.ctrlKey) { + switch (K) { + case 37: // KEY left + act && Calendar.cellClick(cal._nav_pm); + break; + case 38: // KEY up + act && Calendar.cellClick(cal._nav_py); + break; + case 39: // KEY right + act && Calendar.cellClick(cal._nav_nm); + break; + case 40: // KEY down + act && Calendar.cellClick(cal._nav_ny); + break; + default: + return false; + } + } else switch (K) { + case 32: // KEY space (now) + Calendar.cellClick(cal._nav_now); + break; + case 27: // KEY esc + act && cal.callCloseHandler(); + break; + case 37: // KEY left + case 38: // KEY up + case 39: // KEY right + case 40: // KEY down + if (act) { + var prev, x, y, ne, el, step; + prev = K == 37 || K == 38; + step = (K == 37 || K == 39) ? 1 : 7; + function setVars() { + el = cal.currentDateEl; + var p = el.pos; + x = p & 15; + y = p >> 4; + ne = cal.ar_days[y][x]; + };setVars(); + function prevMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() - step); + cal.setDate(date); + }; + function nextMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() + step); + cal.setDate(date); + }; + while (1) { + switch (K) { + case 37: // KEY left + if (--x >= 0) + ne = cal.ar_days[y][x]; + else { + x = 6; + K = 38; + continue; + } + break; + case 38: // KEY up + if (--y >= 0) + ne = cal.ar_days[y][x]; + else { + prevMonth(); + setVars(); + } + break; + case 39: // KEY right + if (++x < 7) + ne = cal.ar_days[y][x]; + else { + x = 0; + K = 40; + continue; + } + break; + case 40: // KEY down + if (++y < cal.ar_days.length) + ne = cal.ar_days[y][x]; + else { + nextMonth(); + setVars(); + } + break; + } + break; + } + if (ne) { + if (!ne.disabled) + Calendar.cellClick(ne); + else if (prev) + prevMonth(); + else + nextMonth(); + } + } + break; + case 13: // KEY enter + if (act) + Calendar.cellClick(cal.currentDateEl, ev); + break; + default: + return false; + } + return Calendar.stopEvent(ev); }; /** * (RE)Initializes the calendar to the given date and firstDayOfWeek */ Calendar.prototype._init = function (firstDayOfWeek, date) { - var today = new Date(), - TY = today.getFullYear(), - TM = today.getMonth(), - TD = today.getDate(); - this.table.style.visibility = "hidden"; - var year = date.getFullYear(); - if (year < this.minYear) { - year = this.minYear; - date.setFullYear(year); - } else if (year > this.maxYear) { - year = this.maxYear; - date.setFullYear(year); - } - this.firstDayOfWeek = firstDayOfWeek; - this.date = new Date(date); - var month = date.getMonth(); - var mday = date.getDate(); - var no_days = date.getMonthDays(); - - // calendar voodoo for computing the first day that would actually be - // displayed in the calendar, even if it's from the previous month. - // WARNING: this is magic. ;-) - date.setDate(1); - var day1 = (date.getDay() - this.firstDayOfWeek) % 7; - if (day1 < 0) - day1 += 7; - date.setDate(-day1); - date.setDate(date.getDate() + 1); - - var row = this.tbody.firstChild; - var MN = Calendar._SMN[month]; - var ar_days = this.ar_days = new Array(); - var weekend = Calendar._TT["WEEKEND"]; - var dates = this.multiple ? (this.datesCells = {}) : null; - for (var i = 0; i < 6; ++i, row = row.nextSibling) { - var cell = row.firstChild; - if (this.weekNumbers) { - cell.className = "day wn"; - cell.innerHTML = date.getWeekNumber(); - cell = cell.nextSibling; - } - row.className = "daysrow"; - var hasdays = false, iday, dpos = ar_days[i] = []; - for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { - iday = date.getDate(); - var wday = date.getDay(); - cell.className = "day"; - cell.pos = i << 4 | j; - dpos[j] = cell; - var current_month = (date.getMonth() == month); - if (!current_month) { - if (this.showsOtherMonths) { - cell.className += " othermonth"; - cell.otherMonth = true; - } else { - cell.className = "emptycell"; - cell.innerHTML = " "; - cell.disabled = true; - continue; - } - } else { - cell.otherMonth = false; - hasdays = true; - } - cell.disabled = false; - cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; - if (dates) - dates[date.print("%Y%m%d")] = cell; - if (this.getDateStatus) { - var status = this.getDateStatus(date, year, month, iday); - if (this.getDateToolTip) { - var toolTip = this.getDateToolTip(date, year, month, iday); - if (toolTip) - cell.title = toolTip; - } - if (status === true) { - cell.className += " disabled"; - cell.disabled = true; - } else { - if (/disabled/i.test(status)) - cell.disabled = true; - cell.className += " " + status; - } - } - if (!cell.disabled) { - cell.caldate = new Date(date); - cell.ttip = "_"; - if (!this.multiple && current_month - && iday == mday && this.hiliteToday) { - cell.className += " selected"; - this.currentDateEl = cell; - } - if (date.getFullYear() == TY && - date.getMonth() == TM && - iday == TD) { - cell.className += " today"; - cell.ttip += Calendar._TT["PART_TODAY"]; - } - if (weekend.indexOf(wday.toString()) != -1) - cell.className += cell.otherMonth ? " oweekend" : " weekend"; - } - } - if (!(hasdays || this.showsOtherMonths)) - row.className = "emptyrow"; - } - this.title.innerHTML = Calendar._MN[month] + ", " + year; - this.onSetTime(); - this.table.style.visibility = "visible"; - this._initMultipleDates(); - // PROFILE - // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; + var today = new Date(), + TY = today.getFullYear(), + TM = today.getMonth(), + TD = today.getDate(); + this.table.style.visibility = "hidden"; + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.firstDayOfWeek = firstDayOfWeek; + this.date = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + + // calendar voodoo for computing the first day that would actually be + // displayed in the calendar, even if it's from the previous month. + // WARNING: this is magic. ;-) + date.setDate(1); + var day1 = (date.getDay() - this.firstDayOfWeek) % 7; + if (day1 < 0) + day1 += 7; + date.setDate(-day1); + date.setDate(date.getDate() + 1); + + var row = this.tbody.firstChild; + var MN = Calendar._SMN[month]; + var ar_days = this.ar_days = new Array(); + var weekend = Calendar._TT["WEEKEND"]; + var dates = this.multiple ? (this.datesCells = {}) : null; + for (var i = 0; i < 6; ++i, row = row.nextSibling) { + var cell = row.firstChild; + if (this.weekNumbers) { + cell.className = "day wn"; + cell.innerHTML = date.getWeekNumber(); + cell = cell.nextSibling; + } + row.className = "daysrow"; + var hasdays = false, iday, dpos = ar_days[i] = []; + for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { + iday = date.getDate(); + var wday = date.getDay(); + cell.className = "day"; + cell.pos = i << 4 | j; + dpos[j] = cell; + var current_month = (date.getMonth() == month); + if (!current_month) { + if (this.showsOtherMonths) { + cell.className += " othermonth"; + cell.otherMonth = true; + } else { + cell.className = "emptycell"; + cell.innerHTML = " "; + cell.disabled = true; + continue; + } + } else { + cell.otherMonth = false; + hasdays = true; + } + cell.disabled = false; + cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; + if (dates) + dates[date.print("%Y%m%d")] = cell; + if (this.getDateStatus) { + var status = this.getDateStatus(date, year, month, iday); + if (this.getDateToolTip) { + var toolTip = this.getDateToolTip(date, year, month, iday); + if (toolTip) + cell.title = toolTip; + } + if (status === true) { + cell.className += " disabled"; + cell.disabled = true; + } else { + if (/disabled/i.test(status)) + cell.disabled = true; + cell.className += " " + status; + } + } + if (!cell.disabled) { + cell.caldate = new Date(date); + cell.ttip = "_"; + if (!this.multiple && current_month + && iday == mday && this.hiliteToday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (date.getFullYear() == TY && + date.getMonth() == TM && + iday == TD) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (weekend.indexOf(wday.toString()) != -1) + cell.className += cell.otherMonth ? " oweekend" : " weekend"; + } + } + if (!(hasdays || this.showsOtherMonths)) + row.className = "emptyrow"; + } + this.title.innerHTML = Calendar._MN[month] + ", " + year; + this.onSetTime(); + this.table.style.visibility = "visible"; + this._initMultipleDates(); + // PROFILE + // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; }; Calendar.prototype._initMultipleDates = function() { - if (this.multiple) { - for (var i in this.multiple) { - var cell = this.datesCells[i]; - var d = this.multiple[i]; - if (!d) - continue; - if (cell) - cell.className += " selected"; - } - } + if (this.multiple) { + for (var i in this.multiple) { + var cell = this.datesCells[i]; + var d = this.multiple[i]; + if (!d) + continue; + if (cell) + cell.className += " selected"; + } + } }; Calendar.prototype._toggleMultipleDate = function(date) { - if (this.multiple) { - var ds = date.print("%Y%m%d"); - var cell = this.datesCells[ds]; - if (cell) { - var d = this.multiple[ds]; - if (!d) { - Calendar.addClass(cell, "selected"); - this.multiple[ds] = date; - } else { - Calendar.removeClass(cell, "selected"); - delete this.multiple[ds]; - } - } - } + if (this.multiple) { + var ds = date.print("%Y%m%d"); + var cell = this.datesCells[ds]; + if (cell) { + var d = this.multiple[ds]; + if (!d) { + Calendar.addClass(cell, "selected"); + this.multiple[ds] = date; + } else { + Calendar.removeClass(cell, "selected"); + delete this.multiple[ds]; + } + } + } }; Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { - this.getDateToolTip = unaryFunction; + this.getDateToolTip = unaryFunction; }; /** @@ -1231,9 +1231,9 @@ Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { * date is different than the currently selected one). */ Calendar.prototype.setDate = function (date) { - if (!date.equalsTo(this.date)) { - this._init(this.firstDayOfWeek, date); - } + if (!date.equalsTo(this.date)) { + this._init(this.firstDayOfWeek, date); + } }; /** @@ -1243,13 +1243,13 @@ Calendar.prototype.setDate = function (date) { * should * change. */ Calendar.prototype.refresh = function () { - this._init(this.firstDayOfWeek, this.date); + this._init(this.firstDayOfWeek, this.date); }; /** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { - this._init(firstDayOfWeek, this.date); - this._displayWeekdays(); + this._init(firstDayOfWeek, this.date); + this._displayWeekdays(); }; /** @@ -1259,36 +1259,36 @@ Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { * the passed date will be marked as disabled. */ Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { - this.getDateStatus = unaryFunction; + this.getDateStatus = unaryFunction; }; /** Customization of allowed year range for the calendar. */ Calendar.prototype.setRange = function (a, z) { - this.minYear = a; - this.maxYear = z; + this.minYear = a; + this.maxYear = z; }; /** Calls the first user handler (selectedHandler). */ Calendar.prototype.callHandler = function () { - if (this.onSelected) { - this.onSelected(this, this.date.print(this.dateFormat)); - } + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } }; /** Calls the second user handler (closeHandler). */ Calendar.prototype.callCloseHandler = function () { - if (this.onClose) { - this.onClose(this); - } - this.hideShowCovered(); + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); }; /** Removes the calendar object from the DOM tree and destroys it. */ Calendar.prototype.destroy = function () { - var el = this.element.parentNode; - el.removeChild(this.element); - Calendar._C = null; - window._dynarch_popupCalendar = null; + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + window._dynarch_popupCalendar = null; }; /** @@ -1296,50 +1296,50 @@ Calendar.prototype.destroy = function () { * its parent). */ Calendar.prototype.reparent = function (new_parent) { - var el = this.element; - el.parentNode.removeChild(el); - new_parent.appendChild(el); + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); }; // This gets called when the user presses a mouse button anywhere in the // document, if the calendar is shown. If the click was outside the open // calendar this function closes it. Calendar._checkCalendar = function(ev) { - var calendar = window._dynarch_popupCalendar; - if (!calendar) { - return false; - } - var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); - for (; el != null && el != calendar.element; el = el.parentNode); - if (el == null) { - // calls closeHandler which should hide the calendar. - window._dynarch_popupCalendar.callCloseHandler(); - return Calendar.stopEvent(ev); - } + var calendar = window._dynarch_popupCalendar; + if (!calendar) { + return false; + } + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + for (; el != null && el != calendar.element; el = el.parentNode); + if (el == null) { + // calls closeHandler which should hide the calendar. + window._dynarch_popupCalendar.callCloseHandler(); + return Calendar.stopEvent(ev); + } }; /** Shows the calendar. */ Calendar.prototype.show = function () { - var rows = this.table.getElementsByTagName("tr"); - for (var i = rows.length; i > 0;) { - var row = rows[--i]; - Calendar.removeClass(row, "rowhilite"); - var cells = row.getElementsByTagName("td"); - for (var j = cells.length; j > 0;) { - var cell = cells[--j]; - Calendar.removeClass(cell, "hilite"); - Calendar.removeClass(cell, "active"); - } - } - this.element.style.display = "block"; - this.hidden = false; - if (this.isPopup) { - window._dynarch_popupCalendar = this; - Calendar.addEvent(document, "keydown", Calendar._keyEvent); - Calendar.addEvent(document, "keypress", Calendar._keyEvent); - Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); - } - this.hideShowCovered(); + var rows = this.table.getElementsByTagName("tr"); + for (var i = rows.length; i > 0;) { + var row = rows[--i]; + Calendar.removeClass(row, "rowhilite"); + var cells = row.getElementsByTagName("td"); + for (var j = cells.length; j > 0;) { + var cell = cells[--j]; + Calendar.removeClass(cell, "hilite"); + Calendar.removeClass(cell, "active"); + } + } + this.element.style.display = "block"; + this.hidden = false; + if (this.isPopup) { + window._dynarch_popupCalendar = this; + Calendar.addEvent(document, "keydown", Calendar._keyEvent); + Calendar.addEvent(document, "keypress", Calendar._keyEvent); + Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); + } + this.hideShowCovered(); }; /** @@ -1347,14 +1347,14 @@ Calendar.prototype.show = function () { * element. */ Calendar.prototype.hide = function () { - if (this.isPopup) { - Calendar.removeEvent(document, "keydown", Calendar._keyEvent); - Calendar.removeEvent(document, "keypress", Calendar._keyEvent); - Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); - } - this.element.style.display = "none"; - this.hidden = true; - this.hideShowCovered(); + if (this.isPopup) { + Calendar.removeEvent(document, "keydown", Calendar._keyEvent); + Calendar.removeEvent(document, "keypress", Calendar._keyEvent); + Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); + } + this.element.style.display = "none"; + this.hidden = true; + this.hideShowCovered(); }; /** @@ -1363,90 +1363,90 @@ Calendar.prototype.hide = function () { * to the parent's containing rectangle). */ Calendar.prototype.showAt = function (x, y) { - var s = this.element.style; - s.left = x + "px"; - s.top = y + "px"; - this.show(); + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); }; /** Shows the calendar near a given element. */ Calendar.prototype.showAtElement = function (el, opts) { - var self = this; - var p = Calendar.getAbsolutePos(el); - if (!opts || typeof opts != "string") { - this.showAt(p.x, p.y + el.offsetHeight); - return true; - } - function fixPosition(box) { - if (box.x < 0) - box.x = 0; - if (box.y < 0) - box.y = 0; - var cp = Calendar.createElement("div"); - var s = cp.style; - s.position = "absolute"; - s.right = s.bottom = s.width = s.height = "0px"; - document.body.appendChild(cp); - var br = Calendar.getAbsolutePos(cp); - document.body.removeChild(cp); - if (Calendar.is_ie) { - br.y += document.body.scrollTop; - br.x += document.body.scrollLeft; - } else { - br.y += window.scrollY; - br.x += window.scrollX; - } - var tmp = box.x + box.width - br.x; - if (tmp > 0) box.x -= tmp; - tmp = box.y + box.height - br.y; - if (tmp > 0) box.y -= tmp; - }; - this.element.style.display = "block"; - Calendar.continuation_for_the_fucking_khtml_browser = function() { - var w = self.element.offsetWidth; - var h = self.element.offsetHeight; - self.element.style.display = "none"; - var valign = opts.substr(0, 1); - var halign = "l"; - if (opts.length > 1) { - halign = opts.substr(1, 1); - } - // vertical alignment - switch (valign) { - case "T": p.y -= h; break; - case "B": p.y += el.offsetHeight; break; - case "C": p.y += (el.offsetHeight - h) / 2; break; - case "t": p.y += el.offsetHeight - h; break; - case "b": break; // already there - } - // horizontal alignment - switch (halign) { - case "L": p.x -= w; break; - case "R": p.x += el.offsetWidth; break; - case "C": p.x += (el.offsetWidth - w) / 2; break; - case "l": p.x += el.offsetWidth - w; break; - case "r": break; // already there - } - p.width = w; - p.height = h + 40; - self.monthsCombo.style.display = "none"; - fixPosition(p); - self.showAt(p.x, p.y); - }; - if (Calendar.is_khtml) - setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); - else - Calendar.continuation_for_the_fucking_khtml_browser(); + var self = this; + var p = Calendar.getAbsolutePos(el); + if (!opts || typeof opts != "string") { + this.showAt(p.x, p.y + el.offsetHeight); + return true; + } + function fixPosition(box) { + if (box.x < 0) + box.x = 0; + if (box.y < 0) + box.y = 0; + var cp = Calendar.createElement("div"); + var s = cp.style; + s.position = "absolute"; + s.right = s.bottom = s.width = s.height = "0px"; + document.body.appendChild(cp); + var br = Calendar.getAbsolutePos(cp); + document.body.removeChild(cp); + if (Calendar.is_ie) { + br.y += document.body.scrollTop; + br.x += document.body.scrollLeft; + } else { + br.y += window.scrollY; + br.x += window.scrollX; + } + var tmp = box.x + box.width - br.x; + if (tmp > 0) box.x -= tmp; + tmp = box.y + box.height - br.y; + if (tmp > 0) box.y -= tmp; + }; + this.element.style.display = "block"; + Calendar.continuation_for_the_fucking_khtml_browser = function() { + var w = self.element.offsetWidth; + var h = self.element.offsetHeight; + self.element.style.display = "none"; + var valign = opts.substr(0, 1); + var halign = "l"; + if (opts.length > 1) { + halign = opts.substr(1, 1); + } + // vertical alignment + switch (valign) { + case "T": p.y -= h; break; + case "B": p.y += el.offsetHeight; break; + case "C": p.y += (el.offsetHeight - h) / 2; break; + case "t": p.y += el.offsetHeight - h; break; + case "b": break; // already there + } + // horizontal alignment + switch (halign) { + case "L": p.x -= w; break; + case "R": p.x += el.offsetWidth; break; + case "C": p.x += (el.offsetWidth - w) / 2; break; + case "l": p.x += el.offsetWidth - w; break; + case "r": break; // already there + } + p.width = w; + p.height = h + 40; + self.monthsCombo.style.display = "none"; + fixPosition(p); + self.showAt(p.x, p.y); + }; + if (Calendar.is_khtml) + setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); + else + Calendar.continuation_for_the_fucking_khtml_browser(); }; /** Customizes the date format. */ Calendar.prototype.setDateFormat = function (str) { - this.dateFormat = str; + this.dateFormat = str; }; /** Customizes the tooltip date format. */ Calendar.prototype.setTtDateFormat = function (str) { - this.ttDateFormat = str; + this.ttDateFormat = str; }; /** @@ -1454,119 +1454,119 @@ Calendar.prototype.setTtDateFormat = function (str) { * calls this.setDate which moves the calendar to the given date. */ Calendar.prototype.parseDate = function(str, fmt) { - if (!fmt) - fmt = this.dateFormat; - this.setDate(Date.parseDate(str, fmt)); + if (!fmt) + fmt = this.dateFormat; + this.setDate(Date.parseDate(str, fmt)); }; Calendar.prototype.hideShowCovered = function () { - if (!Calendar.is_ie && !Calendar.is_opera) - return; - function getVisib(obj){ - var value = obj.style.visibility; - if (!value) { - if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C - if (!Calendar.is_khtml) - value = document.defaultView. - getComputedStyle(obj, "").getPropertyValue("visibility"); - else - value = ''; - } else if (obj.currentStyle) { // IE - value = obj.currentStyle.visibility; - } else - value = ''; - } - return value; - }; - - var tags = new Array("applet", "iframe", "select"); - var el = this.element; - - var p = Calendar.getAbsolutePos(el); - var EX1 = p.x; - var EX2 = el.offsetWidth + EX1; - var EY1 = p.y; - var EY2 = el.offsetHeight + EY1; - - for (var k = tags.length; k > 0; ) { - var ar = document.getElementsByTagName(tags[--k]); - var cc = null; - - for (var i = ar.length; i > 0;) { - cc = ar[--i]; - - p = Calendar.getAbsolutePos(cc); - var CX1 = p.x; - var CX2 = cc.offsetWidth + CX1; - var CY1 = p.y; - var CY2 = cc.offsetHeight + CY1; - - if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = cc.__msh_save_visibility; - } else { - if (!cc.__msh_save_visibility) { - cc.__msh_save_visibility = getVisib(cc); - } - cc.style.visibility = "hidden"; - } - } - } + if (!Calendar.is_ie && !Calendar.is_opera) + return; + function getVisib(obj){ + var value = obj.style.visibility; + if (!value) { + if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C + if (!Calendar.is_khtml) + value = document.defaultView. + getComputedStyle(obj, "").getPropertyValue("visibility"); + else + value = ''; + } else if (obj.currentStyle) { // IE + value = obj.currentStyle.visibility; + } else + value = ''; + } + return value; + }; + + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = cc.__msh_save_visibility; + } else { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = "hidden"; + } + } + } }; /** Internal function; it displays the bar with the names of the weekday. */ Calendar.prototype._displayWeekdays = function () { - var fdow = this.firstDayOfWeek; - var cell = this.firstdayname; - var weekend = Calendar._TT["WEEKEND"]; - for (var i = 0; i < 7; ++i) { - cell.className = "day name"; - var realday = (i + fdow) % 7; - if (i) { - cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); - cell.navtype = 100; - cell.calendar = this; - cell.fdow = realday; - Calendar._add_evs(cell); - } - if (weekend.indexOf(realday.toString()) != -1) { - Calendar.addClass(cell, "weekend"); - } - cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; - cell = cell.nextSibling; - } + var fdow = this.firstDayOfWeek; + var cell = this.firstdayname; + var weekend = Calendar._TT["WEEKEND"]; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + var realday = (i + fdow) % 7; + if (i) { + cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); + cell.navtype = 100; + cell.calendar = this; + cell.fdow = realday; + Calendar._add_evs(cell); + } + if (weekend.indexOf(realday.toString()) != -1) { + Calendar.addClass(cell, "weekend"); + } + cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; + cell = cell.nextSibling; + } }; /** Internal function. Hides all combo boxes that might be displayed. */ Calendar.prototype._hideCombos = function () { - this.monthsCombo.style.display = "none"; - this.yearsCombo.style.display = "none"; + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; }; /** Internal function. Starts dragging the element. */ Calendar.prototype._dragStart = function (ev) { - if (this.dragging) { - return; - } - this.dragging = true; - var posX; - var posY; - if (Calendar.is_ie) { - posY = window.event.clientY + document.body.scrollTop; - posX = window.event.clientX + document.body.scrollLeft; - } else { - posY = ev.clientY + window.scrollY; - posX = ev.clientX + window.scrollX; - } - var st = this.element.style; - this.xOffs = posX - parseInt(st.left); - this.yOffs = posY - parseInt(st.top); - with (Calendar) { - addEvent(document, "mousemove", calDragIt); - addEvent(document, "mouseup", calDragEnd); - } + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseup", calDragEnd); + } }; // BEGIN: DATE OBJECT PATCHES @@ -1582,221 +1582,221 @@ Date.DAY = 24 * Date.HOUR; Date.WEEK = 7 * Date.DAY; Date.parseDate = function(str, fmt) { - var today = new Date(); - var y = 0; - var m = -1; - var d = 0; - var a = str.split(/\W+/); - var b = fmt.match(/%./g); - var i = 0, j = 0; - var hr = 0; - var min = 0; - for (i = 0; i < a.length; ++i) { - if (!a[i]) - continue; - switch (b[i]) { - case "%d": - case "%e": - d = parseInt(a[i], 10); - break; - - case "%m": - m = parseInt(a[i], 10) - 1; - break; - - case "%Y": - case "%y": - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - break; - - case "%b": - case "%B": - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } - } - break; - - case "%H": - case "%I": - case "%k": - case "%l": - hr = parseInt(a[i], 10); - break; - - case "%P": - case "%p": - if (/pm/i.test(a[i]) && hr < 12) - hr += 12; - else if (/am/i.test(a[i]) && hr >= 12) - hr -= 12; - break; - - case "%M": - min = parseInt(a[i], 10); - break; - } - } - if (isNaN(y)) y = today.getFullYear(); - if (isNaN(m)) m = today.getMonth(); - if (isNaN(d)) d = today.getDate(); - if (isNaN(hr)) hr = today.getHours(); - if (isNaN(min)) min = today.getMinutes(); - if (y != 0 && m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - y = 0; m = -1; d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } - } - if (t != -1) { - if (m != -1) { - d = m+1; - } - m = t; - } - } else if (parseInt(a[i], 10) <= 12 && m == -1) { - m = a[i]-1; - } else if (parseInt(a[i], 10) > 31 && y == 0) { - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) - y = today.getFullYear(); - if (m != -1 && d != 0) - return new Date(y, m, d, hr, min, 0); - return today; + var today = new Date(); + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + var b = fmt.match(/%./g); + var i = 0, j = 0; + var hr = 0; + var min = 0; + for (i = 0; i < a.length; ++i) { + if (!a[i]) + continue; + switch (b[i]) { + case "%d": + case "%e": + d = parseInt(a[i], 10); + break; + + case "%m": + m = parseInt(a[i], 10) - 1; + break; + + case "%Y": + case "%y": + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + break; + + case "%b": + case "%B": + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + break; + + case "%H": + case "%I": + case "%k": + case "%l": + hr = parseInt(a[i], 10); + break; + + case "%P": + case "%p": + if (/pm/i.test(a[i]) && hr < 12) + hr += 12; + else if (/am/i.test(a[i]) && hr >= 12) + hr -= 12; + break; + + case "%M": + min = parseInt(a[i], 10); + break; + } + } + if (isNaN(y)) y = today.getFullYear(); + if (isNaN(m)) m = today.getMonth(); + if (isNaN(d)) d = today.getDate(); + if (isNaN(hr)) hr = today.getHours(); + if (isNaN(min)) min = today.getMinutes(); + if (y != 0 && m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i], 10) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i], 10) > 31 && y == 0) { + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) + y = today.getFullYear(); + if (m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + return today; }; /** Returns the number of days in the current month */ Date.prototype.getMonthDays = function(month) { - var year = this.getFullYear(); - if (typeof month == "undefined") { - month = this.getMonth(); - } - if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } + var year = this.getFullYear(); + if (typeof month == "undefined") { + month = this.getMonth(); + } + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } }; /** Returns the number of day in the year. */ Date.prototype.getDayOfYear = function() { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / Date.DAY); + var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); + var time = now - then; + return Math.floor(time / Date.DAY); }; /** Returns the number of the week in year, as defined in ISO 8601. */ Date.prototype.getWeekNumber = function() { - var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var DoW = d.getDay(); - d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu - var ms = d.valueOf(); // GMT - d.setMonth(0); - d.setDate(4); // Thu in Week 1 - return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; + var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var DoW = d.getDay(); + d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu + var ms = d.valueOf(); // GMT + d.setMonth(0); + d.setDate(4); // Thu in Week 1 + return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; }; /** Checks date and time equality */ Date.prototype.equalsTo = function(date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate()) && - (this.getHours() == date.getHours()) && - (this.getMinutes() == date.getMinutes())); + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate()) && + (this.getHours() == date.getHours()) && + (this.getMinutes() == date.getMinutes())); }; /** Set only the year, month, date parts (keep existing time) */ Date.prototype.setDateOnly = function(date) { - var tmp = new Date(date); - this.setDate(1); - this.setFullYear(tmp.getFullYear()); - this.setMonth(tmp.getMonth()); - this.setDate(tmp.getDate()); + var tmp = new Date(date); + this.setDate(1); + this.setFullYear(tmp.getFullYear()); + this.setMonth(tmp.getMonth()); + this.setDate(tmp.getDate()); }; /** Prints the date in a string according to the given format. */ Date.prototype.print = function (str) { - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var wn = this.getWeekNumber(); - var w = this.getDay(); - var s = {}; - var hr = this.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = this.getDayOfYear(); - if (ir == 0) - ir = 12; - var min = this.getMinutes(); - var sec = this.getSeconds(); - s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = Calendar._DN[w]; // full weekday name - s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = Calendar._MN[m]; // full month name - // FIXME: %c : preferred date and time representation for the current locale - s["%C"] = 1 + Math.floor(y / 100); // the century number - s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) - s["%e"] = d; // the day of the month (range 1 to 31) - // FIXME: %D : american date style: %m/%d/%y - // FIXME: %E, %F, %G, %g, %h (man strftime) - s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) - s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) - s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) - s["%k"] = hr; // hour, range 0 to 23 (24h format) - s["%l"] = ir; // hour, range 1 to 12 (12h format) - s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 - s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 - s["%n"] = "\n"; // a newline character - s["%p"] = pm ? "PM" : "AM"; - s["%P"] = pm ? "pm" : "am"; - // FIXME: %r : the time in am/pm notation %I:%M:%S %p - // FIXME: %R : the time in 24-hour notation %H:%M - s["%s"] = Math.floor(this.getTime() / 1000); - s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 - s["%t"] = "\t"; // a tab character - // FIXME: %T : the time in 24-hour notation (%H:%M:%S) - s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; - s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) - s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) - // FIXME: %x : preferred date representation for the current locale without the time - // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) - s["%Y"] = y; // year with the century - s["%%"] = "%"; // a literal '%' character - - var re = /%./g; - if (!Calendar.is_ie5 && !Calendar.is_khtml) - return str.replace(re, function (par) { return s[par] || par; }); - - var a = str.match(re); - for (var i = 0; i < a.length; i++) { - var tmp = s[a[i]]; - if (tmp) { - re = new RegExp(a[i], 'g'); - str = str.replace(re, tmp); - } - } - - return str; + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var wn = this.getWeekNumber(); + var w = this.getDay(); + var s = {}; + var hr = this.getHours(); + var pm = (hr >= 12); + var ir = (pm) ? (hr - 12) : hr; + var dy = this.getDayOfYear(); + if (ir == 0) + ir = 12; + var min = this.getMinutes(); + var sec = this.getSeconds(); + s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] + s["%A"] = Calendar._DN[w]; // full weekday name + s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] + s["%B"] = Calendar._MN[m]; // full month name + // FIXME: %c : preferred date and time representation for the current locale + s["%C"] = 1 + Math.floor(y / 100); // the century number + s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) + s["%e"] = d; // the day of the month (range 1 to 31) + // FIXME: %D : american date style: %m/%d/%y + // FIXME: %E, %F, %G, %g, %h (man strftime) + s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) + s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) + s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) + s["%k"] = hr; // hour, range 0 to 23 (24h format) + s["%l"] = ir; // hour, range 1 to 12 (12h format) + s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 + s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 + s["%n"] = "\n"; // a newline character + s["%p"] = pm ? "PM" : "AM"; + s["%P"] = pm ? "pm" : "am"; + // FIXME: %r : the time in am/pm notation %I:%M:%S %p + // FIXME: %R : the time in 24-hour notation %H:%M + s["%s"] = Math.floor(this.getTime() / 1000); + s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 + s["%t"] = "\t"; // a tab character + // FIXME: %T : the time in 24-hour notation (%H:%M:%S) + s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; + s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) + s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) + // FIXME: %x : preferred date representation for the current locale without the time + // FIXME: %X : preferred time representation for the current locale without the date + s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%Y"] = y; // year with the century + s["%%"] = "%"; // a literal '%' character + + var re = /%./g; + if (!Calendar.is_ie5 && !Calendar.is_khtml) + return str.replace(re, function (par) { return s[par] || par; }); + + var a = str.match(re); + for (var i = 0; i < a.length; i++) { + var tmp = s[a[i]]; + if (tmp) { + re = new RegExp(a[i], 'g'); + str = str.replace(re, tmp); + } + } + + return str; }; Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; Date.prototype.setFullYear = function(y) { - var d = new Date(this); - d.__msh_oldSetFullYear(y); - if (d.getMonth() != this.getMonth()) - this.setDate(28); - this.__msh_oldSetFullYear(y); + var d = new Date(this); + d.__msh_oldSetFullYear(y); + if (d.getMonth() != this.getMonth()) + this.setDate(28); + this.__msh_oldSetFullYear(y); }; // END: DATE OBJECT PATCHES diff --git a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5-utf8.js b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5-utf8.js index 14e0d5ddee..429c90a095 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5-utf8.js +++ b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5-utf8.js @@ -8,7 +8,7 @@ // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. - + // full day names Calendar._DN = new Array ("星期日", diff --git a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5.js b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5.js index a58935873f..3d497107b3 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5.js +++ b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-big5.js @@ -8,7 +8,7 @@ // For translators: please use UTF-8 if possible. We strongly believe that // Unicode is the answer to a real internationalized world. Also please // include your contact information in the header, as can be seen above. - + // full day names Calendar._DN = new Array ("¬P´Á¤é", diff --git a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-utf8.js b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-utf8.js index f6bbbeba14..535d7f557b 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-utf8.js +++ b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-utf8.js @@ -1,9 +1,9 @@ /* - calendar-cs-win.js - language: Czech - encoding: windows-1250 - author: Lubos Jerabek (xnet@seznam.cz) - Jan Uhlir (espinosa@centrum.cz) + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) */ // ** I18N diff --git a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-win.js b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-win.js index 140dff318c..6c7c8c09dd 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-win.js +++ b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-cs-win.js @@ -1,9 +1,9 @@ /* - calendar-cs-win.js - language: Czech - encoding: windows-1250 - author: Lubos Jerabek (xnet@seznam.cz) - Jan Uhlir (espinosa@centrum.cz) + calendar-cs-win.js + language: Czech + encoding: windows-1250 + author: Lubos Jerabek (xnet@seznam.cz) + Jan Uhlir (espinosa@centrum.cz) */ // ** I18N diff --git a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-tr.js b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-tr.js index 2164687fbb..4864fb6d6c 100644 --- a/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-tr.js +++ b/Open-ILS/web/opac/common/js/jscalendar/lang/calendar-tr.js @@ -1,13 +1,13 @@ ////////////////////////////////////////////////////////////////////////////////////////////// -// Turkish Translation by Nuri AKMAN -// Location: Ankara/TURKEY -// e-mail : nuriakman@hotmail.com -// Date : April, 9 2003 +// Turkish Translation by Nuri AKMAN +// Location: Ankara/TURKEY +// e-mail : nuriakman@hotmail.com +// Date : April, 9 2003 // -// Note: if Turkish Characters does not shown on you screen -// please include falowing line your html code: +// Note: if Turkish Characters does not shown on you screen +// please include falowing line your html code: // -// +// // ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 7d739f9cf2..a3c4ce7bc3 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -12,160 +12,160 @@ var __ilsEvent; /* the last event the occurred */ var DEBUGSLIM; function Request(type) { - var s = type.split(":"); - if(s[2] == "1" && isXUL()) s[1] += ".staff"; - this.request = new RemoteRequest(s[0], s[1]); - var p = []; - - if(isXUL()) { - if(!location.href.match(/^https:/)) - this.request.setSecure(false); - - } else { - - if( G.user && G.user.session ) { - /* if the user is logged in, all activity resets the timeout - This is not entirely accurate in the sense that not all - requests will reset the server timeout - this should - get close enough, however. - */ - var at = getAuthtime(); - if(at) new AuthTimer(at).run(); - } - } - - for( var x = 1; x!= arguments.length; x++ ) { - p.push(arguments[x]); - this.request.addParam(arguments[x]); - } - - if( getDebug() ) { - var str = ""; - for( var i = 0; i != p.length; i++ ) { - if( i > 0 ) str += ", " - str += js2JSON(p[i]); - } - _debug('request ' + s[0] + ' ' + s[1] + ' ' + str ); - - } else if( DEBUGSLIM ) { - _debug('request ' + s[1]); - } + var s = type.split(":"); + if(s[2] == "1" && isXUL()) s[1] += ".staff"; + this.request = new RemoteRequest(s[0], s[1]); + var p = []; + + if(isXUL()) { + if(!location.href.match(/^https:/)) + this.request.setSecure(false); + + } else { + + if( G.user && G.user.session ) { + /* if the user is logged in, all activity resets the timeout + This is not entirely accurate in the sense that not all + requests will reset the server timeout - this should + get close enough, however. + */ + var at = getAuthtime(); + if(at) new AuthTimer(at).run(); + } + } + + for( var x = 1; x!= arguments.length; x++ ) { + p.push(arguments[x]); + this.request.addParam(arguments[x]); + } + + if( getDebug() ) { + var str = ""; + for( var i = 0; i != p.length; i++ ) { + if( i > 0 ) str += ", " + str += js2JSON(p[i]); + } + _debug('request ' + s[0] + ' ' + s[1] + ' ' + str ); + + } else if( DEBUGSLIM ) { + _debug('request ' + s[1]); + } } Request.prototype.callback = function(cal) {this.request.setCompleteCallback(cal);} -Request.prototype.send = function(block){this.request.send(block);} -Request.prototype.result = function(){return this.request.getResultObject();} +Request.prototype.send = function(block){this.request.send(block);} +Request.prototype.result = function(){return this.request.getResultObject();} function showCanvas() { - for( var x in G.ui.altcanvas ) { - hideMe(G.ui.altcanvas[x]); - } - hideMe(G.ui.common.loading); - unHideMe(G.ui.common.canvas_main); - try{G.ui.searchbar.text.focus();}catch(e){} + for( var x in G.ui.altcanvas ) { + hideMe(G.ui.altcanvas[x]); + } + hideMe(G.ui.common.loading); + unHideMe(G.ui.common.canvas_main); + try{G.ui.searchbar.text.focus();}catch(e){} } function swapCanvas(newNode) { - for( var x in G.ui.altcanvas ) - hideMe(G.ui.altcanvas[x]); + for( var x in G.ui.altcanvas ) + hideMe(G.ui.altcanvas[x]); - hideMe(G.ui.common.loading); - hideMe(G.ui.common.canvas_main); - unHideMe(newNode); + hideMe(G.ui.common.loading); + hideMe(G.ui.common.canvas_main); + unHideMe(newNode); } /* finds the name of the current page */ var currentPage = null; function findCurrentPage() { - if(currentPage) return currentPage; - - var pages = []; - for( var p in config.page ) pages.push(config.page[p]); - pages = pages.sort( function(a,b){ return - (a.length - b.length); } ); - - var path = location.pathname; - if(!path.match(/.*\.xml$/)) - path += "index.xml"; /* in case they go to / */ - - var page = null; - for( var p in pages ) { - if( path.indexOf(pages[p]) != -1) - page = pages[p]; - } - - for( var p in config.page ) { - if(config.page[p] == page) { - currentPage = p; - return p; - } - } - return null; + if(currentPage) return currentPage; + + var pages = []; + for( var p in config.page ) pages.push(config.page[p]); + pages = pages.sort( function(a,b){ return - (a.length - b.length); } ); + + var path = location.pathname; + if(!path.match(/.*\.xml$/)) + path += "index.xml"; /* in case they go to / */ + + var page = null; + for( var p in pages ) { + if( path.indexOf(pages[p]) != -1) + page = pages[p]; + } + + for( var p in config.page ) { + if(config.page[p] == page) { + currentPage = p; + return p; + } + } + return null; } /* sets all of the params values ----------------------------- */ function initParams() { - var cgi = new CGI(); + var cgi = new CGI(); - /* handle the location var */ - var org; - var loc = cgi.param(PARAM_LOCATION); - var lasso = cgi.param(PARAM_LASSO); + /* handle the location var */ + var org; + var loc = cgi.param(PARAM_LOCATION); + var lasso = cgi.param(PARAM_LASSO); if ( lasso ) { - lasso = findOrgLasso( lasso ); - LASSO = lasso ? lasso.id() : null; - } + lasso = findOrgLasso( lasso ); + LASSO = lasso ? lasso.id() : null; + } if (loc) { - org = findOrgUnit(loc); - LOCATION = org ? org.id() : null; + org = findOrgUnit(loc); + LOCATION = org ? org.id() : null; - if ( !LOCATION ){ - org = findOrgUnit(loc); - LOCATION = org ? org.id() : null; - } + if ( !LOCATION ){ + org = findOrgUnit(loc); + LOCATION = org ? org.id() : null; + } } - org = null; - loc = cgi.param(PARAM_ORIGLOC); - if( loc ) { - org = findOrgUnit(loc); - if(!org) org = findOrgUnitSN(loc); - } - ORIGLOC = (org) ? org.id() : null; - - - DEPTH = parseInt(cgi.param(PARAM_DEPTH)); - if(isNaN(DEPTH)) DEPTH = null; - - - TERM = cgi.param(PARAM_TERM); - STYPE = cgi.param(PARAM_STYPE); - FORM = cgi.param(PARAM_FORM); - //DEPTH = parseInt(cgi.param(PARAM_DEPTH)); - OFFSET = parseInt(cgi.param(PARAM_OFFSET)); - COUNT = parseInt(cgi.param(PARAM_COUNT)); - HITCOUNT = parseInt(cgi.param(PARAM_HITCOUNT)); - MRID = parseInt(cgi.param(PARAM_MRID)); - RID = parseInt(cgi.param(PARAM_RID)); - AUTHTIME = parseInt(cgi.param(PARAM_AUTHTIME)); - ADVTERM = cgi.param(PARAM_ADVTERM); - ADVTYPE = cgi.param(PARAM_ADVTYPE); - RTYPE = cgi.param(PARAM_RTYPE); - SORT = cgi.param(PARAM_SORT); - SORT_DIR = cgi.param(PARAM_SORT_DIR); - DEBUG = cgi.param(PARAM_DEBUG); - CALLNUM = cgi.param(PARAM_CN); - LITFORM = cgi.param(PARAM_LITFORM); - ITEMFORM = cgi.param(PARAM_ITEMFORM); - ITEMTYPE = cgi.param(PARAM_ITEMTYPE); - BIBLEVEL = cgi.param(PARAM_BIBLEVEL); - AUDIENCE = cgi.param(PARAM_AUDIENCE); - SEARCHES = cgi.param(PARAM_SEARCHES); - LANGUAGE = cgi.param(PARAM_LANGUAGE); - TFORM = cgi.param(PARAM_TFORM); - RDEPTH = cgi.param(PARAM_RDEPTH); + org = null; + loc = cgi.param(PARAM_ORIGLOC); + if( loc ) { + org = findOrgUnit(loc); + if(!org) org = findOrgUnitSN(loc); + } + ORIGLOC = (org) ? org.id() : null; + + + DEPTH = parseInt(cgi.param(PARAM_DEPTH)); + if(isNaN(DEPTH)) DEPTH = null; + + + TERM = cgi.param(PARAM_TERM); + STYPE = cgi.param(PARAM_STYPE); + FORM = cgi.param(PARAM_FORM); + //DEPTH = parseInt(cgi.param(PARAM_DEPTH)); + OFFSET = parseInt(cgi.param(PARAM_OFFSET)); + COUNT = parseInt(cgi.param(PARAM_COUNT)); + HITCOUNT = parseInt(cgi.param(PARAM_HITCOUNT)); + MRID = parseInt(cgi.param(PARAM_MRID)); + RID = parseInt(cgi.param(PARAM_RID)); + AUTHTIME = parseInt(cgi.param(PARAM_AUTHTIME)); + ADVTERM = cgi.param(PARAM_ADVTERM); + ADVTYPE = cgi.param(PARAM_ADVTYPE); + RTYPE = cgi.param(PARAM_RTYPE); + SORT = cgi.param(PARAM_SORT); + SORT_DIR = cgi.param(PARAM_SORT_DIR); + DEBUG = cgi.param(PARAM_DEBUG); + CALLNUM = cgi.param(PARAM_CN); + LITFORM = cgi.param(PARAM_LITFORM); + ITEMFORM = cgi.param(PARAM_ITEMFORM); + ITEMTYPE = cgi.param(PARAM_ITEMTYPE); + BIBLEVEL = cgi.param(PARAM_BIBLEVEL); + AUDIENCE = cgi.param(PARAM_AUDIENCE); + SEARCHES = cgi.param(PARAM_SEARCHES); + LANGUAGE = cgi.param(PARAM_LANGUAGE); + TFORM = cgi.param(PARAM_TFORM); + RDEPTH = cgi.param(PARAM_RDEPTH); AVAIL = cgi.param(PARAM_AVAIL); COPYLOCS = cgi.param(PARAM_COPYLOCS); PUBD_BEFORE = cgi.param(PARAM_PUBD_BEFORE); @@ -174,43 +174,43 @@ function initParams() { PUBD_DURING = cgi.param(PARAM_PUBD_DURING); - /* set up some sane defaults */ - //if(isNaN(DEPTH)) DEPTH = 0; - if(isNaN(RDEPTH)) RDEPTH = 0; - if(isNaN(OFFSET)) OFFSET = 0; - if(isNaN(COUNT)) COUNT = 10; - if(isNaN(HITCOUNT)) HITCOUNT = 0; - if(isNaN(MRID)) MRID = 0; - if(isNaN(RID)) RID = 0; - if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */ - if(isNaN(AUTHTIME)) AUTHTIME = 0; - if(ADVTERM==null) ADVTERM = ""; + /* set up some sane defaults */ + //if(isNaN(DEPTH)) DEPTH = 0; + if(isNaN(RDEPTH)) RDEPTH = 0; + if(isNaN(OFFSET)) OFFSET = 0; + if(isNaN(COUNT)) COUNT = 10; + if(isNaN(HITCOUNT)) HITCOUNT = 0; + if(isNaN(MRID)) MRID = 0; + if(isNaN(RID)) RID = 0; + if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */ + if(isNaN(AUTHTIME)) AUTHTIME = 0; + if(ADVTERM==null) ADVTERM = ""; if(isNaN(AVAIL)) AVAIL = 0; } function clearSearchParams() { - TERM = null; - STYPE = null; - FORM = null; - OFFSET = 0; - HITCOUNT = 0; - ADVTERM = null; - ADVTYPE = null; - MRID = null; - RID = null; - RTYPE = null; - SORT = null; - SORT_DIR = null; - RLIST = null; - CALLNUM = null; - LITFORM = null; - ITEMFORM = null; - ITEMTYPE = null; - BIBLEVEL = null; - AUDIENCE = null; - SEARCHES = null; - LANGUAGE = null; - RDEPTH = null; + TERM = null; + STYPE = null; + FORM = null; + OFFSET = 0; + HITCOUNT = 0; + ADVTERM = null; + ADVTYPE = null; + MRID = null; + RID = null; + RTYPE = null; + SORT = null; + SORT_DIR = null; + RLIST = null; + CALLNUM = null; + LITFORM = null; + ITEMFORM = null; + ITEMTYPE = null; + BIBLEVEL = null; + AUDIENCE = null; + SEARCHES = null; + LANGUAGE = null; + RDEPTH = null; AVAIL = null; COPYLOCS = null; PUBD_BEFORE = null; @@ -221,11 +221,11 @@ function clearSearchParams() { function initCookies() { - FONTSIZE = "regular"; - var font = cookieManager.read(COOKIE_FONT); - scaleFonts(font); - if(font) FONTSIZE = font; - SKIN = cookieManager.read(COOKIE_SKIN); + FONTSIZE = "regular"; + var font = cookieManager.read(COOKIE_FONT); + scaleFonts(font); + if(font) FONTSIZE = font; + SKIN = cookieManager.read(COOKIE_SKIN); if(findCurrentPage() == HOME) cookieManager.remove(COOKIE_SEARCH); } @@ -272,185 +272,185 @@ function getPubdDuring() { return PUBD_DURING; } function findBasePath() { - var path = location.pathname; - if(!path.match(/.*\.xml$/)) path += "index.xml"; - var idx = path.indexOf(config.page[findCurrentPage()]); - return path.substring(0, idx); + var path = location.pathname; + if(!path.match(/.*\.xml$/)) path += "index.xml"; + var idx = path.indexOf(config.page[findCurrentPage()]); + return path.substring(0, idx); } function findBaseURL(ssl) { - var path = findBasePath(); - var proto = (ssl) ? "https:" : "http:"; + var path = findBasePath(); + var proto = (ssl) ? "https:" : "http:"; - /* strip port numbers. This is necessary for browsers that - send an explicit :80, 443 - explicit ports - break links that need to change ports (e.g. http -> https) */ - var h = location.host.replace(/:.*/,''); + /* strip port numbers. This is necessary for browsers that + send an explicit :80, 443 - explicit ports + break links that need to change ports (e.g. http -> https) */ + var h = location.host.replace(/:.*/,''); - return proto + "//" + h + path; + return proto + "//" + h + path; } /* function buildISBNSrc(isbn) { - return "http://" + location.host + "/jackets/" + isbn; + return "http://" + location.host + "/jackets/" + isbn; } */ function buildImageLink(name, ssl) { - return findBaseURL(ssl) + "../../../../images/" + name; + return findBaseURL(ssl) + "../../../../images/" + name; } function buildExtrasLink(name, ssl) { - return findBaseURL(ssl) + "../../../../extras/" + name; + return findBaseURL(ssl) + "../../../../extras/" + name; } var consoleService; function _debug(str) { - try { dump('dbg: ' + str + '\n'); } catch(e) {} - - /* potentially useful, but usually just annoying */ - /* - if(!IE) { - if(!consoleService) { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - this.consoleService = Components.classes['@mozilla.org/consoleservice;1'] - .getService(Components.interfaces.nsIConsoleService); - } catch(e) {} - } - - try { - if(consoleService) { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - consoleService.logStringMessage(str + '\n'); - } - } catch(e){} - } - */ + try { dump('dbg: ' + str + '\n'); } catch(e) {} + + /* potentially useful, but usually just annoying */ + /* + if(!IE) { + if(!consoleService) { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + this.consoleService = Components.classes['@mozilla.org/consoleservice;1'] + .getService(Components.interfaces.nsIConsoleService); + } catch(e) {} + } + + try { + if(consoleService) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + consoleService.logStringMessage(str + '\n'); + } + } catch(e){} + } + */ } function buildOPACLink(args, slim, ssl) { - if(!args) args = {}; - var string = ""; - - if(!slim) { - string = findBaseURL(ssl); - if(args.page) string += config.page[args.page]; - else string += config.page[findCurrentPage()]; - } - - /* this may seem unnecessary.. safety precaution for now */ - /* - if( args[PARAM_DEPTH] == null ) - args[PARAM_DEPTH] = getDepth(); - */ - - string += "?"; - - for( var x in args ) { - var v = args[x]; - if(x == "page" || v == null || v == undefined || v+'' == 'NaN' ) continue; - if(x == PARAM_OFFSET && v == 0) continue; - if(x == PARAM_COUNT && v == 10) continue; - if(x == PARAM_FORM && v == 'all' ) continue; - if( instanceOf(v, Array) && v.length ) { - for( var i = 0; i < v.length; i++ ) { - string += "&" + x + "=" + encodeURIComponent(v[i]); - } - } else { - string += "&" + x + "=" + encodeURIComponent(v); - } - } - - if(getDebug()) - string += _appendParam(DEBUG, PARAM_DEBUG, args, getDebug, string); - if(getOrigLocation() != 1) - string += _appendParam(ORIGLOC, PARAM_ORIGLOC, args, getOrigLocation, string); - if(getTerm()) - string += _appendParam(TERM, PARAM_TERM, args, getTerm, string); - if(getStype()) - string += _appendParam(STYPE, PARAM_STYPE, args, getStype, string); - if(getLocation() != 1) - string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string); - if(getLasso() != null) - string += _appendParam(LASSO, PARAM_LASSO, args, getLasso, string); - if(getDepth() != null) - string += _appendParam(DEPTH, PARAM_DEPTH, args, getDepth, string); - if(getForm() && (getForm() != 'all') ) - string += _appendParam(FORM, PARAM_FORM, args, getForm, string); - if(getTform() && (getTform() != 'all') ) - string += _appendParam(TFORM, PARAM_TFORM, args, getTform, string); - if(getOffset() != 0) - string += _appendParam(OFFSET, PARAM_OFFSET, args, getOffset, string); - if(getDisplayCount() != 10) - string += _appendParam(COUNT, PARAM_COUNT, args, getDisplayCount, string); - if(getHitCount()) - string += _appendParam(HITCOUNT, PARAM_HITCOUNT, args, getHitCount, string); - if(getMrid()) - string += _appendParam(MRID, PARAM_MRID, args, getMrid, string); - if(getRid()) - string += _appendParam(RID, PARAM_RID, args, getRid, string); - if(getAuthtime()) - string += _appendParam(AUTHTIME, PARAM_AUTHTIME, args, getAuthtime, string); - if(getAdvTerm()) - string += _appendParam(ADVTERM, PARAM_ADVTERM, args, getAdvTerm, string); - if(getAdvType()) - string += _appendParam(ADVTYPE, PARAM_ADVTYPE, args, getAdvType, string); - if(getRtype()) - string += _appendParam(RTYPE, PARAM_RTYPE, args, getRtype, string); - if(getItemForm()) - string += _appendParam(ITEMFORM, PARAM_ITEMFORM, args, getItemForm, string); - if(getItemType()) - string += _appendParam(ITEMTYPE, PARAM_ITEMTYPE, args, getItemType, string); - if(getBibLevel()) - string += _appendParam(BIBLEVEL, PARAM_BIBLEVEL, args, getBibLevel, string); - if(getLitForm()) - string += _appendParam(LITFORM, PARAM_LITFORM, args, getLitForm, string); - if(getAudience()) - string += _appendParam(AUDIENCE, PARAM_AUDIENCE, args, getAudience, string); - if(getSearches()) - string += _appendParam(SEARCHES, PARAM_SEARCHES, args, getSearches, string); - if(getLanguage()) - string += _appendParam(LANGUAGE, PARAM_LANGUAGE, args, getLanguage, string); - if(getRdepth() != null) - string += _appendParam(RDEPTH, PARAM_RDEPTH, args, getRdepth, string); - if(getSort() != null) - string += _appendParam(SORT, PARAM_SORT, args, getSort, string); - if(getSortDir() != null) - string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string); - if(getAvail()) - string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string); - if(getCopyLocs()) - string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string); + if(!args) args = {}; + var string = ""; + + if(!slim) { + string = findBaseURL(ssl); + if(args.page) string += config.page[args.page]; + else string += config.page[findCurrentPage()]; + } + + /* this may seem unnecessary.. safety precaution for now */ + /* + if( args[PARAM_DEPTH] == null ) + args[PARAM_DEPTH] = getDepth(); + */ + + string += "?"; + + for( var x in args ) { + var v = args[x]; + if(x == "page" || v == null || v == undefined || v+'' == 'NaN' ) continue; + if(x == PARAM_OFFSET && v == 0) continue; + if(x == PARAM_COUNT && v == 10) continue; + if(x == PARAM_FORM && v == 'all' ) continue; + if( instanceOf(v, Array) && v.length ) { + for( var i = 0; i < v.length; i++ ) { + string += "&" + x + "=" + encodeURIComponent(v[i]); + } + } else { + string += "&" + x + "=" + encodeURIComponent(v); + } + } + + if(getDebug()) + string += _appendParam(DEBUG, PARAM_DEBUG, args, getDebug, string); + if(getOrigLocation() != 1) + string += _appendParam(ORIGLOC, PARAM_ORIGLOC, args, getOrigLocation, string); + if(getTerm()) + string += _appendParam(TERM, PARAM_TERM, args, getTerm, string); + if(getStype()) + string += _appendParam(STYPE, PARAM_STYPE, args, getStype, string); + if(getLocation() != 1) + string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string); + if(getLasso() != null) + string += _appendParam(LASSO, PARAM_LASSO, args, getLasso, string); + if(getDepth() != null) + string += _appendParam(DEPTH, PARAM_DEPTH, args, getDepth, string); + if(getForm() && (getForm() != 'all') ) + string += _appendParam(FORM, PARAM_FORM, args, getForm, string); + if(getTform() && (getTform() != 'all') ) + string += _appendParam(TFORM, PARAM_TFORM, args, getTform, string); + if(getOffset() != 0) + string += _appendParam(OFFSET, PARAM_OFFSET, args, getOffset, string); + if(getDisplayCount() != 10) + string += _appendParam(COUNT, PARAM_COUNT, args, getDisplayCount, string); + if(getHitCount()) + string += _appendParam(HITCOUNT, PARAM_HITCOUNT, args, getHitCount, string); + if(getMrid()) + string += _appendParam(MRID, PARAM_MRID, args, getMrid, string); + if(getRid()) + string += _appendParam(RID, PARAM_RID, args, getRid, string); + if(getAuthtime()) + string += _appendParam(AUTHTIME, PARAM_AUTHTIME, args, getAuthtime, string); + if(getAdvTerm()) + string += _appendParam(ADVTERM, PARAM_ADVTERM, args, getAdvTerm, string); + if(getAdvType()) + string += _appendParam(ADVTYPE, PARAM_ADVTYPE, args, getAdvType, string); + if(getRtype()) + string += _appendParam(RTYPE, PARAM_RTYPE, args, getRtype, string); + if(getItemForm()) + string += _appendParam(ITEMFORM, PARAM_ITEMFORM, args, getItemForm, string); + if(getItemType()) + string += _appendParam(ITEMTYPE, PARAM_ITEMTYPE, args, getItemType, string); + if(getBibLevel()) + string += _appendParam(BIBLEVEL, PARAM_BIBLEVEL, args, getBibLevel, string); + if(getLitForm()) + string += _appendParam(LITFORM, PARAM_LITFORM, args, getLitForm, string); + if(getAudience()) + string += _appendParam(AUDIENCE, PARAM_AUDIENCE, args, getAudience, string); + if(getSearches()) + string += _appendParam(SEARCHES, PARAM_SEARCHES, args, getSearches, string); + if(getLanguage()) + string += _appendParam(LANGUAGE, PARAM_LANGUAGE, args, getLanguage, string); + if(getRdepth() != null) + string += _appendParam(RDEPTH, PARAM_RDEPTH, args, getRdepth, string); + if(getSort() != null) + string += _appendParam(SORT, PARAM_SORT, args, getSort, string); + if(getSortDir() != null) + string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string); + if(getAvail()) + string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string); + if(getCopyLocs()) + string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string); if(getPubdBefore()) - string += _appendParam(PUBD_BEFORE, PARAM_PUBD_BEFORE, args, getPubdBefore, string); + string += _appendParam(PUBD_BEFORE, PARAM_PUBD_BEFORE, args, getPubdBefore, string); if(getPubdAfter()) - string += _appendParam(PUBD_AFTER, PARAM_PUBD_AFTER, args, getPubdAfter, string); + string += _appendParam(PUBD_AFTER, PARAM_PUBD_AFTER, args, getPubdAfter, string); if(getPubdBetween()) - string += _appendParam(PUBD_BETWEEN, PARAM_PUBD_BETWEEN, args, getPubdBetween, string); + string += _appendParam(PUBD_BETWEEN, PARAM_PUBD_BETWEEN, args, getPubdBetween, string); if(getPubdDuring()) - string += _appendParam(PUBD_DURING, PARAM_PUBD_DURING, args, getPubdDuring, string); + string += _appendParam(PUBD_DURING, PARAM_PUBD_DURING, args, getPubdDuring, string); - return string.replace(/\&$/,'').replace(/\?\&/,"?"); + return string.replace(/\&$/,'').replace(/\?\&/,"?"); } var xx = 1; function _appendParam( fieldVar, fieldName, overrideArgs, getFunc, string ) { - var ret = ""; + var ret = ""; - if( fieldVar != null && - (fieldVar +'' != 'NaN') && - overrideArgs[fieldName] == null && - getFunc() != null && - getFunc()+'' != '' ) { + if( fieldVar != null && + (fieldVar +'' != 'NaN') && + overrideArgs[fieldName] == null && + getFunc() != null && + getFunc()+'' != '' ) { - ret = "&" + fieldName + "=" + encodeURIComponent(getFunc()); - } + ret = "&" + fieldName + "=" + encodeURIComponent(getFunc()); + } - return ret; + return ret; } /* ----------------------------------------------------------------------- */ @@ -466,52 +466,52 @@ function cleanISBN(isbn) { /* builds a link that goes to the title listings for a metarecord */ function buildTitleLink(rec, link) { - if(!rec) return; - link.appendChild(text(normalize(truncate(rec.title(), 65)))); - var args = {}; - args.page = RRESULT; - args[PARAM_OFFSET] = 0; - args[PARAM_MRID] = rec.doc_id(); - args[PARAM_RTYPE] = RTYPE_MRID; + if(!rec) return; + link.appendChild(text(normalize(truncate(rec.title(), 65)))); + var args = {}; + args.page = RRESULT; + args[PARAM_OFFSET] = 0; + args[PARAM_MRID] = rec.doc_id(); + args[PARAM_RTYPE] = RTYPE_MRID; var linkText = link.innerHTML; // IE - link.setAttribute("href", buildOPACLink(args)); + link.setAttribute("href", buildOPACLink(args)); link.innerHTML = linkText; // IE } function buildTitleDetailLink(rec, link) { - if(!rec) return; - link.appendChild(text(normalize(truncate(rec.title(), 65)))); - var args = {}; - args.page = RDETAIL; - args[PARAM_RID] = rec.doc_id(); + if(!rec) return; + link.appendChild(text(normalize(truncate(rec.title(), 65)))); + var args = {}; + args.page = RDETAIL; + args[PARAM_RID] = rec.doc_id(); // in IE, if the link text contains a '@', it replaces the innerHTML text // with the value of the href attribute. Wait, what? Yes. Capture the // innerHTML and put it back into place after the href is set var linkText = link.innerHTML; // IE - link.setAttribute("href", buildOPACLink(args)); + link.setAttribute("href", buildOPACLink(args)); link.innerHTML = linkText; // IE } /* 'type' is one of STYPE_AUTHOR, STYPE_SUBJECT, ... found in config.js - 'trunc' is the number of characters to show in the string, defaults to 65 */ + 'trunc' is the number of characters to show in the string, defaults to 65 */ function buildSearchLink(type, string, linknode, trunc) { - if(!trunc) trunc = 65; - var args = {}; - if( SHOW_MR_DEFAULT) { - args.page = MRESULT; - } else { - args.page = RRESULT; - args[PARAM_RTYPE] = type; - } - args[PARAM_OFFSET] = 0; - args[PARAM_TERM] = string; - args[PARAM_STYPE] = type; - linknode.appendChild(text(normalize(truncate(string, trunc)))); - linknode.setAttribute("href", buildOPACLink(args)); + if(!trunc) trunc = 65; + var args = {}; + if( SHOW_MR_DEFAULT) { + args.page = MRESULT; + } else { + args.page = RRESULT; + args[PARAM_RTYPE] = type; + } + args[PARAM_OFFSET] = 0; + args[PARAM_TERM] = string; + args[PARAM_STYPE] = type; + linknode.appendChild(text(normalize(truncate(string, trunc)))); + linknode.setAttribute("href", buildOPACLink(args)); } function setSessionCookie(ses) { - cookieManager.write(COOKIE_SES, ses, -1); + cookieManager.write(COOKIE_SES, ses, -1); } @@ -520,171 +520,171 @@ function setSessionCookie(ses) { /* user session handling */ /* ----------------------------------------------------------------------- */ /* session is the login session. If no session is provided, we attempt - to find one in the cookies. If 'force' is true we retrieve the - user from the server even if there is already a global user present. - if ses != G.user.session, we also force a grab */ + to find one in the cookies. If 'force' is true we retrieve the + user from the server even if there is already a global user present. + if ses != G.user.session, we also force a grab */ function grabUser(ses, force) { - if(!ses && isXUL()) { - stash = fetchXULStash(); - ses = stash.session.key - _debug("stash auth token = " + ses); - } + if(!ses && isXUL()) { + stash = fetchXULStash(); + ses = stash.session.key + _debug("stash auth token = " + ses); + } - if(!ses) { - ses = cookieManager.read(COOKIE_SES); - /* https cookies don't show up in http servers.. */ - } + if(!ses) { + ses = cookieManager.read(COOKIE_SES); + /* https cookies don't show up in http servers.. */ + } - if(!ses) return false; + if(!ses) return false; - if(!force) - if(G.user && G.user.session == ses) - return G.user; + if(!force) + if(G.user && G.user.session == ses) + return G.user; - /* first make sure the session is valid */ - var request = new Request(FETCH_SESSION, ses, 1 ); - request.request.alertEvent = false; - request.send(true); - var user = request.result(); + /* first make sure the session is valid */ + var request = new Request(FETCH_SESSION, ses, 1 ); + request.request.alertEvent = false; + request.send(true); + var user = request.result(); - if(!user) { - doLogout(); - return false; /* unable to grab the session */ - } + if(!user) { + doLogout(); + return false; /* unable to grab the session */ + } - if( !(typeof user == 'object' && user._isfieldmapper) ) { - doLogout(); - return false; - } + if( !(typeof user == 'object' && user._isfieldmapper) ) { + doLogout(); + return false; + } - G.user = user; - G.user.fleshed = false; - G.user.session = ses; - setSessionCookie(ses); + G.user = user; + G.user.fleshed = false; + G.user.session = ses; + setSessionCookie(ses); - grabUserPrefs(); - if(G.user.prefs['opac.hits_per_page']) - COUNT = parseInt(G.user.prefs['opac.hits_per_page']); + grabUserPrefs(); + if(G.user.prefs['opac.hits_per_page']) + COUNT = parseInt(G.user.prefs['opac.hits_per_page']); - if(G.user.prefs[PREF_DEF_FONT]) - setFontSize(G.user.prefs[PREF_DEF_FONT]); + if(G.user.prefs[PREF_DEF_FONT]) + setFontSize(G.user.prefs[PREF_DEF_FONT]); - var at = getAuthtime(); - //if(isXUL()) at = xulG['authtime']; + var at = getAuthtime(); + //if(isXUL()) at = xulG['authtime']; - if(at && !isXUL()) new AuthTimer(at).run(); - return G.user; + if(at && !isXUL()) new AuthTimer(at).run(); + return G.user; } /* sets the 'prefs' field of the user object to their preferences - and returns the preferences */ + and returns the preferences */ function grabUserPrefs(user, force) { - if(user == null) user = G.user; - if(!force && user.prefs) return user.prefs; - var req = new Request(FETCH_USER_PREFS, G.user.session, user.id()); - req.send(true); - user.prefs = req.result(); - return user.prefs; + if(user == null) user = G.user; + if(!force && user.prefs) return user.prefs; + var req = new Request(FETCH_USER_PREFS, G.user.session, user.id()); + req.send(true); + user.prefs = req.result(); + return user.prefs; } function grabFleshedUser() { - if(!G.user || !G.user.session) { - grabUser(); - if(!G.user || !G.user.session) return null; - } + if(!G.user || !G.user.session) { + grabUser(); + if(!G.user || !G.user.session) return null; + } - if(G.user.fleshed) return G.user; + if(G.user.fleshed) return G.user; var req = new Request(FETCH_FLESHED_USER, G.user.session); - req.send(true); + req.send(true); - G.user = req.result(); + G.user = req.result(); - if(!G.user || G.user.length == 0) { - G.user = null; return false; - cookieManager.write(COOKIE_SES,""); - } + if(!G.user || G.user.length == 0) { + G.user = null; return false; + cookieManager.write(COOKIE_SES,""); + } - G.user.session = ses; - G.user.fleshed = true; + G.user.session = ses; + G.user.fleshed = true; - setSessionCookie(ses); - return G.user; + setSessionCookie(ses); + return G.user; } function checkUserSkin(new_skin) { - return; /* XXX do some debugging with this... */ + return; /* XXX do some debugging with this... */ - var user_skin = getSkin(); - var cur_skin = grabSkinFromURL(); + var user_skin = getSkin(); + var cur_skin = grabSkinFromURL(); - if(new_skin) user_skin = new_skin; + if(new_skin) user_skin = new_skin; - if(!user_skin) { + if(!user_skin) { - if(grabUser()) { - if(grabUserPrefs()) { - user_skin = G.user.prefs["opac.skin"]; - cookieManager.write( COOKIE_SKIN, user_skin, '+1y' ); - } - } - } + if(grabUser()) { + if(grabUserPrefs()) { + user_skin = G.user.prefs["opac.skin"]; + cookieManager.write( COOKIE_SKIN, user_skin, '+1y' ); + } + } + } - if(!user_skin) return; + if(!user_skin) return; - if( cur_skin != user_skin ) { - var url = buildOPACLink(); - goTo(url.replace(cur_skin, user_skin)); - } + if( cur_skin != user_skin ) { + var url = buildOPACLink(); + goTo(url.replace(cur_skin, user_skin)); + } } function updateUserSetting(setting, value, user) { - if(user == null) user = G.user; - var a = {}; - a[setting] = value; - var req = new Request( UPDATE_USER_PREFS, user.session, a ); - req.send(true); - return req.result(); + if(user == null) user = G.user; + var a = {}; + a[setting] = value; + var req = new Request( UPDATE_USER_PREFS, user.session, a ); + req.send(true); + return req.result(); } function commitUserPrefs() { - var req = new Request( - UPDATE_USER_PREFS, G.user.session, null, G.user.prefs ); - req.send(true); - return req.result(); + var req = new Request( + UPDATE_USER_PREFS, G.user.session, null, G.user.prefs ); + req.send(true); + return req.result(); } function grabSkinFromURL() { - var path = findBasePath(); - path = path.replace("/xml/", ""); - var skin = ""; - for( var i = path.length - 1; i >= 0; i-- ) { - var ch = path.charAt(i); - if(ch == "/") break; - skin += ch; - } - - var skin2 = ""; - for( i = skin.length - 1; i >= 0; i--) - skin2 += skin.charAt(i); - - return skin2; + var path = findBasePath(); + path = path.replace("/xml/", ""); + var skin = ""; + for( var i = path.length - 1; i >= 0; i-- ) { + var ch = path.charAt(i); + if(ch == "/") break; + skin += ch; + } + + var skin2 = ""; + for( i = skin.length - 1; i >= 0; i--) + skin2 += skin.charAt(i); + + return skin2; } /* returns a fleshed G.user on success, false on failure */ function doLogin(suppressEvents) { - abortAllRequests(); + abortAllRequests(); - var uname = G.ui.login.username.value; - var passwd = G.ui.login.password.value; + var uname = G.ui.login.username.value; + var passwd = G.ui.login.password.value; - var init_request = new Request( LOGIN_INIT, uname ); + var init_request = new Request( LOGIN_INIT, uname ); init_request.send(true); var seed = init_request.result(); @@ -693,74 +693,74 @@ function doLogin(suppressEvents) { return null; } - var args = { - password : hex_md5(seed + hex_md5(passwd)), - type : "opac", - org : getOrigLocation() - }; + var args = { + password : hex_md5(seed + hex_md5(passwd)), + type : "opac", + org : getOrigLocation() + }; r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex'); if(r) REGEX_BARCODE = new RegExp(r); if( uname.match(REGEX_BARCODE) ) args.barcode = uname; - else args.username = uname; + else args.username = uname; var auth_request = new Request( LOGIN_COMPLETE, args ); - auth_request.request.alertEvent = false; + auth_request.request.alertEvent = false; auth_request.send(true); var auth_result = auth_request.result(); - if(!auth_result) { - alertId('patron_login_failed'); - return null; - } + if(!auth_result) { + alertId('patron_login_failed'); + return null; + } - if( checkILSEvent(auth_result) ) { + if( checkILSEvent(auth_result) ) { - if( auth_result.textcode == 'PATRON_INACTIVE' ) { - alertId('patron_inactive_alert'); - return; - } + if( auth_result.textcode == 'PATRON_INACTIVE' ) { + alertId('patron_inactive_alert'); + return; + } - if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) { - alertId('patron_card_inactive_alert'); - return; - } + if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) { + alertId('patron_card_inactive_alert'); + return; + } - if( auth_result.textcode == 'LOGIN_FAILED' || - auth_result.textcode == 'PERM_FAILURE' ) { - alertId('patron_login_failed'); - return; - } - } + if( auth_result.textcode == 'LOGIN_FAILED' || + auth_result.textcode == 'PERM_FAILURE' ) { + alertId('patron_login_failed'); + return; + } + } - AUTHTIME = parseInt(auth_result.payload.authtime); - var u = grabUser(auth_result.payload.authtoken, true); - if(u && ! suppressEvents) - runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) ); + AUTHTIME = parseInt(auth_result.payload.authtime); + var u = grabUser(auth_result.payload.authtoken, true); + if(u && ! suppressEvents) + runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) ); - checkUserSkin(); + checkUserSkin(); - return u; + return u; } function doLogout() { - /* cancel everything else */ - abortAllRequests(); + /* cancel everything else */ + abortAllRequests(); - /* be nice and delete the session from the server */ - if(G.user && G.user.session) { - var req = new Request(LOGIN_DELETE, G.user.session); + /* be nice and delete the session from the server */ + if(G.user && G.user.session) { + var req = new Request(LOGIN_DELETE, G.user.session); req.send(true); - try { req.result(); } catch(E){} + try { req.result(); } catch(E){} } - G.user = null; + G.user = null; - /* remove any cached data */ + /* remove any cached data */ dojo.require('dojo.cookie'); dojo.cookie(COOKIE_SES, '', {expires:-1}); dojo.cookie(COOKIE_RIDS, '', {expires:-1}); @@ -768,20 +768,20 @@ function doLogout() { dojo.cookie(COOKIE_SEARCH, '', {expires:-1}); - checkUserSkin("default"); - COUNT = 10; + checkUserSkin("default"); + COUNT = 10; - var args = {}; - args[PARAM_TERM] = ""; - args[PARAM_LOCATION] = getOrigLocation(); - args[PARAM_DEPTH] = findOrgDepth(getOrigLocation()); - args.page = "home"; + var args = {}; + args[PARAM_TERM] = ""; + args[PARAM_LOCATION] = getOrigLocation(); + args[PARAM_DEPTH] = findOrgDepth(getOrigLocation()); + args.page = "home"; - - var nored = false; - try{ if(isFrontPage) nored = true; } catch(e){nored = false;} - if(!nored) goTo(buildOPACLink(args)); + + var nored = false; + try{ if(isFrontPage) nored = true; } catch(e){nored = false;} + if(!nored) goTo(buildOPACLink(args)); } @@ -793,46 +793,46 @@ function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); } /* build the org tree */ /* ----------------------------------------------------------------------- */ function drawOrgTree() { - //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 ); - setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 ); + //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 ); + setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 ); } - + var orgTreeSelector; function buildOrgSelector(node) { - var tree = new SlimTree(node,'orgTreeSelector'); - orgTreeSelector = tree; - for( var i in orgArraySearcher ) { - var node = orgArraySearcher[i]; - if( node == null ) continue; + var tree = new SlimTree(node,'orgTreeSelector'); + orgTreeSelector = tree; + for( var i in orgArraySearcher ) { + var node = orgArraySearcher[i]; + if( node == null ) continue; if(!isXUL() && !isTrue(node.opac_visible())) continue; - if(node.parent_ou() == null) - tree.addNode(node.id(), -1, node.name(), - "javascript:orgSelect(" + node.id() + ");", node.name()); - else { - tree.addNode(node.id(), node.parent_ou(), node.name(), - "javascript:orgSelect(" + node.id() + ");", node.name()); - } - } - hideMe($('org_loading_div')); - unHideMe($('org_selector_tip')); - return tree; + if(node.parent_ou() == null) + tree.addNode(node.id(), -1, node.name(), + "javascript:orgSelect(" + node.id() + ");", node.name()); + else { + tree.addNode(node.id(), node.parent_ou(), node.name(), + "javascript:orgSelect(" + node.id() + ");", node.name()); + } + } + hideMe($('org_loading_div')); + unHideMe($('org_selector_tip')); + return tree; } function orgSelect(id) { - showCanvas(); - runEvt("common", "locationChanged", id, findOrgDepth(id) ); + showCanvas(); + runEvt("common", "locationChanged", id, findOrgDepth(id) ); - var loc = findOrgLasso(getLasso()); - if (!loc) loc = findOrgUnit(id); + var loc = findOrgLasso(getLasso()); + if (!loc) loc = findOrgUnit(id); - removeChildren(G.ui.common.now_searching); - G.ui.common.now_searching.appendChild(text(loc.name())); + removeChildren(G.ui.common.now_searching); + G.ui.common.now_searching.appendChild(text(loc.name())); } function setFontSize(size) { - scaleFonts(size); - cookieManager.write(COOKIE_FONT, size, '+1y'); + scaleFonts(size); + cookieManager.write(COOKIE_FONT, size, '+1y'); } var resourceFormats = [ @@ -906,191 +906,191 @@ function MARCFormatToMods(format) { } function MARCTypeToFriendly(format) { - var words = $('format_words'); - switch(format) { - case 'a' : - case 't' : return $n(words, 'at').innerHTML; - default: - var node = $n(words,format); - if( node ) return node.innerHTML; - } - return ""; + var words = $('format_words'); + switch(format) { + case 'a' : + case 't' : return $n(words, 'at').innerHTML; + default: + var node = $n(words,format); + if( node ) return node.innerHTML; + } + return ""; } function setResourcePic( img, resource ) { - img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg"); - img.title = resource; + img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg"); + img.title = resource; } function msg( text ) { - try { alert( text ); } catch(e) {} + try { alert( text ); } catch(e) {} } function findRecord(id,type) { - try { - for( var i = 0; i != recordsCache.length; i++ ) { - var rec = recordsCache[i]; - if( rec && rec.doc_id() == id ) return rec; - } - } catch(E){} - var meth = FETCH_RMODS - if(type == 'M') meth = FETCH_MRMODS; - var req = new Request(meth, id); - req.request.alertEvent = false; - req.send(true); - var res = req.result(); - if( checkILSEvent(res) ) return null; - return res; + try { + for( var i = 0; i != recordsCache.length; i++ ) { + var rec = recordsCache[i]; + if( rec && rec.doc_id() == id ) return rec; + } + } catch(E){} + var meth = FETCH_RMODS + if(type == 'M') meth = FETCH_MRMODS; + var req = new Request(meth, id); + req.request.alertEvent = false; + req.send(true); + var res = req.result(); + if( checkILSEvent(res) ) return null; + return res; } function Timer(name, node){ - this.name = name; - this.count = 1; - this.node = node; + this.name = name; + this.count = 1; + this.node = node; } Timer.prototype.start = - function(){_timerRun(this.name);} + function(){_timerRun(this.name);} Timer.prototype.stop = - function(){this.done = true;} + function(){this.done = true;} function _timerRun(tname) { - var _t; - eval('_t='+tname); - if(_t.done) return; - if(_t.count > 100) return; - var str = ' . '; - if( (_t.count % 5) == 0 ) - str = _t.count / 5; - _t.node.appendChild(text(str)); - setTimeout("_timerRun('"+tname+"');", 200); - _t.count++; + var _t; + eval('_t='+tname); + if(_t.done) return; + if(_t.count > 100) return; + var str = ' . '; + if( (_t.count % 5) == 0 ) + str = _t.count / 5; + _t.node.appendChild(text(str)); + setTimeout("_timerRun('"+tname+"');", 200); + _t.count++; } function checkILSEvent(obj) { - if( obj && obj.ilsevent != null && obj.ilsevent != 0 ) - return parseInt(obj.ilsevent); - return null; + if( obj && obj.ilsevent != null && obj.ilsevent != 0 ) + return parseInt(obj.ilsevent); + return null; } function alertILSEvent(evt, msg) { if(!msg) msg = ""; - if(msg) - alert(msg +'\n' + evt.textcode + '\n' + evt.desc ); - else - alert(evt.textcode + '\n' + evt.desc ); + if(msg) + alert(msg +'\n' + evt.textcode + '\n' + evt.desc ); + else + alert(evt.textcode + '\n' + evt.desc ); } var __authTimer; function AuthTimer(time) { - this.time = (time - LOGOUT_WARNING_TIME) * 1000; - if(__authTimer) - try {clearTimeout(__authTimer.id)} catch(e){} - __authTimer = this; + this.time = (time - LOGOUT_WARNING_TIME) * 1000; + if(__authTimer) + try {clearTimeout(__authTimer.id)} catch(e){} + __authTimer = this; } AuthTimer.prototype.run = function() { - this.id = setTimeout('_authTimerAlert()', this.time); + this.id = setTimeout('_authTimerAlert()', this.time); } function _authTimerAlert() { - alert( $('auth_session_expiring').innerHTML ); - if(!grabUser(null, true)) doLogout(); + alert( $('auth_session_expiring').innerHTML ); + if(!grabUser(null, true)) doLogout(); } function grabUserByBarcode( authtoken, barcode ) { - var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode ); - req.send(true); - return req.result(); + var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode ); + req.send(true); + return req.result(); } function goHome() { - goTo(buildOPACLink({page:HOME})); + goTo(buildOPACLink({page:HOME})); } function buildOrgSel(selector, org, offset, namecol) { if(!namecol) namecol = 'name'; if(!isXUL() && !isTrue(org.opac_visible())) return; - insertSelectorVal( selector, -1, - org[namecol](), org.id(), null, findOrgDepth(org) - offset ); - for( var c in org.children() ) - buildOrgSel( selector, org.children()[c], offset, namecol); + insertSelectorVal( selector, -1, + org[namecol](), org.id(), null, findOrgDepth(org) - offset ); + for( var c in org.children() ) + buildOrgSel( selector, org.children()[c], offset, namecol); } function buildMergedOrgSel(selector, org_list, offset, namecol) { if(!namecol) namecol = 'name'; for(var i = 0; i < org_list.length; i++) { var org = findOrgUnit(org_list[i]); - insertSelectorVal( selector, -1, - org[namecol](), org.id(), null, findOrgDepth(org) - offset ); - for( var c in org.children() ) - buildOrgSel( selector, org.children()[c], offset, namecol); + insertSelectorVal( selector, -1, + org[namecol](), org.id(), null, findOrgDepth(org) - offset ); + for( var c in org.children() ) + buildOrgSel( selector, org.children()[c], offset, namecol); } } function parseForm(form) { - if(!form) return {}; + if(!form) return {}; - var it = form.replace(/-\w+$/,""); - var itf = null; - var item_form; - var item_type; + var it = form.replace(/-\w+$/,""); + var itf = null; + var item_form; + var item_type; - if(form.match(/-/)) itf = form.replace(/^\w+-/,""); + if(form.match(/-/)) itf = form.replace(/^\w+-/,""); - if(it) { - item_type = []; - for( var i = 0; i < it.length; i++ ) - item_type.push( it.charAt(i) ); - } + if(it) { + item_type = []; + for( var i = 0; i < it.length; i++ ) + item_type.push( it.charAt(i) ); + } - if(itf) { - item_form = []; - for( var i = 0; i < itf.length; i++ ) - item_form.push( itf.charAt(i) ); - } + if(itf) { + item_form = []; + for( var i = 0; i < itf.length; i++ ) + item_form.push( itf.charAt(i) ); + } - return {item_type: item_type, item_form:item_form}; + return {item_type: item_type, item_form:item_form}; } function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); } function fetchPermOrgs() { - var a = []; /* why does arguments come accross as an object and not an array? */ - for( var i = 0; i < arguments.length; i++ ) - a.push(arguments[i]) - - var preq = new Request(FETCH_HIGHEST_PERM_ORG, - G.user.session, G.user.id(), a ); - preq.send(true); - return preq.result(); + var a = []; /* why does arguments come accross as an object and not an array? */ + for( var i = 0; i < arguments.length; i++ ) + a.push(arguments[i]) + + var preq = new Request(FETCH_HIGHEST_PERM_ORG, + G.user.session, G.user.id(), a ); + preq.send(true); + return preq.result(); } function print_tabs(t) { - var r = ''; - for (var j = 0; j < t; j++ ) { r = r + " "; } - return r; + var r = ''; + for (var j = 0; j < t; j++ ) { r = r + " "; } + return r; } function formatJSON(s) { - var r = ''; var t = 0; - for (var i in s) { - if (s[i] == '{' || s[i] == '[' ) { - r = r + s[i] + "\n" + print_tabs(++t); - } else if (s[i] == '}' || s[i] == ']') { - t--; r = r + "\n" + print_tabs(t) + s[i]; - } else if (s[i] == ',') { - r = r + s[i] + "\n" + print_tabs(t); - } else { - r = r + s[i]; - } - } - return r; + var r = ''; var t = 0; + for (var i in s) { + if (s[i] == '{' || s[i] == '[' ) { + r = r + s[i] + "\n" + print_tabs(++t); + } else if (s[i] == '}' || s[i] == ']') { + t--; r = r + "\n" + print_tabs(t) + s[i]; + } else if (s[i] == ',') { + r = r + s[i] + "\n" + print_tabs(t); + } else { + r = r + s[i]; + } + } + return r; } diff --git a/Open-ILS/web/opac/common/js/org_utils.js b/Open-ILS/web/opac/common/js/org_utils.js index 9fe33f47d9..e39a09b7ac 100644 --- a/Open-ILS/web/opac/common/js/org_utils.js +++ b/Open-ILS/web/opac/common/js/org_utils.js @@ -24,42 +24,42 @@ function fetchBatchOrgSetting(orgId, nameList, onload) { /* takes an org unit or id and return the numeric depth */ function findOrgDepth(org_id_or_node) { - var org = findOrgUnit(org_id_or_node); - if(!org) return -1; - var type = findOrgType(org.ou_type()); - if(type) return type.depth(); - return -1; + var org = findOrgUnit(org_id_or_node); + if(!org) return -1; + var type = findOrgType(org.ou_type()); + if(type) return type.depth(); + return -1; } function findOrgTypeFromDepth(depth) { - if( depth == null ) return null; - for( var type in globalOrgTypes ) { - var t = globalOrgTypes[type]; - if( t.depth() == depth ) return t; - } + if( depth == null ) return null; + for( var type in globalOrgTypes ) { + var t = globalOrgTypes[type]; + if( t.depth() == depth ) return t; + } } /* takes the org type id from orgunit.ou_type() field and returns - the org type object */ + the org type object */ function findOrgType(type_id) { - if(typeof type_id == 'object') return type_id; - for(var type in globalOrgTypes) { - var t =globalOrgTypes[type]; - if( t.id() == type_id || t.id() == parseInt(type_id) ) - return t; - } - return null; + if(typeof type_id == 'object') return type_id; + for(var type in globalOrgTypes) { + var t =globalOrgTypes[type]; + if( t.id() == type_id || t.id() == parseInt(type_id) ) + return t; + } + return null; } /* returns an org unit by id. if an object is passed in as the id, - then the object is assumed to be an org unit and is returned */ + then the object is assumed to be an org unit and is returned */ function findOrgUnit(org_id) { - return (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id]; + return (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id]; } function findOrgLasso(lasso_id) { - if (typeof lasso_id == 'object') return lasso_id; + if (typeof lasso_id == 'object') return lasso_id; for (var i in _lasso) { if (_lasso[i].id() == lasso_id) return _lasso[i]; } @@ -68,39 +68,39 @@ function findOrgLasso(lasso_id) { var orgArraySearcherSN = {}; function findOrgUnitSN(shortname) { - if (typeof shortname == 'object') return shortname; - if( orgArraySearcherSN[shortname] ) return orgArraySearcherSN[shortname]; - _debug("fetching org by shortname "+shortname); - var req = new Request(FETCH_ORG_BY_SHORTNAME, shortname); - req.request.alertEvent = false; - req.send(true); - return req.result(); + if (typeof shortname == 'object') return shortname; + if( orgArraySearcherSN[shortname] ) return orgArraySearcherSN[shortname]; + _debug("fetching org by shortname "+shortname); + var req = new Request(FETCH_ORG_BY_SHORTNAME, shortname); + req.request.alertEvent = false; + req.send(true); + return req.result(); } /* builds a trail from the top of the org tree to the node provide. - basically fleshes out 'my orgs' - Returns an array of [org0, org1, ..., myorg] */ + basically fleshes out 'my orgs' + Returns an array of [org0, org1, ..., myorg] */ function orgNodeTrail(node) { - var na = new Array(); - while( node ) { - na.push(node); - node = findOrgUnit(node.parent_ou()); - } - return na.reverse(); + var na = new Array(); + while( node ) { + na.push(node); + node = findOrgUnit(node.parent_ou()); + } + return na.reverse(); } function findSiblingOrgs(node) { return findOrgUnit(node.parent_ou()).children(); } /* true if 'org' is 'me' or a child of mine */ function orgIsMine(me, org) { - if(!me || !org) return false; - if(me.id() == org.id()) return true; - for( var i in me.children() ) { - if(orgIsMine(me.children()[i], org)) - return true; - } - return false; + if(!me || !org) return false; + if(me.id() == org.id()) return true; + for( var i in me.children() ) { + if(orgIsMine(me.children()[i], org)) + return true; + } + return false; } function orgIsMineFromSet(meList, org) { @@ -115,37 +115,37 @@ function orgIsMineFromSet(meList, org) { var orgArraySearcher = {}; var globalOrgTree; for (var i in _l) { - var x = new aou(); - x.id(_l[i][0]); - x.ou_type(_l[i][1]); - x.parent_ou(_l[i][2]); - x.name(_l[i][3]); + var x = new aou(); + x.id(_l[i][0]); + x.ou_type(_l[i][1]); + x.parent_ou(_l[i][2]); + x.name(_l[i][3]); x.opac_visible(_l[i][4]); x.shortname(_l[i][5]); - orgArraySearcher[x.id()] = x; + orgArraySearcher[x.id()] = x; } for (var i in orgArraySearcher) { - var x = orgArraySearcher[i]; - if (x.parent_ou() == null || x.parent_ou() == '') { - globalOrgTree = x; - continue; - } - - var par = findOrgUnit(x.parent_ou()); - if (!par.children()) par.children(new Array()); - par.children().push(x); + var x = orgArraySearcher[i]; + if (x.parent_ou() == null || x.parent_ou() == '') { + globalOrgTree = x; + continue; + } + + var par = findOrgUnit(x.parent_ou()); + if (!par.children()) par.children(new Array()); + par.children().push(x); } function _tree_killer () { - for (var i in orgArraySearcher) { - x=orgArraySearcher[i]; - x.children(null); - x.parent_ou(null); - orgArraySearcher[i]=null; - } - globalOrgTree = null; - orgArraySearcher = null; - globalOrgTypes = null; + for (var i in orgArraySearcher) { + x=orgArraySearcher[i]; + x.children(null); + x.parent_ou(null); + orgArraySearcher[i]=null; + } + globalOrgTree = null; + orgArraySearcher = null; + globalOrgTypes = null; } diff --git a/Open-ILS/web/opac/common/js/slimtree.js b/Open-ILS/web/opac/common/js/slimtree.js index e047dd018a..04d4ab848c 100644 --- a/Open-ILS/web/opac/common/js/slimtree.js +++ b/Open-ILS/web/opac/common/js/slimtree.js @@ -1,12 +1,12 @@ /* -var stpicopen = '../../../../images/slimtree/folder.gif'; +var stpicopen = '../../../../images/slimtree/folder.gif'; var stpicclose = '../../../../images/slimtree/folderopen.gif'; */ -var stpicopen = '../../../../images/slimtree/folder2.gif'; +var stpicopen = '../../../../images/slimtree/folder2.gif'; var stpicclose = '../../../../images/slimtree/folderopen2.gif'; var stpicblank = '../../../../images/slimtree/page.gif'; -var stpicline = '../../../../images/slimtree/line.gif'; -var stpicjoin = '../../../../images/slimtree/join.gif'; +var stpicline = '../../../../images/slimtree/line.gif'; +var stpicjoin = '../../../../images/slimtree/join.gif'; var stpicjoinb = '../../../../images/slimtree/joinbottom.gif'; var stimgopen; @@ -18,140 +18,140 @@ var stimgjoin; function _apc(root,node) { root.appendChild(node); } function SlimTree(context, handle, rootimg) { - - if(!stimgopen) { - stimgopen = elem('img',{src:stpicopen,border:0, style:'height:13px;width:31px;'}); - stimgclose = elem('img',{src:stpicclose,border:0, style:'height:13px;width:31px;'}); - stimgblank = elem('img',{src:stpicblank,border:0, style:'height:18px;width:18px;'}); - stimgline = elem('img',{src:stpicline,border:0, style:'height:18px;width:18px;'}); - stimgjoin = elem('img',{src:stpicjoin,border:0, style:'display:inline;height:18px;width:18px;'}); - } - - this.context = context; - this.handle = handle; - this.cache = new Object(); - if(rootimg) - this.rootimg = elem('img', - {src:rootimg,border:0,style:'padding-right: 4px;'}); + + if(!stimgopen) { + stimgopen = elem('img',{src:stpicopen,border:0, style:'height:13px;width:31px;'}); + stimgclose = elem('img',{src:stpicclose,border:0, style:'height:13px;width:31px;'}); + stimgblank = elem('img',{src:stpicblank,border:0, style:'height:18px;width:18px;'}); + stimgline = elem('img',{src:stpicline,border:0, style:'height:18px;width:18px;'}); + stimgjoin = elem('img',{src:stpicjoin,border:0, style:'display:inline;height:18px;width:18px;'}); + } + + this.context = context; + this.handle = handle; + this.cache = new Object(); + if(rootimg) + this.rootimg = elem('img', + {src:rootimg,border:0,style:'padding-right: 4px;'}); } SlimTree.prototype.addCachedChildren = function(pid) { - var child; - while( child = this.cache[pid].shift() ) - this.addNode( child.id, child.pid, - child.name, child.action, child.title ); - this.cache[pid] = null; + var child; + while( child = this.cache[pid].shift() ) + this.addNode( child.id, child.pid, + child.name, child.action, child.title ); + this.cache[pid] = null; } SlimTree.prototype.addNode = function( id, pid, name, action, title, cls ) { - if( pid != -1 && !$(pid)) { - if(!this.cache[pid]) this.cache[pid] = new Array(); - this.cache[pid].push( - {id:id,pid:pid,name:name,action:action,title:title }); - return; - } - - if(!action) - action='javascript:'+this.handle+'.toggle("'+id+'");'; - - var actionref; - if( typeof action == 'string' ) - actionref = elem('a',{href:action}, name); - else { - actionref = elem('a',{href:'javascript:void(0);'}, name); - actionref.onclick = action; - } - - var div = elem('div',{id:id}); - var topdiv = elem('div',{style:'vertical-align:middle'}); - var link = elem('a', {id:'stlink_' + id}); - var contdiv = elem('div',{id:'stcont_' + id}); - - if(cls) addCSSClass(actionref, cls); - - //actionref.setAttribute('href',action); - if(title) actionref.setAttribute('title',title); - else actionref.setAttribute('title',name); - - _apc(topdiv,link); - _apc(topdiv,actionref); - _apc(div,topdiv); - _apc(div,contdiv); - - if( pid == -1 ) { - - this.rootid = id; - _apc(this.context,div); - if(this.rootimg) _apc(link,this.rootimg.cloneNode(true)); - else _apc(link,stimgblank.cloneNode(true)); - - } else { - - if(pid == this.rootid) this.open(pid); - else this.close(pid); - $(pid).setAttribute('haschild','1'); - _apc(link,stimgblank.cloneNode(true)); - div.style.paddingLeft = '18px'; - div.style.backgroundImage = 'url('+stpicjoinb+')'; - div.style.backgroundRepeat = 'no-repeat'; - _apc($('stcont_' + pid), div); - if (div.previousSibling) stMakePaths(div); - } - if(this.cache[id]) this.addCachedChildren(id); + if( pid != -1 && !$(pid)) { + if(!this.cache[pid]) this.cache[pid] = new Array(); + this.cache[pid].push( + {id:id,pid:pid,name:name,action:action,title:title }); + return; + } + + if(!action) + action='javascript:'+this.handle+'.toggle("'+id+'");'; + + var actionref; + if( typeof action == 'string' ) + actionref = elem('a',{href:action}, name); + else { + actionref = elem('a',{href:'javascript:void(0);'}, name); + actionref.onclick = action; + } + + var div = elem('div',{id:id}); + var topdiv = elem('div',{style:'vertical-align:middle'}); + var link = elem('a', {id:'stlink_' + id}); + var contdiv = elem('div',{id:'stcont_' + id}); + + if(cls) addCSSClass(actionref, cls); + + //actionref.setAttribute('href',action); + if(title) actionref.setAttribute('title',title); + else actionref.setAttribute('title',name); + + _apc(topdiv,link); + _apc(topdiv,actionref); + _apc(div,topdiv); + _apc(div,contdiv); + + if( pid == -1 ) { + + this.rootid = id; + _apc(this.context,div); + if(this.rootimg) _apc(link,this.rootimg.cloneNode(true)); + else _apc(link,stimgblank.cloneNode(true)); + + } else { + + if(pid == this.rootid) this.open(pid); + else this.close(pid); + $(pid).setAttribute('haschild','1'); + _apc(link,stimgblank.cloneNode(true)); + div.style.paddingLeft = '18px'; + div.style.backgroundImage = 'url('+stpicjoinb+')'; + div.style.backgroundRepeat = 'no-repeat'; + _apc($('stcont_' + pid), div); + if (div.previousSibling) stMakePaths(div); + } + if(this.cache[id]) this.addCachedChildren(id); } function stMakePaths(div) { - _apc(div.previousSibling.firstChild,stimgjoin.cloneNode(true)); - _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild); - _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild); - div.previousSibling.firstChild.firstChild.style.marginLeft = '-18px'; - div.previousSibling.style.backgroundImage = 'url('+stpicline+')'; - div.previousSibling.style.backgroundRepeat = 'repeat-y'; + _apc(div.previousSibling.firstChild,stimgjoin.cloneNode(true)); + _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild); + _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild); + div.previousSibling.firstChild.firstChild.style.marginLeft = '-18px'; + div.previousSibling.style.backgroundImage = 'url('+stpicline+')'; + div.previousSibling.style.backgroundRepeat = 'repeat-y'; } SlimTree.prototype.expandAll = function() { this.flex(this.rootid, 'open'); } SlimTree.prototype.closeAll = function() { this.flex(this.rootid,'close'); } SlimTree.prototype.flex = function(id, type) { - if(type=='open') this.open(id); - else { if (id != this.rootid) this.close(id); } - var n = $('stcont_' + id); - for( var c = 0; c != n.childNodes.length; c++ ) { - var ch = n.childNodes[c]; - if(ch.nodeName.toLowerCase() == 'div') { - if($(ch.id).getAttribute('haschild') == '1') - this.flex(ch.id, type); - } - } + if(type=='open') this.open(id); + else { if (id != this.rootid) this.close(id); } + var n = $('stcont_' + id); + for( var c = 0; c != n.childNodes.length; c++ ) { + var ch = n.childNodes[c]; + if(ch.nodeName.toLowerCase() == 'div') { + if($(ch.id).getAttribute('haschild') == '1') + this.flex(ch.id, type); + } + } } SlimTree.prototype.toggle = function(id) { - if($(id).getAttribute('ostate') == '1') this.open(id); - else if($(id).getAttribute('ostate') == '2') this.close(id); + if($(id).getAttribute('ostate') == '1') this.open(id); + else if($(id).getAttribute('ostate') == '2') this.close(id); } SlimTree.prototype.open = function(id) { - if($(id).getAttribute('ostate') == '2') return; - var link = $('stlink_' + id); - if(!link) return; - if(id != this.rootid || !this.rootimg) { - removeChildren(link); - _apc(link,stimgclose.cloneNode(true)); - } - link.setAttribute('href','javascript:' + this.handle + '.close("'+id+'");'); - unHideMe($('stcont_' + id)); - $(id).setAttribute('ostate','2'); + if($(id).getAttribute('ostate') == '2') return; + var link = $('stlink_' + id); + if(!link) return; + if(id != this.rootid || !this.rootimg) { + removeChildren(link); + _apc(link,stimgclose.cloneNode(true)); + } + link.setAttribute('href','javascript:' + this.handle + '.close("'+id+'");'); + unHideMe($('stcont_' + id)); + $(id).setAttribute('ostate','2'); } SlimTree.prototype.close = function(id) { - var link = $('stlink_' + id); - if(!link) return; - if(id != this.rootid || !this.rootimg) { - removeChildren(link); - _apc(link,stimgopen.cloneNode(true)); - } - link.setAttribute('href','javascript:' + this.handle + '.open("'+id+'");'); - hideMe($('stcont_' + id)); - $(id).setAttribute('ostate','1'); + var link = $('stlink_' + id); + if(!link) return; + if(id != this.rootid || !this.rootimg) { + removeChildren(link); + _apc(link,stimgopen.cloneNode(true)); + } + link.setAttribute('href','javascript:' + this.handle + '.open("'+id+'");'); + hideMe($('stcont_' + id)); + $(id).setAttribute('ostate','1'); } diff --git a/Open-ILS/web/opac/common/js/sorttable.js b/Open-ILS/web/opac/common/js/sorttable.js index 710da47578..f289da8fd6 100644 --- a/Open-ILS/web/opac/common/js/sorttable.js +++ b/Open-ILS/web/opac/common/js/sorttable.js @@ -1,7 +1,7 @@ /* - Changed HTML entities to hex encoded entities - bill erickson - */ + Changed HTML entities to hex encoded entities + bill erickson + */ addEvent(window, "load", sortables_init); @@ -31,29 +31,29 @@ function ts_makeSortable(table) { var cell = firstRow.cells[i]; var txt = ts_getInnerText(cell); cell.innerHTML = '' - + txt +'   '; + + txt +'   '; } } function ts_getInnerText(el) { - if (typeof el == "string") return el; - if (typeof el == "undefined") { return el }; - if (el.innerText) return el.innerText; //Not needed but it is faster - var str = ""; - - var cs = el.childNodes; - var l = cs.length; - for (var i = 0; i < l; i++) { - switch (cs[i].nodeType) { - case 1: //ELEMENT_NODE - str += ts_getInnerText(cs[i]); - break; - case 3: //TEXT_NODE - str += cs[i].nodeValue; - break; - } - } - return str; + if (typeof el == "string") return el; + if (typeof el == "undefined") { return el }; + if (el.innerText) return el.innerText; //Not needed but it is faster + var str = ""; + + var cs = el.childNodes; + var l = cs.length; + for (var i = 0; i < l; i++) { + switch (cs[i].nodeType) { + case 1: //ELEMENT_NODE + str += ts_getInnerText(cs[i]); + break; + case 3: //TEXT_NODE + str += cs[i].nodeValue; + break; + } + } + return str; } function ts_resortTable(lnk) { @@ -70,7 +70,7 @@ function ts_resortTable(lnk) { // Work out a type for the column if (table.rows.length <= 1) return; var itm = ts_getInnerText(table.rows[1].cells[column]); - if(!itm) return; + if(!itm) return; sortfn = ts_sort_caseinsensitive; if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date; if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date; @@ -113,11 +113,11 @@ function ts_resortTable(lnk) { } function getParent(el, pTagName) { - if (el == null) return null; - else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase - return el; - else - return getParent(el.parentNode, pTagName); + if (el == null) return null; + else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase + return el; + else + return getParent(el.parentNode, pTagName); } function ts_sort_date(a,b) { // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX diff --git a/Open-ILS/web/opac/common/js/utils.js b/Open-ILS/web/opac/common/js/utils.js index aeae80decf..3d3d77db73 100644 --- a/Open-ILS/web/opac/common/js/utils.js +++ b/Open-ILS/web/opac/common/js/utils.js @@ -1,55 +1,55 @@ function $(id) { return getId(id); } function getId(id) { - return document.getElementById(id); + return document.getElementById(id); } function swapCSSClass(obj, old, newc ) { - removeCSSClass(obj, old ); - addCSSClass(obj, newc ); + removeCSSClass(obj, old ); + addCSSClass(obj, newc ); } function addCSSClass(e,c) { - if(!e || !c) return; + if(!e || !c) return; - var css_class_string = e.className; - var css_class_array; + var css_class_string = e.className; + var css_class_array; - if(css_class_string) - css_class_array = css_class_string.split(/\s+/); + if(css_class_string) + css_class_array = css_class_string.split(/\s+/); - var string_ip = ""; /*strip out nulls*/ - for (var css_class in css_class_array) { - if (css_class_array[css_class] == c) { return; } - if(css_class_array[css_class] !=null) - string_ip += css_class_array[css_class] + " "; - } - string_ip += c; - e.className = string_ip; + var string_ip = ""; /*strip out nulls*/ + for (var css_class in css_class_array) { + if (css_class_array[css_class] == c) { return; } + if(css_class_array[css_class] !=null) + string_ip += css_class_array[css_class] + " "; + } + string_ip += c; + e.className = string_ip; } function removeCSSClass(e, c) { - if(!e || !c) return; + if(!e || !c) return; - var css_class_string = ''; + var css_class_string = ''; - var css_class_array = e.className; - if( css_class_array ) - css_class_array = css_class_array.split(/\s+/); + var css_class_array = e.className; + if( css_class_array ) + css_class_array = css_class_array.split(/\s+/); - var first = 1; - for (var css_class in css_class_array) { - if (css_class_array[css_class] != c) { - if (first == 1) { - css_class_string = css_class_array[css_class]; - first = 0; - } else { - css_class_string = css_class_string + ' ' + - css_class_array[css_class]; - } - } - } - e.className = css_class_string; + var first = 1; + for (var css_class in css_class_array) { + if (css_class_array[css_class] != c) { + if (first == 1) { + css_class_string = css_class_array[css_class]; + first = 0; + } else { + css_class_string = css_class_string + ' ' + + css_class_array[css_class]; + } + } + } + e.className = css_class_string; } @@ -72,21 +72,21 @@ function userPressedEnter(evt) { function goTo(url) { - /* setTimeout because ie sux */ - setTimeout( function(){ location.href = url; }, 0 ); + /* setTimeout because ie sux */ + setTimeout( function(){ location.href = url; }, 0 ); } function removeChildren(dom) { - if(!dom) return; - while(dom.childNodes[0]) - dom.removeChild(dom.childNodes[0]); + if(!dom) return; + while(dom.childNodes[0]) + dom.removeChild(dom.childNodes[0]); } function appendClear(node, child) { - if(typeof child =='string') child = text(child); - removeChildren(node); - node.appendChild(child); + if(typeof child =='string') child = text(child); + removeChildren(node); + node.appendChild(child); } @@ -142,16 +142,16 @@ detect_browser(); function text(t) { - if(t == null) t = ""; - return document.createTextNode(t); + if(t == null) t = ""; + return document.createTextNode(t); } function elem(name, attrs, txt) { var e = document.createElement(name); if (attrs) { for (key in attrs) { - if( key == 'id') e.id = attrs[key]; - else e.setAttribute(key, attrs[key]); + if( key == 'id') e.id = attrs[key]; + else e.setAttribute(key, attrs[key]); } } if (txt) e.appendChild(text(txt)); @@ -160,207 +160,207 @@ function elem(name, attrs, txt) { /* sel is the selector object, sets selected on the - option with the given value. case does not matter...*/ + option with the given value. case does not matter...*/ function setSelector( sel, value ) { - if(sel && value != null) { - for( var i = 0; i!= sel.options.length; i++ ) { - if( sel.options[i] ) { - var val = sel.options[i].value; - if( val == null || val == "" ) /* for IE */ - val = sel.options[i].innerHTML; - value += ""; /* in case of number */ - if( val && val.toLowerCase() == value.toLowerCase() ) { - sel.selectedIndex = i; - sel.options[i].selected = true; - return true; - } - } - } - } - return false; + if(sel && value != null) { + for( var i = 0; i!= sel.options.length; i++ ) { + if( sel.options[i] ) { + var val = sel.options[i].value; + if( val == null || val == "" ) /* for IE */ + val = sel.options[i].innerHTML; + value += ""; /* in case of number */ + if( val && val.toLowerCase() == value.toLowerCase() ) { + sel.selectedIndex = i; + sel.options[i].selected = true; + return true; + } + } + } + } + return false; } function setSelectorRegex( sel, regex ) { - if(sel && regex != null) { - for( var i = 0; i!= sel.options.length; i++ ) { - if( sel.options[i] ) { - var val = sel.options[i].value; - if( val == null || val == "" ) /* for IE */ - val = sel.options[i].innerHTML; - value += ""; /* in case of number */ - if( val && val.match(regex) ) { - sel.selectedIndex = i; - sel.options[i].selected = true; - return true; - } - } - } - } - return false; + if(sel && regex != null) { + for( var i = 0; i!= sel.options.length; i++ ) { + if( sel.options[i] ) { + var val = sel.options[i].value; + if( val == null || val == "" ) /* for IE */ + val = sel.options[i].innerHTML; + value += ""; /* in case of number */ + if( val && val.match(regex) ) { + sel.selectedIndex = i; + sel.options[i].selected = true; + return true; + } + } + } + } + return false; } function getSelectorVal( sel ) { - if(!sel) return null; - var idx = sel.selectedIndex; - if( idx < 0 ) return null; - var o = sel.options[idx]; - var v = o.value; - if(v == null) v = o.innerHTML; - return v; + if(!sel) return null; + var idx = sel.selectedIndex; + if( idx < 0 ) return null; + var o = sel.options[idx]; + var v = o.value; + if(v == null) v = o.innerHTML; + return v; } function getSelectorName( sel ) { - var o = sel.options[sel.selectedIndex]; - var v = o.name; - if(v == null || v == undefined || v == "") v = o.innerHTML; - return v; + var o = sel.options[sel.selectedIndex]; + var v = o.name; + if(v == null || v == undefined || v == "") v = o.innerHTML; + return v; } function setSelectorByName( sel, name ) { - for( var o in sel.options ) { - var opt = sel.options[o]; - if( opt.name == name || opt.innerHTML == name ) { - sel.selectedIndex = o; - opt.selected = true; - } - } + for( var o in sel.options ) { + var opt = sel.options[o]; + if( opt.name == name || opt.innerHTML == name ) { + sel.selectedIndex = o; + opt.selected = true; + } + } } function findSelectorOptByValue( sel, val ) { - for( var i = 0; i < sel.options.length; i++ ) { - var opt = sel.options[i]; - if( opt.value == val ) return opt; - } - return null; + for( var i = 0; i < sel.options.length; i++ ) { + var opt = sel.options[i]; + if( opt.value == val ) return opt; + } + return null; } function debugSelector(sel) { - var s = 'Selector\n'; - for( var i = 0; i != sel.options.length; i++ ) { - var o = sel.options[i]; - s += "\t" + o.innerHTML + "\n"; - } - return s; + var s = 'Selector\n'; + for( var i = 0; i != sel.options.length; i++ ) { + var o = sel.options[i]; + s += "\t" + o.innerHTML + "\n"; + } + return s; } function findParentByNodeName(node, name) { - while( ( node = node.parentNode) ) - if (node.nodeName == name) return node; - return null; + while( ( node = node.parentNode) ) + if (node.nodeName == name) return node; + return null; } /* returns only elements in nodes childNodes list, not sub-children */ function getElementsByTagNameFlat( node, name ) { - var elements = []; - for( var e in node.childNodes ) { - var n = node.childNodes[e]; - if( n && n.nodeName == name ) elements.push(n); - } - return elements; + var elements = []; + for( var e in node.childNodes ) { + var n = node.childNodes[e]; + if( n && n.nodeName == name ) elements.push(n); + } + return elements; } /* expects a tree with a id() method on each node and a children() method to get to each node */ function findTreeItemById( tree, id ) { - if( tree.id() == id ) return tree; - for( var c in tree.children() ) { - var found = findTreeItemById( tree.children()[c], id ); - if(found) return found; - } - return null; + if( tree.id() == id ) return tree; + for( var c in tree.children() ) { + var found = findTreeItemById( tree.children()[c], id ); + if(found) return found; + } + return null; } /* returns null if none of the tests are true. returns sub-array of matching array items otherwise */ function grep( arr, func ) { - var results = []; - if(!arr) return null; - if( arr.constructor == Array ) { - for( var i = 0; i < arr.length; i++ ) { - if( func(arr[i]) ) - results.push(arr[i]); - } - } else { - for( var i in arr ) { - if( func(arr[i]) ) - results.push(arr[i]); - } - } - if(results.length > 0) return results; - return null; + var results = []; + if(!arr) return null; + if( arr.constructor == Array ) { + for( var i = 0; i < arr.length; i++ ) { + if( func(arr[i]) ) + results.push(arr[i]); + } + } else { + for( var i in arr ) { + if( func(arr[i]) ) + results.push(arr[i]); + } + } + if(results.length > 0) return results; + return null; } function ogrep( obj, func ) { - var results = {}; - var found = false; - for( var i in obj ) { - if( func(obj[i]) ) { - results[i] = obj[i]; - found = true; - } - } - if(found) return results; - return null; + var results = {}; + var found = false; + for( var i in obj ) { + if( func(obj[i]) ) { + results[i] = obj[i]; + found = true; + } + } + if(found) return results; + return null; } function doSelectorActions(sel) { - if((IE || Safari) && sel) { - sel.onchange = function() { - var o = sel.options[sel.selectedIndex]; - if(o && o.onclick) o.onclick() - } - } + if((IE || Safari) && sel) { + sel.onchange = function() { + var o = sel.options[sel.selectedIndex]; + if(o && o.onclick) o.onclick() + } + } } /* if index < 0, the item is pushed onto the end */ function insertSelectorVal( selector, index, name, value, action, indent ) { - if( index < 0 ) index = selector.options.length; - var a = []; - for( var i = selector.options.length; i != index; i-- ) - a[i] = selector.options[i-1]; + if( index < 0 ) index = selector.options.length; + var a = []; + for( var i = selector.options.length; i != index; i-- ) + a[i] = selector.options[i-1]; - var opt = setSelectorVal( selector, index, name, value, action, indent ); + var opt = setSelectorVal( selector, index, name, value, action, indent ); - for( var i = index + 1; i < a.length; i++ ) - selector.options[i] = a[i]; + for( var i = index + 1; i < a.length; i++ ) + selector.options[i] = a[i]; - return opt; + return opt; } /* changes the value of the option at the specified index */ function setSelectorVal( selector, index, name, value, action, indent ) { - if(!indent || indent < 0) indent = 0; - indent = parseInt(indent); + if(!indent || indent < 0) indent = 0; + indent = parseInt(indent); - var option; + var option; - if(IE) { - var pre = elem("pre"); - for( var i = 0; i != indent; i++ ) - pre.appendChild(text(" ")); + if(IE) { + var pre = elem("pre"); + for( var i = 0; i != indent; i++ ) + pre.appendChild(text(" ")); - pre.appendChild(text(name)); - option = new Option("", value); - selector.options[index] = option; - option.appendChild(pre); - - } else { - indent = indent * 14; - option= new Option(name, value); - option.setAttribute("style", "padding-left: "+indent+'px;'); - selector.options[index] = option; - if(action) option.onclick = action; - } + pre.appendChild(text(name)); + option = new Option("", value); + selector.options[index] = option; + option.appendChild(pre); + + } else { + indent = indent * 14; + option= new Option(name, value); + option.setAttribute("style", "padding-left: "+indent+'px;'); + selector.options[index] = option; + if(action) option.onclick = action; + } - if(action) option.onclick = action; - return option; + if(action) option.onclick = action; + return option; } /* split on spaces. capitalize the first /\w/ character in each substring */ function normalize(val) { - return val; /* disable me for now */ + return val; /* disable me for now */ if(!val) return ""; @@ -398,10 +398,10 @@ function normalize(val) { /* returns true if n is null or stringifies to 'undefined' */ function isNull(n) { - if( n == null || n == undefined || n.toString().toLowerCase() == "undefined" - || n.toString().toLowerCase() == "null" ) - return true; - return false; + if( n == null || n == undefined || n.toString().toLowerCase() == "undefined" + || n.toString().toLowerCase() == "null" ) + return true; + return false; } @@ -410,43 +410,43 @@ function isNull(n) { function $n( root, nodeName ) { return findNodeByName(root,nodeName); } function findNodeByName(root, nodeName) { - if( !root || !nodeName) return null; + if( !root || !nodeName) return null; - if(root.nodeType != 1) return null; + if(root.nodeType != 1) return null; - if(root.getAttribute("name") == nodeName || root.name == nodeName ) - return root; + if(root.getAttribute("name") == nodeName || root.name == nodeName ) + return root; - var children = root.childNodes; + var children = root.childNodes; - for( var i = 0; i != children.length; i++ ) { - var n = findNodeByName(children[i], nodeName); - if(n) return n; - } + for( var i = 0; i != children.length; i++ ) { + var n = findNodeByName(children[i], nodeName); + if(n) return n; + } - return null; + return null; } /* truncates the string at 'size' characters and appends a '...' to the end */ function truncate(string, size) { - if(string && size != null && - size > -1 && string.length > size) - return string.substr(0, size) + "... "; - return string; + if(string && size != null && + size > -1 && string.length > size) + return string.substr(0, size) + "... "; + return string; } /* style sheets must have a 'name' attribute for these functions to work */ function setActivateStyleSheet(name) { - var i, a, main; - for (i = 0; (a = document.getElementsByTagName ("link")[i]); i++) { - if (a.getAttribute ("rel").indexOf ("style") != -1 && a.getAttribute ("name")) { - a.disabled = true; - if (a.getAttribute ("name").indexOf(name) != -1) - a.disabled = false; - } - } + var i, a, main; + for (i = 0; (a = document.getElementsByTagName ("link")[i]); i++) { + if (a.getAttribute ("rel").indexOf ("style") != -1 && a.getAttribute ("name")) { + a.disabled = true; + if (a.getAttribute ("name").indexOf(name) != -1) + a.disabled = false; + } + } } @@ -454,65 +454,65 @@ function setActivateStyleSheet(name) { var currentFontSize; function scaleFonts(type) { - var size = ""; - var ssize = ""; - var size2 = ""; - var a; - - if(!currentFontSize) currentFontSize = 'regular'; - if(currentFontSize == 'regular' && type == 'regular' ) return; - if( currentFontSize == type ) return; - currentFontSize = type; - - switch(type) { - case "large": /* these are arbitrary.. but they seem to work ok in FF/IE */ - size = "142%"; - size2 = "107%"; - ssize = "94%"; - break; - } - - document.getElementsByTagName('body')[0].style.fontSize = size; - for (i = 0; (a = document.getElementsByTagName ("td")[i]); i++) a.style.fontSize = size;; - for (i = 0; (a = document.getElementsByTagName ("div")[i]); i++) a.style.fontSize = ssize; - for (i = 0; (a = document.getElementsByTagName ("option")[i]); i++) a.style.fontSize = ssize; - for (i = 0; (a = document.getElementsByTagName ("li")[i]); i++) a.style.fontSize = ssize; - for (i = 0; (a = document.getElementsByTagName ("span")[i]); i++) a.style.fontSize = ssize; - for (i = 0; (a = document.getElementsByTagName ("select")[i]); i++) a.style.fontSize = ssize; - for (i = 0; (a = document.getElementsByTagName ("a")[i]); i++) a.style.fontSize = size2; + var size = ""; + var ssize = ""; + var size2 = ""; + var a; + + if(!currentFontSize) currentFontSize = 'regular'; + if(currentFontSize == 'regular' && type == 'regular' ) return; + if( currentFontSize == type ) return; + currentFontSize = type; + + switch(type) { + case "large": /* these are arbitrary.. but they seem to work ok in FF/IE */ + size = "142%"; + size2 = "107%"; + ssize = "94%"; + break; + } + + document.getElementsByTagName('body')[0].style.fontSize = size; + for (i = 0; (a = document.getElementsByTagName ("td")[i]); i++) a.style.fontSize = size;; + for (i = 0; (a = document.getElementsByTagName ("div")[i]); i++) a.style.fontSize = ssize; + for (i = 0; (a = document.getElementsByTagName ("option")[i]); i++) a.style.fontSize = ssize; + for (i = 0; (a = document.getElementsByTagName ("li")[i]); i++) a.style.fontSize = ssize; + for (i = 0; (a = document.getElementsByTagName ("span")[i]); i++) a.style.fontSize = ssize; + for (i = 0; (a = document.getElementsByTagName ("select")[i]); i++) a.style.fontSize = ssize; + for (i = 0; (a = document.getElementsByTagName ("a")[i]); i++) a.style.fontSize = size2; } function sortWordsIgnoreCase(a, b) { - a = a.toLowerCase(); - b = b.toLowerCase(); - if(a>b) return 1; - if(ab) return 1; + if(a' + data + ''); + if( isXUL() ) { + var data = window.escape( + '' + data + ''); - xulG.window_open( - 'data:text/html,' + data, - '', - 'chrome,resizable,width=700,height=500'); + xulG.window_open( + 'data:text/html,' + data, + '', + 'chrome,resizable,width=700,height=500'); - } else { - win = window.open('','', 'resizable,width=700,height=500,scrollbars=1'); - win.document.body.innerHTML = data; - } + } else { + win = window.open('','', 'resizable,width=700,height=500,scrollbars=1'); + win.document.body.innerHTML = data; + } } /* alerts the innerhtml of the node with the given id */ function alertId(id) { - var node = $(id); - if(node) alert(node.innerHTML); + var node = $(id); + if(node) alert(node.innerHTML); } function alertIdText(id, text) { - var node = $(id); + var node = $(id); if(!node) return; if(text) alert(text + '\n\n' + node.innerHTML); else - alert(node.innerHTML); + alert(node.innerHTML); } function confirmId(id) { - var node = $(id); - if(node) return confirm(node.innerHTML); + var node = $(id); + if(node) return confirm(node.innerHTML); } @@ -588,97 +588,97 @@ function goForward() { history.forward(); } function uniquify(arr) { - if(!arr) return []; - var newarr = []; - for( var i = 0; i < arr.length; i++ ) { - var item = arr[i]; - if( ! grep( newarr, function(x) {return (x == item);})) - newarr.push(item); - } - return newarr; + if(!arr) return []; + var newarr = []; + for( var i = 0; i < arr.length; i++ ) { + var item = arr[i]; + if( ! grep( newarr, function(x) {return (x == item);})) + newarr.push(item); + } + return newarr; } function contains(arr, item) { - for( var i = 0; i < arr.length; i++ ) - if( arr[i] == item ) return true; - return false; + for( var i = 0; i < arr.length; i++ ) + if( arr[i] == item ) return true; + return false; } function isTrue(i) { - return (i && !(i+'').match(/f/i) ); + return (i && !(i+'').match(/f/i) ); } /* builds a JS date object with the given info. The given data - has to be valid (e.g. months == 30 is not valid). Returns NULL on - invalid date - Months are 1-12 (unlike the JS date object) - */ + has to be valid (e.g. months == 30 is not valid). Returns NULL on + invalid date + Months are 1-12 (unlike the JS date object) + */ function buildDate( year, month, day, hours, minutes, seconds ) { - if(!year) year = 0; - if(!month) month = 1; - if(!day) day = 1; - if(!hours) hours = 0; - if(!minutes) minutes = 0; - if(!seconds) seconds = 0; - - var d = new Date(year, month - 1, day, hours, minutes, seconds); - - _debug('created date with ' + - (d.getYear() + 1900) +'-'+ - (d.getMonth() + 1) +'-'+ - d.getDate()+' '+ - d.getHours()+':'+ - d.getMinutes()+':'+ - d.getSeconds()); - - - if( - (d.getYear() + 1900) == year && - d.getMonth() == (month - 1) && - d.getDate() == new Number(day) && - d.getHours() == new Number(hours) && - d.getMinutes() == new Number(minutes) && - d.getSeconds() == new Number(seconds) ) { - return d; - } - - return null; + if(!year) year = 0; + if(!month) month = 1; + if(!day) day = 1; + if(!hours) hours = 0; + if(!minutes) minutes = 0; + if(!seconds) seconds = 0; + + var d = new Date(year, month - 1, day, hours, minutes, seconds); + + _debug('created date with ' + + (d.getYear() + 1900) +'-'+ + (d.getMonth() + 1) +'-'+ + d.getDate()+' '+ + d.getHours()+':'+ + d.getMinutes()+':'+ + d.getSeconds()); + + + if( + (d.getYear() + 1900) == year && + d.getMonth() == (month - 1) && + d.getDate() == new Number(day) && + d.getHours() == new Number(hours) && + d.getMinutes() == new Number(minutes) && + d.getSeconds() == new Number(seconds) ) { + return d; + } + + return null; } function mkYearMonDay(date) { - if(!date) date = new Date(); - var y = date.getYear() + 1900; - var m = (date.getMonth() + 1)+''; - var d = date.getDate()+''; - if(m.length == 1) m = '0'+m; - if(d.length == 1) d = '0'+d; - return y+'-'+m+'-'+d; + if(!date) date = new Date(); + var y = date.getYear() + 1900; + var m = (date.getMonth() + 1)+''; + var d = date.getDate()+''; + if(m.length == 1) m = '0'+m; + if(d.length == 1) d = '0'+d; + return y+'-'+m+'-'+d; } function debugFMObject(obj) { - if(typeof obj != 'object' ) return obj; - _debug("---------------------"); - var keys = fmclasses[obj.classname]; - if(!keys) { _debug(formatJSON(js2JSON(obj))); return; } - - keys.sort(); - for( var i = 0; i < keys.length; i++ ) { - var key = keys[i]; - while( key.length < 12 ) key += ' '; - var val = obj[keys[i]](); - if( typeof val == 'object' ) { - _debug(key+' :=\n'); - _debugFMObject(val); - } else { - _debug(key+' = ' +val); - } - - } - _debug("---------------------"); + if(typeof obj != 'object' ) return obj; + _debug("---------------------"); + var keys = fmclasses[obj.classname]; + if(!keys) { _debug(formatJSON(js2JSON(obj))); return; } + + keys.sort(); + for( var i = 0; i < keys.length; i++ ) { + var key = keys[i]; + while( key.length < 12 ) key += ' '; + var val = obj[keys[i]](); + if( typeof val == 'object' ) { + _debug(key+' :=\n'); + _debugFMObject(val); + } else { + _debug(key+' = ' +val); + } + + } + _debug("---------------------"); } diff --git a/Open-ILS/web/opac/extras/bbags.js b/Open-ILS/web/opac/extras/bbags.js index be5fdc1a39..15fe780801 100644 --- a/Open-ILS/web/opac/extras/bbags.js +++ b/Open-ILS/web/opac/extras/bbags.js @@ -3,45 +3,45 @@ /* maybe also a 'skin' var */ function bbInit() { - var cgi = new CGI(); - var bb = cgi.param('bb'); - if(!bb) { unHideMe($('not_found')); return; } - var req = new Request(FLESH_PUBLIC_CONTAINER, 'biblio', bb); - req.callback( bbShow ); - req.send(); + var cgi = new CGI(); + var bb = cgi.param('bb'); + if(!bb) { unHideMe($('not_found')); return; } + var req = new Request(FLESH_PUBLIC_CONTAINER, 'biblio', bb); + req.callback( bbShow ); + req.send(); } var template; function bbShow(r) { - var bb = r.getResultObject(); - if(!bb || !bb.pub()) { unHideMe($('not_found')); return; } - $('bb_name').appendChild(text(bb.name())); + var bb = r.getResultObject(); + if(!bb || !bb.pub()) { unHideMe($('not_found')); return; } + $('bb_name').appendChild(text(bb.name())); - var tbody = $('tbody'); - if(!template) template = tbody.removeChild($('row_template')); + var tbody = $('tbody'); + if(!template) template = tbody.removeChild($('row_template')); - for( var i in bb.items() ) - tbody.appendChild(bbShowItem( template, bb.items()[i] )); + for( var i in bb.items() ) + tbody.appendChild(bbShowItem( template, bb.items()[i] )); } function bbShowItem( template, item ) { - var row = template.cloneNode(true); - - var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() ); - req.request.tlink = $n(row, 'title'); - req.request.alink = $n(row, 'author'); - req.request.blink = $n(row, 'by'); - - req.callback( function(r) { - var rec = r.getResultObject(); - buildTitleDetailLink(rec, r.tlink); - r.tlink.setAttribute('href', '/opac/en-US/skin/default/xml/rdetail.xml?r='+rec.doc_id()); - r.alink.appendChild(text(rec.author())); - unHideMe(r.blink); - }); - - req.send(); - return row; + var row = template.cloneNode(true); + + var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() ); + req.request.tlink = $n(row, 'title'); + req.request.alink = $n(row, 'author'); + req.request.blink = $n(row, 'by'); + + req.callback( function(r) { + var rec = r.getResultObject(); + buildTitleDetailLink(rec, r.tlink); + r.tlink.setAttribute('href', '/opac/en-US/skin/default/xml/rdetail.xml?r='+rec.doc_id()); + r.alink.appendChild(text(rec.author())); + unHideMe(r.blink); + }); + + req.send(); + return row; } diff --git a/Open-ILS/web/opac/extras/os.css b/Open-ILS/web/opac/extras/os.css index 50ce529a12..edc515d660 100644 --- a/Open-ILS/web/opac/extras/os.css +++ b/Open-ILS/web/opac/extras/os.css @@ -1,81 +1,81 @@ body { - font-family: Arial, Helvetica, Sans-serif; - font-size: 0.9em; - } + font-family: Arial, Helvetica, Sans-serif; + font-size: 0.9em; + } p.nav { - text-align: center; - border-top: solid lightgray 1px; - border-bottom: solid lightgray 1px; + text-align: center; + border-top: solid lightgray 1px; + border-bottom: solid lightgray 1px; } h1 { - font-size: 1.5em; - } + font-size: 1.5em; + } input.searchbox { - font-size: 0.9em; - width: 20em; + font-size: 0.9em; + width: 20em; } div#searchdiv { - /* - z-index:10; - position: absolute; - top: 0; - right: 0; - */ - /*width:11em;*/ - background-color: lightgray; - border:2px solid lightblue; - /* - border-right: 0px; - border-top: 0px; - filter: alpha(opacity=50); - -moz-opacity: .5; - */ + /* + z-index:10; + position: absolute; + top: 0; + right: 0; + */ + /*width:11em;*/ + background-color: lightgray; + border:2px solid lightblue; + /* + border-right: 0px; + border-top: 0px; + filter: alpha(opacity=50); + -moz-opacity: .5; + */ } /* html>body div#searchdiv { - position: fixed; + position: fixed; } */ div#header img { - position: absolute; - top: 0; - right: 0; - } + position: absolute; + top: 0; + right: 0; + } h1, div#header p, form p { - margin: 0; - padding: 0; - } + margin: 0; + padding: 0; + } form { - margin: 1em 0 0 3em; - font-size: 0.8em; - } + margin: 1em 0 0 3em; + font-size: 0.8em; + } input { - margin-right: 0.5em; - } + margin-right: 0.5em; + } dt { - margin-top: 1.2em; - } + margin-top: 1.2em; + } dd { - font-style: italic; - margin: 0; - width: 80%; - margin-left: 1em; - } + font-style: italic; + margin: 0; + width: 80%; + margin-left: 1em; + } dd.desc { - font-style: normal; - } + font-style: normal; + } dd.url { - color: #999999; - font-style: normal; - margin-left: 0; - } + color: #999999; + font-style: normal; + margin-left: 0; + } #footer { - text-align: center; - } + text-align: center; + } .escape { /* part of hack used to handle web browsers that don't support disable-output-escaping (e.g. Mozilla) */ - display: inline; - } + display: inline; + } diff --git a/Open-ILS/web/opac/extras/selfcheck/selfcheck.js b/Open-ILS/web/opac/extras/selfcheck/selfcheck.js index d8ab3de700..ec2141dd9d 100644 --- a/Open-ILS/web/opac/extras/selfcheck/selfcheck.js +++ b/Open-ILS/web/opac/extras/selfcheck/selfcheck.js @@ -109,7 +109,7 @@ function selfckFetchOrgDetails() { function selfckSetupPrinter() { try { // Mozilla only - netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); + netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead'); netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesWrite'); @@ -202,7 +202,7 @@ function selfckPatronLogin(barcode) { 'open-ils.actor:open-ils.actor.user.fleshed.retrieve_by_barcode', G.user.session, barcode); - bcReq.request.alertEvent = false; + bcReq.request.alertEvent = false; bcReq.callback(function(r) { patron = r.getResultObject(); @@ -284,7 +284,7 @@ function selfckCheckout(override) { 'open-ils.circ:open-ils.circ.checkout.full' + ((override) ? '.override' : ''), G.user.session, {patron_id:patron.id(), copy_barcode:itemBarcode}); - coReq.request.alertEvent = false; + coReq.request.alertEvent = false; coReq.callback(selfckHandleCoResult); coReq.send(); } @@ -374,8 +374,8 @@ function selfckDislplayCheckout(evt) { var circ = evt.payload.circ; if(record.isbn()) { - var pic = $n(template, 'selfck.jacket'); - pic.setAttribute('src', '../ac/jacket/small/'+cleanISBN(record.isbn())); + var pic = $n(template, 'selfck.jacket'); + pic.setAttribute('src', '../ac/jacket/small/'+cleanISBN(record.isbn())); } $n(template, 'selfck.barcode').appendChild(text(copy.barcode())); $n(template, 'selfck.title').appendChild(text(record.title())); diff --git a/Open-ILS/web/opac/extras/slimpac/advanced.html b/Open-ILS/web/opac/extras/slimpac/advanced.html index fcff938ea9..246644af02 100644 --- a/Open-ILS/web/opac/extras/slimpac/advanced.html +++ b/Open-ILS/web/opac/extras/slimpac/advanced.html @@ -7,232 +7,232 @@ ]> - - &opac.navigate.advanced; - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
&opac.navigate.advanced;
&slimpac.start.nowSearching; - -
&common.keywords.label;
&common.title.label;
&common.author.label;
&common.subject.label;
&common.series.label;
&advanced.language; - -
&advanced.sort.criteria; - -
-
- - -
-
- - - -
- - + + &opac.navigate.advanced; + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
&opac.navigate.advanced;
&slimpac.start.nowSearching; + +
&common.keywords.label;
&common.title.label;
&common.author.label;
&common.subject.label;
&common.series.label;
&advanced.language; + +
&advanced.sort.criteria; + +
+
+ + +
+
+ + + +
+ + diff --git a/Open-ILS/web/opac/extras/slimpac/start.html b/Open-ILS/web/opac/extras/slimpac/start.html index e5cc48abb6..f5002038e5 100644 --- a/Open-ILS/web/opac/extras/slimpac/start.html +++ b/Open-ILS/web/opac/extras/slimpac/start.html @@ -7,187 +7,187 @@ ]> - - &slimpac.start.title; - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
- &slimpac.start.nowSearching; - -
-
-
- - - - - - -
-
-
- - -
-
- - - - -
- - + + &slimpac.start.title; + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ &slimpac.start.nowSearching; + +
+
+
+ + + + + + +
+
+
+ + +
+
+ + + + +
+ + diff --git a/Open-ILS/web/opac/skin/craftsman/css/layout.css b/Open-ILS/web/opac/skin/craftsman/css/layout.css index fbb8606aab..763ce84272 100644 --- a/Open-ILS/web/opac/skin/craftsman/css/layout.css +++ b/Open-ILS/web/opac/skin/craftsman/css/layout.css @@ -1,8 +1,8 @@ -.main_header { width: 100%; } -.space { padding-right:5px; } -.vert_space { padding-top: 82px; width: 100%;} -.right { position:absolute; right: 0px; } -.hide_me { display:none; visibility: hidden; } +.main_header { width: 100%; } +.space { padding-right:5px; } +.vert_space { padding-top: 82px; width: 100%;} +.right { position:absolute; right: 0px; } +.hide_me { display:none; visibility: hidden; } table { border-collapse: collapse; } @@ -132,16 +132,16 @@ table { border-collapse: collapse; } .dim2_border { border: 1px solid #F06000; -moz-border-radius: 3px;} .dim2 { - filter:alpha(opacity=50); - -moz-opacity:0.5; - opacity: 0.5; - text-decoration: none; } + filter:alpha(opacity=50); + -moz-opacity:0.5; + opacity: 0.5; + text-decoration: none; } .dim { - filter:alpha(opacity=10); - -moz-opacity:0.1; - opacity: 0.1; - text-decoration: none; } + filter:alpha(opacity=10); + -moz-opacity:0.1; + opacity: 0.1; + text-decoration: none; } /* ---------------------------------------------------------------------- */ @@ -159,15 +159,15 @@ table { border-collapse: collapse; } .lowhits_div { width: 100%; border-top: 1px solid #E0E0E0; text-align: center; - padding-top: 8px; padding-bottom: 8px; } + padding-top: 8px; padding-bottom: 8px; } .rdetail_extras_div { - } + } .copy_info_region_row { - padding: 6px; - border: 2px solid #E0E0E0; - font-weight: 600; + padding: 6px; + border: 2px solid #E0E0E0; + font-weight: 600; } .rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; } @@ -178,12 +178,12 @@ table { border-collapse: collapse; } .cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;} .bookshelf { - /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/ - /* - background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg); - background-repeat: repeat; - */ - border-bottom: 1px solid black; + /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/ + /* + background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg); + background-repeat: repeat; + */ + border-bottom: 1px solid black; } .cn_browse_loading { width: 95%; padding: 15px; text-align: center; background: #E0F0E0; } diff --git a/Open-ILS/web/opac/skin/default/css/layout.css b/Open-ILS/web/opac/skin/default/css/layout.css index 561e488f4c..1b1b3b5a56 100644 --- a/Open-ILS/web/opac/skin/default/css/layout.css +++ b/Open-ILS/web/opac/skin/default/css/layout.css @@ -1,11 +1,11 @@ body { margin: 6px; } body { background-color: white; } -.main_header { width: 100%; } -.space { padding-right:5px; } -.vert_space { padding-top: 82px; width: 100%;} -.right { position:absolute; right: 0px; } -.hide_me { display:none; visibility: hidden; } +.main_header { width: 100%; } +.space { padding-right:5px; } +.vert_space { padding-top: 82px; width: 100%;} +.right { position:absolute; right: 0px; } +.hide_me { display:none; visibility: hidden; } table { border-collapse: collapse; } @@ -136,16 +136,16 @@ table { border-collapse: collapse; } .dim2_border { border: 1px solid #F06000; -moz-border-radius: 3px;} .dim2 { - filter:alpha(opacity=50); - -moz-opacity:0.5; - opacity: 0.5; - text-decoration: none; } + filter:alpha(opacity=50); + -moz-opacity:0.5; + opacity: 0.5; + text-decoration: none; } .dim { - filter:alpha(opacity=10); - -moz-opacity:0.1; - opacity: 0.1; - text-decoration: none; } + filter:alpha(opacity=10); + -moz-opacity:0.1; + opacity: 0.1; + text-decoration: none; } /* ---------------------------------------------------------------------- */ @@ -162,15 +162,15 @@ table { border-collapse: collapse; } .myopac_update_span { padding: 5px;} .lowhits_div { width: 100%; border-top: 1px solid #E0E0E0; text-align: center; - padding-top: 8px; padding-bottom: 8px; } + padding-top: 8px; padding-bottom: 8px; } .rdetail_extras_div { - border-top: 3px solid #E0E0E0;margin-top: 3px; padding-top: 5px; width: 100%;} + border-top: 3px solid #E0E0E0;margin-top: 3px; padding-top: 5px; width: 100%;} .copy_info_region_row { - padding: 6px; - border: 2px solid #E0E0E0; - font-weight: 600; + padding: 6px; + border: 2px solid #E0E0E0; + font-weight: 600; } .rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; } @@ -181,12 +181,12 @@ table { border-collapse: collapse; } .cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;} .bookshelf { - /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/ - /* - background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg); - background-repeat: repeat; - */ - border-bottom: 1px solid black; + /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/ + /* + background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg); + background-repeat: repeat; + */ + border-bottom: 1px solid black; } .cn_browse_loading { width: 95%; padding: 15px; text-align: center; background: #E0F0E0; } diff --git a/Open-ILS/web/opac/skin/default/js/adv_global.js b/Open-ILS/web/opac/skin/default/js/adv_global.js index 2077845601..7c47c19885 100644 --- a/Open-ILS/web/opac/skin/default/js/adv_global.js +++ b/Open-ILS/web/opac/skin/default/js/adv_global.js @@ -7,41 +7,41 @@ var advSelectedOrg = null; function advgInit() { - /* XXX */ - if( cookieManager.read(COOKIE_NOGROUP_RECORDS) || SHOW_MR_DEFAULT ) - $('adv_group_titles').checked = true; - - $n($('adv_global_tbody'), 'term').focus(); - - var extras = [ - FETCH_LIT_FORMS, - FETCH_ITEM_FORMS, - FETCH_ITEM_TYPES, - FETCH_AUDIENCES, - FETCH_BIB_LEVELS + /* XXX */ + if( cookieManager.read(COOKIE_NOGROUP_RECORDS) || SHOW_MR_DEFAULT ) + $('adv_group_titles').checked = true; + + $n($('adv_global_tbody'), 'term').focus(); + + var extras = [ + FETCH_LIT_FORMS, + FETCH_ITEM_FORMS, + FETCH_ITEM_TYPES, + FETCH_AUDIENCES, + FETCH_BIB_LEVELS ]; - for( var x in extras ) { + for( var x in extras ) { - var req = new Request(extras[x]); + var req = new Request(extras[x]); - if(x == 0) req.request.sel = $('adv_global_lit_form'); - if(x == 1) req.request.sel = $('adv_global_item_form'); - if(x == 2) req.request.sel = $('adv_global_item_type'); - if(x == 3) req.request.sel = $('adv_global_audience'); - if(x == 4) req.request.sel = $('adv_global_bib_level'); + if(x == 0) req.request.sel = $('adv_global_lit_form'); + if(x == 1) req.request.sel = $('adv_global_item_form'); + if(x == 2) req.request.sel = $('adv_global_item_type'); + if(x == 3) req.request.sel = $('adv_global_audience'); + if(x == 4) req.request.sel = $('adv_global_bib_level'); - req.callback(advDrawBibExtras); - req.send(); - } + req.callback(advDrawBibExtras); + req.send(); + } - var input = $n($('adv_global_trow'), 'term'); - input.focus(); - setEnterFunc(input, advSubmitGlobal); + var input = $n($('adv_global_trow'), 'term'); + input.focus(); + setEnterFunc(input, advSubmitGlobal); if(getSort() && getSortDir()) { - setSelector($('adv_global_sort_by'), getSort()); - setSelector($('adv_global_sort_dir'), getSortDir()); + setSelector($('adv_global_sort_by'), getSort()); + setSelector($('adv_global_sort_dir'), getSortDir()); if(getSort() != 'rel') $('adv_global_sort_dir').disabled = false; } @@ -146,177 +146,177 @@ function initSearchBoxes() { } function advAddGblRow() { - var tbody = $("adv_global_tbody"); - var newrow = $("adv_global_trow").cloneNode(true); - tbody.insertBefore(newrow, $("adv_global_addrow")); - var input = $n(newrow, "term"); - input.value = ""; - setEnterFunc(input, advSubmitGlobal); - $n(newrow, 'type').focus(); + var tbody = $("adv_global_tbody"); + var newrow = $("adv_global_trow").cloneNode(true); + tbody.insertBefore(newrow, $("adv_global_addrow")); + var input = $n(newrow, "term"); + input.value = ""; + setEnterFunc(input, advSubmitGlobal); + $n(newrow, 'type').focus(); } function advDrawBibExtras(r) { - var data = r.getResultObject(); - var sel = r.sel; - - data = data.sort( /* sort alphabetically */ - function(a,b) { - if( a.value() < b.value() ) return -1; - if( a.value() > b.value() ) return 1; - return 0; - } - ); - - for( var d = 0; d < data.length; d++ ) { - var thing = data[d]; - var opt = insertSelectorVal( sel, -1, thing.value(), thing.code() ); - opt.setAttribute('title', thing.value()); - } + var data = r.getResultObject(); + var sel = r.sel; + + data = data.sort( /* sort alphabetically */ + function(a,b) { + if( a.value() < b.value() ) return -1; + if( a.value() > b.value() ) return 1; + return 0; + } + ); + + for( var d = 0; d < data.length; d++ ) { + var thing = data[d]; + var opt = insertSelectorVal( sel, -1, thing.value(), thing.code() ); + opt.setAttribute('title', thing.value()); + } } function advSelToStringList(sel) { - var list = getSelectedList(sel); - var vals = []; - for( var i = 0; i < list.length; i++ ) { - var str = list[i]; - for( var j = 0; j < str.length; j++ ) { - //if(str.charAt(j) == ' ') continue; - vals.push(str.charAt(j)); - } - } - return vals.toString(); + var list = getSelectedList(sel); + var vals = []; + for( var i = 0; i < list.length; i++ ) { + var str = list[i]; + for( var j = 0; j < str.length; j++ ) { + //if(str.charAt(j) == ' ') continue; + vals.push(str.charAt(j)); + } + } + return vals.toString(); } function advGetVisSelectorVals(id) { - var basic = id + '_basic'; - if(! $(id).className.match(/hide_me/)) - return advSelToStringList($(id)); - return advSelToStringList($(basic)); + var basic = id + '_basic'; + if(! $(id).className.match(/hide_me/)) + return advSelToStringList($(id)); + return advSelToStringList($(basic)); } function advSubmitGlobal() { - - var sortdir = getSelectorVal($('adv_global_sort_dir')); - var sortby = getSelectorVal($('adv_global_sort_by')); - - var litforms = advGetVisSelectorVals('adv_global_lit_form'); - var itemforms = advGetVisSelectorVals('adv_global_item_form'); - var itemtypes = advGetVisSelectorVals('adv_global_item_type'); - var audiences = advGetVisSelectorVals('adv_global_audience'); - var biblevels = advGetVisSelectorVals('adv_global_bib_level'); + + var sortdir = getSelectorVal($('adv_global_sort_dir')); + var sortby = getSelectorVal($('adv_global_sort_by')); + + var litforms = advGetVisSelectorVals('adv_global_lit_form'); + var itemforms = advGetVisSelectorVals('adv_global_item_form'); + var itemtypes = advGetVisSelectorVals('adv_global_item_type'); + var audiences = advGetVisSelectorVals('adv_global_audience'); + var biblevels = advGetVisSelectorVals('adv_global_bib_level'); var locations = getSelectedList($('adv_copy_location_filter_select')) + ''; - var languages = getSelectedList($('adv_global_lang')) + ''; + var languages = getSelectedList($('adv_global_lang')) + ''; var limit2avail = $('opac.result.limit2avail').checked ? 1 : '' - var searches = advBuildSearchBlob(); - if(!searches) return; - - clearSearchParams(); - - var args = {}; - args.page = MRESULT; - args[PARAM_ITEMFORM] = itemforms; - args[PARAM_ITEMTYPE] = itemtypes; - args[PARAM_BIBLEVEL] = biblevels; - args[PARAM_LITFORM] = litforms; - args[PARAM_AUDIENCE] = audiences; - args[PARAM_LANGUAGE] = languages; - args[PARAM_COPYLOCS] = locations; - //args[PARAM_SEARCHES] = js2JSON(searches); /* break these out */ - args[PARAM_DEPTH] = depthSelGetDepth(); - args[PARAM_LOCATION] = depthSelGetNewLoc(); - args[PARAM_SORT] = sortby; - args[PARAM_SORT_DIR] = sortdir; - args[PARAM_ADVTYPE] = ADVTYPE_MULTI; - args[PARAM_STYPE] = ""; - args[PARAM_TERM] = searches; - args[PARAM_AVAIL] = limit2avail; + var searches = advBuildSearchBlob(); + if(!searches) return; + + clearSearchParams(); + + var args = {}; + args.page = MRESULT; + args[PARAM_ITEMFORM] = itemforms; + args[PARAM_ITEMTYPE] = itemtypes; + args[PARAM_BIBLEVEL] = biblevels; + args[PARAM_LITFORM] = litforms; + args[PARAM_AUDIENCE] = audiences; + args[PARAM_LANGUAGE] = languages; + args[PARAM_COPYLOCS] = locations; + //args[PARAM_SEARCHES] = js2JSON(searches); /* break these out */ + args[PARAM_DEPTH] = depthSelGetDepth(); + args[PARAM_LOCATION] = depthSelGetNewLoc(); + args[PARAM_SORT] = sortby; + args[PARAM_SORT_DIR] = sortdir; + args[PARAM_ADVTYPE] = ADVTYPE_MULTI; + args[PARAM_STYPE] = ""; + args[PARAM_TERM] = searches; + args[PARAM_AVAIL] = limit2avail; // publicate year filtering var pub1; if( (pub1 = $('adv_global_pub_date_1').value) && (''+pub1).match(/\d{4}/)) { switch(getSelectorVal($('adv_global_pub_date_type'))) { case 'equals': - args[PARAM_PUBD_BETWEEN] = pub1+','+pub1; + args[PARAM_PUBD_BETWEEN] = pub1+','+pub1; break; case 'before': - args[PARAM_PUBD_BEFORE] = pub1; + args[PARAM_PUBD_BEFORE] = pub1; break; case 'after': - args[PARAM_PUBD_AFTER] = pub1; + args[PARAM_PUBD_AFTER] = pub1; break; case 'between': var pub2 = $('adv_global_pub_date_2').value; if((''+pub2).match(/\d{4}/)) - args[PARAM_PUBD_BETWEEN] = pub1+','+pub2; + args[PARAM_PUBD_BETWEEN] = pub1+','+pub2; break; } } - /* pubdate sorting causes a record (not metarecord) search */ - if( sortby == SORT_TYPE_PUBDATE || !$('adv_group_titles').checked ) { - args.page = RRESULT; - args[PARAM_RTYPE] = RTYPE_MULTI; - } + /* pubdate sorting causes a record (not metarecord) search */ + if( sortby == SORT_TYPE_PUBDATE || !$('adv_group_titles').checked ) { + args.page = RRESULT; + args[PARAM_RTYPE] = RTYPE_MULTI; + } - if($('adv_group_titles').checked ) - cookieManager.write(COOKIE_NOGROUP_RECORDS,'1',-1); - else - cookieManager.write(COOKIE_NOGROUP_RECORDS,''); + if($('adv_group_titles').checked ) + cookieManager.write(COOKIE_NOGROUP_RECORDS,'1',-1); + else + cookieManager.write(COOKIE_NOGROUP_RECORDS,''); - goTo(buildOPACLink(args)); + goTo(buildOPACLink(args)); } function advBuildSearchBlob() { - var searches = ''; - var tbody = $('adv_global_tbody'); - var rows = tbody.getElementsByTagName('tr'); - - for( var i = 0; i < rows.length; i++ ) { - - var row = rows[i]; - if(!(row && typeof row == 'object')) continue; - if(!row.getAttribute('type')) continue; - - var stype = getSelectorVal($n(row, 'type')); - var contains = getSelectorVal($n(row, 'contains')); - var term = $n(row, 'term').value; - if(!term) continue; - - var string = ""; - switch(contains) { - case 'contains' : - string += " " + term; - break; - - case 'nocontains' : { - var words = term.split(" "); - for( var j in words ) - string += " -" + words[j]; - } - break; - - case 'exact' : - if(term.indexOf('"') > -1) string += " " + term; - else string += " \"" + term + "\""; - break; - } - if(string) { - string = string.replace(/'/g,' '); - string = string.replace(/\\/g,' '); + var searches = ''; + var tbody = $('adv_global_tbody'); + var rows = tbody.getElementsByTagName('tr'); + + for( var i = 0; i < rows.length; i++ ) { + + var row = rows[i]; + if(!(row && typeof row == 'object')) continue; + if(!row.getAttribute('type')) continue; + + var stype = getSelectorVal($n(row, 'type')); + var contains = getSelectorVal($n(row, 'contains')); + var term = $n(row, 'term').value; + if(!term) continue; + + var string = ""; + switch(contains) { + case 'contains' : + string += " " + term; + break; + + case 'nocontains' : { + var words = term.split(" "); + for( var j in words ) + string += " -" + words[j]; + } + break; + + case 'exact' : + if(term.indexOf('"') > -1) string += " " + term; + else string += " \"" + term + "\""; + break; + } + if(string) { + string = string.replace(/'/g,' '); + string = string.replace(/\\/g,' '); string = string.replace(/^\s*/,''); string = string.replace(/\s*$/,''); - //searches[stype].term = string; + //searches[stype].term = string; if(searches) searches += ' '; searches += stype + ':'+ string; - } - } + } + } _debug("created search query " + searches); - return searches; + return searches; } diff --git a/Open-ILS/web/opac/skin/default/js/advanced.js b/Open-ILS/web/opac/skin/default/js/advanced.js index 12728c123c..8ffc8f8375 100644 --- a/Open-ILS/web/opac/skin/default/js/advanced.js +++ b/Open-ILS/web/opac/skin/default/js/advanced.js @@ -4,147 +4,147 @@ attachEvt("common", "run", advInit); function advInit() { - /* propogate these? */ + /* propogate these? */ - depthSelInit(); - setEnterFunc( $n( $('advanced.marc.tbody'), 'advanced.marc.value'), advMARCRun ); + depthSelInit(); + setEnterFunc( $n( $('advanced.marc.tbody'), 'advanced.marc.value'), advMARCRun ); - unHideMe($('adv_quick_search_sidebar')); + unHideMe($('adv_quick_search_sidebar')); - /* - if(isXUL()) - setSelector($('adv_quick_type'), 'tcn'); */ + /* + if(isXUL()) + setSelector($('adv_quick_type'), 'tcn'); */ - setEnterFunc($('adv_quick_text'), advGenericSearch); + setEnterFunc($('adv_quick_text'), advGenericSearch); - unHideMe($('adv_marc_search_sidebar')); + unHideMe($('adv_marc_search_sidebar')); } function advAddMARC() { - var newt = $('adv_sdbar_table').cloneNode(true); - newt.id = ""; - unHideMe($n(newt, 'crow')); - $n(newt, 'advanced.marc.tag').value = ""; - $n(newt, 'advanced.marc.subfield').value = ""; - $n(newt, 'advanced.marc.value').value = ""; - $('adv_marc_search_sidebar').insertBefore(newt, $('adv_marc_submit')); + var newt = $('adv_sdbar_table').cloneNode(true); + newt.id = ""; + unHideMe($n(newt, 'crow')); + $n(newt, 'advanced.marc.tag').value = ""; + $n(newt, 'advanced.marc.subfield').value = ""; + $n(newt, 'advanced.marc.value').value = ""; + $('adv_marc_search_sidebar').insertBefore(newt, $('adv_marc_submit')); } function advMARCRun() { - clearSearchParams(); + clearSearchParams(); - var div = $('adv_marc_search_sidebar'); - var tbodies = div.getElementsByTagName('tbody'); - var searches = []; + var div = $('adv_marc_search_sidebar'); + var tbodies = div.getElementsByTagName('tbody'); + var searches = []; - for( var i = 0; i < tbodies.length; i++ ) { - var tbody = tbodies[i]; - var val = advExtractMARC(tbody); - if(val) searches.push(val); - } + for( var i = 0; i < tbodies.length; i++ ) { + var tbody = tbodies[i]; + var val = advExtractMARC(tbody); + if(val) searches.push(val); + } - if(searches.length == 0) return; + if(searches.length == 0) return; - var arg = {}; - arg.page = RRESULT; - arg[PARAM_FORM] = 'all' - arg[PARAM_RTYPE] = RTYPE_MARC; - arg[PARAM_OFFSET] = 0; - arg[PARAM_DEPTH] = depthSelGetDepth(); - arg[PARAM_LOCATION] = depthSelGetNewLoc(); - arg[PARAM_SEARCHES] = js2JSON(searches); - arg[PARAM_ADVTYPE] = ADVTYPE_MARC; - arg[PARAM_TERM] = ""; + var arg = {}; + arg.page = RRESULT; + arg[PARAM_FORM] = 'all' + arg[PARAM_RTYPE] = RTYPE_MARC; + arg[PARAM_OFFSET] = 0; + arg[PARAM_DEPTH] = depthSelGetDepth(); + arg[PARAM_LOCATION] = depthSelGetNewLoc(); + arg[PARAM_SEARCHES] = js2JSON(searches); + arg[PARAM_ADVTYPE] = ADVTYPE_MARC; + arg[PARAM_TERM] = ""; - goTo(buildOPACLink(arg)); + goTo(buildOPACLink(arg)); } /* EXAMPLE => {"term":"0516011901","restrict":[{"tag":"020","subfield":"a"}]} */ function advExtractMARC(tbody) { - if(!tbody) return null; - var term = $n(tbody, 'advanced.marc.value').value; - if(!term) return null; + if(!tbody) return null; + var term = $n(tbody, 'advanced.marc.value').value; + if(!term) return null; - var subfield = $n(tbody, 'advanced.marc.subfield').value; - if(!subfield) subfield = "_"; + var subfield = $n(tbody, 'advanced.marc.subfield').value; + if(!subfield) subfield = "_"; - var tag = $n(tbody, 'advanced.marc.tag').value; - if(!tag) return null; + var tag = $n(tbody, 'advanced.marc.tag').value; + if(!tag) return null; - return { 'term' : term.toLowerCase(), 'restrict' : [ { 'tag' : tag, 'subfield' : subfield } ] }; + return { 'term' : term.toLowerCase(), 'restrict' : [ { 'tag' : tag, 'subfield' : subfield } ] }; } function advGenericSearch() { - clearSearchParams(); - var type = getSelectorVal($('adv_quick_type')); - - var term = $('adv_quick_text').value; - if(!term) return; - - var arg = {}; - - switch(type) { - - case 'isbn' : - arg.page = RRESULT; - arg[PARAM_STYPE] = ""; - arg[PARAM_TERM] = ""; - arg[PARAM_RTYPE] = RTYPE_ISBN; - arg[PARAM_OFFSET] = 0; - arg[PARAM_ADVTERM] = term.toLowerCase(); - break; - - case 'issn' : - arg.page = RRESULT; - arg[PARAM_STYPE] = ""; - arg[PARAM_TERM] = ""; - arg[PARAM_ADVTERM] = term.toLowerCase(); - arg[PARAM_OFFSET] = 0; - arg[PARAM_RTYPE] = RTYPE_ISSN; - break; - - case 'tcn' : - arg.page = RRESULT; - arg[PARAM_STYPE] = ""; - arg[PARAM_TERM] = ""; - arg[PARAM_ADVTERM] = term; - arg[PARAM_OFFSET] = 0; - arg[PARAM_RTYPE] = RTYPE_TCN; - break; + clearSearchParams(); + var type = getSelectorVal($('adv_quick_type')); + + var term = $('adv_quick_text').value; + if(!term) return; + + var arg = {}; + + switch(type) { + + case 'isbn' : + arg.page = RRESULT; + arg[PARAM_STYPE] = ""; + arg[PARAM_TERM] = ""; + arg[PARAM_RTYPE] = RTYPE_ISBN; + arg[PARAM_OFFSET] = 0; + arg[PARAM_ADVTERM] = term.toLowerCase(); + break; + + case 'issn' : + arg.page = RRESULT; + arg[PARAM_STYPE] = ""; + arg[PARAM_TERM] = ""; + arg[PARAM_ADVTERM] = term.toLowerCase(); + arg[PARAM_OFFSET] = 0; + arg[PARAM_RTYPE] = RTYPE_ISSN; + break; + + case 'tcn' : + arg.page = RRESULT; + arg[PARAM_STYPE] = ""; + arg[PARAM_TERM] = ""; + arg[PARAM_ADVTERM] = term; + arg[PARAM_OFFSET] = 0; + arg[PARAM_RTYPE] = RTYPE_TCN; + break; case 'barcode': advFindBarcode(term); break; - case 'cn': - arg.page = CNBROWSE; - arg[PARAM_CN] = term; - arg[PARAM_DEPTH] = depthSelGetDepth(); - arg[PARAM_LOCATION] = depthSelGetNewLoc(); - break; + case 'cn': + arg.page = CNBROWSE; + arg[PARAM_CN] = term; + arg[PARAM_DEPTH] = depthSelGetDepth(); + arg[PARAM_LOCATION] = depthSelGetNewLoc(); + break; - case 'lccn': - arg.page = RRESULT; - arg[PARAM_FORM] = 'all' - arg[PARAM_RTYPE] = RTYPE_MARC; - arg[PARAM_OFFSET] = 0; - arg[PARAM_DEPTH] = depthSelGetDepth(); - arg[PARAM_LOCATION] = depthSelGetNewLoc(); - arg[PARAM_SEARCHES] = js2JSON([{ 'term' : term.toLowerCase(), - 'restrict' : [ { 'tag' : '010', 'subfield' : '_' } ] }]); - arg[PARAM_ADVTYPE] = ADVTYPE_MARC; - arg[PARAM_TERM] = ""; - break; + case 'lccn': + arg.page = RRESULT; + arg[PARAM_FORM] = 'all' + arg[PARAM_RTYPE] = RTYPE_MARC; + arg[PARAM_OFFSET] = 0; + arg[PARAM_DEPTH] = depthSelGetDepth(); + arg[PARAM_LOCATION] = depthSelGetNewLoc(); + arg[PARAM_SEARCHES] = js2JSON([{ 'term' : term.toLowerCase(), + 'restrict' : [ { 'tag' : '010', 'subfield' : '_' } ] }]); + arg[PARAM_ADVTYPE] = ADVTYPE_MARC; + arg[PARAM_TERM] = ""; + break; - default: alert('not done'); - } + default: alert('not done'); + } - if(arg.page) goTo(buildOPACLink(arg)); + if(arg.page) goTo(buildOPACLink(arg)); } diff --git a/Open-ILS/web/opac/skin/default/js/cn_browse.js b/Open-ILS/web/opac/skin/default/js/cn_browse.js index 232e37d4c0..24a23a2328 100644 --- a/Open-ILS/web/opac/skin/default/js/cn_browse.js +++ b/Open-ILS/web/opac/skin/default/js/cn_browse.js @@ -4,69 +4,69 @@ var cnBrowseCN; var cnBrowseOrg; if( findCurrentPage() == CNBROWSE ) { - attachEvt("common", "run", cnBrowseLoadSearch); - attachEvt( "common", "locationUpdated", cnBrowseResubmit ); - attachEvt( "common", "depthChanged", cnBrowseResubmit ); + attachEvt("common", "run", cnBrowseLoadSearch); + attachEvt( "common", "locationUpdated", cnBrowseResubmit ); + attachEvt( "common", "depthChanged", cnBrowseResubmit ); } function cnBrowseLoadSearch() { - unHideMe($('cn_browse')); - cnBrowseGo(getCallnumber(), getLocation(), getDepth()); + unHideMe($('cn_browse')); + cnBrowseGo(getCallnumber(), getLocation(), getDepth()); } function cnBrowseResubmit() { - var args = {} - args[PARAM_CN] = cnBrowseCN; - args[PARAM_DEPTH] = depthSelGetDepth(); - args[PARAM_LOCATION] = getNewSearchLocation(); - goTo(buildOPACLink(args)); + var args = {} + args[PARAM_CN] = cnBrowseCN; + args[PARAM_DEPTH] = depthSelGetDepth(); + args[PARAM_LOCATION] = getNewSearchLocation(); + goTo(buildOPACLink(args)); } function cnBrowseGo(cn, org, depth) { - if(depth == null) depth = getDepth(); + if(depth == null) depth = getDepth(); - org = findOrgUnit(org); - cnOffset = 0; + org = findOrgUnit(org); + cnOffset = 0; - do { - var t = findOrgType(org.ou_type()); - if( t.depth() > depth ) - org = findOrgUnit(org.parent_ou()); - else break; - } while(true); + do { + var t = findOrgType(org.ou_type()); + if( t.depth() > depth ) + org = findOrgUnit(org.parent_ou()); + else break; + } while(true); - cnBrowseOrg = org; - cnBrowseCN = cn; + cnBrowseOrg = org; + cnBrowseCN = cn; - _cnBrowseGo( cn, org ); - appendClear($('cn_browse_where'), text(org.name())); + _cnBrowseGo( cn, org ); + appendClear($('cn_browse_where'), text(org.name())); } function _cnBrowseGo( cn, org ) { - var req = new Request( FETCH_CNBROWSE, cn, org.id(), cnCount, cnOffset ); - req.callback( cnBrowseDraw ); - req.send(); + var req = new Request( FETCH_CNBROWSE, cn, org.id(), cnCount, cnOffset ); + req.callback( cnBrowseDraw ); + req.send(); } function cnBrowseNext() { - cnOffset++; - _cnBrowseGo( cnBrowseCN, cnBrowseOrg ); + cnOffset++; + _cnBrowseGo( cnBrowseCN, cnBrowseOrg ); } function cnBrowsePrev() { - cnOffset--; - _cnBrowseGo( cnBrowseCN, cnBrowseOrg ); + cnOffset--; + _cnBrowseGo( cnBrowseCN, cnBrowseOrg ); } function cnBrowseDraw( r ) { - var list = r.getResultObject(); - _cnBrowseDraw(list); + var list = r.getResultObject(); + _cnBrowseDraw(list); } @@ -75,60 +75,60 @@ var cnRowT; var cnTdT; function _cnBrowseDraw( list ) { - if(!cnTbody) { - cnTbody = $('cn_tbody'); - cnRowT = $('cn_browse_row'); - cnTdT = cnRowT.removeChild($('cn_browse_td')); - cnTbody.removeChild(cnRowT); - } - removeChildren(cnTbody); - - var counter = 1; - var currentRow = cnRowT.cloneNode(true); - cnTbody.appendChild(currentRow); - - for( var idx in list ) { - - - var currentTd = cnTdT.cloneNode(true); - currentRow.appendChild(currentTd); - - var td = cnTdT.cloneNode(true); - - var obj = list[idx]; - var cn = obj.cn; - var mods = obj.mods; - - var cn_td = $n(currentTd, 'cn_browse_cn'); - var lib_td = $n(currentTd, 'cn_browse_lib'); - var title_td = $n(currentTd, 'cn_browse_title'); - var author_td = $n(currentTd, 'cn_browse_author'); - var pic_td = $n(currentTd, 'cn_browse_pic'); - - cn_td.appendChild(text(cn.label())); - lib_td.appendChild(text(findOrgUnit(cn.owning_lib()).name())); - cnBrowseDrawTitle(mods, title_td, author_td, pic_td); - - if( counter++ % 3 == 0 ) { - counter = 1; - currentRow = cnRowT.cloneNode(true); - cnTbody.appendChild(currentRow); - } - } + if(!cnTbody) { + cnTbody = $('cn_tbody'); + cnRowT = $('cn_browse_row'); + cnTdT = cnRowT.removeChild($('cn_browse_td')); + cnTbody.removeChild(cnRowT); + } + removeChildren(cnTbody); + + var counter = 1; + var currentRow = cnRowT.cloneNode(true); + cnTbody.appendChild(currentRow); + + for( var idx in list ) { + + + var currentTd = cnTdT.cloneNode(true); + currentRow.appendChild(currentTd); + + var td = cnTdT.cloneNode(true); + + var obj = list[idx]; + var cn = obj.cn; + var mods = obj.mods; + + var cn_td = $n(currentTd, 'cn_browse_cn'); + var lib_td = $n(currentTd, 'cn_browse_lib'); + var title_td = $n(currentTd, 'cn_browse_title'); + var author_td = $n(currentTd, 'cn_browse_author'); + var pic_td = $n(currentTd, 'cn_browse_pic'); + + cn_td.appendChild(text(cn.label())); + lib_td.appendChild(text(findOrgUnit(cn.owning_lib()).name())); + cnBrowseDrawTitle(mods, title_td, author_td, pic_td); + + if( counter++ % 3 == 0 ) { + counter = 1; + currentRow = cnRowT.cloneNode(true); + cnTbody.appendChild(currentRow); + } + } } function cnBrowseDrawTitle(mods, title_td, author_td, pic_td) { - buildTitleDetailLink(mods, title_td); - buildSearchLink(STYPE_AUTHOR, mods.author(), author_td); - pic_td.setAttribute("src", buildISBNSrc(cleanISBN(mods.isbn()))); + buildTitleDetailLink(mods, title_td); + buildSearchLink(STYPE_AUTHOR, mods.author(), author_td); + pic_td.setAttribute("src", buildISBNSrc(cleanISBN(mods.isbn()))); - var args = {}; - args.page = RDETAIL; - args[PARAM_OFFSET] = 0; - args[PARAM_RID] = mods.doc_id(); - args[PARAM_MRID] = 0; - pic_td.parentNode.setAttribute("href", buildOPACLink(args)); + var args = {}; + args.page = RDETAIL; + args[PARAM_OFFSET] = 0; + args[PARAM_RID] = mods.doc_id(); + args[PARAM_MRID] = 0; + pic_td.parentNode.setAttribute("href", buildOPACLink(args)); } diff --git a/Open-ILS/web/opac/skin/default/js/container.js b/Open-ILS/web/opac/skin/default/js/container.js index c898663642..32d7862e34 100644 --- a/Open-ILS/web/opac/skin/default/js/container.js +++ b/Open-ILS/web/opac/skin/default/js/container.js @@ -1,67 +1,67 @@ function containerDoRequest( req, callback, args ) { - if( callback ) { - req.callback( callback ); - req.request.args = args; - req.send(); - return null; - } - - req.send(true); - return req.result(); + if( callback ) { + req.callback( callback ); + req.request.args = args; + req.send(); + return null; + } + + req.send(true); + return req.result(); } function containerFetchAll( callback, args ) { - var req = new Request( - FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' ); - return containerDoRequest( req, callback, args ); + var req = new Request( + FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' ); + return containerDoRequest( req, callback, args ); } function containerFlesh( id, callback, args ) { - var req = new Request( FLESH_CONTAINER, G.user.session, 'biblio', id ); - return containerDoRequest( req, callback, args ); + var req = new Request( FLESH_CONTAINER, G.user.session, 'biblio', id ); + return containerDoRequest( req, callback, args ); } function containerDelete( id, callback, args ) { - var req = new Request( DELETE_CONTAINER, G.user.session, 'biblio', id ); - return containerDoRequest(req, callback, args ); + var req = new Request( DELETE_CONTAINER, G.user.session, 'biblio', id ); + return containerDoRequest(req, callback, args ); } function containerCreate( name, pub, callback, args ) { - var container = new cbreb(); - container.btype('bookbag'); - container.owner( G.user.id() ); - container.name( name ); - if(pub) container.pub('t'); - else container.pub('f'); + var container = new cbreb(); + container.btype('bookbag'); + container.owner( G.user.id() ); + container.name( name ); + if(pub) container.pub('t'); + else container.pub('f'); - var req = new Request( - CREATE_CONTAINER, G.user.session, 'biblio', container ); - return containerDoRequest( req, callback, args ); + var req = new Request( + CREATE_CONTAINER, G.user.session, 'biblio', container ); + return containerDoRequest( req, callback, args ); } function containerUpdate( container, callback, args ) { - var req = new Request(UPDATE_CONTAINER, G.user.session, 'biblio', container); - return containerDoRequest(req, callback, args); + var req = new Request(UPDATE_CONTAINER, G.user.session, 'biblio', container); + return containerDoRequest(req, callback, args); } function containerCreateItem( containerId, target, callback, args ) { - var item = new cbrebi(); - item.target_biblio_record_entry(target); - item.bucket(containerId); + var item = new cbrebi(); + item.target_biblio_record_entry(target); + item.bucket(containerId); - var req = new Request( CREATE_CONTAINER_ITEM, - G.user.session, 'biblio', item ); + var req = new Request( CREATE_CONTAINER_ITEM, + G.user.session, 'biblio', item ); - return containerDoRequest( req, callback, args ); + return containerDoRequest( req, callback, args ); } function containerRemoveItem( id, callback, args ) { - var req = new Request( DELETE_CONTAINER_ITEM, G.user.session, 'biblio', id ); - return containerDoRequest( req, callback, args ); + var req = new Request( DELETE_CONTAINER_ITEM, G.user.session, 'biblio', id ); + return containerDoRequest( req, callback, args ); } diff --git a/Open-ILS/web/opac/skin/default/js/copy_details.js b/Open-ILS/web/opac/skin/default/js/copy_details.js index 762b13ee18..58105b00e5 100644 --- a/Open-ILS/web/opac/skin/default/js/copy_details.js +++ b/Open-ILS/web/opac/skin/default/js/copy_details.js @@ -4,349 +4,349 @@ var cpdNodes = {}; function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location ) { var i = cpdCheckExisting(contextRow); - if(i) return i; - - var counter = cpdCounter++; - - /* yank out all of the template rows */ - if(!cpdTemplate) cpdTemplate = $('rdetail_volume_details_row'); - var templateRow = cpdTemplate.cloneNode(true); - templateRow.id = 'cpd_row_' + counter; - - /* shove a dummy a tag in before the context previous sibling */ - /* - contextTbody.insertBefore( - elem('a',{name:'slot_'+templateRow.id}), contextRow.previousSibling); - goTo('#slot_'+templateRow.id); - */ - - if(isXUL()) { - /* unhide before we unhide/clone the parent */ - unHideMe($n(templateRow, 'age_protect_label')); - unHideMe($n(templateRow, 'create_date_label')); - unHideMe($n(templateRow, 'holdable_label')); - unHideMe($n(templateRow, 'due_date_label')); - } - - unHideMe(templateRow); - - var print = $n(templateRow,'print'); - print.onclick = function() { cpdBuildPrintPane( - contextRow, record, callnumber, orgid, depth) }; - - var mainTbody = $n(templateRow, 'copies_tbody'); - var extrasRow = mainTbody.removeChild($n(mainTbody, 'copy_extras_row')); - - var req = new Request(FETCH_COPIES_FROM_VOLUME, record.doc_id(), callnumber, orgid); - req.callback(cpdDrawCopies); - - req.request.args = { - contextTbody : contextTbody, /* tbody that holds the contextrow */ - contextRow : contextRow, /* the row our new row will be inserted after */ - record : record, - callnumber : callnumber, - orgid : orgid, - depth : depth, - templateRow : templateRow, /* contains everything */ - copy_location : copy_location, - mainTbody : mainTbody, /* holds the copy rows */ - extrasRow : extrasRow, /* wrapper row for all extras */ - counter : counter - }; - - if( contextRow.nextSibling ) - contextTbody.insertBefore( templateRow, contextRow.nextSibling ); - else - contextTbody.appendChild( templateRow ); - - req.send(); - _debug('creating new details row with id ' + templateRow.id); - cpdNodes[templateRow.id] = { templateRow : templateRow }; - return templateRow.id; + if(i) return i; + + var counter = cpdCounter++; + + /* yank out all of the template rows */ + if(!cpdTemplate) cpdTemplate = $('rdetail_volume_details_row'); + var templateRow = cpdTemplate.cloneNode(true); + templateRow.id = 'cpd_row_' + counter; + + /* shove a dummy a tag in before the context previous sibling */ + /* + contextTbody.insertBefore( + elem('a',{name:'slot_'+templateRow.id}), contextRow.previousSibling); + goTo('#slot_'+templateRow.id); + */ + + if(isXUL()) { + /* unhide before we unhide/clone the parent */ + unHideMe($n(templateRow, 'age_protect_label')); + unHideMe($n(templateRow, 'create_date_label')); + unHideMe($n(templateRow, 'holdable_label')); + unHideMe($n(templateRow, 'due_date_label')); + } + + unHideMe(templateRow); + + var print = $n(templateRow,'print'); + print.onclick = function() { cpdBuildPrintPane( + contextRow, record, callnumber, orgid, depth) }; + + var mainTbody = $n(templateRow, 'copies_tbody'); + var extrasRow = mainTbody.removeChild($n(mainTbody, 'copy_extras_row')); + + var req = new Request(FETCH_COPIES_FROM_VOLUME, record.doc_id(), callnumber, orgid); + req.callback(cpdDrawCopies); + + req.request.args = { + contextTbody : contextTbody, /* tbody that holds the contextrow */ + contextRow : contextRow, /* the row our new row will be inserted after */ + record : record, + callnumber : callnumber, + orgid : orgid, + depth : depth, + templateRow : templateRow, /* contains everything */ + copy_location : copy_location, + mainTbody : mainTbody, /* holds the copy rows */ + extrasRow : extrasRow, /* wrapper row for all extras */ + counter : counter + }; + + if( contextRow.nextSibling ) + contextTbody.insertBefore( templateRow, contextRow.nextSibling ); + else + contextTbody.appendChild( templateRow ); + + req.send(); + _debug('creating new details row with id ' + templateRow.id); + cpdNodes[templateRow.id] = { templateRow : templateRow }; + return templateRow.id; } function cpdBuildPrintWindow(record, orgid) { - var div = $('rdetail_print_details').cloneNode(true); - div.id = ""; - - $n(div, 'lib').appendChild(text(findOrgUnit(orgid).name())); - $n(div, 'title').appendChild(text(record.title())); - $n(div, 'author').appendChild(text(record.author())); - $n(div, 'edition').appendChild(text(record.edition())); - $n(div, 'pubdate').appendChild(text(record.pubdate())); - $n(div, 'publisher').appendChild(text(record.publisher())); - $n(div, 'phys').appendChild(text(record.physical_description())); - - return div; + var div = $('rdetail_print_details').cloneNode(true); + div.id = ""; + + $n(div, 'lib').appendChild(text(findOrgUnit(orgid).name())); + $n(div, 'title').appendChild(text(record.title())); + $n(div, 'author').appendChild(text(record.author())); + $n(div, 'edition').appendChild(text(record.edition())); + $n(div, 'pubdate').appendChild(text(record.pubdate())); + $n(div, 'publisher').appendChild(text(record.publisher())); + $n(div, 'phys').appendChild(text(record.physical_description())); + + return div; } function cpdStylePopupWindow(div) { - var tds = div.getElementsByTagName('td'); - for( var i = 0; i < tds.length ; i++ ) { - var td = tds[i]; - var sty = td.getAttribute('style'); - if(!sty) sty = ""; - td.setAttribute('style', sty + 'padding: 2px; border: 1px solid #F0F0E0;'); - if( td.className && td.className.match(/hide_me/) ) - td.parentNode.removeChild(td); - } + var tds = div.getElementsByTagName('td'); + for( var i = 0; i < tds.length ; i++ ) { + var td = tds[i]; + var sty = td.getAttribute('style'); + if(!sty) sty = ""; + td.setAttribute('style', sty + 'padding: 2px; border: 1px solid #F0F0E0;'); + if( td.className && td.className.match(/hide_me/) ) + td.parentNode.removeChild(td); + } } /* builds a friendly print window for this CNs data */ function cpdBuildPrintPane(contextRow, record, callnumber, orgid, depth) { - var div = cpdBuildPrintWindow( record, orgid); + var div = cpdBuildPrintWindow( record, orgid); - $n(div, 'cn').appendChild(text(callnumber)); + $n(div, 'cn').appendChild(text(callnumber)); - unHideMe($n(div, 'copy_header')); + unHideMe($n(div, 'copy_header')); - var subtbody = $n(contextRow.nextSibling, 'copies_tbody'); - var rows = subtbody.getElementsByTagName('tr'); + var subtbody = $n(contextRow.nextSibling, 'copies_tbody'); + var rows = subtbody.getElementsByTagName('tr'); - for( var r = 0; r < rows.length; r++ ) { - var row = rows[r]; - if(!row) continue; - var name = row.getAttribute('name'); - if( name.match(/extras_row/) ) continue; /* hide the copy notes, stat-cats */ - var clone = row.cloneNode(true); - var links = clone.getElementsByTagName('a'); - for( var i = 0; i < links.length; i++ ) - links[i].style.display = 'none'; + for( var r = 0; r < rows.length; r++ ) { + var row = rows[r]; + if(!row) continue; + var name = row.getAttribute('name'); + if( name.match(/extras_row/) ) continue; /* hide the copy notes, stat-cats */ + var clone = row.cloneNode(true); + var links = clone.getElementsByTagName('a'); + for( var i = 0; i < links.length; i++ ) + links[i].style.display = 'none'; - $n(div, 'tbody').appendChild(clone); - } + $n(div, 'tbody').appendChild(clone); + } - cpdStylePopupWindow(div); - openWindow( div.innerHTML); + cpdStylePopupWindow(div); + openWindow( div.innerHTML); } /* hide any open tables and if we've already - fleshed this cn, just unhide it */ + fleshed this cn, just unhide it */ function cpdCheckExisting( contextRow ) { - var existingid; - var next = contextRow.nextSibling; - - if( next && next.getAttribute('templateRow') ) { - var obj = cpdNodes[next.id]; - if(obj.templateRow.className.match(/hide_me/)) - unHideMe(obj.templateRow); - else hideMe(obj.templateRow); - existingid = next.id; - } - - if(existingid) _debug('row exists with id ' + existingid); - - for( var o in cpdNodes ) { - var node = cpdNodes[o]; - if( existingid && o == existingid ) continue; - hideMe(node.templateRow); - removeCSSClass(node.templateRow.previousSibling, 'rdetail_context_row'); - } - - addCSSClass(contextRow, 'rdetail_context_row'); - if(existingid) return existingid; - return null; + var existingid; + var next = contextRow.nextSibling; + + if( next && next.getAttribute('templateRow') ) { + var obj = cpdNodes[next.id]; + if(obj.templateRow.className.match(/hide_me/)) + unHideMe(obj.templateRow); + else hideMe(obj.templateRow); + existingid = next.id; + } + + if(existingid) _debug('row exists with id ' + existingid); + + for( var o in cpdNodes ) { + var node = cpdNodes[o]; + if( existingid && o == existingid ) continue; + hideMe(node.templateRow); + removeCSSClass(node.templateRow.previousSibling, 'rdetail_context_row'); + } + + addCSSClass(contextRow, 'rdetail_context_row'); + if(existingid) return existingid; + return null; } /* function cpdFetchCopies(r) { - var args = r.args; - args.cn = r.getResultObject(); - var req = new Request(FETCH_COPIES_FROM_VOLUME, args.cn.id()); - req.request.args = args; - req.callback(cpdDrawCopies); - req.send(); + var args = r.args; + args.cn = r.getResultObject(); + var req = new Request(FETCH_COPIES_FROM_VOLUME, args.cn.id()); + req.request.args = args; + req.callback(cpdDrawCopies); + req.send(); } */ function cpdDrawCopies(r) { - var copies = r.getResultObject(); - var args = r.args; - var copytbody = $n(args.templateRow, 'copies_tbody'); - var copyrow = copytbody.removeChild($n(copytbody, 'copies_row')); - - if(isXUL()) { - /* unhide before we unhide/clone the parent */ - unHideMe($n(copyrow, 'age_protect_value')); - unHideMe($n(copyrow, 'create_date_value')); - unHideMe($n(copyrow, 'copy_holdable_td')); - unHideMe($n(copyrow, 'copy_due_date_td')); - } - - for( var i = 0; i < copies.length; i++ ) { - var row = copyrow.cloneNode(true); - var copyid = copies[i]; - var req = new Request(FETCH_FLESHED_COPY, copies[i]); - req.callback(cpdDrawCopy); - req.request.args = r.args; - req.request.row = row; - req.send(); - copytbody.appendChild(row); - } + var copies = r.getResultObject(); + var args = r.args; + var copytbody = $n(args.templateRow, 'copies_tbody'); + var copyrow = copytbody.removeChild($n(copytbody, 'copies_row')); + + if(isXUL()) { + /* unhide before we unhide/clone the parent */ + unHideMe($n(copyrow, 'age_protect_value')); + unHideMe($n(copyrow, 'create_date_value')); + unHideMe($n(copyrow, 'copy_holdable_td')); + unHideMe($n(copyrow, 'copy_due_date_td')); + } + + for( var i = 0; i < copies.length; i++ ) { + var row = copyrow.cloneNode(true); + var copyid = copies[i]; + var req = new Request(FETCH_FLESHED_COPY, copies[i]); + req.callback(cpdDrawCopy); + req.request.args = r.args; + req.request.row = row; + req.send(); + copytbody.appendChild(row); + } } function cpdDrawCopy(r) { - var copy = r.getResultObject(); - var row = r.row; + var copy = r.getResultObject(); + var row = r.row; if (r.args.copy_location && copy.location().name() != r.args.copy_location) { hideMe(row); return; } - $n(row, 'barcode').appendChild(text(copy.barcode())); - $n(row, 'location').appendChild(text(copy.location().name())); - $n(row, 'status').appendChild(text(copy.status().name())); - - if(isXUL()) { - /* show the hold link */ - var l = $n(row, 'copy_hold_link'); - unHideMe(l); - l.onclick = function() { - holdsDrawEditor( - { - type : 'C', - copyObject : copy, - onComplete : function(){} - } - ); - } - - if( copy.age_protect() ) - appendClear($n(row, 'age_protect_value'), text(copy.age_protect().name())); - - var cd = copy.create_date(); - cd = cd.replace(/T.*/, ''); - $n(row, 'create_date_value').appendChild(text(cd)); - - var yes = $('rdetail.yes').innerHTML; - var no = $('rdetail.no').innerHTML; - - if( isTrue(copy.holdable()) && - isTrue(copy.location().holdable()) && - isTrue(copy.status().holdable()) ) { - $n(row, 'copy_is_holdable').appendChild(text(yes)); - } else { - $n(row, 'copy_is_holdable').appendChild(text(no)); - } - - var circ; - if( copy.circulations() ) { - circ = copy.circulations()[0]; - if( circ ) { - $n(row, 'copy_due_date').appendChild(text(circ.due_date().replace(/[T ].*/,''))); - } - } - - } - - r.args.copy = copy; - r.args.copyrow = row; - cpdShowNotes(copy, r.args) - cpdShowStats(copy, r.args); + $n(row, 'barcode').appendChild(text(copy.barcode())); + $n(row, 'location').appendChild(text(copy.location().name())); + $n(row, 'status').appendChild(text(copy.status().name())); + + if(isXUL()) { + /* show the hold link */ + var l = $n(row, 'copy_hold_link'); + unHideMe(l); + l.onclick = function() { + holdsDrawEditor( + { + type : 'C', + copyObject : copy, + onComplete : function(){} + } + ); + } + + if( copy.age_protect() ) + appendClear($n(row, 'age_protect_value'), text(copy.age_protect().name())); + + var cd = copy.create_date(); + cd = cd.replace(/T.*/, ''); + $n(row, 'create_date_value').appendChild(text(cd)); + + var yes = $('rdetail.yes').innerHTML; + var no = $('rdetail.no').innerHTML; + + if( isTrue(copy.holdable()) && + isTrue(copy.location().holdable()) && + isTrue(copy.status().holdable()) ) { + $n(row, 'copy_is_holdable').appendChild(text(yes)); + } else { + $n(row, 'copy_is_holdable').appendChild(text(no)); + } + + var circ; + if( copy.circulations() ) { + circ = copy.circulations()[0]; + if( circ ) { + $n(row, 'copy_due_date').appendChild(text(circ.due_date().replace(/[T ].*/,''))); + } + } + + } + + r.args.copy = copy; + r.args.copyrow = row; + cpdShowNotes(copy, r.args) + cpdShowStats(copy, r.args); } function _cpdExtrasInit(args) { - var newrid = 'extras_row_' + args.copy.barcode(); - var newrow = $(newrid); - if(!newrow) newrow = args.extrasRow.cloneNode(true); - var tbody = $n(newrow, 'extras_tbody'); - var rowt = $n(tbody, 'extras_row'); - newrow.id = newrid; + var newrid = 'extras_row_' + args.copy.barcode(); + var newrow = $(newrid); + if(!newrow) newrow = args.extrasRow.cloneNode(true); + var tbody = $n(newrow, 'extras_tbody'); + var rowt = $n(tbody, 'extras_row'); + newrow.id = newrid; - var cr = args.copyrow; - var nr = cr.nextSibling; - var np = args.mainTbody; + var cr = args.copyrow; + var nr = cr.nextSibling; + var np = args.mainTbody; - /* insert the extras row into the main table */ - if(nr) np.insertBefore( newrow, nr ); - else np.appendChild(newrow); + /* insert the extras row into the main table */ + if(nr) np.insertBefore( newrow, nr ); + else np.appendChild(newrow); - var link = $n(args.copyrow, 'details_link'); - var link2 = $n(args.copyrow, 'less_details_link'); - var id = newrow.id; - link.id = id + '_morelink'; - link2.id = id + '_lesslink'; - unHideMe(link); - hideMe(link2); + var link = $n(args.copyrow, 'details_link'); + var link2 = $n(args.copyrow, 'less_details_link'); + var id = newrow.id; + link.id = id + '_morelink'; + link2.id = id + '_lesslink'; + unHideMe(link); + hideMe(link2); - link.setAttribute('href', - 'javascript:unHideMe($("'+link2.id+'")); hideMe($("'+link.id+'"));unHideMe($("'+newrow.id+'"));'); + link.setAttribute('href', + 'javascript:unHideMe($("'+link2.id+'")); hideMe($("'+link.id+'"));unHideMe($("'+newrow.id+'"));'); - link2.setAttribute('href', - 'javascript:unHideMe($("'+link.id+'")); hideMe($("'+link2.id+'"));hideMe($("'+newrow.id+'"));'); + link2.setAttribute('href', + 'javascript:unHideMe($("'+link.id+'")); hideMe($("'+link2.id+'"));hideMe($("'+newrow.id+'"));'); - return [ tbody, rowt ]; + return [ tbody, rowt ]; } function cpdShowNotes(copy, args) { - var notes = copy.notes(); - if(!notes || notes.length == 0) return; - - var a = _cpdExtrasInit(args); - var tbody = a[0]; - var rowt = a[1]; - - for( var n in notes ) { - var note = notes[n]; - if(!isTrue(note.pub())) continue; - var row = rowt.cloneNode(true); - $n(row, 'key').appendChild(text(note.title())); - $n(row, 'value').appendChild(text(note.value())); - unHideMe($n(row, 'note')); - unHideMe(row); - tbody.appendChild(row); - } + var notes = copy.notes(); + if(!notes || notes.length == 0) return; + + var a = _cpdExtrasInit(args); + var tbody = a[0]; + var rowt = a[1]; + + for( var n in notes ) { + var note = notes[n]; + if(!isTrue(note.pub())) continue; + var row = rowt.cloneNode(true); + $n(row, 'key').appendChild(text(note.title())); + $n(row, 'value').appendChild(text(note.value())); + unHideMe($n(row, 'note')); + unHideMe(row); + tbody.appendChild(row); + } } function cpdShowStats(copy, args) { - var entries = copy.stat_cat_entry_copy_maps(); - if(!entries || entries.length == 0) return; - - var visibleStatCat = false; - - /* - check all copy stat cats; if we find one that's OPAC visible, - set the flag and break the loop. If we've found one, or we're - in the staff client, build the table. if not, we return doing - nothing, as though the stat_cat_entry_copy_map was empty or null - */ - - for( var n in entries ) - { - var entry = entries[n]; - if(isTrue(entry.stat_cat().opac_visible())) - { - visibleStatCat = true; - break; - } - } - - if(!(isXUL() || visibleStatCat)) return; - - var a = _cpdExtrasInit(args); - var tbody = a[0]; - var rowt = a[1]; - - for( var n in entries ) { - var entry = entries[n]; - if(!(isXUL() || isTrue(entry.stat_cat().opac_visible()))) continue; - var row = rowt.cloneNode(true); - $n(row, 'key').appendChild(text(entry.stat_cat().name())); - $n(row, 'value').appendChild(text(entry.stat_cat_entry().value())); - unHideMe($n(row, 'cat')); - unHideMe(row); - tbody.appendChild(row); - } + var entries = copy.stat_cat_entry_copy_maps(); + if(!entries || entries.length == 0) return; + + var visibleStatCat = false; + + /* + check all copy stat cats; if we find one that's OPAC visible, + set the flag and break the loop. If we've found one, or we're + in the staff client, build the table. if not, we return doing + nothing, as though the stat_cat_entry_copy_map was empty or null + */ + + for( var n in entries ) + { + var entry = entries[n]; + if(isTrue(entry.stat_cat().opac_visible())) + { + visibleStatCat = true; + break; + } + } + + if(!(isXUL() || visibleStatCat)) return; + + var a = _cpdExtrasInit(args); + var tbody = a[0]; + var rowt = a[1]; + + for( var n in entries ) { + var entry = entries[n]; + if(!(isXUL() || isTrue(entry.stat_cat().opac_visible()))) continue; + var row = rowt.cloneNode(true); + $n(row, 'key').appendChild(text(entry.stat_cat().name())); + $n(row, 'value').appendChild(text(entry.stat_cat_entry().value())); + unHideMe($n(row, 'cat')); + unHideMe(row); + tbody.appendChild(row); + } } diff --git a/Open-ILS/web/opac/skin/default/js/depth_selector.js b/Open-ILS/web/opac/skin/default/js/depth_selector.js index 1bd983ee48..8fba3b61b5 100644 --- a/Open-ILS/web/opac/skin/default/js/depth_selector.js +++ b/Open-ILS/web/opac/skin/default/js/depth_selector.js @@ -8,88 +8,88 @@ var _dselspan; var _newlocation = null; function depthSelInit() { - _ds = $('depth_selector'); - _ds.onchange = depthSelectorChanged; - _libselspan = $('lib_selector_span'); - _libsellink = $('lib_selector_link'); - _dselspan = $('depth_selector_span'); - - if( getLocation() == globalOrgTree.id() ) { - unHideMe( _libselspan ); - _libsellink.onclick = _opacHandleLocationTagClick; - } else { - unHideMe( _dselspan ); - buildLocationSelector(); - } - - setSelector(_ds, getDepth()); - _newlocation = getLocation(); + _ds = $('depth_selector'); + _ds.onchange = depthSelectorChanged; + _libselspan = $('lib_selector_span'); + _libsellink = $('lib_selector_link'); + _dselspan = $('depth_selector_span'); + + if( getLocation() == globalOrgTree.id() ) { + unHideMe( _libselspan ); + _libsellink.onclick = _opacHandleLocationTagClick; + } else { + unHideMe( _dselspan ); + buildLocationSelector(); + } + + setSelector(_ds, getDepth()); + _newlocation = getLocation(); } var orgTreeIsBuilt = false; function _opacHandleLocationTagClick() { - swapCanvas(G.ui.common.org_container); + swapCanvas(G.ui.common.org_container); - if(!orgTreeIsBuilt) { - drawOrgTree(); - orgTreeIsBuilt = true; - } + if(!orgTreeIsBuilt) { + drawOrgTree(); + orgTreeIsBuilt = true; + } } function depthSelGetDepth() { - var depth = parseInt(_ds.options[_ds.selectedIndex].value); - if(isNaN(depth)) depth = 0; - return depth; + var depth = parseInt(_ds.options[_ds.selectedIndex].value); + if(isNaN(depth)) depth = 0; + return depth; } function depthSelectorChanged() { - var i = _ds.selectedIndex; - if( i == _ds.options.length - 1 ) { - setSelector( _ds, getDepth() ); - _opacHandleLocationTagClick(); - } else { - /* this re-submits the search when they change the search range - disabled for testing... - */ - /*runEvt('common', 'depthChanged');*/ - } + var i = _ds.selectedIndex; + if( i == _ds.options.length - 1 ) { + setSelector( _ds, getDepth() ); + _opacHandleLocationTagClick(); + } else { + /* this re-submits the search when they change the search range + disabled for testing... + */ + /*runEvt('common', 'depthChanged');*/ + } } var chooseAnotherNode; function buildLocationSelector(newLoc) { - var loc; - if(newLoc != null) loc = newLoc; - else loc = getLocation(); - - if( loc == globalOrgTree.id() ) return; - - var selector = _ds; - if(!chooseAnotherNode) - chooseAnotherNode = selector.removeChild( - selector.getElementsByTagName("option")[0]); - var node = chooseAnotherNode; - removeChildren(selector); - - var location = findOrgUnit(loc); - var type; - if (location) type = findOrgType(location.ou_type()); - - while( type && location ) { - var n = node.cloneNode(true); - n.setAttribute("value", type.depth()); - removeChildren(n); - n.appendChild(text(type.opac_label())); - selector.appendChild(n); - location = findOrgUnit(location.parent_ou()); - if(location) type = findOrgType(location.ou_type()); - else type = null; - } - - selector.appendChild(node); + var loc; + if(newLoc != null) loc = newLoc; + else loc = getLocation(); + + if( loc == globalOrgTree.id() ) return; + + var selector = _ds; + if(!chooseAnotherNode) + chooseAnotherNode = selector.removeChild( + selector.getElementsByTagName("option")[0]); + var node = chooseAnotherNode; + removeChildren(selector); + + var location = findOrgUnit(loc); + var type; + if (location) type = findOrgType(location.ou_type()); + + while( type && location ) { + var n = node.cloneNode(true); + n.setAttribute("value", type.depth()); + removeChildren(n); + n.appendChild(text(type.opac_label())); + selector.appendChild(n); + location = findOrgUnit(location.parent_ou()); + if(location) type = findOrgType(location.ou_type()); + else type = null; + } + + selector.appendChild(node); } function getNewSearchDepth() { return newSearchDepth; } @@ -97,25 +97,25 @@ function getNewSearchLocation() { return (isNull(_newlocation)) ? LOCATION : _ne function depthSelGetNewLoc() { return getNewSearchLocation(); } function updateLoc(location, depth) { - if( depth != null ) { - if(depth != 0 ){ - _libsellink.onclick = _opacHandleLocationTagClick; - if( location == globalOrgTree.id() ) { - hideMe( _dselspan ); - unHideMe( _libselspan ); - } else { - buildLocationSelector(location); - hideMe( _libselspan ); - unHideMe( _dselspan ); - } - } - - setSelector(_ds, depth); - newSearchDepth = depth; - } - - _newlocation = location; - runEvt('common','locationUpdated', location); + if( depth != null ) { + if(depth != 0 ){ + _libsellink.onclick = _opacHandleLocationTagClick; + if( location == globalOrgTree.id() ) { + hideMe( _dselspan ); + unHideMe( _libselspan ); + } else { + buildLocationSelector(location); + hideMe( _libselspan ); + unHideMe( _dselspan ); + } + } + + setSelector(_ds, depth); + newSearchDepth = depth; + } + + _newlocation = location; + runEvt('common','locationUpdated', location); } diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index 4538d08be5..c985aec5ec 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -16,14 +16,14 @@ function holdsHandleStaff() { // if we know the recipient's barcode, use it if(xulG.patron_barcode) return _holdsHandleStaff(); - swapCanvas($('xulholds_box')); - $('xul_recipient_barcode').focus(); - $('xul_recipient_barcode').onkeypress = function(evt) - {if(userPressedEnter(evt)) { _holdsHandleStaff(); } }; - $('xul_recipient_barcode_submit').onclick = _holdsHandleStaff; - $('xul_recipient_me').onclick = _holdsHandleStaffMe; - - $('xul_recipient_barcode').onkeyup = function(evt) { + swapCanvas($('xulholds_box')); + $('xul_recipient_barcode').focus(); + $('xul_recipient_barcode').onkeypress = function(evt) + {if(userPressedEnter(evt)) { _holdsHandleStaff(); } }; + $('xul_recipient_barcode_submit').onclick = _holdsHandleStaff; + $('xul_recipient_me').onclick = _holdsHandleStaffMe; + + $('xul_recipient_barcode').onkeyup = function(evt) { if($('xul_recipient_barcode').value == '') $('xul_recipient_me').disabled = false; else @@ -37,29 +37,29 @@ $('holds_frozen_thaw_input').onkeyup = function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');} function _holdsHandleStaffMe() { - holdArgs.recipient = G.user; - holdsDrawEditor(); + holdArgs.recipient = G.user; + holdsDrawEditor(); } function _holdsHandleStaff() { - var barcode = xulG.patron_barcode || $('xul_recipient_barcode').value; - var user = grabUserByBarcode( G.user.session, barcode ); + var barcode = xulG.patron_barcode || $('xul_recipient_barcode').value; + var user = grabUserByBarcode( G.user.session, barcode ); - var evt; - if(evt = checkILSEvent(user)) { - alertILSEvent(user); - return; - } + var evt; + if(evt = checkILSEvent(user)) { + alertILSEvent(user); + return; + } - if(!barcode || !user) { - alertId('holds_invalid_recipient', barcode); - return - } + if(!barcode || !user) { + alertId('holds_invalid_recipient', barcode); + return + } - grabUserPrefs(user); + grabUserPrefs(user); - holdArgs.recipient = user; - holdsDrawEditor(); + holdArgs.recipient = user; + holdsDrawEditor(); } @@ -71,7 +71,7 @@ function _holdsHandleStaff() { function holdsDrawEditor(args) { - holdArgs = (args) ? args : holdArgs; + holdArgs = (args) ? args : holdArgs; if(!noEmailMessage) noEmailMessage = $('holds_email').removeChild($('holds.no_email')); @@ -79,75 +79,75 @@ function holdsDrawEditor(args) { if(!noEmailMessageXUL) noEmailMessageXUL = $('holds_email').removeChild($('holds.no_email.xul')); - if(isXUL() && holdArgs.recipient == null - && holdArgs.editHold == null) { - holdsHandleStaff(); - return; - } + if(isXUL() && holdArgs.recipient == null + && holdArgs.editHold == null) { + holdsHandleStaff(); + return; + } - if(!holdArgs.recipient) holdArgs.recipient = G.user; - if(!holdArgs.requestor) holdArgs.requestor = G.user; + if(!holdArgs.recipient) holdArgs.recipient = G.user; + if(!holdArgs.requestor) holdArgs.requestor = G.user; - if(!(holdArgs.requestor && holdArgs.requestor.session)) { - detachAllEvt('common','locationChanged'); - attachEvt('common','loggedIn', holdsDrawEditor) - initLogin(); - return; - } + if(!(holdArgs.requestor && holdArgs.requestor.session)) { + detachAllEvt('common','locationChanged'); + attachEvt('common','loggedIn', holdsDrawEditor) + initLogin(); + return; + } - if(holdArgs.editHold) // flesh the args with the existing hold - holdArgsFromHold(holdArgs.editHold, holdArgs); + if(holdArgs.editHold) // flesh the args with the existing hold + holdArgsFromHold(holdArgs.editHold, holdArgs); - holdsDrawWindow(); + holdsDrawWindow(); } // updates the edit window with the existing hold's data function _holdsUpdateEditHold() { - var hold = holdArgs.editHold; - var qstats = holdArgs.status; + var hold = holdArgs.editHold; + var qstats = holdArgs.status; - var orgsel = $('holds_org_selector'); + var orgsel = $('holds_org_selector'); var frozenbox = $('holds_frozen_chkbox'); - setSelector(orgsel, hold.pickup_lib()); + setSelector(orgsel, hold.pickup_lib()); - if( hold.capture_time() || qstats.status > 2 ) { + if( hold.capture_time() || qstats.status > 2 ) { frozenbox.disabled = true; $('holds_frozen_thaw_input').disabled = true; if(qstats.status == 3) { // no pickup lib changes while in-transit - orgsel.disabled = true; + orgsel.disabled = true; } else { var orgs = fetchPermOrgs('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF'); if(orgs[0] == -1) - orgsel.disabled = true; + orgsel.disabled = true; } } else { - orgsel.disabled = false; + orgsel.disabled = false; frozenbox.disabled = false; } - $('holds_submit').onclick = holdsEditHold; - $('holds_update').onclick = holdsEditHold; + $('holds_submit').onclick = holdsEditHold; + $('holds_update').onclick = holdsEditHold; - if(hold.phone_notify()) { - $('holds_enable_phone').checked = true; - $('holds_phone').value = hold.phone_notify(); + if(hold.phone_notify()) { + $('holds_enable_phone').checked = true; + $('holds_phone').value = hold.phone_notify(); - } else { - $('holds_phone').disabled = true; - $('holds_enable_phone').checked = false; - } + } else { + $('holds_phone').disabled = true; + $('holds_enable_phone').checked = false; + } - if(isTrue(hold.email_notify())) { - $('holds_enable_email').checked = true; + if(isTrue(hold.email_notify())) { + $('holds_enable_email').checked = true; - } else { - $('holds_enable_email').checked = false; - } + } else { + $('holds_enable_email').checked = false; + } dijit.byId('holds_expire_time').setValue(dojo.date.stamp.fromISOString(hold.expire_time())); @@ -168,326 +168,326 @@ function _holdsUpdateEditHold() { } function holdsEditHold() { - var hold = holdsBuildHoldFromWindow(); - if(!hold) return; - holdsUpdate(hold); - showCanvas(); - if(holdArgs.onComplete) - holdArgs.onComplete(hold); + var hold = holdsBuildHoldFromWindow(); + if(!hold) return; + holdsUpdate(hold); + showCanvas(); + if(holdArgs.onComplete) + holdArgs.onComplete(hold); } function holdArgsFromHold(hold, oargs) { - var args = (oargs) ? oargs : {}; - args.type = hold.hold_type(); - var target = hold.target(); - - switch(args.type) { - case 'M': - args.metarecord = target; - break; - case 'T': - args.record = target; - break; - case 'V': - args.volume = target; - break; - case 'C': - args.copy = target; - break; - } - return args; + var args = (oargs) ? oargs : {}; + args.type = hold.hold_type(); + var target = hold.target(); + + switch(args.type) { + case 'M': + args.metarecord = target; + break; + case 'T': + args.record = target; + break; + case 'V': + args.volume = target; + break; + case 'C': + args.copy = target; + break; + } + return args; } function holdFetchObjects(hold, doneCallback) { - var args = (hold) ? holdArgsFromHold(hold) : holdArgs; - - var type = args.type; - - if( type == 'C' ) { - - if( args.copyObject ) { - - args.copy = args.copyObject.id(); - args.volume = args.copyObject.call_number(); - _h_set_vol(args, doneCallback); - - } else { - var creq = new Request(FETCH_COPY, args.copy); - - creq.callback( - function(r) { - var cp = r.getResultObject(); - args.copyObject = cp; - args.volume = args.copyObject.call_number(); - _h_set_vol(args, doneCallback); - } - ); - creq.send(); - } - } else { - if( type == 'V' ) { - _h_set_vol(args, doneCallback); - - } else { - if( type == 'T' ) { - _h_set_rec(args, doneCallback); - } else { - _h_set_rec_descriptors(args, doneCallback); - } - } - } - - return args; + var args = (hold) ? holdArgsFromHold(hold) : holdArgs; + + var type = args.type; + + if( type == 'C' ) { + + if( args.copyObject ) { + + args.copy = args.copyObject.id(); + args.volume = args.copyObject.call_number(); + _h_set_vol(args, doneCallback); + + } else { + var creq = new Request(FETCH_COPY, args.copy); + + creq.callback( + function(r) { + var cp = r.getResultObject(); + args.copyObject = cp; + args.volume = args.copyObject.call_number(); + _h_set_vol(args, doneCallback); + } + ); + creq.send(); + } + } else { + if( type == 'V' ) { + _h_set_vol(args, doneCallback); + + } else { + if( type == 'T' ) { + _h_set_rec(args, doneCallback); + } else { + _h_set_rec_descriptors(args, doneCallback); + } + } + } + + return args; } function _h_set_vol(args, doneCallback) { - if( args.volumeObject ) { - args.volume = args.volumeObject.id(); - args.record = args.volumeObject.record(); - _h_set_rec(args, doneCallback); - - } else { - - var vreq = new Request(FETCH_VOLUME, args.volume); - vreq.callback( - function(r) { - var vol = r.getResultObject(); - args.volumeObject = vol; - args.record = vol.record(); - _h_set_rec(args, doneCallback); - } - ); - vreq.send(); - } + if( args.volumeObject ) { + args.volume = args.volumeObject.id(); + args.record = args.volumeObject.record(); + _h_set_rec(args, doneCallback); + + } else { + + var vreq = new Request(FETCH_VOLUME, args.volume); + vreq.callback( + function(r) { + var vol = r.getResultObject(); + args.volumeObject = vol; + args.record = vol.record(); + _h_set_rec(args, doneCallback); + } + ); + vreq.send(); + } } function _h_set_rec(args, doneCallback) { - if(args.recordObject) - args.record = args.recordObject.doc_id(); - else - args.recordObject = findRecord( args.record, 'T' ); - - if( args.type == 'T' || args.type == 'M' ) - _h_set_rec_descriptors(args, doneCallback); - else - if(doneCallback) doneCallback(args); + if(args.recordObject) + args.record = args.recordObject.doc_id(); + else + args.recordObject = findRecord( args.record, 'T' ); + + if( args.type == 'T' || args.type == 'M' ) + _h_set_rec_descriptors(args, doneCallback); + else + if(doneCallback) doneCallback(args); } function _h_set_rec_descriptors(args, doneCallback) { - // grab the list of record desciptors attached to this records metarecord - if( ! args.recordDescriptors ) { - var params = { record: args.record }; - - if( ! args.record ) { - if( args.metarecord ) - params = { metarecord : args.metarecord }; - else - params = { metarecord : args.metarecordObject.doc_id() }; - } - - var req = new Request(FETCH_MR_DESCRIPTORS, params ); - req.callback( - function(r) { - var data = r.getResultObject(); - args.recordDescriptors = data.descriptors; - args.metarecord = data.metarecord; - if( args.type == 'M' && ! args.metarecordObject) - args.metarecordObject = findRecord(args.metarecord, 'M'); - - if(doneCallback) doneCallback(args); - } - ); - req.send(); - - } else { - if(doneCallback) doneCallback(args); - } - - return args; + // grab the list of record desciptors attached to this records metarecord + if( ! args.recordDescriptors ) { + var params = { record: args.record }; + + if( ! args.record ) { + if( args.metarecord ) + params = { metarecord : args.metarecord }; + else + params = { metarecord : args.metarecordObject.doc_id() }; + } + + var req = new Request(FETCH_MR_DESCRIPTORS, params ); + req.callback( + function(r) { + var data = r.getResultObject(); + args.recordDescriptors = data.descriptors; + args.metarecord = data.metarecord; + if( args.type == 'M' && ! args.metarecordObject) + args.metarecordObject = findRecord(args.metarecord, 'M'); + + if(doneCallback) doneCallback(args); + } + ); + req.send(); + + } else { + if(doneCallback) doneCallback(args); + } + + return args; } function holdsDrawWindow() { - swapCanvas($('holds_box')); - $('holds_cancel').onclick = function(){ runEvt('common', 'holdUpdateCanceled'), showCanvas() }; - $('holds_submit').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())}; - $('holds_update').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())}; - holdFetchObjects(null, - function(){ - __holdsDrawWindow(); - - if(holdArgs.editHold) { - hideMe($('holds_submit')); - unHideMe($('holds_update')); - var req = new Request(FETCH_HOLD_STATUS, - G.user.session, holdArgs.editHold.id()); - req.send(true); - holdArgs.status = req.result(); - _holdsUpdateEditHold(); - } - } - ); + swapCanvas($('holds_box')); + $('holds_cancel').onclick = function(){ runEvt('common', 'holdUpdateCanceled'), showCanvas() }; + $('holds_submit').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())}; + $('holds_update').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())}; + holdFetchObjects(null, + function(){ + __holdsDrawWindow(); + + if(holdArgs.editHold) { + hideMe($('holds_submit')); + unHideMe($('holds_update')); + var req = new Request(FETCH_HOLD_STATUS, + G.user.session, holdArgs.editHold.id()); + req.send(true); + holdArgs.status = req.result(); + _holdsUpdateEditHold(); + } + } + ); } function __holdsDrawWindow() { - var rec = holdArgs.recordObject; - var vol = holdArgs.volumeObject; - var copy = holdArgs.copyObject; - var mr = holdArgs.metarecordObject; - - rec = (rec) ? rec : mr; - - if(!holdsOrgSelectorBuilt) { - holdsBuildOrgSelector(null,0); - holdsOrgSelectorBuilt = true; - var selector = $('holds_org_selector'); - - /* - var o_loc = findOrgUnit(getOrigLocation()); - var t = findOrgType(o_loc.ou_type()); - if( t.can_have_users() ) - setSelector(selector, o_loc.id()); - else - */ - - setSelector(selector, holdArgs.recipient.home_ou()); - - } - - /* - if(isXUL()) { - var dsel = $('holds_depth_selector'); - unHideMe($('holds_depth_selector_row')); - if(dsel.getElementsByTagName('option').length == 0) { - var types = globalOrgTypes; - var depth = findOrgDepth(G.user.ws_ou()); - iterate(types, - function(t) { - if(t.depth() > depth) return; - insertSelectorVal(dsel, -1, t.opac_label(), t.depth()); - } - ); - } - } - */ - - appendClear($('holds_recipient'), text( - holdArgs.recipient.family_name() + ', ' + - holdArgs.recipient.first_given_name())); - appendClear($('holds_title'), text(rec.title())); - appendClear($('holds_author'), text(rec.author())); - - if( holdArgs.type == 'V' || holdArgs.type == 'C' ) { - - unHideMe($('holds_type_row')); - unHideMe($('holds_cn_row')); - appendClear($('holds_cn'), text(holdArgs.volumeObject.label())); - - if( holdArgs.type == 'V' ) { - unHideMe($('holds_is_cn')); - hideMe($('holds_is_copy')); - - } else { - hideMe($('holds_is_cn')); - unHideMe($('holds_is_copy')); - unHideMe($('holds_copy_row')); - appendClear($('holds_copy'), text(holdArgs.copyObject.barcode())); - } - - } else { - hideMe($('holds_type_row')); - hideMe($('holds_copy_row')); - hideMe($('holds_cn_row')); - } - - removeChildren($('holds_format')); - - var mods_formats = rec.types_of_resource(); - var formats; - - if(holdArgs.recordDescriptors) - formats = holdArgs.recordDescriptors[0].item_type(); - - if( holdArgs.type == 'T' ) { - var desc = grep( holdArgs.recordDescriptors, - function(i) { - return (i.record() == holdArgs.record); - } - ); - formats = desc[0].item_type(); - } - - if( holdArgs.type == 'M' ) { - var data = holdsParseMRFormats(holdArgs.editHold.holdable_formats()); - mods_formats = data.mods_formats; - formats = data.formats; - } - - - for( var i in mods_formats ) { - var res = mods_formats[i]; - var img = elem("img"); - setResourcePic(img, res); - $('holds_format').appendChild(img); - if(formats) - $('holds_format').appendChild(text(' '+ MARCTypeToFriendly(formats[i]) +' ')); - else - $('holds_format').appendChild(text(' '+ mods_formats[i] +' ')); - $('holds_format').appendChild(elem('br')); - } - - - $('holds_phone').value = holdArgs.recipient.day_phone(); - appendClear( $('holds_email'), text(holdArgs.recipient.email())); - - var pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY]; - - if(pref) { - if( ! pref.match(/email/i) ) { - $('holds_enable_email').checked = false; - } else { - $('holds_enable_email').checked = true; - } - - if( ! pref.match(/phone/i) ) { - $('holds_phone').disabled = true; - $('holds_enable_phone').checked = false; - } else { - $('holds_phone').disabled = false; - $('holds_enable_phone').checked = true; - } - } + var rec = holdArgs.recordObject; + var vol = holdArgs.volumeObject; + var copy = holdArgs.copyObject; + var mr = holdArgs.metarecordObject; + + rec = (rec) ? rec : mr; + + if(!holdsOrgSelectorBuilt) { + holdsBuildOrgSelector(null,0); + holdsOrgSelectorBuilt = true; + var selector = $('holds_org_selector'); + + /* + var o_loc = findOrgUnit(getOrigLocation()); + var t = findOrgType(o_loc.ou_type()); + if( t.can_have_users() ) + setSelector(selector, o_loc.id()); + else + */ + + setSelector(selector, holdArgs.recipient.home_ou()); + + } + + /* + if(isXUL()) { + var dsel = $('holds_depth_selector'); + unHideMe($('holds_depth_selector_row')); + if(dsel.getElementsByTagName('option').length == 0) { + var types = globalOrgTypes; + var depth = findOrgDepth(G.user.ws_ou()); + iterate(types, + function(t) { + if(t.depth() > depth) return; + insertSelectorVal(dsel, -1, t.opac_label(), t.depth()); + } + ); + } + } + */ + + appendClear($('holds_recipient'), text( + holdArgs.recipient.family_name() + ', ' + + holdArgs.recipient.first_given_name())); + appendClear($('holds_title'), text(rec.title())); + appendClear($('holds_author'), text(rec.author())); + + if( holdArgs.type == 'V' || holdArgs.type == 'C' ) { + + unHideMe($('holds_type_row')); + unHideMe($('holds_cn_row')); + appendClear($('holds_cn'), text(holdArgs.volumeObject.label())); + + if( holdArgs.type == 'V' ) { + unHideMe($('holds_is_cn')); + hideMe($('holds_is_copy')); + + } else { + hideMe($('holds_is_cn')); + unHideMe($('holds_is_copy')); + unHideMe($('holds_copy_row')); + appendClear($('holds_copy'), text(holdArgs.copyObject.barcode())); + } + + } else { + hideMe($('holds_type_row')); + hideMe($('holds_copy_row')); + hideMe($('holds_cn_row')); + } + + removeChildren($('holds_format')); + + var mods_formats = rec.types_of_resource(); + var formats; + + if(holdArgs.recordDescriptors) + formats = holdArgs.recordDescriptors[0].item_type(); + + if( holdArgs.type == 'T' ) { + var desc = grep( holdArgs.recordDescriptors, + function(i) { + return (i.record() == holdArgs.record); + } + ); + formats = desc[0].item_type(); + } + + if( holdArgs.type == 'M' ) { + var data = holdsParseMRFormats(holdArgs.editHold.holdable_formats()); + mods_formats = data.mods_formats; + formats = data.formats; + } + + + for( var i in mods_formats ) { + var res = mods_formats[i]; + var img = elem("img"); + setResourcePic(img, res); + $('holds_format').appendChild(img); + if(formats) + $('holds_format').appendChild(text(' '+ MARCTypeToFriendly(formats[i]) +' ')); + else + $('holds_format').appendChild(text(' '+ mods_formats[i] +' ')); + $('holds_format').appendChild(elem('br')); + } + + + $('holds_phone').value = holdArgs.recipient.day_phone(); + appendClear( $('holds_email'), text(holdArgs.recipient.email())); + + var pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY]; + + if(pref) { + if( ! pref.match(/email/i) ) { + $('holds_enable_email').checked = false; + } else { + $('holds_enable_email').checked = true; + } + + if( ! pref.match(/phone/i) ) { + $('holds_phone').disabled = true; + $('holds_enable_phone').checked = false; + } else { + $('holds_phone').disabled = false; + $('holds_enable_phone').checked = true; + } + } if(!holdArgs.recipient.email()) { - $('holds_enable_email').checked = false; - $('holds_enable_email').disabled = true; + $('holds_enable_email').checked = false; + $('holds_enable_email').disabled = true; var message; if(isXUL()) { message = noEmailMessageXUL.cloneNode(true); - appendClear($('holds_email'), message); + appendClear($('holds_email'), message); } else { message = noEmailMessage.cloneNode(true); - appendClear($('holds_email'), message); + appendClear($('holds_email'), message); $('holds.no_email.my_account').setAttribute('href', buildOPACLink({page:MYOPAC},null,true)); } unHideMe(message); } - if(!$('holds_phone').value) - $('holds_enable_phone').checked = false; + if(!$('holds_phone').value) + $('holds_enable_phone').checked = false; - appendClear($('holds_physical_desc'), text(rec.physical_description())); + appendClear($('holds_physical_desc'), text(rec.physical_description())); - if(holdArgs.type == 'M') hideMe($('hold_physical_desc_row')); + if(holdArgs.type == 'M') hideMe($('hold_physical_desc_row')); - holdsSetFormatSelector(); + holdsSetFormatSelector(); $('holds_frozen_chkbox').checked = false; hideMe($('hold_frozen_thaw_row')); @@ -503,240 +503,240 @@ function __holdsDrawWindow() { } function holdsParseMRFormats(str) { - var data = str.split(/-/); - - var formats = []; - var mods_formats = []; - - for( var i = 0; i < data[0].length; i++ ) { - formats.push( data[0].charAt(i) ); - mods_formats.push( MARCFormatToMods( formats[i] ) ); - } - - formats = uniquify(formats); - mods_formats = uniquify(mods_formats); - - return { - formats : formats, - mods_formats : mods_formats, - lang : data[2], - largeprint : data[1] - }; + var data = str.split(/-/); + + var formats = []; + var mods_formats = []; + + for( var i = 0; i < data[0].length; i++ ) { + formats.push( data[0].charAt(i) ); + mods_formats.push( MARCFormatToMods( formats[i] ) ); + } + + formats = uniquify(formats); + mods_formats = uniquify(mods_formats); + + return { + formats : formats, + mods_formats : mods_formats, + lang : data[2], + largeprint : data[1] + }; } function holdsSetFormatSelector() { - var type = holdArgs.type; - if( type == 'C' || type == 'V' || holdArgs.editHold ) return; + var type = holdArgs.type; + if( type == 'C' || type == 'V' || holdArgs.editHold ) return; - var data = holdsGetFormats(); - var avail_formats = data.avail_formats; - var sel_formats = data.sel_formats; - holdArgs.language = data.lang; + var data = holdsGetFormats(); + var avail_formats = data.avail_formats; + var sel_formats = data.sel_formats; + holdArgs.language = data.lang; - unHideMe($('holds_alt_formats_row_extras')); - var selector = $('hold_alt_form_selector'); + unHideMe($('holds_alt_formats_row_extras')); + var selector = $('hold_alt_form_selector'); - for( var i = 0; i < avail_formats.length; i++ ) { - var form = avail_formats[i]; - unHideMe(findSelectorOptByValue(selector, form)); - } + for( var i = 0; i < avail_formats.length; i++ ) { + var form = avail_formats[i]; + unHideMe(findSelectorOptByValue(selector, form)); + } } function holdsGetFormats() { - var lang; - var formats = []; - var sformats = []; // selected formats - - var type = holdArgs.type; - var desc = holdArgs.recordDescriptors; - var rec = holdArgs.record; - var mrec = holdArgs.metarecord; - - if( type == 'T' ) { - - for( var i = 0; i < desc.length; i++ ) { - var d = desc[i]; - if( d.record() == holdArgs.record ) { - lang = d.item_lang(); - holdArgs.myFormat = _t_f_2_format(d.item_type(), d.item_form()); - sformats.push(holdArgs.myFormat); - break; - } - } - } - - for( var i = 0; i < desc.length; i++ ) { - var d = desc[i]; - if( d.item_lang() != lang ) continue; - formats.push( _t_f_2_format(d.item_type(), d.item_form())); - } - - formats = uniquify(formats); - - return { - lang : lang, - avail_formats : formats, - sel_formats : sformats - }; + var lang; + var formats = []; + var sformats = []; // selected formats + + var type = holdArgs.type; + var desc = holdArgs.recordDescriptors; + var rec = holdArgs.record; + var mrec = holdArgs.metarecord; + + if( type == 'T' ) { + + for( var i = 0; i < desc.length; i++ ) { + var d = desc[i]; + if( d.record() == holdArgs.record ) { + lang = d.item_lang(); + holdArgs.myFormat = _t_f_2_format(d.item_type(), d.item_form()); + sformats.push(holdArgs.myFormat); + break; + } + } + } + + for( var i = 0; i < desc.length; i++ ) { + var d = desc[i]; + if( d.item_lang() != lang ) continue; + formats.push( _t_f_2_format(d.item_type(), d.item_form())); + } + + formats = uniquify(formats); + + return { + lang : lang, + avail_formats : formats, + sel_formats : sformats + }; } function _t_f_2_format(type, form) { - if( form == 'd' ) return 'at-d'; - return (type == 'a' || type == 't') ? 'at' : - ( type == 'i' || type == 'g' || type == 'j' ) ? type : null; + if( form == 'd' ) return 'at-d'; + return (type == 'a' || type == 't') ? 'at' : + ( type == 'i' || type == 'g' || type == 'j' ) ? type : null; } function holdsSetSelectedFormats() { - var cn = $('holds_alt_formats_row').className; - if( cn && cn.match(/hide_me/) ) return; + var cn = $('holds_alt_formats_row').className; + if( cn && cn.match(/hide_me/) ) return; - var selector = $('hold_alt_form_selector'); - var vals = getSelectedList(selector); + var selector = $('hold_alt_form_selector'); + var vals = getSelectedList(selector); - if(vals.length == 0) return; + if(vals.length == 0) return; - var fstring = ""; + var fstring = ""; - if( contains(vals, 'at-d') ) { - if( contains(vals, 'at') ) - fstring = 'at'; - else - fstring = 'at-d'; - } else { - if( contains(vals, 'at') ) - fstring = 'at'; - } + if( contains(vals, 'at-d') ) { + if( contains(vals, 'at') ) + fstring = 'at'; + else + fstring = 'at-d'; + } else { + if( contains(vals, 'at') ) + fstring = 'at'; + } - for( var i = 0; i < vals.length; i++ ) { - var val = vals[i]; - if( !val.match(/at/) ) fstring = val + fstring; - } + for( var i = 0; i < vals.length; i++ ) { + var val = vals[i]; + if( !val.match(/at/) ) fstring = val + fstring; + } - if( holdArgs.language ) { - if( fstring.match(/-/) ) - fstring = fstring + '-' + holdArgs.language; - else - fstring = fstring + '--' + holdArgs.language; - } + if( holdArgs.language ) { + if( fstring.match(/-/) ) + fstring = fstring + '-' + holdArgs.language; + else + fstring = fstring + '--' + holdArgs.language; + } - return fstring; + return fstring; } function holdsCheckPossibility(pickuplib, hold, recurse) { - var args = { - titleid : holdArgs.record, - volume_id : holdArgs.volume, - copy_id : holdArgs.copy, - hold_type : holdArgs.type, - patronid : holdArgs.recipient.id(), - depth : 0, - pickup_lib : pickuplib - }; - - if(recurse) { - /* if we're calling create again (recursing), - we know that the hold possibility check already succeeded */ - holdHandleCreateResponse({_recurse:true, _hold:hold}, true ); - - } else { - _debug("hold possible args = "+js2JSON(args)); - - var req = new Request(CHECK_HOLD_POSSIBLE, G.user.session, args ); - - req.request.alertEvent = false; - req.request._hold = hold; - req.request._recurse = recurse; - req.callback(holdHandleCreateResponse); - req.send(); - } + var args = { + titleid : holdArgs.record, + volume_id : holdArgs.volume, + copy_id : holdArgs.copy, + hold_type : holdArgs.type, + patronid : holdArgs.recipient.id(), + depth : 0, + pickup_lib : pickuplib + }; + + if(recurse) { + /* if we're calling create again (recursing), + we know that the hold possibility check already succeeded */ + holdHandleCreateResponse({_recurse:true, _hold:hold}, true ); + + } else { + _debug("hold possible args = "+js2JSON(args)); + + var req = new Request(CHECK_HOLD_POSSIBLE, G.user.session, args ); + + req.request.alertEvent = false; + req.request._hold = hold; + req.request._recurse = recurse; + req.callback(holdHandleCreateResponse); + req.send(); + } } function holdsBuildOrgSelector(node) { - if(!node) node = globalOrgTree; + if(!node) node = globalOrgTree; if(!isTrue(node.opac_visible())) return; - var selector = $('holds_org_selector'); - var index = selector.options.length; - - var type = findOrgType(node.ou_type()); - var indent = type.depth() - 1; - var opt = setSelectorVal( selector, index, node.name(), node.id(), null, indent ); - if(!type.can_have_users()) { - opt.disabled = true; - addCSSClass(opt, 'disabled_option'); - } - - for( var i in node.children() ) { - var child = node.children()[i]; - if(child) holdsBuildOrgSelector(child); - } + var selector = $('holds_org_selector'); + var index = selector.options.length; + + var type = findOrgType(node.ou_type()); + var indent = type.depth() - 1; + var opt = setSelectorVal( selector, index, node.name(), node.id(), null, indent ); + if(!type.can_have_users()) { + opt.disabled = true; + addCSSClass(opt, 'disabled_option'); + } + + for( var i in node.children() ) { + var child = node.children()[i]; + if(child) holdsBuildOrgSelector(child); + } } function holdsBuildHoldFromWindow() { - var org = getSelectorVal($('holds_org_selector')); - var node = findOrgUnit(org); - var ntype = findOrgType(node.ou_type()); - if(!ntype.can_have_users()) { - alertId('holds_pick_good_org'); - return; - } - - var hold = new ahr(); - if(holdArgs.editHold) { - hold = holdArgs.editHold; - holdArgs.editHold = null; - } - - if( $('holds_enable_phone').checked ) { - var phone = $('holds_phone').value; - if( !phone || !phone.match(REGEX_PHONE) ) { - alert($('holds_bad_phone').innerHTML); - return null; - } - hold.phone_notify(phone); - - } else { - hold.phone_notify(""); - } - - if( $('holds_enable_email').checked ) - hold.email_notify(1); - else - hold.email_notify(0); - - var target; - - switch(holdArgs.type) { - case 'M': - target = holdArgs.metarecord; break; - case 'T': - target = holdArgs.record; break; - case 'V': - target = holdArgs.volume; break; - case 'C': - target = holdArgs.copy; break; - } - - - - hold.pickup_lib(org); - //hold.request_lib(org); - hold.requestor(holdArgs.requestor.id()); - hold.usr(holdArgs.recipient.id()); - hold.target(target); - hold.hold_type(holdArgs.type); + var org = getSelectorVal($('holds_org_selector')); + var node = findOrgUnit(org); + var ntype = findOrgType(node.ou_type()); + if(!ntype.can_have_users()) { + alertId('holds_pick_good_org'); + return; + } + + var hold = new ahr(); + if(holdArgs.editHold) { + hold = holdArgs.editHold; + holdArgs.editHold = null; + } + + if( $('holds_enable_phone').checked ) { + var phone = $('holds_phone').value; + if( !phone || !phone.match(REGEX_PHONE) ) { + alert($('holds_bad_phone').innerHTML); + return null; + } + hold.phone_notify(phone); + + } else { + hold.phone_notify(""); + } + + if( $('holds_enable_email').checked ) + hold.email_notify(1); + else + hold.email_notify(0); + + var target; + + switch(holdArgs.type) { + case 'M': + target = holdArgs.metarecord; break; + case 'T': + target = holdArgs.record; break; + case 'V': + target = holdArgs.volume; break; + case 'C': + target = holdArgs.copy; break; + } + + + + hold.pickup_lib(org); + //hold.request_lib(org); + hold.requestor(holdArgs.requestor.id()); + hold.usr(holdArgs.recipient.id()); + hold.target(target); + hold.hold_type(holdArgs.type); var expDate = dijit.byId('holds_expire_time').getValue(); if(expDate) { @@ -767,105 +767,105 @@ function holdsBuildHoldFromWindow() { hold.thaw_date(null); } - //check for alternate hold formats - var fstring = holdsSetSelectedFormats(); - if(fstring) { - hold.hold_type('M'); - hold.holdable_formats(fstring); - hold.target(holdArgs.metarecord); - } - return hold; + //check for alternate hold formats + var fstring = holdsSetSelectedFormats(); + if(fstring) { + hold.hold_type('M'); + hold.holdable_formats(fstring); + hold.target(holdArgs.metarecord); + } + return hold; } - + function holdsPlaceHold(hold, recurse) { - if(!hold) return; - swapCanvas($('check_holds_box')); - holdsCheckPossibility(hold.pickup_lib(), hold, recurse); + if(!hold) return; + swapCanvas($('check_holds_box')); + holdsCheckPossibility(hold.pickup_lib(), hold, recurse); } function holdHandleCreateResponse(r, recurse) { - if(!recurse) { - var res = r.getResultObject(); - if(checkILSEvent(res) || res.success != 1) { - if(res.success != 1) { - alert($('hold_not_allowed').innerHTML); - } else { - if( res.textcode == 'PATRON_BARRED' ) { - alertId('hold_failed_patron_barred'); - } else { - alert($('hold_not_allowed').innerHTML); - } - } - swapCanvas($('holds_box')); - return; - } + if(!recurse) { + var res = r.getResultObject(); + if(checkILSEvent(res) || res.success != 1) { + if(res.success != 1) { + alert($('hold_not_allowed').innerHTML); + } else { + if( res.textcode == 'PATRON_BARRED' ) { + alertId('hold_failed_patron_barred'); + } else { + alert($('hold_not_allowed').innerHTML); + } + } + swapCanvas($('holds_box')); + return; + } r._hold.selection_depth(res.depth); - } + } - holdCreateHold(r._recurse, r._hold); + holdCreateHold(r._recurse, r._hold); } function holdCreateHold( recurse, hold ) { - var method = CREATE_HOLD; - if(recurse) method = CREATE_HOLD_OVERRIDE; - var req = new Request( method, holdArgs.requestor.session, hold ); - req.request.alertEvent = false; - req.send(true); - var res = req.result(); - holdProcessResult(hold, res, recurse); - - showCanvas(); - - runEvt('common', 'holdUpdated'); + var method = CREATE_HOLD; + if(recurse) method = CREATE_HOLD_OVERRIDE; + var req = new Request( method, holdArgs.requestor.session, hold ); + req.request.alertEvent = false; + req.send(true); + var res = req.result(); + holdProcessResult(hold, res, recurse); + + showCanvas(); + + runEvt('common', 'holdUpdated'); } function holdProcessResult( hold, res, recurse ) { - if( res == '1' ) { - alert($('holds_success').innerHTML); - holdArgs = null; + if( res == '1' ) { + alert($('holds_success').innerHTML); + holdArgs = null; - } else { + } else { - if( recurse ) { - alert($('holds_failure').innerHTML); - return; - } + if( recurse ) { + alert($('holds_failure').innerHTML); + return; + } - if( grep(res, function(e) { return (e.textcode == 'HOLD_EXISTS'); }) ) { - if( fetchPermOrgs('HOLD_EXISTS.override')[0] != -1 ) { - if( confirm($('hold_dup_exists_override').innerHTML) ) { - return holdsPlaceHold(hold, true); - } + if( grep(res, function(e) { return (e.textcode == 'HOLD_EXISTS'); }) ) { + if( fetchPermOrgs('HOLD_EXISTS.override')[0] != -1 ) { + if( confirm($('hold_dup_exists_override').innerHTML) ) { + return holdsPlaceHold(hold, true); + } - } else { - return alert($('hold_dup_exists').innerHTML); - } - } + } else { + return alert($('hold_dup_exists').innerHTML); + } + } - alert($('holds_failure').innerHTML); - } + alert($('holds_failure').innerHTML); + } } function holdsCancel(holdid, user) { - if(!user) user = G.user; - var req = new Request(CANCEL_HOLD, user.session, holdid, /* Patron via OPAC */ 6); - req.send(true); - return req.result(); - runEvt('common', 'holdUpdated'); + if(!user) user = G.user; + var req = new Request(CANCEL_HOLD, user.session, holdid, /* Patron via OPAC */ 6); + req.send(true); + return req.result(); + runEvt('common', 'holdUpdated'); } function holdsUpdate(hold, user) { - if(!user) user = G.user; - var req = new Request(UPDATE_HOLD, user.session, hold); - req.send(true); - var x = req.result(); // cause an exception if there is one - runEvt('common', 'holdUpdated'); + if(!user) user = G.user; + var req = new Request(UPDATE_HOLD, user.session, hold); + req.send(true); + var x = req.result(); // cause an exception if there is one + runEvt('common', 'holdUpdated'); } /* verify that the thaw date is valid and after today */ diff --git a/Open-ILS/web/opac/skin/default/js/mresult.js b/Open-ILS/web/opac/skin/default/js/mresult.js index 51850529fc..bdbc592bdc 100644 --- a/Open-ILS/web/opac/skin/default/js/mresult.js +++ b/Open-ILS/web/opac/skin/default/js/mresult.js @@ -18,102 +18,102 @@ hideMe($('copyright_block')); function mresultDoSearch() { - TFORM = null; /* clear the rresult tform var so it's not propogated */ + TFORM = null; /* clear the rresult tform var so it's not propogated */ - swapCanvas($('loading_alt')); - table = G.ui.result.main_table; + swapCanvas($('loading_alt')); + table = G.ui.result.main_table; - while( table.parentNode.rows.length <= (getDisplayCount() + 1) ) - table.appendChild(G.ui.result.row_template.cloneNode(true)); + while( table.parentNode.rows.length <= (getDisplayCount() + 1) ) + table.appendChild(G.ui.result.row_template.cloneNode(true)); - if( (getSearches() || getAdvTerm()) && !getTerm() ) { - if(getAdvType() == ADVTYPE_MULTI ) mresultCollectAdvIds(); + if( (getSearches() || getAdvTerm()) && !getTerm() ) { + if(getAdvType() == ADVTYPE_MULTI ) mresultCollectAdvIds(); - } else { - _mresultCollectIds(); - ADVTERM = ""; - ADVTYPE = ""; - } + } else { + _mresultCollectIds(); + ADVTERM = ""; + ADVTYPE = ""; + } } function _mresultCollectIds() { - resultCollectSearchIds(true, SEARCH_MRS_QUERY, mresultHandleMRIds ); + resultCollectSearchIds(true, SEARCH_MRS_QUERY, mresultHandleMRIds ); } function mresultCollectAdvIds() { - resultCollectSearchIds(false, SEARCH_MRS_QUERY, mresultHandleMRIds ); + resultCollectSearchIds(false, SEARCH_MRS_QUERY, mresultHandleMRIds ); } function mresultHandleMRIds(r) { - var res = r.getResultObject(); + var res = r.getResultObject(); resultCompiledSearch = res.compiled_search; cookieManager.write(COOKIE_SEARCH, js2JSON(res.compiled_search), -1); - if(res.count != null) { - if( getOffset() == 0 ) HITCOUNT = res.count; - runEvt('result', 'hitCountReceived'); - } - runEvt('result', 'idsReceived', res.ids); + if(res.count != null) { + if( getOffset() == 0 ) HITCOUNT = res.count; + runEvt('result', 'hitCountReceived'); + } + runEvt('result', 'idsReceived', res.ids); } function mresultSetRecords(idstruct) { - if(!idstruct) return; - var o = getOffset(); - for( var x = o; x < idstruct.length + o; x++ ) { - if( idstruct[x-o] != null ) { - var r = parseInt(idstruct[x - o][0]); - var ra = parseFloat(idstruct[x - o][1]); - var or = parseInt(idstruct[x - o][2]); - if(!isNull(r) && !isNaN(r)) records[x] = r; - if(!isNull(ra) && !isNaN(ra)) ranks[x] = ra; - if(!isNull(or) && !isNaN(or)) onlyrecord[x] = or; - } - } - - TOPRANK = ranks[getOffset()]; + if(!idstruct) return; + var o = getOffset(); + for( var x = o; x < idstruct.length + o; x++ ) { + if( idstruct[x-o] != null ) { + var r = parseInt(idstruct[x - o][0]); + var ra = parseFloat(idstruct[x - o][1]); + var or = parseInt(idstruct[x - o][2]); + if(!isNull(r) && !isNaN(r)) records[x] = r; + if(!isNull(ra) && !isNaN(ra)) ranks[x] = ra; + if(!isNull(or) && !isNaN(or)) onlyrecord[x] = or; + } + } + + TOPRANK = ranks[getOffset()]; } function mresultCollectRecords() { - if(getHitCount() > 0 ) runEvt("result", "preCollectRecords"); - var i = 0; - for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) { - if(isNull(records[x])) break; - if(isNaN(records[x])) continue; - var req = new Request(FETCH_MRMODS, records[x]); - - req.request.userdata = i++; - - /* wait at most 10 seconds for the mods rec to come back */ - /* this needs more testing */ - req.request.timeout(10); - req.request.abortCallback( - function(){ - recordsHandled++; - if(resultPageIsDone()) { - runEvt('result', 'allRecordsReceived', recordsCache); - unHideMe($('copyright_block')); - } - } - ); - - req.callback(mresultHandleMods); - req.send(); - } + if(getHitCount() > 0 ) runEvt("result", "preCollectRecords"); + var i = 0; + for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) { + if(isNull(records[x])) break; + if(isNaN(records[x])) continue; + var req = new Request(FETCH_MRMODS, records[x]); + + req.request.userdata = i++; + + /* wait at most 10 seconds for the mods rec to come back */ + /* this needs more testing */ + req.request.timeout(10); + req.request.abortCallback( + function(){ + recordsHandled++; + if(resultPageIsDone()) { + runEvt('result', 'allRecordsReceived', recordsCache); + unHideMe($('copyright_block')); + } + } + ); + + req.callback(mresultHandleMods); + req.send(); + } } function mresultHandleMods(r) { - var rec = r.getResultObject(); - var pagePosition = r.userdata; - runEvt('result', 'recordReceived', rec, pagePosition, true); - if(rec) resultCollectCopyCounts(rec, pagePosition, FETCH_MR_COPY_COUNTS); - if(resultPageIsDone()) { - runEvt('result', 'allRecordsReceived', recordsCache); - unHideMe($('copyright_block')); /* *** */ - } + var rec = r.getResultObject(); + var pagePosition = r.userdata; + runEvt('result', 'recordReceived', rec, pagePosition, true); + if(rec) resultCollectCopyCounts(rec, pagePosition, FETCH_MR_COPY_COUNTS); + if(resultPageIsDone()) { + runEvt('result', 'allRecordsReceived', recordsCache); + unHideMe($('copyright_block')); /* *** */ + } } diff --git a/Open-ILS/web/opac/skin/default/js/myopac.js b/Open-ILS/web/opac/skin/default/js/myopac.js index 2be360cd78..1a77a0e2a7 100644 --- a/Open-ILS/web/opac/skin/default/js/myopac.js +++ b/Open-ILS/web/opac/skin/default/js/myopac.js @@ -13,15 +13,15 @@ var myopacRefWorksHost = 'http://www.refworks.com'; function clearNodes( node, keepArray ) { - if(!node) return; - for( var n in keepArray ) node.removeChild(keepArray[n]); - removeChildren(node); - for( var n in keepArray ) node.appendChild(keepArray[n]); + if(!node) return; + for( var n in keepArray ) node.removeChild(keepArray[n]); + removeChildren(node); + for( var n in keepArray ) node.appendChild(keepArray[n]); } function myOPACInit() { - if(!(G.user && G.user.session)) { + if(!(G.user && G.user.session)) { initLogin(); } else { @@ -29,7 +29,7 @@ function myOPACInit() { allowPendingAddr = fetchOrgSettingDefault(G.user.home_ou(), 'opac.allow_pending_address'); if(allowPendingAddr) unHideMe($('myopac_pending_addr_td')); - myOPACChangePage( "summary" ); + myOPACChangePage( "summary" ); } $('myopac_holds_thaw_date_input').onkeyup = @@ -40,96 +40,96 @@ function myOPACInit() { } function myopacReload() { - //swapCanvas($('myopac_reloading')); - var a = {}; - a[PARAM_LOCATION] = getNewSearchLocation(); - a[PARAM_DEPTH] = getNewSearchDepth(); - hideMe($('canvas_main')); - goTo(buildOPACLink(a, true)); + //swapCanvas($('myopac_reloading')); + var a = {}; + a[PARAM_LOCATION] = getNewSearchLocation(); + a[PARAM_DEPTH] = getNewSearchDepth(); + hideMe($('canvas_main')); + goTo(buildOPACLink(a, true)); } function myOPACChangePage( page ) { - showCanvas(); - - var s = $("myopac_summary_td"); - var c = $("myopac_checked_td"); - var f = $("myopac_fines_td"); - var h = $("myopac_holds_td"); - var p = $("myopac_prefs_td"); - var b = $('myopac_bookbag_td'); - - var ss = $("myopac_summary_div"); - var cc = $("myopac_checked_div"); - var ff = $("myopac_fines_div"); - var hh = $("myopac_holds_div"); - var pp = $("myopac_prefs_div"); - var bb = $('myopac_bookbag_div'); - - var cls = "myopac_link"; - var acls = "myopac_link_active"; - - hideMe(ss); - hideMe(cc); hideMe(ff); - hideMe(hh); hideMe(pp); - hideMe(bb); - - removeCSSClass(s, acls ); - removeCSSClass(c, acls ); - removeCSSClass(f, acls ); - removeCSSClass(h, acls ); - removeCSSClass(p, acls ); - removeCSSClass(b, acls ); - - switch( page ) { - - case "summary": - unHideMe(ss); - addCSSClass(s, acls ); - myOPACShowSummary(); - break; - - case "checked": - unHideMe(cc); - addCSSClass(c, acls ); - myOPACShowChecked(); - break; - - case "holds": - unHideMe(hh); - addCSSClass(h, acls ); - myOPACShowHolds(); - break; - - case "fines": - unHideMe(ff); - addCSSClass(f, acls ); - myOPACShowFines(); - break; - - case "prefs": - unHideMe(pp); - addCSSClass(p, acls ); - myOPACShowPrefs(); - break; - - case 'bookbag': - unHideMe(bb); - addCSSClass(b, acls); - myOPACShowBookbags(); - break; - } + showCanvas(); + + var s = $("myopac_summary_td"); + var c = $("myopac_checked_td"); + var f = $("myopac_fines_td"); + var h = $("myopac_holds_td"); + var p = $("myopac_prefs_td"); + var b = $('myopac_bookbag_td'); + + var ss = $("myopac_summary_div"); + var cc = $("myopac_checked_div"); + var ff = $("myopac_fines_div"); + var hh = $("myopac_holds_div"); + var pp = $("myopac_prefs_div"); + var bb = $('myopac_bookbag_div'); + + var cls = "myopac_link"; + var acls = "myopac_link_active"; + + hideMe(ss); + hideMe(cc); hideMe(ff); + hideMe(hh); hideMe(pp); + hideMe(bb); + + removeCSSClass(s, acls ); + removeCSSClass(c, acls ); + removeCSSClass(f, acls ); + removeCSSClass(h, acls ); + removeCSSClass(p, acls ); + removeCSSClass(b, acls ); + + switch( page ) { + + case "summary": + unHideMe(ss); + addCSSClass(s, acls ); + myOPACShowSummary(); + break; + + case "checked": + unHideMe(cc); + addCSSClass(c, acls ); + myOPACShowChecked(); + break; + + case "holds": + unHideMe(hh); + addCSSClass(h, acls ); + myOPACShowHolds(); + break; + + case "fines": + unHideMe(ff); + addCSSClass(f, acls ); + myOPACShowFines(); + break; + + case "prefs": + unHideMe(pp); + addCSSClass(p, acls ); + myOPACShowPrefs(); + break; + + case 'bookbag': + unHideMe(bb); + addCSSClass(b, acls); + myOPACShowBookbags(); + break; + } } function myOPACShowChecked() { - if(checkedDrawn) return; - var req = new Request(FETCH_CHECKED_OUT_SUM, G.user.session, G.user.id()); - req.callback(myOPACDrawCheckedOutSlim); - req.send(); + if(checkedDrawn) return; + var req = new Request(FETCH_CHECKED_OUT_SUM, G.user.session, G.user.id()); + req.callback(myOPACDrawCheckedOutSlim); + req.send(); - var nreq = new Request(FETCH_NON_CAT_CIRCS, G.user.session); - nreq.callback(myOPACDrawNonCatCircs); - nreq.send(); + var nreq = new Request(FETCH_NON_CAT_CIRCS, G.user.session); + nreq.callback(myOPACDrawNonCatCircs); + nreq.send(); } @@ -138,35 +138,35 @@ var circsCache = new Array(); var checkedDrawn = false; function moClearCheckedTable() { - var tbody = $("myopac_checked_tbody"); - var loading = $("myopac_checked_loading"); - var none = $("myopac_checked_none"); - clearNodes( tbody, [ loading, none ] ); + var tbody = $("myopac_checked_tbody"); + var loading = $("myopac_checked_loading"); + var none = $("myopac_checked_none"); + clearNodes( tbody, [ loading, none ] ); } var __can_renew_one = false; function myOPACDrawCheckedOutSlim(r) { - var checked = r.getResultObject(); - var tbody = $("myopac_checked_tbody"); - var loading = $("myopac_checked_loading"); - var none = $("myopac_checked_none"); + var checked = r.getResultObject(); + var tbody = $("myopac_checked_tbody"); + var loading = $("myopac_checked_loading"); + var none = $("myopac_checked_none"); __can_renew_one = false; - if(checkedDrawn) return; - checkedDrawn = true; - if(!checkedRowTemplate) - checkedRowTemplate = tbody.removeChild($("myopac_checked_row")); + if(checkedDrawn) return; + checkedDrawn = true; + if(!checkedRowTemplate) + checkedRowTemplate = tbody.removeChild($("myopac_checked_row")); moClearCheckedTable(); - hideMe(loading); /* remove all children and start over */ - if(!(checked && (checked.out || checked.overdue))) { - unHideMe(none); - return; - } + hideMe(loading); /* remove all children and start over */ + if(!(checked && (checked.out || checked.overdue))) { + unHideMe(none); + return; + } var totalAsync = checked.overdue.length + checked.out.length; var fetchedCircs = []; @@ -191,21 +191,21 @@ function myOPACDrawCheckedOutSlim(r) { ); } - for( var i = 0; i < checked.overdue.length; i++ ) { - var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.overdue[i]); - //req.request.tbody = tbody; - req.request.od = true; - req.callback(collectCircs); - req.send(); - } + for( var i = 0; i < checked.overdue.length; i++ ) { + var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.overdue[i]); + //req.request.tbody = tbody; + req.request.od = true; + req.callback(collectCircs); + req.send(); + } - for( var i = 0; i < checked.out.length; i++ ) { - var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.out[i]); - //req.request.tbody = tbody; - req.callback(collectCircs); - req.send(); - } + for( var i = 0; i < checked.out.length; i++ ) { + var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.out[i]); + //req.request.tbody = tbody; + req.callback(collectCircs); + req.send(); + } appendClear($('mo_items_out_count'), text(new String( parseInt(checked.overdue.length) + parseInt(checked.out.length) )) ); @@ -222,33 +222,33 @@ function myOPACDrawCheckedOutSlim(r) { //function myOPACDrawCheckedItem(r) { function myOPACDrawCheckedItem(circ, tbody) { - //var circ = r.getResultObject(); - //var tbody = r.tbody; - var row = checkedRowTemplate.cloneNode(true); - row.id = 'myopac_checked_row_ ' + circ.id(); + //var circ = r.getResultObject(); + //var tbody = r.tbody; + var row = checkedRowTemplate.cloneNode(true); + row.id = 'myopac_checked_row_ ' + circ.id(); row.setAttribute('circid', circ.id()); - var due = _trimTime(circ.due_date()); + var due = _trimTime(circ.due_date()); - var dlink = $n( row, "myopac_checked_due" ); - var rlink = $n( row, "myopac_checked_renewals" ); - //var rnlink = $n( row, "myopac_checked_renew_link" ); + var dlink = $n( row, "myopac_checked_due" ); + var rlink = $n( row, "myopac_checked_renewals" ); + //var rnlink = $n( row, "myopac_checked_renew_link" ); - //if( r.od ) due = elem('b', {style:'color:red;font-size:110%'},due); - if( circ._od ) { + //if( r.od ) due = elem('b', {style:'color:red;font-size:110%'},due); + if( circ._od ) { due = elem('b', null, due); addCSSClass(due, 'overdue'); } else { due = text(due); } - dlink.appendChild(due); - rlink.appendChild(text(circ.renewal_remaining())); - unHideMe(row); - //rnlink.setAttribute('href', 'javascript:myOPACRenewCirc("'+circ.id()+'");'); - circsCache.push(circ); + dlink.appendChild(due); + rlink.appendChild(text(circ.renewal_remaining())); + unHideMe(row); + //rnlink.setAttribute('href', 'javascript:myOPACRenewCirc("'+circ.id()+'");'); + circsCache.push(circ); - if( circ.renewal_remaining() < 1 ) { + if( circ.renewal_remaining() < 1 ) { $n(row, 'selectme').disabled = true; if(!__can_renew_one) $('mo_renew_button').disabled = true; @@ -258,48 +258,48 @@ function myOPACDrawCheckedItem(circ, tbody) { $n(row, 'selectme').disabled = false; } - tbody.appendChild(row); + tbody.appendChild(row); - var req = new Request(FETCH_MODS_FROM_COPY, circ.target_copy() ); - req.request.alertEvent = false; - req.request.circ = circ.id(); - req.request.copy = circ.target_copy(); - req.callback(myOPACDrawCheckedTitle); - req.send(); + var req = new Request(FETCH_MODS_FROM_COPY, circ.target_copy() ); + req.request.alertEvent = false; + req.request.circ = circ.id(); + req.request.copy = circ.target_copy(); + req.callback(myOPACDrawCheckedTitle); + req.send(); } var __circ_titles = {}; function myOPACDrawCheckedTitle(r) { - var record = r.getResultObject(); - var circid = r.circ; - - if(!record || checkILSEvent(record)) { - var req = new Request( FETCH_COPY, r.copy ); - req.request.circ = circid - req.callback(myOPACDrawNonCatalogedItem); - req.send(); - return; - } - - var row = $('myopac_checked_row_ ' + circid); - var tlink = $n( row, "myopac_checked_title_link" ); - var alink = $n( row, "myopac_checked_author_link" ); - buildTitleDetailLink(record, tlink); - buildSearchLink(STYPE_AUTHOR, record.author(), alink); + var record = r.getResultObject(); + var circid = r.circ; + + if(!record || checkILSEvent(record)) { + var req = new Request( FETCH_COPY, r.copy ); + req.request.circ = circid + req.callback(myOPACDrawNonCatalogedItem); + req.send(); + return; + } + + var row = $('myopac_checked_row_ ' + circid); + var tlink = $n( row, "myopac_checked_title_link" ); + var alink = $n( row, "myopac_checked_author_link" ); + buildTitleDetailLink(record, tlink); + buildSearchLink(STYPE_AUTHOR, record.author(), alink); __circ_titles[circid] = record.title(); } function myOPACDrawNonCatalogedItem(r) { - var copy = r.getResultObject(); - var circid = r.circ; + var copy = r.getResultObject(); + var circid = r.circ; - var row = $('myopac_checked_row_ ' + circid); - var tlink = $n( row, "myopac_checked_title_link" ); - var alink = $n( row, "myopac_checked_author_link" ); + var row = $('myopac_checked_row_ ' + circid); + var tlink = $n( row, "myopac_checked_title_link" ); + var alink = $n( row, "myopac_checked_author_link" ); - tlink.parentNode.appendChild(text(copy.dummy_title())); - alink.parentNode.appendChild(text(copy.dummy_author())); + tlink.parentNode.appendChild(text(copy.dummy_title())); + alink.parentNode.appendChild(text(copy.dummy_author())); __circ_titles[circid] = copy.dummy_title(); } @@ -307,36 +307,36 @@ function myOPACDrawNonCatalogedItem(r) { /* function myOPACRenewCirc(circid) { - var circ; - for( var i = 0; i != circsCache.length; i++ ) - if(circsCache[i].id() == circid) - circ = circsCache[i]; + var circ; + for( var i = 0; i != circsCache.length; i++ ) + if(circsCache[i].id() == circid) + circ = circsCache[i]; - if(!confirm($('myopac_renew_confirm').innerHTML)) return; + if(!confirm($('myopac_renew_confirm').innerHTML)) return; - var req = new Request(RENEW_CIRC, G.user.session, - { patron : G.user.id(), copyid : circ.target_copy(), opac_renewal : 1 } ); - req.request.alertEvent = false; - req.send(true); - var res = req.result(); + var req = new Request(RENEW_CIRC, G.user.session, + { patron : G.user.id(), copyid : circ.target_copy(), opac_renewal : 1 } ); + req.request.alertEvent = false; + req.send(true); + var res = req.result(); - if(checkILSEvent(res) || checkILSEvent(res[0])) { - alertId('myopac_renew_fail'); - return; - } + if(checkILSEvent(res) || checkILSEvent(res[0])) { + alertId('myopac_renew_fail'); + return; + } - alert($('myopac_renew_success').innerHTML); - checkedDrawn = false; - myOPACShowChecked(); + alert($('myopac_renew_success').innerHTML); + checkedDrawn = false; + myOPACShowChecked(); } */ function myOPACShowHolds() { - var req = new Request(FETCH_HOLDS, G.user.session, G.user.id()); - req.callback(myOPACDrawHolds); - req.send(); + var req = new Request(FETCH_HOLDS, G.user.session, G.user.id()); + req.callback(myOPACDrawHolds); + req.send(); $('myopac_holds_actions_none').selected = true; } @@ -345,41 +345,41 @@ var holdsTemplateRow; var myopacForceHoldsRedraw = false; function myOPACDrawHolds(r) { - var tbody = $("myopac_holds_tbody"); - if(holdsTemplateRow && !myopacForceHoldsRedraw) return; + var tbody = $("myopac_holds_tbody"); + if(holdsTemplateRow && !myopacForceHoldsRedraw) return; myopacForceHoldsRedraw = false; - if(holdsTemplateRowOrig) { - holdsTemplateRow = holdsTemplateRowOrig; - removeChildren(tbody); - } else { - holdsTemplateRow = tbody.removeChild($("myopac_holds_row")); - holdsTemplateRowOrig = holdsTemplateRow; - } + if(holdsTemplateRowOrig) { + holdsTemplateRow = holdsTemplateRowOrig; + removeChildren(tbody); + } else { + holdsTemplateRow = tbody.removeChild($("myopac_holds_row")); + holdsTemplateRowOrig = holdsTemplateRow; + } - hideMe($('myopac_holds_loading')); + hideMe($('myopac_holds_loading')); - var holds = r.getResultObject(); + var holds = r.getResultObject(); - if(!holds || holds.length < 1) unHideMe($('myopac_holds_none')); - for( var i = 0; i != holds.length; i++ ) { + if(!holds || holds.length < 1) unHideMe($('myopac_holds_none')); + for( var i = 0; i != holds.length; i++ ) { - var h = holds[i]; - holdCache[h.id()] = h; + var h = holds[i]; + holdCache[h.id()] = h; - var row = holdsTemplateRow.cloneNode(true); - row.id = "myopac_holds_row_" + h.id(); + var row = holdsTemplateRow.cloneNode(true); + row.id = "myopac_holds_row_" + h.id(); - var form = $n(row, "myopac_holds_formats"); - form.id = "myopac_holds_form_" + h.id(); + var form = $n(row, "myopac_holds_formats"); + form.id = "myopac_holds_form_" + h.id(); - var orglink = $n(row, "myopac_holds_location"); - orglink.appendChild(text(findOrgUnit(h.pickup_lib()).name())); + var orglink = $n(row, "myopac_holds_location"); + orglink.appendChild(text(findOrgUnit(h.pickup_lib()).name())); - tbody.appendChild(row); + tbody.appendChild(row); - $n(row,'myopac_holds_edit_link').setAttribute( - 'href','javascript:myOPACEditHold("'+ h.id()+'");'); + $n(row,'myopac_holds_edit_link').setAttribute( + 'href','javascript:myOPACEditHold("'+ h.id()+'");'); if(isTrue(h.frozen())) { hideMe($n(row, 'myopac_hold_unfrozen_true')) @@ -402,7 +402,7 @@ function myOPACDrawHolds(r) { text(dojo.date.locale.format(exp_date, {selector:'date'}))); } - unHideMe(row); + unHideMe(row); var interval = fetchOrgSettingDefault(G.user.home_ou(), 'circ.hold_expire_alert_interval'); if(interval && exp_date) { @@ -418,35 +418,35 @@ function myOPACDrawHolds(r) { } function myOPACEditHold(holdid) { - var hold = holdCache[holdid]; - - holdsDrawEditor( - { - editHold : hold, - onComplete : function(){ - holdsTemplateRow = null; - myOPACShowHolds(); - } - } - ); + var hold = holdCache[holdid]; + + holdsDrawEditor( + { + editHold : hold, + onComplete : function(){ + holdsTemplateRow = null; + myOPACShowHolds(); + } + } + ); } function myOPACDrawHoldStatus(hold) { - var req = new Request(FETCH_HOLD_STATUS, G.user.session, hold.id() ); - req.callback(myOShowHoldStatus); - req.request.hold = hold; - req.send(); + var req = new Request(FETCH_HOLD_STATUS, G.user.session, hold.id() ); + req.callback(myOShowHoldStatus); + req.request.hold = hold; + req.send(); } var myopacShowHoldEstimate = false; function myOShowHoldStatus(r) { - var hold = r.hold; - var qstats = r.getResultObject(); + var hold = r.hold; + var qstats = r.getResultObject(); holdStatusCache[hold.id()] = qstats; - var row = $("myopac_holds_row_" + r.hold.id()); + var row = $("myopac_holds_row_" + r.hold.id()); if(qstats.estimated_wait || myopacShowHoldEstimate) { myopacShowHoldEstimate = true; @@ -456,10 +456,10 @@ function myOShowHoldStatus(r) { unHideMe($n(row, 'myopac_holds_estimated_wait')); } - if( qstats.status == 4 ) { - unHideMe($n(row, 'hold_status_available')); - hideMe($n(row, 'myopac_holds_cancel_link')); - } + if( qstats.status == 4 ) { + unHideMe($n(row, 'hold_status_available')); + hideMe($n(row, 'myopac_holds_cancel_link')); + } if(false) { var node = $n(row, 'hold_qstats'); @@ -468,125 +468,125 @@ function myOShowHoldStatus(r) { unHideMe(node); } else { - if( qstats.status < 3 ) - unHideMe($n(row, 'hold_status_waiting')); + if( qstats.status < 3 ) + unHideMe($n(row, 'hold_status_waiting')); - if( qstats.status == 3 ) - unHideMe($n(row, 'hold_status_transit')); + if( qstats.status == 3 ) + unHideMe($n(row, 'hold_status_transit')); } } function myOPACDrawHoldTitle(hold) { - var method; + var method; - if( hold.hold_type() == 'T' || hold.hold_type() == 'M' ) { - if(hold.hold_type() == "M") method = FETCH_MRMODS; - if(hold.hold_type() == "T") method = FETCH_RMODS; - var req = new Request(method, hold.target()); - req.callback(myOPACFleshHoldTitle); - req.request.hold = hold; - req.request.alertEvent = false; - req.send(); + if( hold.hold_type() == 'T' || hold.hold_type() == 'M' ) { + if(hold.hold_type() == "M") method = FETCH_MRMODS; + if(hold.hold_type() == "T") method = FETCH_RMODS; + var req = new Request(method, hold.target()); + req.callback(myOPACFleshHoldTitle); + req.request.hold = hold; + req.request.alertEvent = false; + req.send(); - } else { - holdFetchObjects(hold, - function(a) { _myOPACFleshHoldTitle(hold, a);}); - } + } else { + holdFetchObjects(hold, + function(a) { _myOPACFleshHoldTitle(hold, a);}); + } } function myOPACFleshHoldTitle(r) { - var rec = r.getResultObject(); - _myOPACFleshHoldTitle(r.hold, {recordObject: rec}); + var rec = r.getResultObject(); + _myOPACFleshHoldTitle(r.hold, {recordObject: rec}); } function _myOPACFleshHoldTitle(hold, holdObjects) { - var record = holdObjects.recordObject; - var volume = holdObjects.volumeObject; - var copy = holdObjects.copyObject; + var record = holdObjects.recordObject; + var volume = holdObjects.volumeObject; + var copy = holdObjects.copyObject; - var row = $("myopac_holds_row_" + hold.id()); - var title_link = $n(row, "myopac_holds_title_link"); - var author_link = $n(row, "myopac_holds_author_link"); + var row = $("myopac_holds_row_" + hold.id()); + var title_link = $n(row, "myopac_holds_title_link"); + var author_link = $n(row, "myopac_holds_author_link"); - if(!record || checkILSEvent(record) ) { - addCSSClass(row, 'invalid_hold'); - $n(row, 'myopac_holds_edit_link').setAttribute('href', 'javascript:void(0);'); - $n(row, 'myopac_holds_edit_link').onclick = function(){alertId('invalid_hold');}; - return; - } + if(!record || checkILSEvent(record) ) { + addCSSClass(row, 'invalid_hold'); + $n(row, 'myopac_holds_edit_link').setAttribute('href', 'javascript:void(0);'); + $n(row, 'myopac_holds_edit_link').onclick = function(){alertId('invalid_hold');}; + return; + } - buildTitleDetailLink(record, title_link); - buildSearchLink(STYPE_AUTHOR, record.author(), author_link); + buildTitleDetailLink(record, title_link); + buildSearchLink(STYPE_AUTHOR, record.author(), author_link); - if( volume ) { - $n(row, 'volume').appendChild(text(volume.label())); - unHideMe($n(row, 'vol_copy')); - if(copy) $n(row, 'copy').appendChild(text(copy.barcode())); - } + if( volume ) { + $n(row, 'volume').appendChild(text(volume.label())); + unHideMe($n(row, 'vol_copy')); + if(copy) $n(row, 'copy').appendChild(text(copy.barcode())); + } - var form = $("myopac_holds_form_" + hold.id()); + var form = $("myopac_holds_form_" + hold.id()); - if(form) { - var mods_formats = record.types_of_resource(); + if(form) { + var mods_formats = record.types_of_resource(); - if( hold.hold_type() == 'M' ) { - var data = holdsParseMRFormats(hold.holdable_formats()); - mods_formats = data.mods_formats; - } + if( hold.hold_type() == 'M' ) { + var data = holdsParseMRFormats(hold.holdable_formats()); + mods_formats = data.mods_formats; + } - for( var i = 0; i < mods_formats.length; i++ ) { - var img = elem("img"); - setResourcePic(img, mods_formats[i]); - form.appendChild(img); - } - } + for( var i = 0; i < mods_formats.length; i++ ) { + var img = elem("img"); + setResourcePic(img, mods_formats[i]); + form.appendChild(img); + } + } } var finesShown = false; function myOPACShowFines() { - if(finesShown) return; finesShown = true; - var req = new Request(FETCH_FINES_SUMMARY, G.user.session, G.user.id() ); - req.callback(_myOPACShowFines); - req.send(); + if(finesShown) return; finesShown = true; + var req = new Request(FETCH_FINES_SUMMARY, G.user.session, G.user.id() ); + req.callback(_myOPACShowFines); + req.send(); } function _myOPACShowFines(r) { - hideMe($('myopac_fines_summary_loading')); - unHideMe($('myopac_fines_summary_row')); + hideMe($('myopac_fines_summary_loading')); + unHideMe($('myopac_fines_summary_row')); - var summary = r.getResultObject(); - var total = "0.00"; /* localization? */ - var paid = "0.00"; - var balance = "0.00"; - if( instanceOf(summary,mous) ) { + var summary = r.getResultObject(); + var total = "0.00"; /* localization? */ + var paid = "0.00"; + var balance = "0.00"; + if( instanceOf(summary,mous) ) { - total = _finesFormatNumber(summary.total_owed()); - paid = _finesFormatNumber(summary.total_paid()); - balance = _finesFormatNumber(summary.balance_owed()); + total = _finesFormatNumber(summary.total_owed()); + paid = _finesFormatNumber(summary.total_paid()); + balance = _finesFormatNumber(summary.balance_owed()); - var req = new Request(FETCH_TRANSACTIONS, G.user.session, G.user.id() ); - req.callback(myOPACShowTransactions); - req.send(); - } + var req = new Request(FETCH_TRANSACTIONS, G.user.session, G.user.id() ); + req.callback(myOPACShowTransactions); + req.send(); + } - $('myopac_fines_summary_total').appendChild(text(total)); - $('myopac_fines_summary_paid').appendChild(text(paid)); - $('myopac_fines_summary_balance').appendChild(text(balance)); + $('myopac_fines_summary_total').appendChild(text(total)); + $('myopac_fines_summary_paid').appendChild(text(paid)); + $('myopac_fines_summary_balance').appendChild(text(balance)); } function _finesFormatNumber(num) { - if(isNull(num)) num = 0; - num = num + ""; - if(num.length < 2 || !num.match(/\./)) num += ".00"; - if(num.match(/\./) && num.charAt(num.length-2) == '.') num += "0"; - return num; + if(isNull(num)) num = 0; + num = num + ""; + if(num.length < 2 || !num.match(/\./)) num += ".00"; + if(num.match(/\./) && num.charAt(num.length-2) == '.') num += "0"; + return num; } //function _trimTime(time) { if(!time) return ""; return time.replace(/\ .*/,""); } function _trimTime(time) { - if(!time) return ""; + if(!time) return ""; var d = dojo.date.stamp.fromISOString(time); if(!d) return ""; /* date parse failed */ return d.iso8601Format('YMD'); @@ -601,60 +601,60 @@ function _trimSeconds(time) { function myOPACShowTransactions(r) { - if(myopacGenericTransTemplate || myopacCircTransTemplate) return; + if(myopacGenericTransTemplate || myopacCircTransTemplate) return; - var transactions = r.getResultObject(); + var transactions = r.getResultObject(); - for( var idx in transactions ) { + for( var idx in transactions ) { - var trans = transactions[idx].transaction; - var record = transactions[idx].record; - var circ = transactions[idx].circ; + var trans = transactions[idx].transaction; + var record = transactions[idx].record; + var circ = transactions[idx].circ; - if(trans.xact_type() == 'circulation') - myOPACShowCircTransaction(trans, record, circ); + if(trans.xact_type() == 'circulation') + myOPACShowCircTransaction(trans, record, circ); - else if(trans.xact_type() == 'grocery' ) - myopacShowGenericTransaction( trans ); - } + else if(trans.xact_type() == 'grocery' ) + myopacShowGenericTransaction( trans ); + } } var myopacGenericTransTemplate; function myopacShowGenericTransaction( trans ) { - var tbody = $('myopac_trans_tbody'); + var tbody = $('myopac_trans_tbody'); - if(!myopacGenericTransTemplate) { - myopacGenericTransTemplate = - tbody.removeChild($('myopac_trans_row')); - removeChildren(tbody); - } + if(!myopacGenericTransTemplate) { + myopacGenericTransTemplate = + tbody.removeChild($('myopac_trans_row')); + removeChildren(tbody); + } - var row = myopacGenericTransTemplate.cloneNode(true); + var row = myopacGenericTransTemplate.cloneNode(true); - $n(row,'myopac_trans_start').appendChild( - text(_trimSeconds(trans.xact_start()))); + $n(row,'myopac_trans_start').appendChild( + text(_trimSeconds(trans.xact_start()))); - $n(row,'myopac_trans_last_payment').appendChild( - text(_trimSeconds(trans.last_payment_ts()))); + $n(row,'myopac_trans_last_payment').appendChild( + text(_trimSeconds(trans.last_payment_ts()))); - $n(row,'myopac_trans_init_amount').appendChild( - text(_finesFormatNumber(trans.total_owed()))); + $n(row,'myopac_trans_init_amount').appendChild( + text(_finesFormatNumber(trans.total_owed()))); - $n(row,'myopac_trans_total_paid').appendChild( - text(_finesFormatNumber(trans.total_paid()))); + $n(row,'myopac_trans_total_paid').appendChild( + text(_finesFormatNumber(trans.total_paid()))); - $n(row,'myopac_trans_balance').appendChild( - text(_finesFormatNumber(trans.balance_owed()))); + $n(row,'myopac_trans_balance').appendChild( + text(_finesFormatNumber(trans.balance_owed()))); - var req = new Request(FETCH_MONEY_BILLING, G.user.session, trans.id()); - req.send(true); - var bills = req.result(); - if(bills && bills[0]) - $n(row,'myopac_trans_bill_type').appendChild( - text(bills[0].billing_type())); + var req = new Request(FETCH_MONEY_BILLING, G.user.session, trans.id()); + req.send(true); + var bills = req.result(); + if(bills && bills[0]) + $n(row,'myopac_trans_bill_type').appendChild( + text(bills[0].billing_type())); - tbody.appendChild(row); - unHideMe($('myopac_trans_div')); + tbody.appendChild(row); + unHideMe($('myopac_trans_div')); } @@ -662,173 +662,173 @@ function myopacShowGenericTransaction( trans ) { /* draws a circulation transaction summary */ var myopacCircTransTemplate; function myOPACShowCircTransaction(trans, record, circ) { - var tbody = $('myopac_circ_trans_tbody'); + var tbody = $('myopac_circ_trans_tbody'); - if(!myopacCircTransTemplate) { - myopacCircTransTemplate = tbody.removeChild($('myopac_circ_trans_row')); - removeChildren(tbody); - } + if(!myopacCircTransTemplate) { + myopacCircTransTemplate = tbody.removeChild($('myopac_circ_trans_row')); + removeChildren(tbody); + } - var row = myopacCircTransTemplate.cloneNode(true); + var row = myopacCircTransTemplate.cloneNode(true); - if(record) { - buildTitleDetailLink(record, $n(row,'myopac_circ_trans_title')); + if(record) { + buildTitleDetailLink(record, $n(row,'myopac_circ_trans_title')); - $n(row,'myopac_circ_trans_author').appendChild(text( - normalize(truncate(record.author(), 65)))); + $n(row,'myopac_circ_trans_author').appendChild(text( + normalize(truncate(record.author(), 65)))); - } else { + } else { - var req = new Request( FETCH_COPY, circ.target_copy() ); - req.alertEvents = false; - req.send(true); - var copy = req.result(); - if( copy ) { - $n(row,'myopac_circ_trans_title').appendChild(text(copy.dummy_title())); - $n(row,'myopac_circ_trans_author').appendChild(text(copy.dummy_author())); - } - } + var req = new Request( FETCH_COPY, circ.target_copy() ); + req.alertEvents = false; + req.send(true); + var copy = req.result(); + if( copy ) { + $n(row,'myopac_circ_trans_title').appendChild(text(copy.dummy_title())); + $n(row,'myopac_circ_trans_author').appendChild(text(copy.dummy_author())); + } + } - $n(row,'myopac_circ_trans_start'). - appendChild(text(_trimTime(trans.xact_start()))); + $n(row,'myopac_circ_trans_start'). + appendChild(text(_trimTime(trans.xact_start()))); var due = _trimTime(circ.due_date()); - var checkin = _trimTime(circ.stop_fines_time()); + var checkin = _trimTime(circ.stop_fines_time()); - $n(row,'myopac_circ_trans_due').appendChild(text(due)) - if(checkin) - appendClear($n(row,'myopac_circ_trans_finished'), text(checkin)); - if(circ.stop_fines() == 'LOST') - appendClear($n(row,'myopac_circ_trans_finished'), text(circ.stop_fines())); - if(circ.stop_fines() == 'CLAIMSRETURNED') - appendClear($n(row,'myopac_circ_trans_finished'), text("")); + $n(row,'myopac_circ_trans_due').appendChild(text(due)) + if(checkin) + appendClear($n(row,'myopac_circ_trans_finished'), text(checkin)); + if(circ.stop_fines() == 'LOST') + appendClear($n(row,'myopac_circ_trans_finished'), text(circ.stop_fines())); + if(circ.stop_fines() == 'CLAIMSRETURNED') + appendClear($n(row,'myopac_circ_trans_finished'), text("")); - $n(row,'myopac_circ_trans_balance'). - appendChild(text(_finesFormatNumber(trans.balance_owed()))); + $n(row,'myopac_circ_trans_balance'). + appendChild(text(_finesFormatNumber(trans.balance_owed()))); - tbody.appendChild(row); - unHideMe($('myopac_circ_trans_div')); + tbody.appendChild(row); + unHideMe($('myopac_circ_trans_div')); } function myOPACSavePrefs() { - G.user.prefs[PREF_HITS_PER] = getSelectorVal($('prefs_hits_per')); - G.user.prefs[PREF_DEF_FONT] = getSelectorVal($('prefs_def_font')); - G.user.prefs[PREF_HOLD_NOTIFY] = getSelectorVal($('prefs_hold_notify')); - G.user.prefs[PREF_DEF_DEPTH] = getSelectorVal($('prefs_def_range')); + G.user.prefs[PREF_HITS_PER] = getSelectorVal($('prefs_hits_per')); + G.user.prefs[PREF_DEF_FONT] = getSelectorVal($('prefs_def_font')); + G.user.prefs[PREF_HOLD_NOTIFY] = getSelectorVal($('prefs_hold_notify')); + G.user.prefs[PREF_DEF_DEPTH] = getSelectorVal($('prefs_def_range')); - if( $('myopac_pref_home_lib').checked == true ) - G.user.prefs[PREF_DEF_LOCATION] = null; - else - G.user.prefs[PREF_DEF_LOCATION] = getSelectorVal($('prefs_def_location')); + if( $('myopac_pref_home_lib').checked == true ) + G.user.prefs[PREF_DEF_LOCATION] = null; + else + G.user.prefs[PREF_DEF_LOCATION] = getSelectorVal($('prefs_def_location')); - if(commitUserPrefs()) - alert($('prefs_update_success').innerHTML); - else alert($('prefs_update_failure').innerHTML); + if(commitUserPrefs()) + alert($('prefs_update_success').innerHTML); + else alert($('prefs_update_failure').innerHTML); } function myOPACShowDefFont() { - var font; - if(G.user.prefs[PREF_DEF_FONT]) - font = G.user.prefs[PREF_DEF_FONT]; - else font = "regular"; - setSelector($('prefs_def_font'), font); + var font; + if(G.user.prefs[PREF_DEF_FONT]) + font = G.user.prefs[PREF_DEF_FONT]; + else font = "regular"; + setSelector($('prefs_def_font'), font); } function myOPACShowHoldNotify() { - var pref = G.user.prefs[PREF_HOLD_NOTIFY]; + var pref = G.user.prefs[PREF_HOLD_NOTIFY]; - if(pref) { - if(pref.match(/email/i) && pref.match(/phone/i)) { - setSelector($('prefs_hold_notify'), 'phone:email'); - } else if( pref.match(/email/i) ) { - setSelector($('prefs_hold_notify'), 'email'); - } else if( pref.match(/phone/i) ) { - setSelector($('prefs_hold_notify'), 'phone'); - } + if(pref) { + if(pref.match(/email/i) && pref.match(/phone/i)) { + setSelector($('prefs_hold_notify'), 'phone:email'); + } else if( pref.match(/email/i) ) { + setSelector($('prefs_hold_notify'), 'email'); + } else if( pref.match(/phone/i) ) { + setSelector($('prefs_hold_notify'), 'phone'); + } - } else { - setSelector($('prefs_hold_notify'), 'phone:email'); - } + } else { + setSelector($('prefs_hold_notify'), 'phone:email'); + } } function myOPACShowPrefs() { - grabUserPrefs(); - myOPACShowHitsPer(); - myOPACShowDefFont(); - myOPACShowHoldNotify(); - myOPACShowDefLocation(); - hideMe($('myopac_prefs_loading')); + grabUserPrefs(); + myOPACShowHitsPer(); + myOPACShowDefFont(); + myOPACShowHoldNotify(); + myOPACShowDefLocation(); + hideMe($('myopac_prefs_loading')); } var defSearchLocationDrawn = false; var defDepthIndex = 0; function myOPACShowDefLocation() { - var selector = $('prefs_def_location'); - var rsel = $('prefs_def_range'); - - if(!defSearchLocationDrawn) { + var selector = $('prefs_def_location'); + var rsel = $('prefs_def_range'); - defSearchLocationDrawn = true; + if(!defSearchLocationDrawn) { - var org = G.user.prefs[PREF_DEF_LOCATION]; + defSearchLocationDrawn = true; - if(!org) { - $('myopac_pref_home_lib').checked = true; - $('prefs_def_location').disabled = true; - org = G.user.home_ou(); - } + var org = G.user.prefs[PREF_DEF_LOCATION]; - buildOrgSel(selector, globalOrgTree, 0); + if(!org) { + $('myopac_pref_home_lib').checked = true; + $('prefs_def_location').disabled = true; + org = G.user.home_ou(); + } - globalOrgTypes = globalOrgTypes.sort( - function(a, b) { - if( a.depth() < b.depth() ) return -1; - return 1; - } - ); + buildOrgSel(selector, globalOrgTree, 0); - iterate(globalOrgTypes, - function(t) { - if( t.depth() <= findOrgDepth(org) ) { - setSelectorVal(rsel, defDepthIndex++, t.opac_label(), t.depth()); - if( t.depth() == findOrgDepth(org) ) - setSelector(rsel, t.depth()); - } - } - ); - } + globalOrgTypes = globalOrgTypes.sort( + function(a, b) { + if( a.depth() < b.depth() ) return -1; + return 1; + } + ); + + iterate(globalOrgTypes, + function(t) { + if( t.depth() <= findOrgDepth(org) ) { + setSelectorVal(rsel, defDepthIndex++, t.opac_label(), t.depth()); + if( t.depth() == findOrgDepth(org) ) + setSelector(rsel, t.depth()); + } + } + ); + } - setSelector(selector, org); + setSelector(selector, org); } function myOPACShowHitsPer() { - var hits = 10; - if(G.user.prefs[PREF_HITS_PER]) - hits = G.user.prefs[PREF_HITS_PER]; - var hitsSel = $('prefs_hits_per'); - setSelector(hitsSel, hits); + var hits = 10; + if(G.user.prefs[PREF_HITS_PER]) + hits = G.user.prefs[PREF_HITS_PER]; + var hitsSel = $('prefs_hits_per'); + setSelector(hitsSel, hits); } var userShown = false; function myOPACShowSummary() { - if(userShown) return; userShown = true; - var req = new Request(FETCH_FLESHED_USER,G.user.session, G.user.id()); - req.callback(_myOPACSummaryShowUer); - req.send(); + if(userShown) return; userShown = true; + var req = new Request(FETCH_FLESHED_USER,G.user.session, G.user.id()); + req.callback(_myOPACSummaryShowUer); + req.send(); } var addrRowTemplate; var notesTemplate; function _myOPACSummaryShowUer(r) { - var user = r.getResultObject(); - fleshedUser = user; - if(!user) return; + var user = r.getResultObject(); + fleshedUser = user; + if(!user) return; var expireDate = dojo.date.stamp.fromISOString(user.expire_date()); if( expireDate < new Date() ) { @@ -836,71 +836,71 @@ function _myOPACSummaryShowUer(r) { unHideMe($('myopac.expired.alert')); } - var iv1 = user.ident_value()+''; + var iv1 = user.ident_value()+''; if (iv1.length > 4 && iv1.match(/\d{4}/)) iv1 = iv1.substring(0,4) + '***********'; - appendClear($('myopac_summary_prefix'),text(user.prefix())); - appendClear($('myopac_summary_first'),text(user.first_given_name())); - appendClear($('myopac_summary_middle'),text(user.second_given_name())); - appendClear($('myopac_summary_dayphone'),text(user.day_phone())); - appendClear($('myopac_summary_eveningphone'),text(user.evening_phone())); - appendClear($('myopac_summary_otherphone'),text(user.other_phone())); - appendClear($('myopac_summary_last'),text(user.family_name())); - appendClear($('myopac_summary_suffix'),text(user.suffix())); - appendClear($('myopac_summary_username'),text(user.usrname())); - appendClear($('myopac_summary_email'),text(user.email())); - appendClear($('myopac_summary_barcode'),text(user.card().barcode())); - appendClear($('myopac_summary_ident1'),text(iv1)); - appendClear($('myopac_summary_homelib'),text(findOrgUnit(user.home_ou()).name())); - appendClear($('myopac_summary_create_date'),text(_trimTime(user.create_date()))); - - var req = new Request( - FETCH_USER_NOTES, G.user.session, {pub:1, patronid:G.user.id()}); - req.callback(myopacDrawNotes); - req.send(); - - - var tbody = $('myopac_addr_tbody'); - var template; - - if(addrRowTemplate) { - template = addrRowTemplate; - } else { - template = tbody.removeChild($('myopac_addr_row')); - addrRowTemplate = template; - } - removeChildren(tbody); + appendClear($('myopac_summary_prefix'),text(user.prefix())); + appendClear($('myopac_summary_first'),text(user.first_given_name())); + appendClear($('myopac_summary_middle'),text(user.second_given_name())); + appendClear($('myopac_summary_dayphone'),text(user.day_phone())); + appendClear($('myopac_summary_eveningphone'),text(user.evening_phone())); + appendClear($('myopac_summary_otherphone'),text(user.other_phone())); + appendClear($('myopac_summary_last'),text(user.family_name())); + appendClear($('myopac_summary_suffix'),text(user.suffix())); + appendClear($('myopac_summary_username'),text(user.usrname())); + appendClear($('myopac_summary_email'),text(user.email())); + appendClear($('myopac_summary_barcode'),text(user.card().barcode())); + appendClear($('myopac_summary_ident1'),text(iv1)); + appendClear($('myopac_summary_homelib'),text(findOrgUnit(user.home_ou()).name())); + appendClear($('myopac_summary_create_date'),text(_trimTime(user.create_date()))); + + var req = new Request( + FETCH_USER_NOTES, G.user.session, {pub:1, patronid:G.user.id()}); + req.callback(myopacDrawNotes); + req.send(); + + + var tbody = $('myopac_addr_tbody'); + var template; + + if(addrRowTemplate) { + template = addrRowTemplate; + } else { + template = tbody.removeChild($('myopac_addr_row')); + addrRowTemplate = template; + } + removeChildren(tbody); var addrs = user.addresses(); - for( var a in addrs ) { + for( var a in addrs ) { var addr = addrs[a]; if(!allowPendingAddr && isTrue(addr.pending())) continue; if(addr.replaces() != null) continue; - var row = template.cloneNode(true); - myOPACDrawAddr(row, addr, addrs); - tbody.appendChild(row); - } + var row = template.cloneNode(true); + myOPACDrawAddr(row, addr, addrs); + tbody.appendChild(row); + } } function myopacDrawNotes(r) { - var notes = r.getResultObject(); - var tbody = $('myopac.notes.tbody'); - if(!notesTemplate) - notesTemplate = tbody.removeChild($('myopac.notes.tr')); - removeChildren(tbody); + var notes = r.getResultObject(); + var tbody = $('myopac.notes.tbody'); + if(!notesTemplate) + notesTemplate = tbody.removeChild($('myopac.notes.tr')); + removeChildren(tbody); - iterate(notes, - function(note) { - unHideMe($('myopac.notes.div')); - var row = notesTemplate.cloneNode(true); - $n(row, 'title').appendChild(text(note.title())); - $n(row, 'value').appendChild(text(note.value())); - tbody.appendChild(row); - } - ); + iterate(notes, + function(note) { + unHideMe($('myopac.notes.div')); + var row = notesTemplate.cloneNode(true); + $n(row, 'title').appendChild(text(note.title())); + $n(row, 'value').appendChild(text(note.value())); + tbody.appendChild(row); + } + ); } @@ -989,7 +989,7 @@ function myopacSaveAddress(row, addr, deleteMe) { addr.post_code($n(row, 'myopac_pending_addr_zip').value); } - var req = new Request( + var req = new Request( 'open-ils.actor:open-ils.actor.user.address.pending.cud', G.user.session, addr); @@ -1023,16 +1023,16 @@ function myopacSaveAddress(row, addr, deleteMe) { function myOPACUpdateUsername() { - var username = $('myopac_new_username').value; - if(username == null || username == "") { - alert($('myopac_username_error').innerHTML); - return; - } + var username = $('myopac_new_username').value; + if(username == null || username == "") { + alert($('myopac_username_error').innerHTML); + return; + } - if( username.match(/.*\s.*/) ) { - alert($('myopac_invalid_username').innerHTML); - return; - } + if( username.match(/.*\s.*/) ) { + alert($('myopac_invalid_username').innerHTML); + return; + } r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex'); if(r) REGEX_BARCODE = new RegExp(r); @@ -1042,91 +1042,91 @@ function myOPACUpdateUsername() { return; } - /* first see if the requested username is taken */ - var req = new Request(CHECK_USERNAME, G.user.session, username); - req.send(true); - var res = req.result(); - /* If the username does not already exist, res will be null; - * we can move on to updating the username. - * - * If the username does exist, then res will be the user ID. - * G.user.id() gives us the currently authenticated user ID. - * If res == G.user.id(), we try to update the username anyways. - */ - if( res !== null && res != G.user.id() ) { - alertId('myopac_username_dup'); - return; - } - - var req = new Request(UPDATE_USERNAME, G.user.session, username ); - req.send(true); - if(req.result()) { - - var evt; - var res = req.result(); - if(evt = checkILSEvent(res)) { - alertILSEvent(res); - return; - } - - G.user.usrname(username); - hideMe($('myopac_update_username_row')); - userShown = false; - alertId('myopac_username_success'); - myOPACShowSummary(); - return; - } - - alert($('myopac_username_failure').innerHTML); + /* first see if the requested username is taken */ + var req = new Request(CHECK_USERNAME, G.user.session, username); + req.send(true); + var res = req.result(); + /* If the username does not already exist, res will be null; + * we can move on to updating the username. + * + * If the username does exist, then res will be the user ID. + * G.user.id() gives us the currently authenticated user ID. + * If res == G.user.id(), we try to update the username anyways. + */ + if( res !== null && res != G.user.id() ) { + alertId('myopac_username_dup'); + return; + } + + var req = new Request(UPDATE_USERNAME, G.user.session, username ); + req.send(true); + if(req.result()) { + + var evt; + var res = req.result(); + if(evt = checkILSEvent(res)) { + alertILSEvent(res); + return; + } + + G.user.usrname(username); + hideMe($('myopac_update_username_row')); + userShown = false; + alertId('myopac_username_success'); + myOPACShowSummary(); + return; + } + + alert($('myopac_username_failure').innerHTML); } function myOPACUpdateEmail() { - var email = $('myopac_new_email').value; - if(email == null || email == "") { - alert($('myopac_email_error').innerHTML); - return; - } + var email = $('myopac_new_email').value; + if(email == null || email == "") { + alert($('myopac_email_error').innerHTML); + return; + } - var req = new Request(UPDATE_EMAIL, G.user.session, email ); - req.send(true); - if(req.result()) { - G.user.usrname(email); - hideMe($('myopac_update_email_row')); - userShown = false; - alertId('myopac_email_success'); - myOPACShowSummary(); - return; - } + var req = new Request(UPDATE_EMAIL, G.user.session, email ); + req.send(true); + if(req.result()) { + G.user.usrname(email); + hideMe($('myopac_update_email_row')); + userShown = false; + alertId('myopac_email_success'); + myOPACShowSummary(); + return; + } - alert($('myopac_email_failure').innerHTML); + alert($('myopac_email_failure').innerHTML); } function myOPACUpdatePassword() { - var curpassword = $('myopac_current_password').value; - var password = $('myopac_new_password').value; - var password2 = $('myopac_new_password2').value; + var curpassword = $('myopac_current_password').value; + var password = $('myopac_new_password').value; + var password2 = $('myopac_new_password2').value; - if( curpassword == null || curpassword == "" || - password == null || password == "" || - password2 == null || password2 == "" || password != password2 ) { - alert($('myopac_password_error').innerHTML); - return; - } + if( curpassword == null || curpassword == "" || + password == null || password == "" || + password2 == null || password2 == "" || password != password2 ) { + alert($('myopac_password_error').innerHTML); + return; + } - if(!strongPassword(password, true)) return; + if(!strongPassword(password, true)) return; - var req = new Request(UPDATE_PASSWORD, G.user.session, password, curpassword ); - req.send(true); - if(req.result()) { - hideMe($('myopac_update_password_row')); - userShown = false; - alertId('myopac_password_success'); - myOPACShowSummary(); - return; - } + var req = new Request(UPDATE_PASSWORD, G.user.session, password, curpassword ); + req.send(true); + if(req.result()) { + hideMe($('myopac_update_password_row')); + userShown = false; + alertId('myopac_password_success'); + myOPACShowSummary(); + return; + } - alert($('myopac_password_failure').innerHTML); + alert($('myopac_password_failure').innerHTML); } @@ -1135,203 +1135,203 @@ function myOPACUpdatePassword() { var containerTemplate; function myOPACShowBookbags(force) { - var tbody =$('myopac_bookbag_tbody') ; - - if(!containerTemplate) - containerTemplate = tbody.removeChild($('myopac_bookbag_tr')); - else if(!force) return; - - removeChildren(tbody); - - var containers = containerFetchAll(); - - var found = false; - for( var i in containers ) { - found = true; - var cont = containers[i]; - var row = containerTemplate.cloneNode(true); - row.id = 'myopac_bookbag_row_' + cont.id(); - var link = $n(row, 'myopac_expand_bookbag'); - var dlink = $n(row, 'myopac_container_delete'); - link.appendChild( text(cont.name()) ); - link.setAttribute('href', - 'javascript:myOPACExpandBookbag("' + cont.id() + '","' + cont.name() + '");'); - myOPACFetchBBItems( cont.id(), row ); - dlink.setAttribute('href', 'javascript:myOPACDeleteBookbag("'+cont.id()+'");'); - - if( isTrue(cont.pub()) ) { - unHideMe($n(row, 'myopac_bb_published_yes')); - var link = $n(row, 'myopac_bb_published_view'); - link.setAttribute('href', buildExtrasLink( 'feed/bookbag/html-full/'+cont.id(), false)); - link.setAttribute('target', '_blank' ); - unHideMe(link); - - link = $n(row, 'myopac_bb_published_atom'); - link.setAttribute('href', buildExtrasLink( 'feed/bookbag/rss2-full/'+cont.id(), false)); - link.setAttribute('target', '_blank' ); - unHideMe(link); - - link = $n(row, 'myopac_bb_make_unpublished'); - link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'", true);'); - unHideMe(link); + var tbody =$('myopac_bookbag_tbody') ; + + if(!containerTemplate) + containerTemplate = tbody.removeChild($('myopac_bookbag_tr')); + else if(!force) return; + + removeChildren(tbody); + + var containers = containerFetchAll(); + + var found = false; + for( var i in containers ) { + found = true; + var cont = containers[i]; + var row = containerTemplate.cloneNode(true); + row.id = 'myopac_bookbag_row_' + cont.id(); + var link = $n(row, 'myopac_expand_bookbag'); + var dlink = $n(row, 'myopac_container_delete'); + link.appendChild( text(cont.name()) ); + link.setAttribute('href', + 'javascript:myOPACExpandBookbag("' + cont.id() + '","' + cont.name() + '");'); + myOPACFetchBBItems( cont.id(), row ); + dlink.setAttribute('href', 'javascript:myOPACDeleteBookbag("'+cont.id()+'");'); + + if( isTrue(cont.pub()) ) { + unHideMe($n(row, 'myopac_bb_published_yes')); + var link = $n(row, 'myopac_bb_published_view'); + link.setAttribute('href', buildExtrasLink( 'feed/bookbag/html-full/'+cont.id(), false)); + link.setAttribute('target', '_blank' ); + unHideMe(link); + + link = $n(row, 'myopac_bb_published_atom'); + link.setAttribute('href', buildExtrasLink( 'feed/bookbag/rss2-full/'+cont.id(), false)); + link.setAttribute('target', '_blank' ); + unHideMe(link); + + link = $n(row, 'myopac_bb_make_unpublished'); + link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'", true);'); + unHideMe(link); - var RW = $n(row, 'myopac_bb_exp_refworks'); - if (RW && myopacEnableRefWorks) { - var here = (findOrgUnit(getLocation())).name(); - var org_name = here.replace(" ", "+"); - var cgi = new CGI(); - - RW.setAttribute('href', - myopacRefWorksHost + '/express/expressimport.asp?vendor=' - + org_name - + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F' - + cgi.server_name + '/opac/extras/feed/bookbag/marctxt-full/' - + cont.id() - ); - RW.setAttribute('target', 'RefWorksMain'); - unHideMe($n(row, 'myopac_bb_exp_refworks')); - } - } else { - unHideMe($n(row, 'myopac_bb_published_no')); - var link = $n(row, 'myopac_bb_make_published'); - link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'");'); - unHideMe(link); - } - - tbody.appendChild(row); - } - - if(!found) unHideMe($('myopac_bookbags_none')); - else unHideMe($('myopac_bookbag_table')); + var RW = $n(row, 'myopac_bb_exp_refworks'); + if (RW && myopacEnableRefWorks) { + var here = (findOrgUnit(getLocation())).name(); + var org_name = here.replace(" ", "+"); + var cgi = new CGI(); + + RW.setAttribute('href', + myopacRefWorksHost + '/express/expressimport.asp?vendor=' + + org_name + + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F' + + cgi.server_name + '/opac/extras/feed/bookbag/marctxt-full/' + + cont.id() + ); + RW.setAttribute('target', 'RefWorksMain'); + unHideMe($n(row, 'myopac_bb_exp_refworks')); + } + } else { + unHideMe($n(row, 'myopac_bb_published_no')); + var link = $n(row, 'myopac_bb_make_published'); + link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'");'); + unHideMe(link); + } + + tbody.appendChild(row); + } + + if(!found) unHideMe($('myopac_bookbags_none')); + else unHideMe($('myopac_bookbag_table')); } function myOPACMakeBBPublished(bbid, hideme) { - var bb = fleshedContainers[bbid]; + var bb = fleshedContainers[bbid]; - if(hideme) { - if(!confirm($('myopac_make_unpublished_confirm').innerHTML)) return; - bb.pub('f'); - } else { - if(!confirm($('myopac_make_published_confirm').innerHTML)) return; - bb.pub('t'); - } + if(hideme) { + if(!confirm($('myopac_make_unpublished_confirm').innerHTML)) return; + bb.pub('f'); + } else { + if(!confirm($('myopac_make_published_confirm').innerHTML)) return; + bb.pub('t'); + } - var result = containerUpdate(bb); + var result = containerUpdate(bb); - var code = checkILSEvent(result); - if(code) { alertILSEvent(result); return; } + var code = checkILSEvent(result); + if(code) { alertILSEvent(result); return; } - alert($('myopac_bb_update_success').innerHTML); - myOPACShowBookbags(true); + alert($('myopac_bb_update_success').innerHTML); + myOPACShowBookbags(true); } function myOPACDeleteBookbag(id) { - if( confirm( $('myopac_delete_bookbag_warn').innerHTML ) ) { - var result = containerDelete(id); - var code = checkILSEvent(result); - if(code) { alertILSEvent(result); return; } - alert($('myopac_bb_update_success').innerHTML); - hideMe($('myopac_bookbag_items_table')); - hideMe($('myopac_bookbag_items_name')); - hideMe($('myopac_bookbag_no_items')); - myOPACShowBookbags(true); - } + if( confirm( $('myopac_delete_bookbag_warn').innerHTML ) ) { + var result = containerDelete(id); + var code = checkILSEvent(result); + if(code) { alertILSEvent(result); return; } + alert($('myopac_bb_update_success').innerHTML); + hideMe($('myopac_bookbag_items_table')); + hideMe($('myopac_bookbag_items_name')); + hideMe($('myopac_bookbag_no_items')); + myOPACShowBookbags(true); + } } function myOPACFetchBBItems( id, row, block ) { - if(!block) { - containerFlesh( id, _myOPACSetBBItems, { row: row } ); - } else { - var cont = containerFlesh(id); - myOPACSetBBItems( cont, row ); - } + if(!block) { + containerFlesh( id, _myOPACSetBBItems, { row: row } ); + } else { + var cont = containerFlesh(id); + myOPACSetBBItems( cont, row ); + } } function _myOPACSetBBItems(r) { myOPACSetBBItems( r.getResultObject(), r.args.row ); } function myOPACSetBBItems( container, row ) { - fleshedContainers[container.id()] = container; - var node = $n(row, 'myopac_bookbag_item_count'); - removeChildren(node); - node.appendChild( text(container.items().length) ); + fleshedContainers[container.id()] = container; + var node = $n(row, 'myopac_bookbag_item_count'); + removeChildren(node); + node.appendChild( text(container.items().length) ); } var BBItemsRow; function myOPACExpandBookbag( id, name ) { - - var tbody = $('myopac_bookbag_items_tbody'); - if(!BBItemsRow) BBItemsRow = tbody.removeChild($('myopac_bookbag_items_row')); - removeChildren(tbody); - removeChildren($('myopac_bookbag_items_name')); - - $('myopac_bookbag_items_name').appendChild(text(name)); - - if( fleshedContainers[id] ) { - var len = fleshedContainers[id].items().length; - - if( len == 0 ) { - unHideMe($('myopac_bookbag_no_items')); - hideMe($('myopac_bookbag_items_table')); - return; - } - - hideMe($('myopac_bookbag_no_items')); - unHideMe($('myopac_bookbag_items_table')); - - for( var i = 0; i != len; i++ ) { - var row = BBItemsRow.cloneNode(true); - found = true; - - var item = fleshedContainers[id].items()[i]; - var tlink = $n(row,'myopac_bookbag_items_title'); - var alink = $n(row,'myopac_bookbag_items_author'); - - var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() ); - req.request.tlink = tlink; - req.request.alink = alink; - req.callback(myOPACShowBBItem); - req.send(); + + var tbody = $('myopac_bookbag_items_tbody'); + if(!BBItemsRow) BBItemsRow = tbody.removeChild($('myopac_bookbag_items_row')); + removeChildren(tbody); + removeChildren($('myopac_bookbag_items_name')); + + $('myopac_bookbag_items_name').appendChild(text(name)); + + if( fleshedContainers[id] ) { + var len = fleshedContainers[id].items().length; + + if( len == 0 ) { + unHideMe($('myopac_bookbag_no_items')); + hideMe($('myopac_bookbag_items_table')); + return; + } + + hideMe($('myopac_bookbag_no_items')); + unHideMe($('myopac_bookbag_items_table')); + + for( var i = 0; i != len; i++ ) { + var row = BBItemsRow.cloneNode(true); + found = true; + + var item = fleshedContainers[id].items()[i]; + var tlink = $n(row,'myopac_bookbag_items_title'); + var alink = $n(row,'myopac_bookbag_items_author'); + + var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() ); + req.request.tlink = tlink; + req.request.alink = alink; + req.callback(myOPACShowBBItem); + req.send(); - var clink = $n(row, 'myopac_bookbag_items_remove'); - clink.setAttribute('href', 'javascript:myOPACRemoveBBItem("'+item.id()+'","'+id+'","'+name+'");'); + var clink = $n(row, 'myopac_bookbag_items_remove'); + clink.setAttribute('href', 'javascript:myOPACRemoveBBItem("'+item.id()+'","'+id+'","'+name+'");'); - tbody.appendChild(row); - } - } + tbody.appendChild(row); + } + } } function myOPACRemoveBBItem( id, containerid, container_name ) { - if(!confirm($('myopac_remove_bb_item_confirm').innerHTML)) return; - var stat = containerRemoveItem( id ); - if(stat) alert($('myopac_bb_update_success').innerHTML); - myOPACFetchBBItems( containerid, $('myopac_bookbag_row_' + containerid), true); - myOPACExpandBookbag( containerid, container_name ); + if(!confirm($('myopac_remove_bb_item_confirm').innerHTML)) return; + var stat = containerRemoveItem( id ); + if(stat) alert($('myopac_bb_update_success').innerHTML); + myOPACFetchBBItems( containerid, $('myopac_bookbag_row_' + containerid), true); + myOPACExpandBookbag( containerid, container_name ); } function myOPACShowBBItem(r) { - var record = r.getResultObject(); - buildTitleDetailLink(record, r.tlink); - buildSearchLink(STYPE_AUTHOR, record.author(), r.alink); + var record = r.getResultObject(); + buildTitleDetailLink(record, r.tlink); + buildSearchLink(STYPE_AUTHOR, record.author(), r.alink); } function myOPACCreateBookbag() { - var name = $('myopac_bookbag_new_name').value; - if(!name) return; + var name = $('myopac_bookbag_new_name').value; + if(!name) return; - var exists = false; - for( var c in fleshedContainers ) { exists = true; break; } + var exists = false; + for( var c in fleshedContainers ) { exists = true; break; } - /* let them know what they are getting into... */ - if(!exists) if(!confirm($('bb_create_warning').innerHTML)) return; + /* let them know what they are getting into... */ + if(!exists) if(!confirm($('bb_create_warning').innerHTML)) return; - var result = containerCreate( name, $('bb_public_yes').checked ); - var code = checkILSEvent(result); - if(code) { alertILSEvent(result); return; } - if(result) alert($('myopac_bb_update_success').innerHTML); - myOPACShowBookbags(true); + var result = containerCreate( name, $('bb_public_yes').checked ); + var code = checkILSEvent(result); + if(code) { alertILSEvent(result); return; } + if(result) alert($('myopac_bb_update_success').innerHTML); + myOPACShowBookbags(true); } @@ -1343,13 +1343,13 @@ var nonCatCircIds; var nonCatTypes; /* if we have some circs, grab the non-cat types */ function myOPACDrawNonCatCircs(r) { - var ids = r.getResultObject(); - if(ids.length == 0) return; - nonCatCircIds = ids; - unHideMe($('non_cat_circs_div')); - var req = new Request(FETCH_NON_CAT_TYPES, G.user.home_ou()); - req.callback(myOPACDrawNonCatCircs2); - req.send(); + var ids = r.getResultObject(); + if(ids.length == 0) return; + nonCatCircIds = ids; + unHideMe($('non_cat_circs_div')); + var req = new Request(FETCH_NON_CAT_TYPES, G.user.home_ou()); + req.callback(myOPACDrawNonCatCircs2); + req.send(); } @@ -1357,42 +1357,42 @@ function myOPACDrawNonCatCircs(r) { var nonCatTbody; var nonCatRow; function myOPACDrawNonCatCircs2(r) { - nonCatTypes = r.getResultObject(); - nonCatTbody = $('non_cat_circs_tbody'); - if(!nonCatRow) nonCatRow = - nonCatTbody.removeChild($('non_cat_circs_row')); - removeChildren(nonCatTbody); - for( var i in nonCatCircIds ) { - var req = new Request(FETCH_NON_CAT_CIRC, G.user.session, nonCatCircIds[i]); - req.callback(myOPACDrawNonCatCirc); - req.send(); - } + nonCatTypes = r.getResultObject(); + nonCatTbody = $('non_cat_circs_tbody'); + if(!nonCatRow) nonCatRow = + nonCatTbody.removeChild($('non_cat_circs_row')); + removeChildren(nonCatTbody); + for( var i in nonCatCircIds ) { + var req = new Request(FETCH_NON_CAT_CIRC, G.user.session, nonCatCircIds[i]); + req.callback(myOPACDrawNonCatCirc); + req.send(); + } } /* draw a single circ */ function myOPACDrawNonCatCirc(r) { - var circ = r.getResultObject(); + var circ = r.getResultObject(); - var type = grep(nonCatTypes, - function(i){ - return (i.id() == circ.item_type()); - } - )[0]; + var type = grep(nonCatTypes, + function(i){ + return (i.id() == circ.item_type()); + } + )[0]; - var row = nonCatTbody.appendChild(nonCatRow.cloneNode(true)); - appendClear($n(row, 'circ_lib'), text(findOrgUnit(circ.circ_lib()).name())); - appendClear($n(row, 'item_type'), text(type.name())); + var row = nonCatTbody.appendChild(nonCatRow.cloneNode(true)); + appendClear($n(row, 'circ_lib'), text(findOrgUnit(circ.circ_lib()).name())); + appendClear($n(row, 'item_type'), text(type.name())); - var duration = interval_to_seconds(type.circ_duration()); - duration = parseInt(duration + '000'); + var duration = interval_to_seconds(type.circ_duration()); + duration = parseInt(duration + '000'); - var dtf = circ.circ_time(); + var dtf = circ.circ_time(); var start = dojo.date.stamp.fromISOString(circ.circ_time()); - var due = new Date( start.getTime() + duration ); - appendClear($n(row, 'circ_time'), text(due.iso8601Format('YMDHM', null, true, true))); + var due = new Date( start.getTime() + duration ); + appendClear($n(row, 'circ_time'), text(due.iso8601Format('YMDHM', null, true, true))); } @@ -1437,7 +1437,7 @@ var __success_count = 0; /* renews all selected circulations */ function myOPACRenewSelected() { var rows = myopacGetCheckedOutRows(); - if(!confirm($('myopac_renew_confirm').innerHTML)) return; + if(!confirm($('myopac_renew_confirm').innerHTML)) return; __success_count = 0; for( var i = 0; i < rows.length; i++ ) { @@ -1446,10 +1446,10 @@ function myOPACRenewSelected() { if( ! $n(row, 'selectme').checked ) continue; var circ_id = row.getAttribute('circid'); - var circ; - for( var j = 0; j != circsCache.length; j++ ) - if(circsCache[j].id() == circ_id) - circ = circsCache[j]; + var circ; + for( var j = 0; j != circsCache.length; j++ ) + if(circsCache[j].id() == circ_id) + circ = circsCache[j]; __renew_circs.push(circ); } @@ -1503,7 +1503,7 @@ function myHandleRenewResponse(r) { __renew_circs = []; - if( __success_count > 0 ) + if( __success_count > 0 ) alertIdText('myopac_renew_success', __success_count); hideMe($('my_renewing')); diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 66df72319f..ec017dd098 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -44,190 +44,190 @@ var rdetailEnd = null; /* serials are currently the only use of Dojo strings in the OPAC */ if (rdetailDisplaySerialHoldings) { - dojo.require("dijit.Menu"); - dojo.require("dijit.form.Button"); - dojo.requireLocalization("openils.opac", "opac"); - opac_strings = dojo.i18n.getLocalization("openils.opac", "opac"); + dojo.require("dijit.Menu"); + dojo.require("dijit.form.Button"); + dojo.requireLocalization("openils.opac", "opac"); + opac_strings = dojo.i18n.getLocalization("openils.opac", "opac"); } function rdetailReload() { - var args = {}; - args[PARAM_LOCATION] = getNewSearchLocation(); - args[PARAM_DEPTH] = depthSelGetDepth(); - goTo(buildOPACLink(args)); + var args = {}; + args[PARAM_LOCATION] = getNewSearchLocation(); + args[PARAM_DEPTH] = depthSelGetDepth(); + goTo(buildOPACLink(args)); } /* looks to see if we have a next and/or previous record in the record cache, if so, set up the nav links */ function rdetailSetPaging(ids) { - cachedRecords = {}; - cachedRecords.ids = ids; - - for( var i = 0; i < cachedRecords.ids.length; i++ ) { - var rec = cachedRecords.ids[i]; - if( rec == getRid() ) { - if( i > 0 ) prevRecord = cachedRecords.ids[i-1]; - if( i < cachedRecords.ids.length - 1 ) - nextRecord = cachedRecords.ids[i+1]; - break; - } - } - - $('np_offset').appendChild(text(i + 1)); - $('np_count').appendChild(text(getHitCount())); - - if(prevRecord) { - unHideMe($('np_table')); - unHideMe($('np_prev')); - unHideMe($('np_start')); - rdetailPrev = function() { _rdetailNav(prevRecord); }; - rdetailStart = function() { _rdetailNav(cachedRecords.ids[0]); }; - } - - if(nextRecord) { - unHideMe($('np_table')); - unHideMe($('np_next')); - unHideMe($('np_end')); - rdetailNext = function() { _rdetailNav(nextRecord); }; - rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); }; - } - - runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length); + cachedRecords = {}; + cachedRecords.ids = ids; + + for( var i = 0; i < cachedRecords.ids.length; i++ ) { + var rec = cachedRecords.ids[i]; + if( rec == getRid() ) { + if( i > 0 ) prevRecord = cachedRecords.ids[i-1]; + if( i < cachedRecords.ids.length - 1 ) + nextRecord = cachedRecords.ids[i+1]; + break; + } + } + + $('np_offset').appendChild(text(i + 1)); + $('np_count').appendChild(text(getHitCount())); + + if(prevRecord) { + unHideMe($('np_table')); + unHideMe($('np_prev')); + unHideMe($('np_start')); + rdetailPrev = function() { _rdetailNav(prevRecord); }; + rdetailStart = function() { _rdetailNav(cachedRecords.ids[0]); }; + } + + if(nextRecord) { + unHideMe($('np_table')); + unHideMe($('np_next')); + unHideMe($('np_end')); + rdetailNext = function() { _rdetailNav(nextRecord); }; + rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); }; + } + + runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length); } function _rdetailNav(id, offset) { - var args = {}; - args[PARAM_RID] = id; - goTo(buildOPACLink(args)); + var args = {}; + args[PARAM_RID] = id; + goTo(buildOPACLink(args)); } function rdetailDraw() { - detachAllEvt('common','depthChanged'); - detachAllEvt('common','locationUpdated'); - attachEvt('common','depthChanged', rdetailReload); - attachEvt('common','locationUpdated', rdetailReload); - attachEvt('common','holdUpdated', rdetailReload); - attachEvt('common','holdUpdateCanceled', rdetailReload); - - copyRowParent = G.ui.rdetail.cp_info_row.parentNode; - copyRow = copyRowParent.removeChild(G.ui.rdetail.cp_info_row); - statusRow = G.ui.rdetail.cp_status.parentNode; - statusRow.id = '__rdsrow'; - - G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies; - G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies; - - if(getLocation() == globalOrgTree.id()) - hideMe(G.ui.rdetail.cp_info_all); - - var req = new Request(FETCH_RMODS, getRid()); - req.callback(_rdetailDraw); - req.send(); - - if (rdetailDisplaySerialHoldings) { - var req = new Request(FETCH_MFHD_SUMMARY, getRid()); - req.callback(_holdingsDraw); - req.send(); - if (isXUL()) { - var here = findOrgUnit(getLocation()); - dojo.place("
0 || getDepth === 0 ) { while (getDepth() < findOrgDepth(here)) here = findOrgUnit( here.parent_ou() ); - if (!orgIsMine(findOrgUnit(here), findOrgUnit(holdings.owning_lib()))) { - return null; - } + if (!orgIsMine(findOrgUnit(here), findOrgUnit(holdings.owning_lib()))) { + return null; + } } - var hh = holdings.holdings(); - var hch = holdings.current_holdings(); - var hs = holdings.supplements(); - var hcs = holdings.current_supplements(); - var hi = holdings.indexes(); - var hci = holdings.current_indexes(); - var ho = holdings.online(); - var hm = holdings.missing(); - var hinc = holdings.incomplete(); - var hloc = holdings.location() || 'MFHD'; - - if ( hh.length == 0 && hch.length == 0 && hs.length == 0 && - hcs.length == 0 && hi.length == 0 && hci.length == 0 && - ho.length == 0 && hm.length == 0 && hinc.length == 0 - ) { - - if (isXUL()) { - /* - * If we have a record, but nothing to show for it, then the - * record is likely empty or corrupt. This gives cataloguers a - * chance to add holdings or correct the record - */ - hh = 'PLACEHOLDER'; - } else { - return null; - } - } - - dojo.place("
" + - dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) + - "
", "rdetail_details_table", "after" - ); - if (hh.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.HOLDINGS, hh); } - if (hch.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_HOLDINGS, hch); } - if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENTS, hs); } - if (hcs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_SUPPLEMENTS, hcs); } - if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEXES, hi); } - if (hci.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_INDEXES, hci); } - if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.ONLINE_VOLUMES, ho); } - if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.MISSING_VOLUMES, hm); } - if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INCOMPLETE_VOLUMES, hinc); } - - if (isXUL()) { - dojo.require('openils.Event'); - dojo.require('openils.PermaCrud'); - var mfhd_edit = new dijit.Menu({}); - new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first"); - new dijit.MenuItem({onClick:function(){ - var pcrud = new openils.PermaCrud({"authtoken": G.user.session}); - var mfhd_rec = pcrud.retrieve("sre", holdings.id()); - if (mfhd_rec) { - pcrud.eliminate(mfhd_rec); - alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()])); - } - }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last"); - // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last"); - var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"}); - mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last"); - mfhd_edit.startup(); - } + var hh = holdings.holdings(); + var hch = holdings.current_holdings(); + var hs = holdings.supplements(); + var hcs = holdings.current_supplements(); + var hi = holdings.indexes(); + var hci = holdings.current_indexes(); + var ho = holdings.online(); + var hm = holdings.missing(); + var hinc = holdings.incomplete(); + var hloc = holdings.location() || 'MFHD'; + + if ( hh.length == 0 && hch.length == 0 && hs.length == 0 && + hcs.length == 0 && hi.length == 0 && hci.length == 0 && + ho.length == 0 && hm.length == 0 && hinc.length == 0 + ) { + + if (isXUL()) { + /* + * If we have a record, but nothing to show for it, then the + * record is likely empty or corrupt. This gives cataloguers a + * chance to add holdings or correct the record + */ + hh = 'PLACEHOLDER'; + } else { + return null; + } + } + + dojo.place("
" + + dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) + + "
", "rdetail_details_table", "after" + ); + if (hh.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.HOLDINGS, hh); } + if (hch.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_HOLDINGS, hch); } + if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENTS, hs); } + if (hcs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_SUPPLEMENTS, hcs); } + if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEXES, hi); } + if (hci.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.CURRENT_INDEXES, hci); } + if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.ONLINE_VOLUMES, ho); } + if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.MISSING_VOLUMES, hm); } + if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INCOMPLETE_VOLUMES, hinc); } + + if (isXUL()) { + dojo.require('openils.Event'); + dojo.require('openils.PermaCrud'); + var mfhd_edit = new dijit.Menu({}); + new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first"); + new dijit.MenuItem({onClick:function(){ + var pcrud = new openils.PermaCrud({"authtoken": G.user.session}); + var mfhd_rec = pcrud.retrieve("sre", holdings.id()); + if (mfhd_rec) { + pcrud.eliminate(mfhd_rec); + alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()])); + } + }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last"); + // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last"); + var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"}); + mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last"); + mfhd_edit.startup(); + } } function _holdingsDrawMFHDEntry(entryNum, entryName, entry) { - var flatEntry = entry.toString().replace(/,/g, ', '); - dojo.place(" " + entryName + "" + flatEntry + "", "rdetail_holdings_tbody_" + entryNum, "last"); + var flatEntry = entry.toString().replace(/,/g, ', '); + dojo.place(" " + entryName + "" + flatEntry + "", "rdetail_holdings_tbody_" + entryNum, "last"); } function _rdetailDraw(r) { - record = r.getResultObject(); - - runEvt('rdetail', 'recordRetrieved', record.doc_id()); - - G.ui.rdetail.title.appendChild(text(record.title())); - buildSearchLink(STYPE_AUTHOR, record.author(), G.ui.rdetail.author); - G.ui.rdetail.isbn.appendChild(text(cleanISBN(record.isbn()))); - G.ui.rdetail.edition.appendChild(text(record.edition())); - G.ui.rdetail.pubdate.appendChild(text(record.pubdate())); - G.ui.rdetail.publisher.appendChild(text(record.publisher())); - $('rdetail_physical_desc').appendChild(text(record.physical_description())); - r = record.types_of_resource(); - if(r) { - G.ui.rdetail.tor.appendChild(text(r[0])); - setResourcePic( G.ui.rdetail.tor_pic, r[0]); - } - G.ui.rdetail.abstr.appendChild(text(record.synopsis())); - - try{ - if(record.isbn()) { - if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) { - unHideMe($('rdetail.jacket_attrib_div')); - var href = $('rdetail.jacket_attrib_link').getAttribute('href') +cleanISBN(record.isbn()); - $('rdetail.jacket_attrib_link').setAttribute('href', href); - } - rdetailCheckForGBPreview(); - - } else { - hideMe($("rdetail.jacket_attrib_div")); - hideMe($("rdetail_img_link")); - } - } catch(E) {} - - - // see if the record has any external links - var links = record.online_loc(); - for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) { - var href = links[i]; - // avoid matching "HTTP: The Complete Reference" - if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) { - unHideMe($('rdetail_online_row')); - // MODS can contain a display label (used for the text of the link) - // as well as a note about the URL; many legacy systems conflate the - // two and generate MARC records that expect the note to be used as - // the text of the link, with no display label; here's the canonical - // format: - // - // 856 40 $uhttp://localhost$yDisplay label$zPublic note - // - // Note that the MARC21slim2MODS XSL concatenates $3 and $y together - // (as $y was defined later in MARC21's life as the display label) - var displayLabel = '' + links[i+1]; - var note = '' + links[i+2]; - if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) { - if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) { - displayLabel = href; - } else { - displayLabel = note; - } - } - $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel)); - if (note && note != displayLabel) { - $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note)); - } - $('rdetail_online').appendChild(elem('br')); - } - } - - // Fill in our unAPI ID, if anyone cares - var abbrs = document.getElementsByTagName('abbr'); - var span; - for (var i = 0; i < abbrs.length; i = i + 1) { - if (abbrs[i].getAttribute('name') == 'unapi') { - span = abbrs[i]; - break; - } - } - buildunAPISpan( span, 'biblio-record_entry', record.doc_id() ); - - $('rdetail_place_hold').setAttribute( - 'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});'); - - var RW = $('rdetail_exp_refworks'); - if (RW && rdetailEnableRefWorks) { - - var here = (findOrgUnit(getLocation())).name(); - var org_name = here.replace(" ", "+"); - var cgi = new CGI(); - - RW.setAttribute( - 'href', - rdetailRefWorksHost + '/express/expressimport.asp?vendor=' - + org_name - + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F' - + cgi.server_name + '/opac/extras/supercat/marctxt/record/' - + record.doc_id() - ); - - RW.setAttribute('target', 'RefWorksMain'); - - unHideMe($('rdetail_exp_refworks_span')); - } - - $('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large')); - G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn()))); - runEvt("rdetail", "recordDrawn"); - recordsCache.push(record); - - rdetailSetExtrasSelector(); - - var breq = new Request(FETCH_BRE, [getRid()]); - breq.callback( rdetailCheckDeleted ); - breq.send(); - - resultBuildCaches( [ record ] ); - resultDrawSubjects(); - resultDrawSeries(); - - // grab added content - acCollectData(cleanISBN(record.isbn()), rdetailhandleAC); + record = r.getResultObject(); + + runEvt('rdetail', 'recordRetrieved', record.doc_id()); + + G.ui.rdetail.title.appendChild(text(record.title())); + buildSearchLink(STYPE_AUTHOR, record.author(), G.ui.rdetail.author); + G.ui.rdetail.isbn.appendChild(text(cleanISBN(record.isbn()))); + G.ui.rdetail.edition.appendChild(text(record.edition())); + G.ui.rdetail.pubdate.appendChild(text(record.pubdate())); + G.ui.rdetail.publisher.appendChild(text(record.publisher())); + $('rdetail_physical_desc').appendChild(text(record.physical_description())); + r = record.types_of_resource(); + if(r) { + G.ui.rdetail.tor.appendChild(text(r[0])); + setResourcePic( G.ui.rdetail.tor_pic, r[0]); + } + G.ui.rdetail.abstr.appendChild(text(record.synopsis())); + + try{ + if(record.isbn()) { + if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) { + unHideMe($('rdetail.jacket_attrib_div')); + var href = $('rdetail.jacket_attrib_link').getAttribute('href') +cleanISBN(record.isbn()); + $('rdetail.jacket_attrib_link').setAttribute('href', href); + } + rdetailCheckForGBPreview(); + + } else { + hideMe($("rdetail.jacket_attrib_div")); + hideMe($("rdetail_img_link")); + } + } catch(E) {} + + + // see if the record has any external links + var links = record.online_loc(); + for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) { + var href = links[i]; + // avoid matching "HTTP: The Complete Reference" + if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) { + unHideMe($('rdetail_online_row')); + // MODS can contain a display label (used for the text of the link) + // as well as a note about the URL; many legacy systems conflate the + // two and generate MARC records that expect the note to be used as + // the text of the link, with no display label; here's the canonical + // format: + // + // 856 40 $uhttp://localhost$yDisplay label$zPublic note + // + // Note that the MARC21slim2MODS XSL concatenates $3 and $y together + // (as $y was defined later in MARC21's life as the display label) + var displayLabel = '' + links[i+1]; + var note = '' + links[i+2]; + if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) { + if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) { + displayLabel = href; + } else { + displayLabel = note; + } + } + $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel)); + if (note && note != displayLabel) { + $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note)); + } + $('rdetail_online').appendChild(elem('br')); + } + } + + // Fill in our unAPI ID, if anyone cares + var abbrs = document.getElementsByTagName('abbr'); + var span; + for (var i = 0; i < abbrs.length; i = i + 1) { + if (abbrs[i].getAttribute('name') == 'unapi') { + span = abbrs[i]; + break; + } + } + buildunAPISpan( span, 'biblio-record_entry', record.doc_id() ); + + $('rdetail_place_hold').setAttribute( + 'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});'); + + var RW = $('rdetail_exp_refworks'); + if (RW && rdetailEnableRefWorks) { + + var here = (findOrgUnit(getLocation())).name(); + var org_name = here.replace(" ", "+"); + var cgi = new CGI(); + + RW.setAttribute( + 'href', + rdetailRefWorksHost + '/express/expressimport.asp?vendor=' + + org_name + + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F' + + cgi.server_name + '/opac/extras/supercat/marctxt/record/' + + record.doc_id() + ); + + RW.setAttribute('target', 'RefWorksMain'); + + unHideMe($('rdetail_exp_refworks_span')); + } + + $('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large')); + G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn()))); + runEvt("rdetail", "recordDrawn"); + recordsCache.push(record); + + rdetailSetExtrasSelector(); + + var breq = new Request(FETCH_BRE, [getRid()]); + breq.callback( rdetailCheckDeleted ); + breq.send(); + + resultBuildCaches( [ record ] ); + resultDrawSubjects(); + resultDrawSeries(); + + // grab added content + acCollectData(cleanISBN(record.isbn()), rdetailhandleAC); } function rdetailCheckDeleted(r) { - var br = r.getResultObject()[0]; - if( isTrue(br.deleted()) ) { - hideMe($('rdetail_place_hold')); - $('rdetail_more_actions_selector').disabled = true; - unHideMe($('rdetail_deleted_exp')); - } + var br = r.getResultObject()[0]; + if( isTrue(br.deleted()) ) { + hideMe($('rdetail_place_hold')); + $('rdetail_more_actions_selector').disabled = true; + unHideMe($('rdetail_deleted_exp')); + } } function rdetailSetExtrasSelector() { - if(!grabUser()) return; - unHideMe($('rdetail_more_actions')); + if(!grabUser()) return; + unHideMe($('rdetail_more_actions')); - var req = new Request( - FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' ); - req.callback(rdetailAddBookbags); - req.send(); + var req = new Request( + FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' ); + req.callback(rdetailAddBookbags); + req.send(); } function rdetailAddBookbags(r) { - var containers = r.getResultObject(); - var selector = $('rdetail_more_actions_selector'); - var found = false; - var index = 3; - doSelectorActions(selector); + var containers = r.getResultObject(); + var selector = $('rdetail_more_actions_selector'); + var found = false; + var index = 3; + doSelectorActions(selector); - for( var i = 0; i != containers.length; i++ ) { - found = true; - var container = containers[i]; - insertSelectorVal( selector, index++, container.name(), - "container_" + container.id(), rdetailAddToBookbag, 1 ); - } + for( var i = 0; i != containers.length; i++ ) { + found = true; + var container = containers[i]; + insertSelectorVal( selector, index++, container.name(), + "container_" + container.id(), rdetailAddToBookbag, 1 ); + } - nextContainerIndex = index; + nextContainerIndex = index; } var _actions = {}; function rdetailNewBookbag() { - var name = prompt($('rdetail_bb_new').innerHTML,""); - if(!name) return; - - var id; - if( id = containerCreate( name ) ) { - alert($('rdetail_bb_success').innerHTML); - var selector = $('rdetail_more_actions_selector'); - insertSelectorVal( selector, nextContainerIndex++, name, - "container_" + id, rdetailAddToBookbag, 1 ); - setSelector( selector, 'start' ); - } + var name = prompt($('rdetail_bb_new').innerHTML,""); + if(!name) return; + + var id; + if( id = containerCreate( name ) ) { + alert($('rdetail_bb_success').innerHTML); + var selector = $('rdetail_more_actions_selector'); + insertSelectorVal( selector, nextContainerIndex++, name, + "container_" + id, rdetailAddToBookbag, 1 ); + setSelector( selector, 'start' ); + } } function rdetailAddToBookbag() { - var selector = $('rdetail_more_actions_selector'); - var id = selector.options[selector.selectedIndex].value; - setSelector( selector, 'start' ); + var selector = $('rdetail_more_actions_selector'); + var id = selector.options[selector.selectedIndex].value; + setSelector( selector, 'start' ); - if( containerCreateItem( id.substring(10), record.doc_id() )) { - alert($('rdetail_bb_item_success').innerHTML); - } + if( containerCreateItem( id.substring(10), record.doc_id() )) { + alert($('rdetail_bb_item_success').innerHTML); + } } var rdetailMarcFetched = false; function rdetailShowExtra(type, args) { - hideMe($('rdetail_copy_info_div')); - hideMe($('rdetail_reviews_div')); - hideMe($('rdetail_toc_div')); - hideMe($('rdetail_anotes_div')); - hideMe($('rdetail_excerpt_div')); - hideMe($('rdetail_preview_div')); - hideMe($('rdetail_marc_div')); - hideMe($('cn_browse')); - hideMe($('rdetail_cn_browse_div')); - hideMe($('rdetail_notes_div')); - - removeCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_annotation_link'), 'rdetail_extras_selected'); - removeCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected'); - - switch(type) { - - case "copyinfo": - unHideMe($('rdetail_copy_info_div')); - addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected'); - break; - - case "reviews": - addCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_reviews_div')); - break; - - case "excerpt": - addCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_excerpt_div')); - break; - - case "preview": - addCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_preview_div')); - rdetailDisplayGBPreview(); - break; - - case "anotes": - addCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_anotes_div')); - break; - - case "toc": - addCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_toc_div')); - break; - - case "marc": - addCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_marc_div')); - if(rdetailMarcFetched) return; - unHideMe($('rdetail_extras_loading')); - rdetailMarcFetched = true; - var req = new Request( FETCH_MARC_HTML, record.doc_id() ); - req.callback(rdetailViewMarc); - req.send(); - break; - - case 'cn': - addCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected'); - unHideMe($('rdetail_cn_browse_div')); - rdetailShowCNBrowse(defaultCN, getLocation(), null, true); - break; - - } + hideMe($('rdetail_copy_info_div')); + hideMe($('rdetail_reviews_div')); + hideMe($('rdetail_toc_div')); + hideMe($('rdetail_anotes_div')); + hideMe($('rdetail_excerpt_div')); + hideMe($('rdetail_preview_div')); + hideMe($('rdetail_marc_div')); + hideMe($('cn_browse')); + hideMe($('rdetail_cn_browse_div')); + hideMe($('rdetail_notes_div')); + + removeCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_annotation_link'), 'rdetail_extras_selected'); + removeCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected'); + + switch(type) { + + case "copyinfo": + unHideMe($('rdetail_copy_info_div')); + addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected'); + break; + + case "reviews": + addCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_reviews_div')); + break; + + case "excerpt": + addCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_excerpt_div')); + break; + + case "preview": + addCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_preview_div')); + rdetailDisplayGBPreview(); + break; + + case "anotes": + addCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_anotes_div')); + break; + + case "toc": + addCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_toc_div')); + break; + + case "marc": + addCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_marc_div')); + if(rdetailMarcFetched) return; + unHideMe($('rdetail_extras_loading')); + rdetailMarcFetched = true; + var req = new Request( FETCH_MARC_HTML, record.doc_id() ); + req.callback(rdetailViewMarc); + req.send(); + break; + + case 'cn': + addCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected'); + unHideMe($('rdetail_cn_browse_div')); + rdetailShowCNBrowse(defaultCN, getLocation(), null, true); + break; + + } } function rdetailVolumeDetails(args) { - var row = $(args.rowid); - var tbody = row.parentNode; - cpdBuild( tbody, row, record, args.cn, args.org, args.depth, args.copy_location ); - return; + var row = $(args.rowid); + var tbody = row.parentNode; + cpdBuild( tbody, row, record, args.cn, args.org, args.depth, args.copy_location ); + return; } function rdetailBuildCNList() { - var select = $('cn_browse_selector'); - var index = 0; - var arr = []; - for( var cn in callnumberCache ) arr.push( cn ); - arr.sort(); - - if( arr.length == 0 ) { - hideMe($('rdetail_cn_browse_select_div')); - return; - } - - for( var i in arr ) { - var cn = arr[i]; - var opt = new Option(cn); - select.options[index++] = opt; - } - select.onchange = rdetailGatherCN; + var select = $('cn_browse_selector'); + var index = 0; + var arr = []; + for( var cn in callnumberCache ) arr.push( cn ); + arr.sort(); + + if( arr.length == 0 ) { + hideMe($('rdetail_cn_browse_select_div')); + return; + } + + for( var i in arr ) { + var cn = arr[i]; + var opt = new Option(cn); + select.options[index++] = opt; + } + select.onchange = rdetailGatherCN; } function rdetailGatherCN() { - var cn = getSelectorVal($('cn_browse_selector')); - rdetailShowCNBrowse( cn, getLocation(), getDepth(), true ); - setSelector( $('cn_browse_selector'), cn ); + var cn = getSelectorVal($('cn_browse_selector')); + rdetailShowCNBrowse( cn, getLocation(), getDepth(), true ); + setSelector( $('cn_browse_selector'), cn ); } function rdetailShowCNBrowse( cn, loc, depth, fromOnclick ) { - if(!cn) { - unHideMe($('cn_browse_none')); - hideMe($('rdetail_cn_browse_select_div')); - return; - } - - unHideMe($('rdetail_cn_browse_select_div')); - rdetailBuildCNList(); - setSelector( $('cn_browse_selector'), cn ); - hideMe($('rdetail_copy_info_div')); - hideMe($('rdetail_reviews_div')); - hideMe($('rdetail_toc_div')); - hideMe($('rdetail_marc_div')); - unHideMe($('rdetail_cn_browse_div')); - unHideMe($('cn_browse')); - if( !rdetailLocalOnly && ! fromOnclick ) depth = findOrgDepth(globalOrgTree); - cnBrowseGo(cn, loc, depth); + if(!cn) { + unHideMe($('cn_browse_none')); + hideMe($('rdetail_cn_browse_select_div')); + return; + } + + unHideMe($('rdetail_cn_browse_select_div')); + rdetailBuildCNList(); + setSelector( $('cn_browse_selector'), cn ); + hideMe($('rdetail_copy_info_div')); + hideMe($('rdetail_reviews_div')); + hideMe($('rdetail_toc_div')); + hideMe($('rdetail_marc_div')); + unHideMe($('rdetail_cn_browse_div')); + unHideMe($('cn_browse')); + if( !rdetailLocalOnly && ! fromOnclick ) depth = findOrgDepth(globalOrgTree); + cnBrowseGo(cn, loc, depth); } function rdetailhandleAC(data) { - if( data.reviews.html ) { - $('rdetail_review_container').innerHTML = data.reviews.html; - unHideMe($('rdetail_reviews_link')); - } - - if( data.toc.html ) { - $('rdetail_toc_div').innerHTML = data.toc.html; - unHideMe($('rdetail_toc_link')); - } - - if( data.excerpt.html ) { - $('rdetail_excerpt_div').innerHTML = data.excerpt.html; - unHideMe($('rdetail_excerpt_link')); - } - - if( data.anotes.html ) { - $('rdetail_anotes_div').innerHTML = data.anotes.html; - unHideMe($('rdetail_anotes_link')); - } + if( data.reviews.html ) { + $('rdetail_review_container').innerHTML = data.reviews.html; + unHideMe($('rdetail_reviews_link')); + } + + if( data.toc.html ) { + $('rdetail_toc_div').innerHTML = data.toc.html; + unHideMe($('rdetail_toc_link')); + } + + if( data.excerpt.html ) { + $('rdetail_excerpt_div').innerHTML = data.excerpt.html; + unHideMe($('rdetail_excerpt_link')); + } + + if( data.anotes.html ) { + $('rdetail_anotes_div').innerHTML = data.anotes.html; + unHideMe($('rdetail_anotes_link')); + } } function rdetailShowReviews(r) { - hideMe($('rdetail_extras_loading')); - var res = r.getResultObject(); - var par = $('rdetail_reviews_div'); - var template = par.removeChild($('rdetail_review_template')); - if( res && res.length > 0 ) { - unHideMe($('rdetail_reviews_link')); - for( var i = 0; i != res.length; i++ ) { - var rev = res[i]; - if( rev.text && rev.info ) { - var node = template.cloneNode(true); - $n(node, 'review_header').appendChild(text(rev.info)); - $n(node, 'review_text').appendChild(text(rev.text)); - par.appendChild(node); - } - } - } + hideMe($('rdetail_extras_loading')); + var res = r.getResultObject(); + var par = $('rdetail_reviews_div'); + var template = par.removeChild($('rdetail_review_template')); + if( res && res.length > 0 ) { + unHideMe($('rdetail_reviews_link')); + for( var i = 0; i != res.length; i++ ) { + var rev = res[i]; + if( rev.text && rev.info ) { + var node = template.cloneNode(true); + $n(node, 'review_header').appendChild(text(rev.info)); + $n(node, 'review_text').appendChild(text(rev.text)); + par.appendChild(node); + } + } + } } function rdetailShowTOC(r) { - hideMe($('rdetail_extras_loading')); - var resp = r.getResultObject(); - if(resp) { - unHideMe($('rdetail_toc_link')); - $('rdetail_toc_div').innerHTML = resp; - } + hideMe($('rdetail_extras_loading')); + var resp = r.getResultObject(); + if(resp) { + unHideMe($('rdetail_toc_link')); + $('rdetail_toc_div').innerHTML = resp; + } } function rdetailBuildInfoRows() { - var req; - var method = FETCH_COPY_COUNTS_SUMMARY; - if (rdetailShowCopyLocation) - method = FETCH_COPY_LOCATION_COUNTS_SUMMARY; - - if( rdetailShowLocal ) - req = new Request(method, record.doc_id(), getLocation(), getDepth()) - else - req = new Request(method, record.doc_id()); - req.callback(_rdetailBuildInfoRows); - req.send(); + var req; + var method = FETCH_COPY_COUNTS_SUMMARY; + if (rdetailShowCopyLocation) + method = FETCH_COPY_LOCATION_COUNTS_SUMMARY; + + if( rdetailShowLocal ) + req = new Request(method, record.doc_id(), getLocation(), getDepth()) + else + req = new Request(method, record.doc_id()); + req.callback(_rdetailBuildInfoRows); + req.send(); } function _rdetailRows(node) { - if( rdetailShowLocal && getLocation() != globalOrgTree.id() ) { - var loc = findOrgUnit(getLocation()); - if( node ) { - if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return; - } else { - for( var i = 0; i < globalOrgTree.children().length; i++ ) { - var org = findOrgUnit(globalOrgTree.children()[i]); - if( orgIsMine(org, loc) ) { - node = org; - break; - } - } - } - } + if( rdetailShowLocal && getLocation() != globalOrgTree.id() ) { + var loc = findOrgUnit(getLocation()); + if( node ) { + if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return; + } else { + for( var i = 0; i < globalOrgTree.children().length; i++ ) { + var org = findOrgUnit(globalOrgTree.children()[i]); + if( orgIsMine(org, loc) ) { + node = org; + break; + } + } + } + } - if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols()) - node = globalOrgTree; + if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols()) + node = globalOrgTree; - /* don't show hidden orgs */ + /* don't show hidden orgs */ - if(node) { + if(node) { - if(!isXUL() && !isTrue(node.opac_visible())) return; + if(!isXUL() && !isTrue(node.opac_visible())) return; - var row = copyRow.cloneNode(true); - row.id = "cp_info_" + node.id(); + var row = copyRow.cloneNode(true); + row.id = "cp_info_" + node.id(); - var libtd = findNodeByName( row, config.names.rdetail.lib_cell ); - var cntd = findNodeByName( row, config.names.rdetail.cn_cell ); - var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell ); - var actions = $n(row, 'rdetail_actions_cell'); + var libtd = findNodeByName( row, config.names.rdetail.lib_cell ); + var cntd = findNodeByName( row, config.names.rdetail.cn_cell ); + var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell ); + var actions = $n(row, 'rdetail_actions_cell'); - var p = libtd.getElementsByTagName('a')[0]; - libtd.insertBefore(text(node.name()), p); - libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;"); + var p = libtd.getElementsByTagName('a')[0]; + libtd.insertBefore(text(node.name()), p); + libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;"); - if(!findOrgType(node.ou_type()).can_have_vols()) { + if(!findOrgType(node.ou_type()).can_have_vols()) { - row.removeChild(cntd); - row.removeChild(cpctd); - row.removeChild(actions); - row.setAttribute('novols', '1'); + row.removeChild(cntd); + row.removeChild(cpctd); + row.removeChild(actions); + row.setAttribute('novols', '1'); - libtd.setAttribute("colspan", numStatuses + 3 ); - libtd.colSpan = numStatuses + 3; - addCSSClass(row, 'copy_info_region_row'); - } + libtd.setAttribute("colspan", numStatuses + 3 ); + libtd.colSpan = numStatuses + 3; + addCSSClass(row, 'copy_info_region_row'); + } - copyRowParent.appendChild(row); + copyRowParent.appendChild(row); - } else { node = globalOrgTree; } + } else { node = globalOrgTree; } - for( var c in node.children() ) - _rdetailRows(node.children()[c]); + for( var c in node.children() ) + _rdetailRows(node.children()[c]); } function rdetailCNPrint(orgid, cn) { - var div = cpdBuildPrintWindow( record, orgid); - var template = div.removeChild($n(div, 'cnrow')); - var rowNode = $("cp_info_" + orgid); - cpdStylePopupWindow(div); - openWindow(div.innerHTML); + var div = cpdBuildPrintWindow( record, orgid); + var template = div.removeChild($n(div, 'cnrow')); + var rowNode = $("cp_info_" + orgid); + cpdStylePopupWindow(div); + openWindow(div.innerHTML); } var localCNFound = false; var ctr = 0; function _rdetailBuildInfoRows(r) { - if (rdetailShowCopyLocation) - unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ) ); + if (rdetailShowCopyLocation) + unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ) ); - removeChildren(copyRowParent); + removeChildren(copyRowParent); - _rdetailRows(); + _rdetailRows(); - var summary = r.getResultObject(); - if(!summary) return; + var summary = r.getResultObject(); + if(!summary) return; - var found = false; - for( var i = 0; i < summary.length; i++ ) { + var found = false; + for( var i = 0; i < summary.length; i++ ) { - var arr = summary[i]; - globalCNCache[arr[1]] = 1; - var thisOrg = findOrgUnit(arr[0]); - var rowNode = $("cp_info_" + thisOrg.id()); - if(!rowNode) continue; + var arr = summary[i]; + globalCNCache[arr[1]] = 1; + var thisOrg = findOrgUnit(arr[0]); + var rowNode = $("cp_info_" + thisOrg.id()); + if(!rowNode) continue; - if(rowNode.getAttribute("used")) { + if(rowNode.getAttribute("used")) { - if( rowNode.nextSibling ) { - sib = rowNode.nextSibling; - o ='cp_info_'+thisOrg.id()+'_'; - /* push the new row on as the last row for this org unit */ - while( sib && sib.id.match(o) ) { - sib = sib.nextSibling; - } - if(sib) - rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib); - else - rowNode = copyRowParent.appendChild(copyRow.cloneNode(true)); - } else { - rowNode = copyRowParent.appendChild(copyRow.cloneNode(true)); - } + if( rowNode.nextSibling ) { + sib = rowNode.nextSibling; + o ='cp_info_'+thisOrg.id()+'_'; + /* push the new row on as the last row for this org unit */ + while( sib && sib.id.match(o) ) { + sib = sib.nextSibling; + } + if(sib) + rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib); + else + rowNode = copyRowParent.appendChild(copyRow.cloneNode(true)); + } else { + rowNode = copyRowParent.appendChild(copyRow.cloneNode(true)); + } - var n = findNodeByName( rowNode, config.names.rdetail.lib_cell ); - n.appendChild(text(thisOrg.name())); - n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;"); - rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr); + var n = findNodeByName( rowNode, config.names.rdetail.lib_cell ); + n.appendChild(text(thisOrg.name())); + n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;"); + rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr); - } else { - rowNode.setAttribute("used", "1"); - } + } else { + rowNode.setAttribute("used", "1"); + } - var cpc_temp = rowNode.removeChild( - findNodeByName(rowNode, config.names.rdetail.cp_count_cell)); + var cpc_temp = rowNode.removeChild( + findNodeByName(rowNode, config.names.rdetail.cp_count_cell)); - var statuses = arr[2]; - var cl = ''; - if (rdetailShowCopyLocation) { - cl = arr[2]; - statuses = arr[3]; - } + var statuses = arr[2]; + var cl = ''; + if (rdetailShowCopyLocation) { + cl = arr[2]; + statuses = arr[3]; + } - rdetailApplyStatuses(rowNode, cpc_temp, statuses); + rdetailApplyStatuses(rowNode, cpc_temp, statuses); - var isLocal = false; - if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) { - found = true; - isLocal = true; - if(!localCNFound) { - localCNFound = true; - defaultCN = arr[1]; - } - } + var isLocal = false; + if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) { + found = true; + isLocal = true; + if(!localCNFound) { + localCNFound = true; + defaultCN = arr[1]; + } + } - //if(isLocal) unHideMe(rowNode); - unHideMe(rowNode); + //if(isLocal) unHideMe(rowNode); + unHideMe(rowNode); - rdetailSetPath( thisOrg, isLocal ); - rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, cl ); + rdetailSetPath( thisOrg, isLocal ); + rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, cl ); - if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1]; - } + if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1]; + } - if(!found) unHideMe(G.ui.rdetail.cp_info_none); + if(!found) unHideMe(G.ui.rdetail.cp_info_none); } function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) { - if(local) { - var cache = callnumberCache[cn]; - if( cache ) cache.count++; - else callnumberCache[cn] = { count : 1 }; - } - - var depth = getDepth(); - if( !local ) depth = findOrgDepth(globalOrgTree); - - $n(row, 'rdetail_callnumber_cell').appendChild(text(cn)); - - if (rdetailShowCopyLocation) { - var cl_cell = $n(row, 'rdetail_copylocation_cell'); - cl_cell.appendChild(text(cl)); - unHideMe(cl_cell); - } - - _debug('setting action clicks for cn ' + cn); - - var dHref = 'javascript:rdetailVolumeDetails('+ - '{copy_location : "'+cl+'", rowid : "'+row.id+'", cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});'; - - var bHref = 'javascript:rdetailShowCNBrowse("' + cn + '", '+orgNode.id()+', "'+depth+'");'; - - unHideMe( $n(row, 'details') ) - $n(row, 'details').setAttribute('href', dHref); - unHideMe( $n(row, 'browse') ) - $n(row, 'browse').setAttribute('href', bHref); - - if(isXUL()) { - unHideMe($n(row, 'hold_div')); - $n(row, 'hold').onclick = function() { - var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id()); - req.callback( - function(r) { - var vol = r.getResultObject(); - holdsDrawEditor({type: 'V', volumeObject : vol}); - } - ); - req.send(); - }; - } + if(local) { + var cache = callnumberCache[cn]; + if( cache ) cache.count++; + else callnumberCache[cn] = { count : 1 }; + } + + var depth = getDepth(); + if( !local ) depth = findOrgDepth(globalOrgTree); + + $n(row, 'rdetail_callnumber_cell').appendChild(text(cn)); + + if (rdetailShowCopyLocation) { + var cl_cell = $n(row, 'rdetail_copylocation_cell'); + cl_cell.appendChild(text(cl)); + unHideMe(cl_cell); + } + + _debug('setting action clicks for cn ' + cn); + + var dHref = 'javascript:rdetailVolumeDetails('+ + '{copy_location : "'+cl+'", rowid : "'+row.id+'", cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});'; + + var bHref = 'javascript:rdetailShowCNBrowse("' + cn + '", '+orgNode.id()+', "'+depth+'");'; + + unHideMe( $n(row, 'details') ) + $n(row, 'details').setAttribute('href', dHref); + unHideMe( $n(row, 'browse') ) + $n(row, 'browse').setAttribute('href', bHref); + + if(isXUL()) { + unHideMe($n(row, 'hold_div')); + $n(row, 'hold').onclick = function() { + var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id()); + req.callback( + function(r) { + var vol = r.getResultObject(); + holdsDrawEditor({type: 'V', volumeObject : vol}); + } + ); + req.send(); + }; + } } // sets the path to org as 'active' and displays the path if it's local function rdetailSetPath(org, local) { - if( findOrgDepth(org) == 0 ) return; - var row = $("cp_info_" + org.id()); - row.setAttribute("hasinfo", "1"); - unHideMe(row); - rdetailSetPath(findOrgUnit(org.parent_ou()), local); + if( findOrgDepth(org) == 0 ) return; + var row = $("cp_info_" + org.id()); + row.setAttribute("hasinfo", "1"); + unHideMe(row); + rdetailSetPath(findOrgUnit(org.parent_ou()), local); } //Append all the statuses for a given summary to the //copy summary table function rdetailApplyStatuses( row, template, statuses ) { - for( var j in _statusPositions ) { - var stat = _statusPositions[j]; - var val = statuses[stat.id()]; - var nn = template.cloneNode(true); - if(val) nn.appendChild(text(val)); - else nn.appendChild(text(0)); - row.appendChild(nn); - } + for( var j in _statusPositions ) { + var stat = _statusPositions[j]; + var val = statuses[stat.id()]; + var nn = template.cloneNode(true); + if(val) nn.appendChild(text(val)); + else nn.appendChild(text(0)); + row.appendChild(nn); + } } //Add one td (creating a new column) to the copy summary //table for each opac_visible copy status function rdetailBuildStatusColumns() { - rdetailGrabCopyStatuses(); - var parent = statusRow; - var template = parent.removeChild(G.ui.rdetail.cp_status); + rdetailGrabCopyStatuses(); + var parent = statusRow; + var template = parent.removeChild(G.ui.rdetail.cp_status); - var i = 0; - for( i = 0; i < cp_statuses.length; i++ ) { + var i = 0; + for( i = 0; i < cp_statuses.length; i++ ) { - var c = cp_statuses[i]; - if( c && isTrue(c.opac_visible()) ) { - var name = c.name(); - _statusPositions[i] = c; - var node = template.cloneNode(true); - var data = findNodeByName( node, config.names.rdetail.cp_status); + var c = cp_statuses[i]; + if( c && isTrue(c.opac_visible()) ) { + var name = c.name(); + _statusPositions[i] = c; + var node = template.cloneNode(true); + var data = findNodeByName( node, config.names.rdetail.cp_status); - data.appendChild(text(name)); - parent.appendChild(node); - } - } + data.appendChild(text(name)); + parent.appendChild(node); + } + } - numStatuses = 0; - for(x in _statusPositions) numStatuses++; + numStatuses = 0; + for(x in _statusPositions) numStatuses++; } function rdetailGrabCopyStatuses() { - if(cp_statuses) return cp_statuses; - var req = new Request(FETCH_COPY_STATUSES); - req.send(true); - cp_statuses = req.result(); - cp_statuses = cp_statuses.sort(_rdetailSortStatuses); + if(cp_statuses) return cp_statuses; + var req = new Request(FETCH_COPY_STATUSES); + req.send(true); + cp_statuses = req.result(); + cp_statuses = cp_statuses.sort(_rdetailSortStatuses); } function _rdetailSortStatuses(a, b) { - return parseInt(a.id()) - parseInt(b.id()); + return parseInt(a.id()) - parseInt(b.id()); } /** * Check for a Google Book preview */ function rdetailCheckForGBPreview() { - if (!rdetailGoogleBookPreview) return; - searchForGBPreview( cleanISBN(record.isbn()) ); + if (!rdetailGoogleBookPreview) return; + searchForGBPreview( cleanISBN(record.isbn()) ); } /** @@ -982,25 +982,25 @@ function rdetailCheckForGBPreview() { */ function searchForGBPreview( isbn ) { - // Delete any previous Google Booksearch JSON queries. - var GBPJsonScript = document.getElementById("GBPJsonScript"); - if (GBPJsonScript) { - GBPJsonScript.parentNode.removeChild(GBPJsonScript); - } - - // Add a script element with the src as the user's Google Booksearch query. - // JSON output is specified by including the alt=json-in-script argument - // and the callback function is also specified as a URI argument. - var GBPScriptElement = document.createElement("script"); - - GBPScriptElement.setAttribute("id", "GBPJsonScript"); - GBPScriptElement.setAttribute("src", - "http://books.google.com/books?bibkeys=" + - isbn + "&jscmd=viewapi&callback=GBPreviewCallback"); - GBPScriptElement.setAttribute("type", "text/javascript"); - - // make the request to Google booksearch - document.documentElement.firstChild.appendChild(GBPScriptElement); + // Delete any previous Google Booksearch JSON queries. + var GBPJsonScript = document.getElementById("GBPJsonScript"); + if (GBPJsonScript) { + GBPJsonScript.parentNode.removeChild(GBPJsonScript); + } + + // Add a script element with the src as the user's Google Booksearch query. + // JSON output is specified by including the alt=json-in-script argument + // and the callback function is also specified as a URI argument. + var GBPScriptElement = document.createElement("script"); + + GBPScriptElement.setAttribute("id", "GBPJsonScript"); + GBPScriptElement.setAttribute("src", + "http://books.google.com/books?bibkeys=" + + isbn + "&jscmd=viewapi&callback=GBPreviewCallback"); + GBPScriptElement.setAttribute("type", "text/javascript"); + + // make the request to Google booksearch + document.documentElement.firstChild.appendChild(GBPScriptElement); } /** @@ -1012,37 +1012,37 @@ function searchForGBPreview( isbn ) { * @param {JSON} booksInfo is the JSON object pulled from the Google books service. */ function GBPreviewCallback(GBPBookInfo) { - var GBPreviewDiv = document.getElementById("rdetail_preview_div"); - var GBPBook; - - for ( i in GBPBookInfo ) { - GBPBook = GBPBookInfo[i]; - } - - if ( !GBPBook ) { - return; - } - - if ( GBPBook.preview != "noview" ) { - if ( GBPBook.preview == 'full' ) { - setText( $('rdetail_preview_link'), $('rdetail_preview_full_text').innerHTML ); - $('rdetail_preview_link_a').title = $('rdetail_preview_title').innerHTML; - } - - // Add a button below the book cover image to load the preview. - GBPBadge = document.createElement( 'img' ); - GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif'; - GBPBadge.title = $('rdetail_preview_badge').innerHTML; - GBPBadge.style.border = 0; - GBPBadgelink = document.createElement( 'a' ); - GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");'; - GBPBadgelink.appendChild( GBPBadge ); - $('rdetail_image_cell').appendChild( GBPBadgelink ); - $('rdetail_preview_div').style.height = 600; - - /* Display the "Preview" tab in the Extras section */ - unHideMe( $('rdetail_preview_link' ) ); - } + var GBPreviewDiv = document.getElementById("rdetail_preview_div"); + var GBPBook; + + for ( i in GBPBookInfo ) { + GBPBook = GBPBookInfo[i]; + } + + if ( !GBPBook ) { + return; + } + + if ( GBPBook.preview != "noview" ) { + if ( GBPBook.preview == 'full' ) { + setText( $('rdetail_preview_link'), $('rdetail_preview_full_text').innerHTML ); + $('rdetail_preview_link_a').title = $('rdetail_preview_title').innerHTML; + } + + // Add a button below the book cover image to load the preview. + GBPBadge = document.createElement( 'img' ); + GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif'; + GBPBadge.title = $('rdetail_preview_badge').innerHTML; + GBPBadge.style.border = 0; + GBPBadgelink = document.createElement( 'a' ); + GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");'; + GBPBadgelink.appendChild( GBPBadge ); + $('rdetail_image_cell').appendChild( GBPBadgelink ); + $('rdetail_preview_div').style.height = 600; + + /* Display the "Preview" tab in the Extras section */ + unHideMe( $('rdetail_preview_link' ) ); + } } /** @@ -1052,18 +1052,18 @@ function GBPreviewCallback(GBPBookInfo) { * XXX I18N of Google Book Preview language attribute needed */ function rdetailDisplayGBPreview() { - unHideMe($('rdetail_extras_loading')); - GBPreviewPane = $('rdetail_preview_div'); - if ( GBPreviewPane.getAttribute('loaded') == null || - GBPreviewPane.getAttribute('loaded') == "false" ) { - google.load("books", "0", {"callback" : rdetailGBPViewerLoadCallback, "language": "en"} ); - GBPreviewPane.setAttribute('loaded', 'true'); - } + unHideMe($('rdetail_extras_loading')); + GBPreviewPane = $('rdetail_preview_div'); + if ( GBPreviewPane.getAttribute('loaded') == null || + GBPreviewPane.getAttribute('loaded') == "false" ) { + google.load("books", "0", {"callback" : rdetailGBPViewerLoadCallback, "language": "en"} ); + GBPreviewPane.setAttribute('loaded', 'true'); + } } function rdetailGBPViewerLoadCallback() { - hideMe($('rdetail_extras_loading')); - var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div')); - GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) ); + hideMe($('rdetail_extras_loading')); + var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div')); + GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) ); } diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 300b5712ae..7fa3084dc2 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -10,27 +10,27 @@ var resultCompiledSearch = null; /* set up the event handlers */ if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) { - G.evt.result.hitCountReceived.push(resultSetHitInfo); - G.evt.result.recordReceived.push(resultDisplayRecord, resultAddCopyCounts); - G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts); - G.evt.result.allRecordsReceived.push(resultBuildCaches, resultDrawSubjects, + G.evt.result.hitCountReceived.push(resultSetHitInfo); + G.evt.result.recordReceived.push(resultDisplayRecord, resultAddCopyCounts); + G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts); + G.evt.result.allRecordsReceived.push(resultBuildCaches, resultDrawSubjects, resultDrawAuthors, resultDrawSeries, function(){unHideMe($('result_info_2'))}, - fetchGoogleBooksLink); + fetchGoogleBooksLink); - attachEvt('result','lowHits',resultLowHits); - attachEvt('result','zeroHits',resultZeroHits); - attachEvt( "common", "locationUpdated", resultSBSubmit ); - /* do this after we have ID's so the rank for mr pages will be correct */ - attachEvt("result", "preCollectRecords", resultPaginate); + attachEvt('result','lowHits',resultLowHits); + attachEvt('result','zeroHits',resultZeroHits); + attachEvt( "common", "locationUpdated", resultSBSubmit ); + /* do this after we have ID's so the rank for mr pages will be correct */ + attachEvt("result", "preCollectRecords", resultPaginate); } function resultSBSubmit(){searchBarSubmit();} /* returns the last 'index' postion ocurring in this page */ function resultFinalPageIndex() { - if(getHitCount() < (getOffset() + getDisplayCount())) - return getHitCount() - 1; - return getOffset() + getDisplayCount() - 1; + if(getHitCount() < (getOffset() + getDisplayCount())) + return getHitCount() - 1; + return getOffset() + getDisplayCount() - 1; } @@ -39,63 +39,63 @@ function resultFinalPageIndex() { /* generic search method */ function resultCollectSearchIds( type, method, handler ) { - var sort = (getSort() == SORT_TYPE_REL) ? null : getSort(); - var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null; + var sort = (getSort() == SORT_TYPE_REL) ? null : getSort(); + var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null; - var item_type; - var item_form; - var args = {}; + var item_type; + var item_form; + var args = {}; - if( type ) { - var form = parseForm(getForm()); - item_type = form.item_type; - item_form = form.item_form; + if( type ) { + var form = parseForm(getForm()); + item_type = form.item_type; + item_form = form.item_form; - } else { - item_type = (getItemType()) ? getItemType().split(/,/) : null; - item_form = (getItemForm()) ? getItemForm().split(/,/) : null; - } + } else { + item_type = (getItemType()) ? getItemType().split(/,/) : null; + item_form = (getItemForm()) ? getItemForm().split(/,/) : null; + } - var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount(); + var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount(); - if( getOffset() > 0 ) { - if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() ) - limit = getHitCount() - getOffset(); - } + if( getOffset() > 0 ) { + if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() ) + limit = getHitCount() - getOffset(); + } - var lasso = getLasso(); + var lasso = getLasso(); - if (lasso) args.org_unit = -lasso; - else args.org_unit = getLocation(); + if (lasso) args.org_unit = -lasso; + else args.org_unit = getLocation(); - args.depth = getDepth(); - args.limit = limit; - args.offset = getOffset(); - args.visibility_limit = 3000; + args.depth = getDepth(); + args.limit = limit; + args.offset = getOffset(); + args.visibility_limit = 3000; args.default_class = getStype(); - if(sort) args.sort = sort; - if(sortdir) args.sort_dir = sortdir; - if(item_type) args.item_type = item_type; - if(item_form) args.item_form = item_form; + if(sort) args.sort = sort; + if(sortdir) args.sort_dir = sortdir; + if(item_type) args.item_type = item_type; + if(item_form) args.item_form = item_form; if(getAvail()) args.available = 1; - if(getAudience()) args.audience = getAudience().split(/,/); - if(getLitForm()) args.lit_form = getLitForm().split(/,/); - if(getLanguage()) args.language = getLanguage().split(/,/); - if(getBibLevel()) args.bib_level = getBibLevel().split(/,/); - if(getCopyLocs()) args.locations = getCopyLocs().split(/,/); + if(getAudience()) args.audience = getAudience().split(/,/); + if(getLitForm()) args.lit_form = getLitForm().split(/,/); + if(getLanguage()) args.language = getLanguage().split(/,/); + if(getBibLevel()) args.bib_level = getBibLevel().split(/,/); + if(getCopyLocs()) args.locations = getCopyLocs().split(/,/); if(getPubdBefore()) args.before = getPubdBefore(); else if(getPubdAfter()) args.after = getPubdAfter(); else if(getPubdBetween()) args.between = getPubdBetween().split(/,/); - _debug('Search args: ' + js2JSON(args)); - _debug('Raw query: ' + getTerm()); + _debug('Search args: ' + js2JSON(args)); + _debug('Raw query: ' + getTerm()); - var req = new Request(method, args, getTerm(), 1); - req.callback(handler); - req.send(); + var req = new Request(method, args, getTerm(), 1); + req.callback(handler); + req.send(); } @@ -103,315 +103,315 @@ function resultCollectSearchIds( type, method, handler ) { /* set the search result info, number of hits, which results we're - displaying, links to the next/prev pages, etc. */ + displaying, links to the next/prev pages, etc. */ function resultSetHitInfo() { - var lasso = getLasso(); - if (!lasso) { - /* tell the user where the results are coming from */ - var baseorg = findOrgUnit(getLocation()); - var depth = getDepth(); - var mydepth = findOrgDepth(baseorg); - if( findOrgDepth(baseorg) != depth ) { - var tmporg = baseorg; - while( mydepth > depth ) { - mydepth--; - tmporg = findOrgUnit(tmporg.parent_ou()); - } - unHideMe($('including_results_for')); - $('including_results_location').appendChild(text(tmporg.name())); - } - } + var lasso = getLasso(); + if (!lasso) { + /* tell the user where the results are coming from */ + var baseorg = findOrgUnit(getLocation()); + var depth = getDepth(); + var mydepth = findOrgDepth(baseorg); + if( findOrgDepth(baseorg) != depth ) { + var tmporg = baseorg; + while( mydepth > depth ) { + mydepth--; + tmporg = findOrgUnit(tmporg.parent_ou()); + } + unHideMe($('including_results_for')); + $('including_results_location').appendChild(text(tmporg.name())); + } + } - try{searchTimer.stop()}catch(e){} + try{searchTimer.stop()}catch(e){} - //if( findCurrentPage() == MRESULT ) { - if( findCurrentPage() == MRESULT || + //if( findCurrentPage() == MRESULT ) { + if( findCurrentPage() == MRESULT || - (findCurrentPage() == RRESULT && - ( - getRtype() == RTYPE_TITLE || - getRtype() == RTYPE_AUTHOR || - getRtype() == RTYPE_SUBJECT || - getRtype() == RTYPE_SERIES || - getRtype() == RTYPE_KEYWORD - ) + (findCurrentPage() == RRESULT && + ( + getRtype() == RTYPE_TITLE || + getRtype() == RTYPE_AUTHOR || + getRtype() == RTYPE_SUBJECT || + getRtype() == RTYPE_SERIES || + getRtype() == RTYPE_KEYWORD + ) - ) ) { + ) ) { - if(getHitCount() <= lowHitCount && getTerm()) - runEvt('result', 'lowHits'); - } + if(getHitCount() <= lowHitCount && getTerm()) + runEvt('result', 'lowHits'); + } - if(getHitCount() == 0) { - runEvt('result', 'zeroHits'); - return; - } + if(getHitCount() == 0) { + runEvt('result', 'zeroHits'); + return; + } - var pages = getHitCount() / getDisplayCount(); - if(pages % 1) pages = parseInt(pages) + 1; + var pages = getHitCount() / getDisplayCount(); + if(pages % 1) pages = parseInt(pages) + 1; - + - var cpage = (getOffset()/getDisplayCount()) + 1; + var cpage = (getOffset()/getDisplayCount()) + 1; - G.ui.result.current_page.appendChild(text(cpage)); - G.ui.result.num_pages.appendChild(text(pages + ")")); /* the ) is dumb */ + G.ui.result.current_page.appendChild(text(cpage)); + G.ui.result.num_pages.appendChild(text(pages + ")")); /* the ) is dumb */ - $('current_page2').appendChild(text(cpage)); - $('num_pages2').appendChild(text(pages + ")")); /* the ) is dumb */ + $('current_page2').appendChild(text(cpage)); + $('num_pages2').appendChild(text(pages + ")")); /* the ) is dumb */ - /* set the offsets */ - var offsetEnd = getDisplayCount() + getOffset(); - if( getDisplayCount() > (getHitCount() - getOffset())) - offsetEnd = getHitCount(); + /* set the offsets */ + var offsetEnd = getDisplayCount() + getOffset(); + if( getDisplayCount() > (getHitCount() - getOffset())) + offsetEnd = getHitCount(); - G.ui.result.offset_end.appendChild(text(offsetEnd)); - G.ui.result.offset_start.appendChild(text(getOffset() + 1)); + G.ui.result.offset_end.appendChild(text(offsetEnd)); + G.ui.result.offset_start.appendChild(text(getOffset() + 1)); - $('offset_end2').appendChild(text(offsetEnd)); - $('offset_start2').appendChild(text(getOffset() + 1)); + $('offset_end2').appendChild(text(offsetEnd)); + $('offset_start2').appendChild(text(getOffset() + 1)); - G.ui.result.result_count.appendChild(text(getHitCount())); - unHideMe(G.ui.result.info); + G.ui.result.result_count.appendChild(text(getHitCount())); + unHideMe(G.ui.result.info); - $('result_count2').appendChild(text(getHitCount())); - unHideMe($('result_info_div2')); + $('result_count2').appendChild(text(getHitCount())); + unHideMe($('result_info_div2')); } function resultLowHits() { - showCanvas(); - unHideMe($('result_low_hits')); - if(getHitCount() > 0) - unHideMe($('result_low_hits_msg')); + showCanvas(); + unHideMe($('result_low_hits')); + if(getHitCount() > 0) + unHideMe($('result_low_hits_msg')); var words = []; for(var key in resultCompiledSearch.searches) words.push(resultCompiledSearch.searches[key].term); - var sreq = new Request(CHECK_SPELL, words.join(' ')); - sreq.callback(resultSuggestSpelling); - sreq.send(); + var sreq = new Request(CHECK_SPELL, words.join(' ')); + sreq.callback(resultSuggestSpelling); + sreq.send(); for(var key in resultCompiledSearch.searches) { - var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term); - areq.callback(resultLowHitXRef); - areq.send(); - } + var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term); + areq.callback(resultLowHitXRef); + areq.send(); + } - if( !(getForm() == null || getForm() == 'all' || getForm() == "") ) { - var a = {}; - a[PARAM_FORM] = "all"; - $('low_hits_remove_format_link').setAttribute('href',buildOPACLink(a)); - unHideMe($('low_hits_remove_format')); - } + if( !(getForm() == null || getForm() == 'all' || getForm() == "") ) { + var a = {}; + a[PARAM_FORM] = "all"; + $('low_hits_remove_format_link').setAttribute('href',buildOPACLink(a)); + unHideMe($('low_hits_remove_format')); + } - resultSuggestSearchClass(); + resultSuggestSearchClass(); - if(getTerm()) resultExpandSearch(); /* advanced search */ + if(getTerm()) resultExpandSearch(); /* advanced search */ } var lowHitsXRefSet = {}; var lowHitsXRefLink; var lowHitsXRefLinkParent; function resultLowHitXRef(r) { - if(!lowHitsXRefLink){ - lowHitsXRefLinkParent = $('low_hits_xref_link').parentNode; - lowHitsXRefLink = lowHitsXRefLinkParent.removeChild($('low_hits_xref_link')); - } - var res = r.getResultObject(); - var arr = res.from; - arr.concat(res.also); - if(arr && arr.length > 0) { - unHideMe($('low_hits_cross_ref')); - var word; - var c = 0; - while( word = arr.shift() ) { + if(!lowHitsXRefLink){ + lowHitsXRefLinkParent = $('low_hits_xref_link').parentNode; + lowHitsXRefLink = lowHitsXRefLinkParent.removeChild($('low_hits_xref_link')); + } + var res = r.getResultObject(); + var arr = res.from; + arr.concat(res.also); + if(arr && arr.length > 0) { + unHideMe($('low_hits_cross_ref')); + var word; + var c = 0; + while( word = arr.shift() ) { if (lowHitsXRefSet[word] == 1) continue; lowHitsXRefSet[word] = 1; - if(c++ > 20) break; - var a = {}; - a[PARAM_TERM] = word; - var template = lowHitsXRefLink.cloneNode(true); - template.setAttribute('href',buildOPACLink(a)); - template.appendChild(text(word)); - lowHitsXRefLinkParent.appendChild(template); - lowHitsXRefLinkParent.appendChild(text(' ')); - } - } + if(c++ > 20) break; + var a = {}; + a[PARAM_TERM] = word; + var template = lowHitsXRefLink.cloneNode(true); + template.setAttribute('href',buildOPACLink(a)); + template.appendChild(text(word)); + lowHitsXRefLinkParent.appendChild(template); + lowHitsXRefLinkParent.appendChild(text(' ')); + } + } } function resultZeroHits() { - showCanvas(); - unHideMe($('result_low_hits')); - unHideMe($('result_zero_hits_msg')); - //if(getTerm()) resultExpandSearch(); /* advanced search */ + showCanvas(); + unHideMe($('result_low_hits')); + unHideMe($('result_zero_hits_msg')); + //if(getTerm()) resultExpandSearch(); /* advanced search */ } function resultExpandSearch() { - var top = findOrgDepth(globalOrgTree); - if(getDepth() == top) return; - unHideMe($('low_hits_expand_range')); - var par = $('low_hits_expand_link').parentNode; - var template = par.removeChild($('low_hits_expand_link')); - - var bottom = getDepth(); - while( top < bottom ) { - var a = {}; - a[PARAM_DEPTH] = top; - var temp = template.cloneNode(true); - temp.appendChild(text(findOrgTypeFromDepth(top).opac_label())) - temp.setAttribute('href',buildOPACLink(a)); - par.appendChild(temp); - top++; - } + var top = findOrgDepth(globalOrgTree); + if(getDepth() == top) return; + unHideMe($('low_hits_expand_range')); + var par = $('low_hits_expand_link').parentNode; + var template = par.removeChild($('low_hits_expand_link')); + + var bottom = getDepth(); + while( top < bottom ) { + var a = {}; + a[PARAM_DEPTH] = top; + var temp = template.cloneNode(true); + temp.appendChild(text(findOrgTypeFromDepth(top).opac_label())) + temp.setAttribute('href',buildOPACLink(a)); + par.appendChild(temp); + top++; + } } function resultSuggestSearchClass() { - var stype = getStype(); - if(stype == STYPE_KEYWORD) return; - var a = {}; var ref; - unHideMe($('low_hits_search_type')); - if(stype != STYPE_TITLE) { - ref = $('low_hits_title_search'); - unHideMe(ref); - a[PARAM_STYPE] = STYPE_TITLE; - ref.setAttribute('href',buildOPACLink(a)); - } - if(stype != STYPE_AUTHOR) { - ref = $('low_hits_author_search'); - unHideMe(ref); - a[PARAM_STYPE] = STYPE_AUTHOR; - ref.setAttribute('href',buildOPACLink(a)); - } - if(stype != STYPE_SUBJECT) { - ref = $('low_hits_subject_search'); - unHideMe(ref); - a[PARAM_STYPE] = STYPE_SUBJECT; - ref.setAttribute('href',buildOPACLink(a)); - } - if(stype != STYPE_KEYWORD) { - ref = $('low_hits_keyword_search'); - unHideMe(ref); - a[PARAM_STYPE] = STYPE_KEYWORD; - ref.setAttribute('href',buildOPACLink(a)); - } - if(stype != STYPE_SERIES) { - ref = $('low_hits_series_search'); - unHideMe(ref); - a[PARAM_STYPE] = STYPE_SERIES; - ref.setAttribute('href',buildOPACLink(a)); - } + var stype = getStype(); + if(stype == STYPE_KEYWORD) return; + var a = {}; var ref; + unHideMe($('low_hits_search_type')); + if(stype != STYPE_TITLE) { + ref = $('low_hits_title_search'); + unHideMe(ref); + a[PARAM_STYPE] = STYPE_TITLE; + ref.setAttribute('href',buildOPACLink(a)); + } + if(stype != STYPE_AUTHOR) { + ref = $('low_hits_author_search'); + unHideMe(ref); + a[PARAM_STYPE] = STYPE_AUTHOR; + ref.setAttribute('href',buildOPACLink(a)); + } + if(stype != STYPE_SUBJECT) { + ref = $('low_hits_subject_search'); + unHideMe(ref); + a[PARAM_STYPE] = STYPE_SUBJECT; + ref.setAttribute('href',buildOPACLink(a)); + } + if(stype != STYPE_KEYWORD) { + ref = $('low_hits_keyword_search'); + unHideMe(ref); + a[PARAM_STYPE] = STYPE_KEYWORD; + ref.setAttribute('href',buildOPACLink(a)); + } + if(stype != STYPE_SERIES) { + ref = $('low_hits_series_search'); + unHideMe(ref); + a[PARAM_STYPE] = STYPE_SERIES; + ref.setAttribute('href',buildOPACLink(a)); + } } function resultSuggestSpelling(r) { - var res = r.getResultObject(); - var phrase = getTerm(); - var words = phrase.split(/ /); - - var newterm = ""; - - for( var w = 0; w < words.length; w++ ) { - var word = words[w]; - var blob = grep(res, function(i){return (i.word == word);}); - if( blob ) blob = blob[0]; - else continue; - if( blob.word == word ) { - if( blob.suggestions && blob.suggestions[0] ) { - newterm += " " + blob.suggestions[0]; - unHideMe($('did_you_mean')); - } else { - newterm += " " + word; - } - } - } - - var arg = {}; - arg[PARAM_TERM] = newterm; - $('spell_check_link').setAttribute('href', buildOPACLink(arg)); - $('spell_check_link').appendChild(text(newterm)); + var res = r.getResultObject(); + var phrase = getTerm(); + var words = phrase.split(/ /); + + var newterm = ""; + + for( var w = 0; w < words.length; w++ ) { + var word = words[w]; + var blob = grep(res, function(i){return (i.word == word);}); + if( blob ) blob = blob[0]; + else continue; + if( blob.word == word ) { + if( blob.suggestions && blob.suggestions[0] ) { + newterm += " " + blob.suggestions[0]; + unHideMe($('did_you_mean')); + } else { + newterm += " " + word; + } + } + } + + var arg = {}; + arg[PARAM_TERM] = newterm; + $('spell_check_link').setAttribute('href', buildOPACLink(arg)); + $('spell_check_link').appendChild(text(newterm)); } function resultPaginate() { - var o = getOffset(); + var o = getOffset(); - if( !( ((o) + getDisplayCount()) >= getHitCount()) ) { + if( !( ((o) + getDisplayCount()) >= getHitCount()) ) { - var args = {}; - args[PARAM_OFFSET] = o + getDisplayCount(); - args[PARAM_SORT] = SORT; - args[PARAM_SORT_DIR] = SORT_DIR; - args[PARAM_RLIST] = new CGI().param(PARAM_RLIST); + var args = {}; + args[PARAM_OFFSET] = o + getDisplayCount(); + args[PARAM_SORT] = SORT; + args[PARAM_SORT_DIR] = SORT_DIR; + args[PARAM_RLIST] = new CGI().param(PARAM_RLIST); - G.ui.result.next_link.setAttribute("href", buildOPACLink(args)); - addCSSClass(G.ui.result.next_link, config.css.result.nav_active); + G.ui.result.next_link.setAttribute("href", buildOPACLink(args)); + addCSSClass(G.ui.result.next_link, config.css.result.nav_active); - $('next_link2').setAttribute("href", buildOPACLink(args)); - addCSSClass($('next_link2'), config.css.result.nav_active); + $('next_link2').setAttribute("href", buildOPACLink(args)); + addCSSClass($('next_link2'), config.css.result.nav_active); - args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount()); + args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount()); - /* when hit count is divisible by display count, we have to adjust */ - if( getHitCount() % getDisplayCount() == 0 ) - args[PARAM_OFFSET] -= getDisplayCount(); + /* when hit count is divisible by display count, we have to adjust */ + if( getHitCount() % getDisplayCount() == 0 ) + args[PARAM_OFFSET] -= getDisplayCount(); /* - G.ui.result.end_link.setAttribute("href", buildOPACLink(args)); - addCSSClass(G.ui.result.end_link, config.css.result.nav_active); + G.ui.result.end_link.setAttribute("href", buildOPACLink(args)); + addCSSClass(G.ui.result.end_link, config.css.result.nav_active); - $('end_link2').setAttribute("href", buildOPACLink(args)); - addCSSClass($('end_link2'), config.css.result.nav_active); + $('end_link2').setAttribute("href", buildOPACLink(args)); + addCSSClass($('end_link2'), config.css.result.nav_active); */ - } + } - if( o > 0 ) { + if( o > 0 ) { - var args = {}; - args[PARAM_SORT] = SORT; - args[PARAM_SORT_DIR] = SORT_DIR; - args[PARAM_RLIST] = new CGI().param(PARAM_RLIST); + var args = {}; + args[PARAM_SORT] = SORT; + args[PARAM_SORT_DIR] = SORT_DIR; + args[PARAM_RLIST] = new CGI().param(PARAM_RLIST); - args[PARAM_OFFSET] = o - getDisplayCount(); - G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args)); - addCSSClass(G.ui.result.prev_link, config.css.result.nav_active); + args[PARAM_OFFSET] = o - getDisplayCount(); + G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args)); + addCSSClass(G.ui.result.prev_link, config.css.result.nav_active); - $('prev_link2').setAttribute( "href", buildOPACLink(args)); - addCSSClass($('prev_link2'), config.css.result.nav_active); + $('prev_link2').setAttribute( "href", buildOPACLink(args)); + addCSSClass($('prev_link2'), config.css.result.nav_active); - args[PARAM_OFFSET] = 0; - G.ui.result.home_link.setAttribute( "href", buildOPACLink(args)); - addCSSClass(G.ui.result.home_link, config.css.result.nav_active); + args[PARAM_OFFSET] = 0; + G.ui.result.home_link.setAttribute( "href", buildOPACLink(args)); + addCSSClass(G.ui.result.home_link, config.css.result.nav_active); - $('search_home_link2').setAttribute( "href", buildOPACLink(args)); - addCSSClass($('search_home_link2'), config.css.result.nav_active); - } + $('search_home_link2').setAttribute( "href", buildOPACLink(args)); + addCSSClass($('search_home_link2'), config.css.result.nav_active); + } - if(getDisplayCount() < getHitCount()) { - unHideMe($('start_end_links_span')); - unHideMe($('start_end_links_span2')); + if(getDisplayCount() < getHitCount()) { + unHideMe($('start_end_links_span')); + unHideMe($('start_end_links_span2')); } - showCanvas(); - try{searchTimer.stop()}catch(e){} + showCanvas(); + try{searchTimer.stop()}catch(e){} } function buildunAPISpan (span, type, id) { - var cgi = new CGI(); - var d = new Date(); + var cgi = new CGI(); + var d = new Date(); - addCSSClass(span,'unapi-id'); + addCSSClass(span,'unapi-id'); - span.setAttribute( - 'title', - 'tag:' + cgi.server_name + ',' + - d.getFullYear() + - ':' + type + '/' + id - ); + span.setAttribute( + 'title', + 'tag:' + cgi.server_name + ',' + + d.getFullYear() + + ':' + type + '/' + id + ); } function unhideGoogleBooksLink (data) { @@ -430,18 +430,18 @@ function unhideGoogleBooksLink (data) { } /* display the record info in the record display table 'pos' is the - zero based position the record should have in the display table */ + zero based position the record should have in the display table */ function resultDisplayRecord(rec, pos, is_mr) { - if(rec == null) rec = new mvr(); /* so the page won't die if there was an error */ - recordsHandled++; - recordsCache.push(rec); + if(rec == null) rec = new mvr(); /* so the page won't die if there was an error */ + recordsHandled++; + recordsCache.push(rec); - var r = table.rows[pos + 1]; + var r = table.rows[pos + 1]; var currentISBN = cleanISBN(rec.isbn()); if (googleBooksLink) { - var gbspan = $n(r, "googleBooksLink"); + var gbspan = $n(r, "googleBooksLink"); if (currentISBN) { gbspan.setAttribute( 'name', @@ -454,148 +454,148 @@ function resultDisplayRecord(rec, pos, is_mr) { } /* - try { - var rank = parseFloat(ranks[pos + getOffset()]); - rank = parseInt( rank * 100 ); - var relspan = $n(r, "relevancy_span"); - relspan.appendChild(text(rank)); - unHideMe(relspan.parentNode); - } catch(e){ } + try { + var rank = parseFloat(ranks[pos + getOffset()]); + rank = parseInt( rank * 100 ); + var relspan = $n(r, "relevancy_span"); + relspan.appendChild(text(rank)); + unHideMe(relspan.parentNode); + } catch(e){ } */ - var pic = $n(r, config.names.result.item_jacket); - pic.setAttribute("src", buildISBNSrc(currentISBN)); - - var title_link = $n(r, config.names.result.item_title); - var author_link = $n(r, config.names.result.item_author); - - if( is_mr ) { - var onlyrec = onlyrecord[ getOffset() + pos ]; - if(onlyrec) { - buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec); - - var args = {}; - args.page = RDETAIL; - args[PARAM_OFFSET] = 0; - args[PARAM_RID] = onlyrec; - args[PARAM_MRID] = rec.doc_id(); - pic.parentNode.setAttribute("href", buildOPACLink(args)); - title_link.setAttribute("href", buildOPACLink(args)); - title_link.appendChild(text(normalize(truncate(rec.title(), 65)))); - - } else { - buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id()); - - buildTitleLink(rec, title_link); - var args = {}; - args.page = RRESULT; - args[PARAM_OFFSET] = 0; - args[PARAM_MRID] = rec.doc_id(); - pic.parentNode.setAttribute("href", buildOPACLink(args)); - } - - } else { - buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', rec.doc_id()); - - buildTitleDetailLink(rec, title_link); - var args = {}; - args.page = RDETAIL; - args[PARAM_OFFSET] = 0; - args[PARAM_RID] = rec.doc_id(); - pic.parentNode.setAttribute("href", buildOPACLink(args)); - - unHideMe($n(r,'place_hold_span')); - $n(r,'place_hold_link').setAttribute( - 'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"T"});'); - } - - buildSearchLink(STYPE_AUTHOR, rec.author(), author_link); - - if(! is_mr ) { - - if(!isNull(rec.edition())) { - unHideMe( $n(r, "result_table_extra_span")); - $n(r, "result_table_edition_span").appendChild( text( rec.edition()) ); - } - if(!isNull(rec.pubdate())) { - unHideMe( $n(r, "result_table_extra_span")); - unHideMe($n(r, "result_table_pub_span")); - $n(r, "result_table_pub_span").appendChild( text( rec.pubdate() )); - } - if(!isNull(rec.publisher()) ) { - unHideMe( $n(r, "result_table_extra_span")); - unHideMe($n(r, "result_table_pub_span")); - $n(r, "result_table_pub_span").appendChild( text( " " + rec.publisher() )); - } - - if(!isNull(rec.physical_description()) ) { - unHideMe( $n(r, "result_table_extra_span")); - var t = " " + rec.physical_description(); - //$n(r, "result_table_phys_span").appendChild( text(t.replace(/:.*/g,''))); - $n(r, "result_table_phys_span").appendChild( text(t)); - } - - } - - resultBuildFormatIcons( r, rec, is_mr ); - - unHideMe(r); - - runEvt("result", "recordDrawn", rec.doc_id(), title_link); - - /* - if(resultPageIsDone()) { - runEvt('result', 'allRecordsReceived', recordsCache); - } - */ + var pic = $n(r, config.names.result.item_jacket); + pic.setAttribute("src", buildISBNSrc(currentISBN)); + + var title_link = $n(r, config.names.result.item_title); + var author_link = $n(r, config.names.result.item_author); + + if( is_mr ) { + var onlyrec = onlyrecord[ getOffset() + pos ]; + if(onlyrec) { + buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec); + + var args = {}; + args.page = RDETAIL; + args[PARAM_OFFSET] = 0; + args[PARAM_RID] = onlyrec; + args[PARAM_MRID] = rec.doc_id(); + pic.parentNode.setAttribute("href", buildOPACLink(args)); + title_link.setAttribute("href", buildOPACLink(args)); + title_link.appendChild(text(normalize(truncate(rec.title(), 65)))); + + } else { + buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id()); + + buildTitleLink(rec, title_link); + var args = {}; + args.page = RRESULT; + args[PARAM_OFFSET] = 0; + args[PARAM_MRID] = rec.doc_id(); + pic.parentNode.setAttribute("href", buildOPACLink(args)); + } + + } else { + buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', rec.doc_id()); + + buildTitleDetailLink(rec, title_link); + var args = {}; + args.page = RDETAIL; + args[PARAM_OFFSET] = 0; + args[PARAM_RID] = rec.doc_id(); + pic.parentNode.setAttribute("href", buildOPACLink(args)); + + unHideMe($n(r,'place_hold_span')); + $n(r,'place_hold_link').setAttribute( + 'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"T"});'); + } + + buildSearchLink(STYPE_AUTHOR, rec.author(), author_link); + + if(! is_mr ) { + + if(!isNull(rec.edition())) { + unHideMe( $n(r, "result_table_extra_span")); + $n(r, "result_table_edition_span").appendChild( text( rec.edition()) ); + } + if(!isNull(rec.pubdate())) { + unHideMe( $n(r, "result_table_extra_span")); + unHideMe($n(r, "result_table_pub_span")); + $n(r, "result_table_pub_span").appendChild( text( rec.pubdate() )); + } + if(!isNull(rec.publisher()) ) { + unHideMe( $n(r, "result_table_extra_span")); + unHideMe($n(r, "result_table_pub_span")); + $n(r, "result_table_pub_span").appendChild( text( " " + rec.publisher() )); + } + + if(!isNull(rec.physical_description()) ) { + unHideMe( $n(r, "result_table_extra_span")); + var t = " " + rec.physical_description(); + //$n(r, "result_table_phys_span").appendChild( text(t.replace(/:.*/g,''))); + $n(r, "result_table_phys_span").appendChild( text(t)); + } + + } + + resultBuildFormatIcons( r, rec, is_mr ); + + unHideMe(r); + + runEvt("result", "recordDrawn", rec.doc_id(), title_link); + + /* + if(resultPageIsDone()) { + runEvt('result', 'allRecordsReceived', recordsCache); + } + */ } function _resultFindRec(id) { - for( var i = 0; i != recordsCache.length; i++ ) { - var rec = recordsCache[i]; - if( rec && rec.doc_id() == id ) - return rec; - } - return null; + for( var i = 0; i != recordsCache.length; i++ ) { + var rec = recordsCache[i]; + if( rec && rec.doc_id() == id ) + return rec; + } + return null; } function resultBuildFormatIcons( row, rec, is_mr ) { - var ress = rec.types_of_resource(); + var ress = rec.types_of_resource(); - for( var i in ress ) { + for( var i in ress ) { - var res = ress[i]; - if(!res) continue; + var res = ress[i]; + if(!res) continue; - var link = $n(row, res + "_link"); - link.title = res; - var img = link.getElementsByTagName("img")[0]; - removeCSSClass( img, config.css.dim ); + var link = $n(row, res + "_link"); + link.title = res; + var img = link.getElementsByTagName("img")[0]; + removeCSSClass( img, config.css.dim ); - var f = getForm(); - if( f != "all" ) { - if( f == modsFormatToMARC(res) ) - addCSSClass( img, "dim2_border"); - } + var f = getForm(); + if( f != "all" ) { + if( f == modsFormatToMARC(res) ) + addCSSClass( img, "dim2_border"); + } - var args = {}; - args[PARAM_OFFSET] = 0; + var args = {}; + args[PARAM_OFFSET] = 0; - if(is_mr) { - args.page = RRESULT; - args[PARAM_TFORM] = modsFormatToMARC(res); - args[PARAM_MRID] = rec.doc_id(); + if(is_mr) { + args.page = RRESULT; + args[PARAM_TFORM] = modsFormatToMARC(res); + args[PARAM_MRID] = rec.doc_id(); - } else { - args.page = RDETAIL - args[PARAM_RID] = rec.doc_id(); - } + } else { + args.page = RDETAIL + args[PARAM_RID] = rec.doc_id(); + } - link.setAttribute("href", buildOPACLink(args)); + link.setAttribute("href", buildOPACLink(args)); - } + } } function fetchGoogleBooksLink () { @@ -613,144 +613,144 @@ function fetchGoogleBooksLink () { function resultPageIsDone(pos) { - return (recordsHandled == getDisplayCount() - || recordsHandled + getOffset() == getHitCount()); + return (recordsHandled == getDisplayCount() + || recordsHandled + getOffset() == getHitCount()); } var resultCCHeaderApplied = false; /* -------------------------------------------------------------------- */ /* dynamically add the copy count rows based on the org type 'countsrow' - is the row into which we will add TD's to hold the copy counts - This code generates copy count cells with an id of - 'copy_count_cell__' */ + is the row into which we will add TD's to hold the copy counts + This code generates copy count cells with an id of + 'copy_count_cell__' */ function resultAddCopyCounts(rec, pagePosition) { - var r = table.rows[pagePosition + 1]; - var countsrow = $n(r, config.names.result.counts_row ); - var ccell = $n(countsrow, config.names.result.count_cell); - - var nodes = orgNodeTrail(findOrgUnit(getLocation())); - var node = nodes[0]; - var type = findOrgType(node.ou_type()); - ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition; - ccell.title = type.opac_label(); - //addCSSClass(ccell, config.css.result.cc_cell_even); - - var lastcell = ccell; - var lastheadcell = null; - - var cchead = null; - var ccheadcell = null; - if(!resultCCHeaderApplied && !getLasso()) { - ccrow = $('result_thead_row'); - ccheadcell = ccrow.removeChild($n(ccrow, "result_thead_ccell")); - var t = ccheadcell.cloneNode(true); - lastheadcell = t; - t.appendChild(text(type.opac_label())); - ccrow.appendChild(t); - resultCCHeaderApplied = true; - } - - if(nodes[1]) { - - var x = 1; - var d = findOrgDepth(nodes[1]); - var d2 = findOrgDepth(nodes[nodes.length -1]); - - for( var i = d; i <= d2 ; i++ ) { - - ccell = ccell.cloneNode(true); - - //if((i % 2)) removeCSSClass(ccell, "copy_count_cell_even"); - //else addCSSClass(ccell, "copy_count_cell_even"); - - var node = nodes[x++]; - var type = findOrgType(node.ou_type()); - - ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition; - ccell.title = type.opac_label(); - countsrow.insertBefore(ccell, lastcell); - lastcell = ccell; - - if(ccheadcell) { - var t = ccheadcell.cloneNode(true); - t.appendChild(text(type.opac_label())); - ccrow.insertBefore(t, lastheadcell); - lastheadcell = t; - } - } - } - - unHideMe($("search_info_table")); + var r = table.rows[pagePosition + 1]; + var countsrow = $n(r, config.names.result.counts_row ); + var ccell = $n(countsrow, config.names.result.count_cell); + + var nodes = orgNodeTrail(findOrgUnit(getLocation())); + var node = nodes[0]; + var type = findOrgType(node.ou_type()); + ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition; + ccell.title = type.opac_label(); + //addCSSClass(ccell, config.css.result.cc_cell_even); + + var lastcell = ccell; + var lastheadcell = null; + + var cchead = null; + var ccheadcell = null; + if(!resultCCHeaderApplied && !getLasso()) { + ccrow = $('result_thead_row'); + ccheadcell = ccrow.removeChild($n(ccrow, "result_thead_ccell")); + var t = ccheadcell.cloneNode(true); + lastheadcell = t; + t.appendChild(text(type.opac_label())); + ccrow.appendChild(t); + resultCCHeaderApplied = true; + } + + if(nodes[1]) { + + var x = 1; + var d = findOrgDepth(nodes[1]); + var d2 = findOrgDepth(nodes[nodes.length -1]); + + for( var i = d; i <= d2 ; i++ ) { + + ccell = ccell.cloneNode(true); + + //if((i % 2)) removeCSSClass(ccell, "copy_count_cell_even"); + //else addCSSClass(ccell, "copy_count_cell_even"); + + var node = nodes[x++]; + var type = findOrgType(node.ou_type()); + + ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition; + ccell.title = type.opac_label(); + countsrow.insertBefore(ccell, lastcell); + lastcell = ccell; + + if(ccheadcell) { + var t = ccheadcell.cloneNode(true); + t.appendChild(text(type.opac_label())); + ccrow.insertBefore(t, lastheadcell); + lastheadcell = t; + } + } + } + + unHideMe($("search_info_table")); } /* collect copy counts for a record using method 'methodName' */ function resultCollectCopyCounts(rec, pagePosition, methodName) { - if(rec == null || rec.doc_id() == null) return; + if(rec == null || rec.doc_id() == null) return; - var loc = getLasso(); - if (loc) loc = -loc; - else loc= getLocation(); + var loc = getLasso(); + if (loc) loc = -loc; + else loc= getLocation(); - var req = new Request(methodName, loc, rec.doc_id(), getForm() ); - req.request.userdata = [ rec, pagePosition ]; - req.callback(resultHandleCopyCounts); - req.send(); + var req = new Request(methodName, loc, rec.doc_id(), getForm() ); + req.request.userdata = [ rec, pagePosition ]; + req.callback(resultHandleCopyCounts); + req.send(); } function resultHandleCopyCounts(r) { - runEvt('result', 'copyCountsReceived', r.userdata[0], r.userdata[1], r.getResultObject()); + runEvt('result', 'copyCountsReceived', r.userdata[0], r.userdata[1], r.getResultObject()); } /* XXX Needs to understand Lasso copy counts... */ /* display the collected copy counts */ function resultDisplayCopyCounts(rec, pagePosition, copy_counts) { - if(copy_counts == null || rec == null) return; - - if (getLasso()) { - var copy_counts_lasso = { - transcendant : null, - count : 0, - unshadow : 0, - available : 0, - depth : -1, - org_unit : getLasso() - }; - - for (var i in copy_counts) { - copy_counts_lasso.transcendant = copy_counts[i].transcendant; - copy_counts_lasso.count += parseInt(copy_counts[i].count); - copy_counts_lasso.unshadow += parseInt(copy_counts[i].unshadow); - copy_counts_lasso.available += parseInt(copy_counts[i].available); - } - - copy_counts = [ copy_counts_lasso ]; - } - - var i = 0; - while(copy_counts[i] != null) { - var cell = $("copy_count_cell_" + i +"_" + pagePosition); - var cts = copy_counts[i]; - cell.appendChild(text(cts.available + " / " + cts.count)); - - if(isXUL()) { - /* here we style opac-invisible records for xul */ - - if( cts.depth == 0 ) { - if(!cts.transcendant && !cts.unshadow) { - _debug("found an opac-shadowed record: " + rec.doc_id()); - var row = cell.parentNode.parentNode.parentNode.parentNode.parentNode; - if( cts.count == 0 ) - addCSSClass( row, 'no_copies' ); - else - addCSSClass( row, 'shadowed' ); - } - } - } - i++; - } + if(copy_counts == null || rec == null) return; + + if (getLasso()) { + var copy_counts_lasso = { + transcendant : null, + count : 0, + unshadow : 0, + available : 0, + depth : -1, + org_unit : getLasso() + }; + + for (var i in copy_counts) { + copy_counts_lasso.transcendant = copy_counts[i].transcendant; + copy_counts_lasso.count += parseInt(copy_counts[i].count); + copy_counts_lasso.unshadow += parseInt(copy_counts[i].unshadow); + copy_counts_lasso.available += parseInt(copy_counts[i].available); + } + + copy_counts = [ copy_counts_lasso ]; + } + + var i = 0; + while(copy_counts[i] != null) { + var cell = $("copy_count_cell_" + i +"_" + pagePosition); + var cts = copy_counts[i]; + cell.appendChild(text(cts.available + " / " + cts.count)); + + if(isXUL()) { + /* here we style opac-invisible records for xul */ + + if( cts.depth == 0 ) { + if(!cts.transcendant && !cts.unshadow) { + _debug("found an opac-shadowed record: " + rec.doc_id()); + var row = cell.parentNode.parentNode.parentNode.parentNode.parentNode; + if( cts.count == 0 ) + addCSSClass( row, 'no_copies' ); + else + addCSSClass( row, 'shadowed' ); + } + } + } + i++; + } } diff --git a/Open-ILS/web/opac/skin/default/js/rresult.js b/Open-ILS/web/opac/skin/default/js/rresult.js index d93aa45471..e666cd96a2 100644 --- a/Open-ILS/web/opac/skin/default/js/rresult.js +++ b/Open-ILS/web/opac/skin/default/js/rresult.js @@ -16,190 +16,190 @@ hideMe($('copyright_block')); function rresultDoSearch() { - swapCanvas($('loading_alt')); - - table = G.ui.result.main_table; - hideMe(G.ui.result.row_template); - if( table && table.parentNode ) { - while( table.parentNode.rows.length <= (getDisplayCount() +1) ) - hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true))); - } - rresultCollectIds(); + swapCanvas($('loading_alt')); + + table = G.ui.result.main_table; + hideMe(G.ui.result.row_template); + if( table && table.parentNode ) { + while( table.parentNode.rows.length <= (getDisplayCount() +1) ) + hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true))); + } + rresultCollectIds(); } function rresultCollectIds() { - var ids; - - switch(getRtype()) { - - case RTYPE_COOKIE: - ids = JSON2js(cookieManager.read(COOKIE_RIDS)); - _rresultHandleIds( ids, ids.length ); - break; - - case RTYPE_TITLE: - case RTYPE_AUTHOR: - case RTYPE_SUBJECT: - case RTYPE_SERIES: - case RTYPE_KEYWORD: - rresultDoRecordSearch(); - break; - - case RTYPE_MULTI: - rresultDoRecordMultiSearch(); - break; - - case RTYPE_LIST : - rresultHandleList(); - break; - - case RTYPE_MARC : - rresultCollectMARCIds(); - break; - - case RTYPE_ISBN : - rresultCollectISBNIds(); - break; - - case RTYPE_TCN : - rresultCollectTCNIds(); - break; - - case RTYPE_ISSN : - rresultCollectISSNIds(); - break; - - - case RTYPE_MRID : - case null : - case "" : - default: - var form = rresultGetForm(); - var args = { format : form, org : getLocation(), depth : rresultGetDepth() }; - - var lasso = getLasso(); - if (lasso) args.org = -lasso; - - var req = new Request(FETCH_RIDS, getMrid(), args); - req.callback( rresultHandleRIds ); - req.send(); - - if( rresultGetDepth() != findOrgDepth(globalOrgTree) ) { - var link = $('rresult_show_all_link'); - if(link) { - unHideMe($('rresult_show_all')); - link.appendChild( text( - findOrgType(globalOrgTree.ou_type()).opac_label())); - } - - } else { - if( rresultGetDepth() != getDepth() ) { /* inside a limited display */ - var link = $('rresult_show_here_link'); - if(link) { - link.appendChild( text( - findOrgType(findOrgUnit(getLocation()).ou_type()).opac_label())); - unHideMe($('rresult_show_here')); - } - } - } - } + var ids; + + switch(getRtype()) { + + case RTYPE_COOKIE: + ids = JSON2js(cookieManager.read(COOKIE_RIDS)); + _rresultHandleIds( ids, ids.length ); + break; + + case RTYPE_TITLE: + case RTYPE_AUTHOR: + case RTYPE_SUBJECT: + case RTYPE_SERIES: + case RTYPE_KEYWORD: + rresultDoRecordSearch(); + break; + + case RTYPE_MULTI: + rresultDoRecordMultiSearch(); + break; + + case RTYPE_LIST : + rresultHandleList(); + break; + + case RTYPE_MARC : + rresultCollectMARCIds(); + break; + + case RTYPE_ISBN : + rresultCollectISBNIds(); + break; + + case RTYPE_TCN : + rresultCollectTCNIds(); + break; + + case RTYPE_ISSN : + rresultCollectISSNIds(); + break; + + + case RTYPE_MRID : + case null : + case "" : + default: + var form = rresultGetForm(); + var args = { format : form, org : getLocation(), depth : rresultGetDepth() }; + + var lasso = getLasso(); + if (lasso) args.org = -lasso; + + var req = new Request(FETCH_RIDS, getMrid(), args); + req.callback( rresultHandleRIds ); + req.send(); + + if( rresultGetDepth() != findOrgDepth(globalOrgTree) ) { + var link = $('rresult_show_all_link'); + if(link) { + unHideMe($('rresult_show_all')); + link.appendChild( text( + findOrgType(globalOrgTree.ou_type()).opac_label())); + } + + } else { + if( rresultGetDepth() != getDepth() ) { /* inside a limited display */ + var link = $('rresult_show_here_link'); + if(link) { + link.appendChild( text( + findOrgType(findOrgUnit(getLocation()).ou_type()).opac_label())); + unHideMe($('rresult_show_here')); + } + } + } + } } function rresultExpandSearch() { - var args = {}; - args[PARAM_RDEPTH] = findOrgDepth(globalOrgTree); - goTo(buildOPACLink(args)); + var args = {}; + args[PARAM_RDEPTH] = findOrgDepth(globalOrgTree); + goTo(buildOPACLink(args)); } function rresultContractSearch() { - var args = {}; - RDEPTH = null; - args[PARAM_OFFSET] = 0; - goTo(buildOPACLink(args)); + var args = {}; + RDEPTH = null; + args[PARAM_OFFSET] = 0; + goTo(buildOPACLink(args)); } function rresultGetDepth() { - if( getRdepth() != null) return getRdepth(); - return getDepth(); + if( getRdepth() != null) return getRdepth(); + return getDepth(); } function rresultGetForm() { - var form; - - if(getTform()) /* did the user select a format from the icon list (temporary) */ - form = (getTform() == 'all') ? null : getTform(); - else /* did the use select a format from simple search dropdown */ - form = (getForm() == 'all') ? null : getForm(); - - if(!form) { /* did the user select a format from the advanced search */ - form = getItemType(); - var f = getItemForm(); - - if(form) { - form = form.replace(/,/,''); - if(f) form += '-' + f; - } else { - if(f) form = '-' + f; - } - } - - return form; + var form; + + if(getTform()) /* did the user select a format from the icon list (temporary) */ + form = (getTform() == 'all') ? null : getTform(); + else /* did the use select a format from simple search dropdown */ + form = (getForm() == 'all') ? null : getForm(); + + if(!form) { /* did the user select a format from the advanced search */ + form = getItemType(); + var f = getItemForm(); + + if(form) { + form = form.replace(/,/,''); + if(f) form += '-' + f; + } else { + if(f) form = '-' + f; + } + } + + return form; } function rresultCollectMARCIds() { - var args = {}; - args.searches = JSON2js(getSearches()); - args.limit = 200; - args.org_unit = globalOrgTree.id(); - args.depth = 0; - - rresultIsPaged = true; - var req = new Request(FETCH_ADV_MARC_MRIDS, args, getDisplayCount(), getOffset()); - req.callback(rresultHandleRIds); - req.request.noretry = true; - req.send(); + var args = {}; + args.searches = JSON2js(getSearches()); + args.limit = 200; + args.org_unit = globalOrgTree.id(); + args.depth = 0; + + rresultIsPaged = true; + var req = new Request(FETCH_ADV_MARC_MRIDS, args, getDisplayCount(), getOffset()); + req.callback(rresultHandleRIds); + req.request.noretry = true; + req.send(); } function rresultCollectISBNIds() { - var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() ); - req.callback( - function(r) { - var blob = r.getResultObject(); - _rresultHandleIds(blob.ids, blob.count); - } - ); - req.send(); + var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() ); + req.callback( + function(r) { + var blob = r.getResultObject(); + _rresultHandleIds(blob.ids, blob.count); + } + ); + req.send(); } function rresultCollectTCNIds() { - var req = new Request(FETCH_ADV_TCN_RIDS, getAdvTerm() ); - req.callback( - function(r) { - var blob = r.getResultObject(); - _rresultHandleIds(blob.ids, blob.count); - } - ); - req.send(); + var req = new Request(FETCH_ADV_TCN_RIDS, getAdvTerm() ); + req.callback( + function(r) { + var blob = r.getResultObject(); + _rresultHandleIds(blob.ids, blob.count); + } + ); + req.send(); } function rresultCollectISSNIds() { - var req = new Request(FETCH_ADV_ISSN_RIDS, getAdvTerm() ); - req.callback( - function(r) { - var blob = r.getResultObject(); - _rresultHandleIds(blob.ids, blob.count); - } - ); - req.send(); + var req = new Request(FETCH_ADV_ISSN_RIDS, getAdvTerm() ); + req.callback( + function(r) { + var blob = r.getResultObject(); + _rresultHandleIds(blob.ids, blob.count); + } + ); + req.send(); } function rresultHandleList() { - var ids = new CGI().param(PARAM_RLIST); + var ids = new CGI().param(PARAM_RLIST); var count; if(!dojo.isArray(ids)) { count = 1; @@ -207,116 +207,116 @@ function rresultHandleList() { } else { count = ids.length; } - if(ids) _rresultHandleIds(ids, count); + if(ids) _rresultHandleIds(ids, count); } var rresultTries = 0; function rresultHandleRIds(r) { - var res = r.getResultObject(); + var res = r.getResultObject(); - if(!res) res = {count:0,ids:[]}; + if(!res) res = {count:0,ids:[]}; - if( res.count == 0 && rresultTries == 0 && ! r.noretry) { + if( res.count == 0 && rresultTries == 0 && ! r.noretry) { - rresultTries++; - var form = rresultGetForm(); - var args = { format : form, org : getLocation(), depth : findOrgDepth(globalOrgTree) }; + rresultTries++; + var form = rresultGetForm(); + var args = { format : form, org : getLocation(), depth : findOrgDepth(globalOrgTree) }; - var lasso = getLasso(); - if (lasso) args.org = -lasso; + var lasso = getLasso(); + if (lasso) args.org = -lasso; - var req = new Request(FETCH_RIDS, getMrid(), args ); - req.callback( rresultHandleRIds ); - req.send(); - unHideMe($('no_formats')); - hideMe($('rresult_show_all')); + var req = new Request(FETCH_RIDS, getMrid(), args ); + req.callback( rresultHandleRIds ); + req.send(); + unHideMe($('no_formats')); + hideMe($('rresult_show_all')); - } else { + } else { - _rresultHandleIds(res.ids, res.count); - } + _rresultHandleIds(res.ids, res.count); + } } function _rresultHandleIds(ids, count) { - //var json = js2JSON({ids:ids,count:count}); - /* - cookieManager.write(COOKIE_SRIDS, json, '+1d'); - */ - - HITCOUNT = parseInt(count); - runEvt('result', 'hitCountReceived'); - runEvt('result', 'idsReceived', ids, getOffset()); + //var json = js2JSON({ids:ids,count:count}); + /* + cookieManager.write(COOKIE_SRIDS, json, '+1d'); + */ + + HITCOUNT = parseInt(count); + runEvt('result', 'hitCountReceived'); + runEvt('result', 'idsReceived', ids, getOffset()); } /* function rresultCollectRecords(ids) { - runEvt("result", "preCollectRecords"); - var x = 0; - for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) { - if(ids[i] == null) break; - var req = new Request(FETCH_RMODS, parseInt(ids[i])); - req.callback(rresultHandleMods); - req.request.userdata = x++; - req.send(); - } + runEvt("result", "preCollectRecords"); + var x = 0; + for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) { + if(ids[i] == null) break; + var req = new Request(FETCH_RMODS, parseInt(ids[i])); + req.callback(rresultHandleMods); + req.request.userdata = x++; + req.send(); + } } */ function rresultCollectRecords(ids, base) { - runEvt("result", "preCollectRecords"); - var x = 0; - - if (!base) base = 0; - if( rresultIsPaged ) base = 0; - - for( var i = base; i!= getDisplayCount() + base; i++ ) { - if(ids[i] == null) break; - var req = new Request(FETCH_RMODS, parseInt(ids[i])); - req.callback(rresultHandleMods); - req.request.userdata = x++; - req.send(); - } + runEvt("result", "preCollectRecords"); + var x = 0; + + if (!base) base = 0; + if( rresultIsPaged ) base = 0; + + for( var i = base; i!= getDisplayCount() + base; i++ ) { + if(ids[i] == null) break; + var req = new Request(FETCH_RMODS, parseInt(ids[i])); + req.callback(rresultHandleMods); + req.request.userdata = x++; + req.send(); + } } function rresultHandleMods(r) { - var rec = r.getResultObject(); - runEvt('result', 'recordReceived', rec, r.userdata, false); - resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS); - if(resultPageIsDone()) { - runEvt('result', 'allRecordsReceived', recordsCache); - unHideMe($('copyright_block')); - } + var rec = r.getResultObject(); + runEvt('result', 'recordReceived', rec, r.userdata, false); + resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS); + if(resultPageIsDone()) { + runEvt('result', 'allRecordsReceived', recordsCache); + unHideMe($('copyright_block')); + } } function rresultLaunchDrawn(id, node) { - runEvt("rresult", "recordDrawn", id, node); + runEvt("rresult", "recordDrawn", id, node); } function rresultDoRecordSearch() { - rresultIsPaged = true; - resultCollectSearchIds(true, SEARCH_RS_QUERY, rresultFilterSearchResults ); + rresultIsPaged = true; + resultCollectSearchIds(true, SEARCH_RS_QUERY, rresultFilterSearchResults ); } function rresultDoRecordMultiSearch() { - rresultIsPaged = true; - resultCollectSearchIds(false, SEARCH_RS_QUERY, rresultFilterSearchResults ); + rresultIsPaged = true; + resultCollectSearchIds(false, SEARCH_RS_QUERY, rresultFilterSearchResults ); } function rresultFilterSearchResults(r) { - var result = r.getResultObject(); - var ids = []; - if( result.count > 0 ) { - for( var i = 0; i != result.ids.length; i++ ) - ids.push(result.ids[i][0]); - } + var result = r.getResultObject(); + var ids = []; + if( result.count > 0 ) { + for( var i = 0; i != result.ids.length; i++ ) + ids.push(result.ids[i][0]); + } resultCompiledSearch = result.compiled_search; cookieManager.write(COOKIE_SEARCH, js2JSON(result.compiled_search), -1); - _rresultHandleIds( ids, result.count ); + _rresultHandleIds( ids, result.count ); } diff --git a/Open-ILS/web/opac/skin/default/js/search_bar.js b/Open-ILS/web/opac/skin/default/js/search_bar.js index 37dc49eaf6..0b83d0cb60 100644 --- a/Open-ILS/web/opac/skin/default/js/search_bar.js +++ b/Open-ILS/web/opac/skin/default/js/search_bar.js @@ -9,37 +9,37 @@ var isFrontPage = false; G.evt.common.init.push(searchBarInit); /* if set by the org selector, this will be the location used the - next time the search is submitted */ + next time the search is submitted */ var newSearchLocation; var newSearchDepth = null; function searchBarInit() { - _ts = G.ui.searchbar.type_selector; - _fs = G.ui.searchbar.form_selector; + _ts = G.ui.searchbar.type_selector; + _fs = G.ui.searchbar.form_selector; - try{G.ui.searchbar.text.focus();}catch(e){} - G.ui.searchbar.text.onkeydown = - function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; - _ts.onkeydown = - function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; - _fs.onkeydown = - function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; + try{G.ui.searchbar.text.focus();}catch(e){} + G.ui.searchbar.text.onkeydown = + function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; + _ts.onkeydown = + function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; + _fs.onkeydown = + function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } }; - G.ui.searchbar.submit.onclick = searchBarSubmit; + G.ui.searchbar.submit.onclick = searchBarSubmit; - /* set up the selector objects, etc */ - G.ui.searchbar.text.value = (getTerm() != null) ? getTerm() : ""; - setSelector(_ts, getStype()); - setSelector(_fs, getForm()); + /* set up the selector objects, etc */ + G.ui.searchbar.text.value = (getTerm() != null) ? getTerm() : ""; + setSelector(_ts, getStype()); + setSelector(_fs, getForm()); - depthSelInit(); + depthSelInit(); - if(!isFrontPage && (findCurrentPage() != MYOPAC)) { - attachEvt('common','depthChanged', searchBarSubmit); - } + if(!isFrontPage && (findCurrentPage() != MYOPAC)) { + attachEvt('common','depthChanged', searchBarSubmit); + } if( (limit = $('opac.result.limit2avail')) ) { if(getAvail()) limit.checked = true; @@ -50,29 +50,29 @@ function searchBarInit() { function searchBarSubmit(isFilterSort) { - var text = G.ui.searchbar.text.value; + var text = G.ui.searchbar.text.value; - clearSearchParams(); + clearSearchParams(); - if(!text || text == "") return; + if(!text || text == "") return; - var d = (newSearchDepth != null) ? newSearchDepth : depthSelGetDepth(); - if(isNaN(d)) d = 0; + var d = (newSearchDepth != null) ? newSearchDepth : depthSelGetDepth(); + if(isNaN(d)) d = 0; - var args = {}; + var args = {}; - if(SHOW_MR_DEFAULT || (isFilterSort && findCurrentPage() == MRESULT)) { - args.page = MRESULT; - } else { - args.page = RRESULT; - args[PARAM_RTYPE] = _ts.options[_ts.selectedIndex].value; - } + if(SHOW_MR_DEFAULT || (isFilterSort && findCurrentPage() == MRESULT)) { + args.page = MRESULT; + } else { + args.page = RRESULT; + args[PARAM_RTYPE] = _ts.options[_ts.selectedIndex].value; + } - args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value; - args[PARAM_TERM] = text; - args[PARAM_LOCATION] = depthSelGetNewLoc(); - args[PARAM_DEPTH] = d; - args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value; + args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value; + args[PARAM_TERM] = text; + args[PARAM_LOCATION] = depthSelGetNewLoc(); + args[PARAM_DEPTH] = d; + args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value; if($('opac.result.limit2avail')) { args[PARAM_AVAIL] = ($('opac.result.limit2avail').checked) ? 1 : ''; @@ -82,7 +82,7 @@ function searchBarSubmit(isFilterSort) { } } - goTo(buildOPACLink(args)); + goTo(buildOPACLink(args)); } diff --git a/Open-ILS/web/opac/skin/default/js/sidebar.js b/Open-ILS/web/opac/skin/default/js/sidebar.js index 45296e41be..bd8cf348b1 100644 --- a/Open-ILS/web/opac/skin/default/js/sidebar.js +++ b/Open-ILS/web/opac/skin/default/js/sidebar.js @@ -1,5 +1,5 @@ /* set up the colors in the sidebar - Disables/Enables certain components based on various state data */ + Disables/Enables certain components based on various state data */ attachEvt("common", "init", initSideBar); attachEvt("common", "init", setSidebarLinks); @@ -7,56 +7,56 @@ attachEvt("common", "init", setSidebarLinks); attachEvt("common", "unload", sidebarTreesFree ); function prevRResults() { - return buildOPACLink({ page : RRESULT }); + return buildOPACLink({ page : RRESULT }); } function prevMResults() { - return buildOPACLink({ page : MRESULT }); + return buildOPACLink({ page : MRESULT }); } function initSideBar() { - var page = findCurrentPage(); + var page = findCurrentPage(); - if( page == MRESULT ) - unHideMe($("sidebar_results_wrapper")); + if( page == MRESULT ) + unHideMe($("sidebar_results_wrapper")); - if( page == RRESULT ) { - unHideMe($("sidebar_results_wrapper")); - unHideMe(G.ui.sidebar[MRESULT]); - if( getRtype() == RTYPE_MRID ) - $("sidebar_title_group_results").setAttribute("href", prevMResults()); - else hideMe($("sidebar_title_group_results").parentNode); - } + if( page == RRESULT ) { + unHideMe($("sidebar_results_wrapper")); + unHideMe(G.ui.sidebar[MRESULT]); + if( getRtype() == RTYPE_MRID ) + $("sidebar_title_group_results").setAttribute("href", prevMResults()); + else hideMe($("sidebar_title_group_results").parentNode); + } - if( page == RDETAIL ) { - unHideMe($("sidebar_results_wrapper")); + if( page == RDETAIL ) { + unHideMe($("sidebar_results_wrapper")); - unHideMe(G.ui.sidebar[MRESULT]); - if(getRtype()) - $("sidebar_title_results").setAttribute("href", prevRResults()); - unHideMe(G.ui.sidebar[RRESULT]); + unHideMe(G.ui.sidebar[MRESULT]); + if(getRtype()) + $("sidebar_title_results").setAttribute("href", prevRResults()); + unHideMe(G.ui.sidebar[RRESULT]); - if( getRtype() == RTYPE_MRID ) - $("sidebar_title_group_results").setAttribute("href", prevMResults()); - else hideMe($("sidebar_title_group_results").parentNode); - } + if( getRtype() == RTYPE_MRID ) + $("sidebar_title_group_results").setAttribute("href", prevMResults()); + else hideMe($("sidebar_title_group_results").parentNode); + } - unHideMe(G.ui.sidebar[page]); - addCSSClass(G.ui.sidebar[page], "sidebar_item_active"); + unHideMe(G.ui.sidebar[page]); + addCSSClass(G.ui.sidebar[page], "sidebar_item_active"); - /* if we're logged in, show it and replace the Login link with the Logout link */ - if(grabUser()) { - G.ui.sidebar.username_dest.appendChild(text(G.user.usrname())); - unHideMe(G.ui.sidebar.logoutbox); - unHideMe(G.ui.sidebar.logged_in_as); - hideMe(G.ui.sidebar.loginbox); - } + /* if we're logged in, show it and replace the Login link with the Logout link */ + if(grabUser()) { + G.ui.sidebar.username_dest.appendChild(text(G.user.usrname())); + unHideMe(G.ui.sidebar.logoutbox); + unHideMe(G.ui.sidebar.logged_in_as); + hideMe(G.ui.sidebar.loginbox); + } - if(G.ui.sidebar.login) G.ui.sidebar.login.onclick = initLogin; - if(G.ui.sidebar.logout) G.ui.sidebar.logout.onclick = doLogout; + if(G.ui.sidebar.login) G.ui.sidebar.login.onclick = initLogin; + if(G.ui.sidebar.logout) G.ui.sidebar.logout.onclick = doLogout; - if(isXUL()) hideMe( G.ui.sidebar.logoutbox ); + if(isXUL()) hideMe( G.ui.sidebar.logoutbox ); } /* sets up the login ui components */ @@ -64,61 +64,61 @@ var loginBoxVisible = false; function loginDance() { - if(doLogin(true)) { + if(doLogin(true)) { - if(!strongPassword( G.ui.login.password.value ) ) { + if(!strongPassword( G.ui.login.password.value ) ) { - cookieManager.write(COOKIE_SES, ""); - hideMe($('login_table')); - unHideMe($('change_pw_table')); - $('change_pw_current').focus(); - $('change_pw_button').onclick = changePassword; - setEnterFunc($('change_pw_2'), changePassword); + cookieManager.write(COOKIE_SES, ""); + hideMe($('login_table')); + unHideMe($('change_pw_table')); + $('change_pw_current').focus(); + $('change_pw_button').onclick = changePassword; + setEnterFunc($('change_pw_2'), changePassword); - } else { - loggedInOK(); - } - } + } else { + loggedInOK(); + } + } } function loggedInOK() { - showCanvas(); - G.ui.sidebar.username_dest.appendChild(text(G.user.usrname())); - unHideMe(G.ui.sidebar.logoutbox); - unHideMe(G.ui.sidebar.logged_in_as); - hideMe(G.ui.sidebar.loginbox); - runEvt( 'common', 'loggedIn'); - - var org = G.user.prefs[PREF_DEF_LOCATION]; - if(!org) org = G.user.home_ou(); - - var depth = G.user.prefs[PREF_DEF_DEPTH]; - if(! ( depth && depth <= findOrgDepth(org)) ) - depth = findOrgDepth(org); - - runEvt( "common", "locationChanged", org, depth); + showCanvas(); + G.ui.sidebar.username_dest.appendChild(text(G.user.usrname())); + unHideMe(G.ui.sidebar.logoutbox); + unHideMe(G.ui.sidebar.logged_in_as); + hideMe(G.ui.sidebar.loginbox); + runEvt( 'common', 'loggedIn'); + + var org = G.user.prefs[PREF_DEF_LOCATION]; + if(!org) org = G.user.home_ou(); + + var depth = G.user.prefs[PREF_DEF_DEPTH]; + if(! ( depth && depth <= findOrgDepth(org)) ) + depth = findOrgDepth(org); + + runEvt( "common", "locationChanged", org, depth); } function changePassword() { - var pc = $('change_pw_current').value; - var p1 = $('change_pw_1').value; - var p2 = $('change_pw_2').value; + var pc = $('change_pw_current').value; + var p1 = $('change_pw_1').value; + var p2 = $('change_pw_2').value; - if( p1 != p2 ) { - alert($('pw_no_match').innerHTML); - return; - } + if( p1 != p2 ) { + alert($('pw_no_match').innerHTML); + return; + } - if(!strongPassword(p2, true) ) return; + if(!strongPassword(p2, true) ) return; - var req = new Request(UPDATE_PASSWORD, G.user.session, p2, pc ); - req.send(true); - if(req.result()) { - alert($('pw_update_successful').innerHTML); - loggedInOK(); - } + var req = new Request(UPDATE_PASSWORD, G.user.session, p2, pc ); + req.send(true); + if(req.result()) { + alert($('pw_update_successful').innerHTML); + loggedInOK(); + } } var pwRegexSetting; @@ -132,7 +132,7 @@ function strongPassword(pass, alrt) { return true; } else { if(alrt) - alert($('pw_not_strong').innerHTML); + alert($('pw_not_strong').innerHTML); return false; } } @@ -140,55 +140,55 @@ function strongPassword(pass, alrt) { /* no regex configured, use the default */ - var good = false; + var good = false; - do { + do { - if(pass.length < 7) break; - if(!pass.match(/.*\d+.*/)) break; - if(!pass.match(/.*[A-Za-z]+.*/)) break; - good = true; + if(pass.length < 7) break; + if(!pass.match(/.*\d+.*/)) break; + if(!pass.match(/.*[A-Za-z]+.*/)) break; + good = true; - } while(0); + } while(0); - if(!good && alrt) alert($('pw_not_strong').innerHTML); - return good; + if(!good && alrt) alert($('pw_not_strong').innerHTML); + return good; } function initLogin() { - G.ui.login.button.onclick = loginDance; - G.ui.login.username.onkeydown = - function(evt) {if(userPressedEnter(evt)) loginDance();}; - G.ui.login.password.onkeydown = - function(evt) {if(userPressedEnter(evt)) loginDance();}; - -// if(loginBoxVisible) { -// showCanvas(); -// } else { - swapCanvas(G.ui.login.box); - try{G.ui.login.username.focus();}catch(e){} -// } - -// loginBoxVisible = !loginBoxVisible; - G.ui.login.cancel.onclick = showCanvas; - if(findCurrentPage() == MYOPAC) - G.ui.login.cancel.onclick = goHome; + G.ui.login.button.onclick = loginDance; + G.ui.login.username.onkeydown = + function(evt) {if(userPressedEnter(evt)) loginDance();}; + G.ui.login.password.onkeydown = + function(evt) {if(userPressedEnter(evt)) loginDance();}; + +// if(loginBoxVisible) { +// showCanvas(); +// } else { + swapCanvas(G.ui.login.box); + try{G.ui.login.username.focus();}catch(e){} +// } + +// loginBoxVisible = !loginBoxVisible; + G.ui.login.cancel.onclick = showCanvas; + if(findCurrentPage() == MYOPAC) + G.ui.login.cancel.onclick = goHome; } function setSidebarLinks() { - G.ui.sidebar.home_link.setAttribute("href", buildOPACLink({page:HOME})); - G.ui.sidebar.advanced_link.setAttribute("href", buildOPACLink({page:ADVANCED})); - G.ui.sidebar.myopac_link.setAttribute("href", buildOPACLink({page:MYOPAC}, false, true)); + G.ui.sidebar.home_link.setAttribute("href", buildOPACLink({page:HOME})); + G.ui.sidebar.advanced_link.setAttribute("href", buildOPACLink({page:ADVANCED})); + G.ui.sidebar.myopac_link.setAttribute("href", buildOPACLink({page:MYOPAC}, false, true)); } function sidebarTreesFree() { - removeChildren($(subjectSidebarTree.rootid)); - removeChildren($(authorSidebarTree.rootid)); - removeChildren($(seriesSidebarTree.rootid)); - subjectSidebarTree = null; - authorSidebarTree = null; - seriesSidebarTree = null; + removeChildren($(subjectSidebarTree.rootid)); + removeChildren($(authorSidebarTree.rootid)); + removeChildren($(seriesSidebarTree.rootid)); + subjectSidebarTree = null; + authorSidebarTree = null; + seriesSidebarTree = null; } @@ -200,26 +200,26 @@ function sidebarTreesFree() { attachEvt('common', 'init', buildEGGalLink); function buildEGGalLink() { - /* we're in a lib, nothing to do here */ - if( getOrigLocation() ) return; - if(!$('eg_gal_link')) return; - - //var link = 'http://demo.galib.uga.edu/express?pinesid='; - var link = 'http://www.galileo.usg.edu/express?pinesid='; - if(grabUser()) { - $('eg_gal_link').setAttribute('href', link + G.user.session); - return; - } - - $('eg_gal_link').setAttribute('href', 'javascript:void(0);'); - $('eg_gal_link').setAttribute('target', ''); - $('eg_gal_link').onclick = function() { - /* we're not logged in. go ahead and login */ - detachAllEvt('common','locationChanged'); - detachAllEvt('common','loggedIn'); - attachEvt('common','loggedIn', function() { goTo(link + G.user.session); }) - initLogin(); - }; + /* we're in a lib, nothing to do here */ + if( getOrigLocation() ) return; + if(!$('eg_gal_link')) return; + + //var link = 'http://demo.galib.uga.edu/express?pinesid='; + var link = 'http://www.galileo.usg.edu/express?pinesid='; + if(grabUser()) { + $('eg_gal_link').setAttribute('href', link + G.user.session); + return; + } + + $('eg_gal_link').setAttribute('href', 'javascript:void(0);'); + $('eg_gal_link').setAttribute('target', ''); + $('eg_gal_link').onclick = function() { + /* we're not logged in. go ahead and login */ + detachAllEvt('common','locationChanged'); + detachAllEvt('common','loggedIn'); + attachEvt('common','loggedIn', function() { goTo(link + G.user.session); }) + initLogin(); + }; } /* --------------------------------------------------------------------------------- */ diff --git a/Open-ILS/web/opac/skin/default/js/sidebar_extras.js b/Open-ILS/web/opac/skin/default/js/sidebar_extras.js index cb35d886d3..f93dbb960c 100644 --- a/Open-ILS/web/opac/skin/default/js/sidebar_extras.js +++ b/Open-ILS/web/opac/skin/default/js/sidebar_extras.js @@ -6,110 +6,110 @@ var authorCache = {}; var seriesCache = {}; function resultBuildCaches(records) { - for( var r in records ) { - var rec = records[r]; - for( var s in rec.subject() ) - subjectCache[s] == null ? subjectCache[s] = 1 : subjectCache[s]++; - authorCache[rec.author()] = 1; - for( var s in rec.series() ) seriesCache[rec.series()[s]] = 1; - } + for( var r in records ) { + var rec = records[r]; + for( var s in rec.subject() ) + subjectCache[s] == null ? subjectCache[s] = 1 : subjectCache[s]++; + authorCache[rec.author()] = 1; + for( var s in rec.series() ) seriesCache[rec.series()[s]] = 1; + } } function resultSortSubjects(a, b) { return -(a.count - b.count); } /* sort in reverse */ function resultDrawSubjects() { - var subjs = []; - for( var s in subjectCache ) - subjs.push( { sub : s, count : subjectCache[s] } ); - subjs.sort(resultSortSubjects); + var subjs = []; + for( var s in subjectCache ) + subjs.push( { sub : s, count : subjectCache[s] } ); + subjs.sort(resultSortSubjects); - var ss = []; - for( var s in subjs ) ss.push(subjs[s].sub); + var ss = []; + for( var s in subjs ) ss.push(subjs[s].sub); - resultDrawSidebarTrees( - STYPE_SUBJECT, - "subjectSidebarTree", ss, - $("subject_tree_sidebar"), - $("subject_sidebar_tree_div") ); + resultDrawSidebarTrees( + STYPE_SUBJECT, + "subjectSidebarTree", ss, + $("subject_tree_sidebar"), + $("subject_sidebar_tree_div") ); } function resultDrawAuthors() { - var auths = new Array(); - for( var s in authorCache ) auths.push(s); - - resultDrawSidebarTrees( - STYPE_AUTHOR, - "authorSidebarTree", auths.sort(), - $("author_tree_sidebar"), - $("author_sidebar_tree_div") ); + var auths = new Array(); + for( var s in authorCache ) auths.push(s); + + resultDrawSidebarTrees( + STYPE_AUTHOR, + "authorSidebarTree", auths.sort(), + $("author_tree_sidebar"), + $("author_sidebar_tree_div") ); } function resultDrawSeries() { - var sers = new Array(); - for( var s in seriesCache ) sers.push(s); - resultDrawSidebarTrees( - STYPE_SERIES, - "seriesSidebarTree", sers.sort(), - $("series_tree_sidebar"), - $("series_sidebar_tree_div") ); + var sers = new Array(); + for( var s in seriesCache ) sers.push(s); + resultDrawSidebarTrees( + STYPE_SERIES, + "seriesSidebarTree", sers.sort(), + $("series_tree_sidebar"), + $("series_sidebar_tree_div") ); } var IESux = true; function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode ) { - eval("tree = " + treeName); + eval("tree = " + treeName); - var xrefCache = []; - var found = false; - var x = 0; - for( var i in items ) { + var xrefCache = []; + var found = false; + var x = 0; + for( var i in items ) { - if(isNull(items[i])) continue; + if(isNull(items[i])) continue; - /* again, IE is a turd */ - if(IE) { if(x++ > 5) break; } - else { if(x++ > 7) break; } + /* again, IE is a turd */ + if(IE) { if(x++ > 5) break; } + else { if(x++ > 7) break; } - found = true; + found = true; - var item = normalize(truncate(items[i], 65)); - var args = {}; - var href = resultQuickLink( items[i], stype ); - tree.addNode( stype + "_" + items[i], treeName + 'Root', item, href ); + var item = normalize(truncate(items[i], 65)); + var args = {}; + var href = resultQuickLink( items[i], stype ); + tree.addNode( stype + "_" + items[i], treeName + 'Root', item, href ); -// if( !IE ) resultFireXRefReq(treeName, stype, items[i]); +// if( !IE ) resultFireXRefReq(treeName, stype, items[i]); - var a = {}; - a.type = stype; - a.term = item; - xrefCache.push(a); - } + var a = {}; + a.type = stype; + a.term = item; + xrefCache.push(a); + } - if(found) { - unHideMe(wrapperNode); -// if(IE) resultFireXRefSingle(treeName, xrefCache, stype); - /* XXX */ // disabled auth lookups for now + if(found) { + unHideMe(wrapperNode); +// if(IE) resultFireXRefSingle(treeName, xrefCache, stype); + /* XXX */ // disabled auth lookups for now - if( DO_AUTHORITY_LOOKUPS ) { - resultFireXRefBatch(treeName, xrefCache, stype); - } - } + if( DO_AUTHORITY_LOOKUPS ) { + resultFireXRefBatch(treeName, xrefCache, stype); + } + } } /* XXX */ function resultFireXRefBatch(treeName, xrefCache, stype) { - var query = []; - for( var i = 0; i != xrefCache.length; i++ ) { - var topic = xrefCache[i]; - query.push( [ topic.type, topic.term ] ); - } - var req = new Request(FETCH_CROSSREF_BATCH, query); - var tree; - eval('tree=' + treeName); - req.request._tree = tree; - req.request._stype = stype; - req.callback(resultRenderXRefTree); - req.send(); + var query = []; + for( var i = 0; i != xrefCache.length; i++ ) { + var topic = xrefCache[i]; + query.push( [ topic.type, topic.term ] ); + } + var req = new Request(FETCH_CROSSREF_BATCH, query); + var tree; + eval('tree=' + treeName); + req.request._tree = tree; + req.request._stype = stype; + req.callback(resultRenderXRefTree); + req.send(); } var xrefCacheIndex = {}; @@ -118,101 +118,101 @@ xrefCacheIndex['author'] = 0; xrefCacheIndex['series'] = 0; function resultHandleXRefResponse(r) { - resultFireXRefSingle( r._treename, r._cache, r._stype ); - resultAppendCrossRef(r); + resultFireXRefSingle( r._treename, r._cache, r._stype ); + resultAppendCrossRef(r); } function resultFireXRefSingle( treeName, xrefCache, stype ) { - var i = xrefCacheIndex[stype]++; - if(xrefCache[i] == null) return; - var item = xrefCache[i].term; - var tree; - eval('tree=' + treeName); - var req = new Request(FETCH_CROSSREF, stype, item); - req.request._tree = tree; - req.request._item = item; - req.request._stype = stype; - req.request._cache = xrefCache; - req.request._treename = treeName; - req.callback(resultHandleXRefResponse); - req.send(); + var i = xrefCacheIndex[stype]++; + if(xrefCache[i] == null) return; + var item = xrefCache[i].term; + var tree; + eval('tree=' + treeName); + var req = new Request(FETCH_CROSSREF, stype, item); + req.request._tree = tree; + req.request._item = item; + req.request._stype = stype; + req.request._cache = xrefCache; + req.request._treename = treeName; + req.callback(resultHandleXRefResponse); + req.send(); } function resultFireXRefReq( treeName, stype, item ) { - var tree; - eval('tree=' + treeName); - var req = new Request(FETCH_CROSSREF, stype, item); - req.request._tree = tree; - req.request._item = item; - req.request._stype = stype; - req.callback(resultAppendCrossRef); - req.send(); + var tree; + eval('tree=' + treeName); + var req = new Request(FETCH_CROSSREF, stype, item); + req.request._tree = tree; + req.request._item = item; + req.request._stype = stype; + req.callback(resultAppendCrossRef); + req.send(); } function resultQuickLink( term, type ) { - var args = {}; - if(SHOW_MR_DEFAULT) { - args.page = MRESULT; - } else { - args.page = RRESULT; - args[PARAM_RTYPE] = type; - } - args[PARAM_OFFSET] = 0; - args[PARAM_TERM] = term; - args[PARAM_STYPE] = type; - return buildOPACLink(args); + var args = {}; + if(SHOW_MR_DEFAULT) { + args.page = MRESULT; + } else { + args.page = RRESULT; + args[PARAM_RTYPE] = type; + } + args[PARAM_OFFSET] = 0; + args[PARAM_TERM] = term; + args[PARAM_STYPE] = type; + return buildOPACLink(args); } /* XXX */ function resultRenderXRefTree(r) { - var tree = r._tree; - var res = r.getResultObject(); - var stype = r._stype; - - for( var c in res ) { - var cls = res[c]; - for( var t in cls ) { - var term = res[c][t]; - var froms = term['from']; - var alsos = term['also']; - var total = 0; - - for( var i = 0; (total++ < 5 && i < froms.length); i++ ) { - var string = normalize(truncate(froms[i], 45)); - if($(stype + '_' + froms[i])) continue; - tree.addNode(stype + '_' + froms[i], - stype + '_' + t, string, resultQuickLink(froms[i],stype)); - } - for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) { - var string = normalize(truncate(alsos[i], 45)); - if($(stype + '_' + alsos[i])) continue; - tree.addNode(stype + '_' + alsos[i], - stype + '_' + t, string, resultQuickLink(alsos[i],stype)); - } - } - } + var tree = r._tree; + var res = r.getResultObject(); + var stype = r._stype; + + for( var c in res ) { + var cls = res[c]; + for( var t in cls ) { + var term = res[c][t]; + var froms = term['from']; + var alsos = term['also']; + var total = 0; + + for( var i = 0; (total++ < 5 && i < froms.length); i++ ) { + var string = normalize(truncate(froms[i], 45)); + if($(stype + '_' + froms[i])) continue; + tree.addNode(stype + '_' + froms[i], + stype + '_' + t, string, resultQuickLink(froms[i],stype)); + } + for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) { + var string = normalize(truncate(alsos[i], 45)); + if($(stype + '_' + alsos[i])) continue; + tree.addNode(stype + '_' + alsos[i], + stype + '_' + t, string, resultQuickLink(alsos[i],stype)); + } + } + } } /* Addes the see-from/see-also entries for this subject item */ function resultAppendCrossRef(r) { - var tree = r._tree - var item = r._item - var stype = r._stype; - var result = r.getResultObject(); - if(!result) return; - var froms = result['from']; - var alsos = result['also']; + var tree = r._tree + var item = r._item + var stype = r._stype; + var result = r.getResultObject(); + if(!result) return; + var froms = result['from']; + var alsos = result['also']; - var total = 0; + var total = 0; - for( var i = 0; (total++ < 5 && i < froms.length); i++ ) - resultAddXRefItem( tree, item, stype, froms, i ); + for( var i = 0; (total++ < 5 && i < froms.length); i++ ) + resultAddXRefItem( tree, item, stype, froms, i ); - for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) - resultAddXRefItem( tree, item, stype, alsos, i ); + for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) + resultAddXRefItem( tree, item, stype, alsos, i ); } /** @@ -221,19 +221,19 @@ function resultAppendCrossRef(r) { var collectedStrings = []; function resultAddXRefItem(tree, rootItem, stype, arr, idx) { - var string = normalize(truncate(arr[idx], 45)); + var string = normalize(truncate(arr[idx], 45)); - if( string == rootItem ) return; + if( string == rootItem ) return; - if( grep( collectedStrings, - function(a) { return (a == string); }) ) return; + if( grep( collectedStrings, + function(a) { return (a == string); }) ) return; - if($(stype + '_' + arr[idx])) return; + if($(stype + '_' + arr[idx])) return; - tree.addNode(stype + '_' + arr[idx], - stype + '_' + rootItem, string, resultQuickLink(arr[idx],stype)); + tree.addNode(stype + '_' + arr[idx], + stype + '_' + rootItem, string, resultQuickLink(arr[idx],stype)); - collectedStrings.push(string); + collectedStrings.push(string); } diff --git a/Open-ILS/web/opac/skin/default/js/tips.js b/Open-ILS/web/opac/skin/default/js/tips.js index b24985b326..a4573b88b8 100644 --- a/Open-ILS/web/opac/skin/default/js/tips.js +++ b/Open-ILS/web/opac/skin/default/js/tips.js @@ -2,18 +2,18 @@ attachEvt('result', 'allRecordsReceived', insertTip); /* var user_tips = [ - 'Click on a folder icon in the sidebar to access related quick searches', - "If you don't find what you want try expanding your search using the range selector at the right of the search bar" + 'Click on a folder icon in the sidebar to access related quick searches', + "If you don't find what you want try expanding your search using the range selector at the right of the search bar" ]; */ function insertTip () { - var tip_div = document.getElementById('tips'); - if (tip_div) { - var tips = tip_div.getElementsByTagName('div')[0].getElementsByTagName('span'); - var index = Math.floor(Math.random() * tips.length); - tip_div.appendChild( tips[index] ); - removeCSSClass(tip_div, 'hide_me'); - } + var tip_div = document.getElementById('tips'); + if (tip_div) { + var tips = tip_div.getElementsByTagName('div')[0].getElementsByTagName('span'); + var index = Math.floor(Math.random() * tips.length); + tip_div.appendChild( tips[index] ); + removeCSSClass(tip_div, 'hide_me'); + } } diff --git a/Open-ILS/web/opac/theme/craftsman/css/colors.css b/Open-ILS/web/opac/theme/craftsman/css/colors.css index 7209c9458c..aa5f1c08e9 100644 --- a/Open-ILS/web/opac/theme/craftsman/css/colors.css +++ b/Open-ILS/web/opac/theme/craftsman/css/colors.css @@ -1,6 +1,6 @@ -body a { color: black; text-decoration: none;} +body a { color: black; text-decoration: none;} body a:visited { color: black; text-decoration: none;} -body a:hover { color: red; text-decoration: underline;} +body a:hover { color: red; text-decoration: underline;} /* the idea is to have 4 complimentary colors that @@ -43,10 +43,10 @@ a:focus { background: #E0F0E0; color: #000000;} .canvas { /* main content div for each page */ /* - border-left: 3px solid #A7EA9D; + border-left: 3px solid #A7EA9D; border-bottom: 3px solid #A7EA9D; - border-top: 3px solid #A7EA9D; - */ + border-top: 3px solid #A7EA9D; + */ } /* border around home search box */ @@ -86,7 +86,7 @@ a:focus { background: #E0F0E0; color: #000000;} .result_table_subtable { border-top: 1px solid #E0E0E0; } .copy_count_cell { border-right: 1px solid #E0E0E0; } -.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } +.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } #rdetail_image_cell { } diff --git a/Open-ILS/web/opac/theme/default/css/colors.css b/Open-ILS/web/opac/theme/default/css/colors.css index fe250477bd..ba0b7c5adb 100644 --- a/Open-ILS/web/opac/theme/default/css/colors.css +++ b/Open-ILS/web/opac/theme/default/css/colors.css @@ -1,6 +1,6 @@ -body a { color: black; text-decoration: none;} +body a { color: black; text-decoration: none;} body a:visited { color: black; text-decoration: none;} -body a:hover { color: red; text-decoration: underline;} +body a:hover { color: red; text-decoration: underline;} /* the idea is to have 4 complimentary colors that @@ -44,7 +44,7 @@ a:focus { background: #E0F0E0; color: #000000;} .canvas { /* main content div for each page */ border-left: 3px solid #A7EA9D; border-bottom: 3px solid #A7EA9D; - border-top: 3px solid #A7EA9D; + border-top: 3px solid #A7EA9D; } /* border around home search box */ @@ -84,7 +84,7 @@ a:focus { background: #E0F0E0; color: #000000;} .result_table_subtable { border-top: 1px solid #E0E0E0; } .copy_count_cell { border-right: 1px solid #E0E0E0; } -.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } +.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } #rdetail_image_cell { border: 1px solid white; border-right: 1px solid #A7EA9D;} diff --git a/Open-ILS/web/opac/theme/reddish/css/colors.css b/Open-ILS/web/opac/theme/reddish/css/colors.css index 7c49125116..76a2f038ff 100644 --- a/Open-ILS/web/opac/theme/reddish/css/colors.css +++ b/Open-ILS/web/opac/theme/reddish/css/colors.css @@ -1,6 +1,6 @@ -body a { color: black; text-decoration: none;} +body a { color: black; text-decoration: none;} body a:visited { color: black; text-decoration: none;} -body a:hover { color: red; text-decoration: underline;} +body a:hover { color: red; text-decoration: underline;} /* @@ -46,7 +46,7 @@ a:focus { background: #FFDFBF; color: #000000;} .canvas { /* main content div for each page */ border-left: 3px solid #FF8000; border-bottom: 3px solid #FF8000; - border-top: 3px solid #FF8000; + border-top: 3px solid #FF8000; } /* border around home search box */ @@ -86,7 +86,7 @@ a:focus { background: #FFDFBF; color: #000000;} .result_table_subtable { border-top: 1px solid #E0E0E0; } .copy_count_cell { border-right: 1px solid #E0E0E0; } -.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } +.copy_count_div { border-left: 2px solid #E0F6E0; border-right: 2px solid #E0F6E0; } #rdetail_image_cell { border: 1px solid white; border-right: 1px solid #A7EA9D;} diff --git a/Open-ILS/web/reports/oils_rpt.css b/Open-ILS/web/reports/oils_rpt.css index d4db1f2b16..a96210b62e 100644 --- a/Open-ILS/web/reports/oils_rpt.css +++ b/Open-ILS/web/reports/oils_rpt.css @@ -9,286 +9,286 @@ table { border-collapse: collapse; } .fm_table thead tr { background: #F0F0F0; } .oils_rpt_main_link { - padding: 5px; - font-size: 10pt; + padding: 5px; + font-size: 10pt; } #oils_rpt_name_table { - vertical-align: middle; - background: #E0F0F0; - margin-bottom: 20px; - width: 100%; + vertical-align: middle; + background: #E0F0F0; + margin-bottom: 20px; + width: 100%; } #oils_rpt_name_table td { - padding: 5px; + padding: 5px; } #oils_rpt_table { - width: 100%; - border-top: 2px solid #E0E0E0; - border-left: 2px solid #E0E0E0; - margin-top: 25px; - margin-left: 10px; - padding: 5px; + width: 100%; + border-top: 2px solid #E0E0E0; + border-left: 2px solid #E0E0E0; + margin-top: 25px; + margin-left: 10px; + padding: 5px; } #oils_rpt_table tr { - -moz-border-radius: 5px 5px 5px 5px; + -moz-border-radius: 5px 5px 5px 5px; } #oils_rpt_table td { - vertical-align: top; - padding: 3px; + vertical-align: top; + padding: 3px; } #oils_rpt_tree_loading { - width: 100%; - text-align: center; - background: #E0E0E0; - margin-top: 40px; - padding: 5px; + width: 100%; + text-align: center; + background: #E0E0E0; + margin-top: 40px; + padding: 5px; } .oils_rpt_info_item { - width: 310px; + width: 310px; } .oils_rpt_info_title { - text-align: center; - font-weight: 600; - padding-bottom: 10px; + text-align: center; + font-weight: 600; + padding-bottom: 10px; } .oils_rpt_info_selector { - border: 1px solid blue; - background: #E0F0F0; - min-height: 150px; - max-height: 290px; - overflow: auto; + border: 1px solid blue; + background: #E0F0F0; + min-height: 150px; + max-height: 290px; + overflow: auto; } .oils_rpt_small_info_selector { - border: 1px solid blue; - background: #E0F0F0; - height: 80px; - width: 12em; - overflow: auto; + border: 1px solid blue; + background: #E0F0F0; + height: 80px; + width: 12em; + overflow: auto; } .oils_rpt_info_div { - text-align: center; - width: 320px; - padding-left: 10px; - padding: 10px; - border-left: 2px solid #E0E0E0; - border-bottom: 1px solid #E0E0E0; - margin-right: 20px; + text-align: center; + width: 320px; + padding-left: 10px; + padding: 10px; + border-left: 2px solid #E0E0E0; + border-bottom: 1px solid #E0E0E0; + margin-right: 20px; } #oils_rpt_table_right_td { - padding-right: 20px; - padding-left: 20px; + padding-right: 20px; + padding-left: 20px; } button { - color:#050; - font-family:'trebuchet ms',helvetica,sans-serif; - font-size:84%; - font-weight:bold; - background-color:#fed; - border:2px solid; - border-top-color:#696; - border-left-color:#696; - border-right-color:#363; - border-bottom-color:#363; - margin: 4px; - border-style: outset; + color:#050; + font-family:'trebuchet ms',helvetica,sans-serif; + font-size:84%; + font-weight:bold; + background-color:#fed; + border:2px solid; + border-top-color:#696; + border-left-color:#696; + border-right-color:#363; + border-bottom-color:#363; + margin: 4px; + border-style: outset; } button:active { - border-style: inset; + border-style: inset; } button:disabled { - color: #000; - background-color: #EEE; - border: 2px solid #888; + color: #000; + background-color: #EEE; + border: 2px solid #888; } .floaty { - position: absolute; - text-align: center; - z-index: 1; - /*background: #E0F0F0; */ - background: #FFCC7F; /* see FF9900 as the primary color in the color picker for complimentaries */ - border: 3px groove #0033EE; - padding: 10px; + position: absolute; + text-align: center; + z-index: 1; + /*background: #E0F0F0; */ + background: #FFCC7F; /* see FF9900 as the primary color in the color picker for complimentaries */ + border: 3px groove #0033EE; + padding: 10px; - /* testing static location */ - width: 600px; - top: 60px; - left: 20px; + /* testing static location */ + width: 600px; + top: 60px; + left: 20px; } .oils_rpt_tab_picker_selected { - background: #96A1C6; + background: #96A1C6; } .oils_rpt_tab_table { - width: 100%; - background: #F0F0F0; - margin: 4px; - margin-bottom: 10px; - border: 1px solid #808080; - border-collapse: collapse; - text-align: center; - font-weight: bold; + width: 100%; + background: #F0F0F0; + margin: 4px; + margin-bottom: 10px; + border: 1px solid #808080; + border-collapse: collapse; + text-align: center; + font-weight: bold; } .oils_rpt_tab_table td { - border-left: 1px solid #808080; - border-right: 1px solid #808080; - padding: 2px; + border-left: 1px solid #808080; + border-right: 1px solid #808080; + padding: 2px; } #oils_rpt_column_editor_close_div { - margin-top: 5px; - padding-top: 5px; - border-top: 2px solid #E0E0E0; + margin-top: 5px; + padding-top: 5px; + border-top: 2px solid #E0E0E0; } .oils_rpt_field_editor_window { - margin: 5px; - text-align: left; - padding: 5px; - padding-left: 20px; + margin: 5px; + text-align: left; + padding: 5px; + padding-left: 20px; } .oils_rpt_tree_link_ref { - color: #A52A2A; + color: #A52A2A; } .oils_rpt_invalid_input { - background: red; + background: red; } .oils_rpt_editor_window_tbody td { - border-bottom: 1px solid #A0A0A0; - padding: 4px; + border-bottom: 1px solid #A0A0A0; + padding: 4px; } .oils_rpt_cal_image { - cursor: pointer; - border: 1px solid red; - padding: 0px; margin: -3px; + cursor: pointer; + border: 1px solid red; + padding: 0px; margin: -3px; } #oils_rpt_folder_table { - margin-top: 15px; - width: 100%; + margin-top: 15px; + width: 100%; } #oils_rpt_folder_table_left_td { - vertical-align: top; - width: 25%; + vertical-align: top; + width: 25%; } #oils_rpt_folder_table_right_td { - border-left: 2px solid #E0E0E0; - text-align: center; - vertical-align: top; - padding: 10px; + border-left: 2px solid #E0E0E0; + text-align: center; + vertical-align: top; + padding: 10px; } .oils_rpt_folder_window { - border: 1px solid blue; - background: #E6F0F0; - text-align: left; + border: 1px solid blue; + background: #E6F0F0; + text-align: left; } .oils_rpt_folder_window td { - padding: 5px; + padding: 5px; } #oils_rpt_folder_window_contents_div { - width: 100%; - margin-top: 5px; + width: 100%; + margin-top: 5px; } .oils_rpt_param_table thead td { - font-weight: bold; + font-weight: bold; } .oils_rpt_param_table td { - border: 1px solid #808080; - padding: 5px; + border: 1px solid #808080; + padding: 5px; } #oils_rpt_folder_details_table { - width: 100%; - margin-bottom: 10px; + width: 100%; + margin-bottom: 10px; } #oils_rpt_folder_details_table tr { - border: 1px solid #808080; + border: 1px solid #808080; } #oils_rpt_folder_details_table td { - text-align: center; - padding: 5px; + text-align: center; + padding: 5px; } #oils_rpt_template_folder_go_row { - border-bottom: 1px solid #808080; - margin-bottom: 10px; + border-bottom: 1px solid #808080; + margin-bottom: 10px; } #oils_rpt_param_editor_table { - width: 100%; + width: 100%; } #oils_rpt_param_editor_table td { - border: 1px solid #808080; - padding: 2px; + border: 1px solid #808080; + padding: 2px; } #oils_rpt_param_editor_table thead td { - font-weight: bold; - text-align: center; + font-weight: bold; + text-align: center; } .oils_rpt_folder_tree { - margin: 5px; + margin: 5px; } .oils_rpt_folder_tree_div { - border: 1px solid #808080; - margin: 10px; - min-width: 170px; + border: 1px solid #808080; + margin: 10px; + min-width: 170px; } .oils_rpt_folder_contents { - min-width: 200px; + min-width: 200px; } .oils_rpt_folder_window_contents_row { - border-bottom: 1px solid #808080; - margin: 10px; + border-bottom: 1px solid #808080; + margin: 10px; } #oils_rpt_folder_window_contents_table { - width: 100%; + width: 100%; } #oils_rpt_folder_window_contents_table td { - text-align: center; + text-align: center; } #oils_rpt_editor_div { - width: 100%; + width: 100%; } #oils_rpt_name_table tr { border: 1px solid #808080; } @@ -304,18 +304,18 @@ button:disabled { .oils_rpt_generic_table td { border: 1px solid #808080; padding: 5px; } #oils_rpt_content_count_row_2 { - border-top: 2px solid #808080; - border-bottom: 1px solid #808080; - padding-top: 10px; - margin-top: 10px; + border-top: 2px solid #808080; + border-bottom: 1px solid #808080; + padding-top: 10px; + margin-top: 10px; } #oils_rpt_editor_table tr { - border-bottom: 1px solid #D0D0D0; + border-bottom: 1px solid #D0D0D0; } #oils_rpt_editor_table tr td { - border-left: 1px solid #808080; + border-left: 1px solid #808080; } diff --git a/Open-ILS/web/reports/oils_rpt.js b/Open-ILS/web/reports/oils_rpt.js index ba542ffb03..8aa0f349f7 100644 --- a/Open-ILS/web/reports/oils_rpt.js +++ b/Open-ILS/web/reports/oils_rpt.js @@ -1,143 +1,143 @@ var perms = [ 'RUN_REPORTS', 'SHARE_REPORT_FOLDER' ]; function oilsInitReports() { - oilsRptIdObjects(); - - /* tell FF to capture mouse movements */ - document.captureEvents(Event.MOUSEMOVE); - document.onmousemove = setMousePos; - - DEBUGSLIM = true; - - var cgi = new CGI(); - fetchUser(cgi.param('ses')); - DOM.oils_rpt_user.appendChild(text(USER.usrname())); - - if( cgi.param('dbg') ) oilsRptDebugEnabled = true; - - fetchHighestPermOrgs(SESSION, USER.id(), perms); - if( PERMS.RUN_REPORTS == -1 ) { - unHideMe(DOM.oils_rpt_permission_denied); - hideMe(DOM.oils_rpt_tree_loading); - return false; - } - - - oilsRptCookie = new HTTP.Cookies(); - oilsRptCurrentOrg = USER.ws_ou(); - cookieManager.write(COOKIE_SES, SESSION, -1, '/'); - cookieManager.write('ws_ou', USER.ws_ou(), -1, '/'); - - oilsRptFetchOrgTree( - function() { - oilsLoadRptTree( - function() { - hideMe(DOM.oils_rpt_tree_loading); - unHideMe(DOM.oils_rpt_folder_table); - } - ) - } - ); - return true; + oilsRptIdObjects(); + + /* tell FF to capture mouse movements */ + document.captureEvents(Event.MOUSEMOVE); + document.onmousemove = setMousePos; + + DEBUGSLIM = true; + + var cgi = new CGI(); + fetchUser(cgi.param('ses')); + DOM.oils_rpt_user.appendChild(text(USER.usrname())); + + if( cgi.param('dbg') ) oilsRptDebugEnabled = true; + + fetchHighestPermOrgs(SESSION, USER.id(), perms); + if( PERMS.RUN_REPORTS == -1 ) { + unHideMe(DOM.oils_rpt_permission_denied); + hideMe(DOM.oils_rpt_tree_loading); + return false; + } + + + oilsRptCookie = new HTTP.Cookies(); + oilsRptCurrentOrg = USER.ws_ou(); + cookieManager.write(COOKIE_SES, SESSION, -1, '/'); + cookieManager.write('ws_ou', USER.ws_ou(), -1, '/'); + + oilsRptFetchOrgTree( + function() { + oilsLoadRptTree( + function() { + hideMe(DOM.oils_rpt_tree_loading); + unHideMe(DOM.oils_rpt_folder_table); + } + ) + } + ); + return true; } function oilsRtpInitFolders() { - oilsRptCurrentFolderManager = - new oilsRptFolderManager(DOM.oils_rpt_folder_tree_div); - oilsRptCurrentFolderManager.draw(SESSION); + oilsRptCurrentFolderManager = + new oilsRptFolderManager(DOM.oils_rpt_folder_tree_div); + oilsRptCurrentFolderManager.draw(SESSION); } function oilsCleanupReports() { - try {oilsRptDebugWindow.close();} catch(e) {} - DOM = null; - oilsRptObjectCache = null; - oilsRptObject.objectCache = null; + try {oilsRptDebugWindow.close();} catch(e) {} + DOM = null; + oilsRptObjectCache = null; + oilsRptObject.objectCache = null; } /* --------------------------------------------------------------------- - Define the report object - --------------------------------------------------------------------- */ + Define the report object + --------------------------------------------------------------------- */ function oilsReport(templateObj, reportObj) { - this.def = { - select : [], - from : {}, - where : [], - having : [], - order_by : [] - }; - - this.params = {}; - this.name = ""; - this.reportObject = reportObj; - - if(templateObj) this.setTemplate(templateObj); - - if( reportObj ) - this.params = JSON2js(reportObj.data()); - if(!this.params) this.params = {}; + this.def = { + select : [], + from : {}, + where : [], + having : [], + order_by : [] + }; + + this.params = {}; + this.name = ""; + this.reportObject = reportObj; + + if(templateObj) this.setTemplate(templateObj); + + if( reportObj ) + this.params = JSON2js(reportObj.data()); + if(!this.params) this.params = {}; } oilsReport.prototype.setTemplate = function(template) { - this.def = JSON2js(template.data()); - this.name = template.name(); - this.templateObject = template; + this.def = JSON2js(template.data()); + this.name = template.name(); + this.templateObject = template; } oilsReport.prototype.toString = function() { - return formatJSON(js2JSON(this)); + return formatJSON(js2JSON(this)); } oilsReport.prototype.toHTMLString = function() { - return formatJSONHTML(js2JSON(this)); + return formatJSONHTML(js2JSON(this)); } oilsReport.prototype.gatherParams = function() { - //if(oilsRptObjectKeys(this.params).length == 0) return; - _debug("we have params: " + js2JSON(this.params)); + //if(oilsRptObjectKeys(this.params).length == 0) return; + _debug("we have params: " + js2JSON(this.params)); - var params = []; - this._gatherParams(params, this.def.where, 'where', 'condition'); - this._gatherParams(params, this.def.having, 'having', 'condition'); - return params; + var params = []; + this._gatherParams(params, this.def.where, 'where', 'condition'); + this._gatherParams(params, this.def.having, 'having', 'condition'); + return params; } oilsReport.prototype._gatherParams = function(params, arr, type, field) { - if(!arr) return; - for( var i = 0; i < arr.length; i++ ) { - - var obj = arr[i]; - node = obj[field]; - var key; - var op; - - /* add select transform support */ - - if( typeof node == 'string' ) { - key = node.match(/::.*/); - } else { - op = oilsRptObjectKeys(node)[0]; - key = (node[op] +'').match(/::.*/); - } - - if(!key) continue; - key = key[0].replace(/::/,''); - _debug("key = "+key+", param = " + this.params[key]); - - params.push( { - key : key, - op : op, - value : this.params[key], - column : obj.column, - path : obj.path, - type : type, - relation : obj.relation, - field : field - }); - } + if(!arr) return; + for( var i = 0; i < arr.length; i++ ) { + + var obj = arr[i]; + node = obj[field]; + var key; + var op; + + /* add select transform support */ + + if( typeof node == 'string' ) { + key = node.match(/::.*/); + } else { + op = oilsRptObjectKeys(node)[0]; + key = (node[op] +'').match(/::.*/); + } + + if(!key) continue; + key = key[0].replace(/::/,''); + _debug("key = "+key+", param = " + this.params[key]); + + params.push( { + key : key, + op : op, + value : this.params[key], + column : obj.column, + path : obj.path, + type : type, + relation : obj.relation, + field : field + }); + } } @@ -154,29 +154,29 @@ oilsReport.prototype.__gatherTemplateParams = function(arr, type) { if(!arr) return []; var params = []; - for( var i = 0; i < arr.length; i++ ) { + for( var i = 0; i < arr.length; i++ ) { - var obj = arr[i]; - var node = obj.condition; - var op = oilsRptObjectKeys(node)[0]; - var key = node[op]; + var obj = arr[i]; + var node = obj.condition; + var op = oilsRptObjectKeys(node)[0]; + var key = node[op]; /** if this is a dynamic param, skip it */ if( key && (key+'').match(/::.*/) ) continue; - _debug("template params: op = " + op + ", value = " + js2JSON(key)); + _debug("template params: op = " + op + ", value = " + js2JSON(key)); - params.push( { - key : key, /* key == value, since this is not a dynamic param */ - op : op, + params.push( { + key : key, /* key == value, since this is not a dynamic param */ + op : op, value : key, - column : obj.column, - path : obj.path, - type : type, - relation : obj.relation, - field : field - }); - } + column : obj.column, + path : obj.path, + type : type, + relation : obj.relation, + field : field + }); + } return params; } diff --git a/Open-ILS/web/reports/oils_rpt.xhtml b/Open-ILS/web/reports/oils_rpt.xhtml index 967060e99f..47430f9838 100644 --- a/Open-ILS/web/reports/oils_rpt.xhtml +++ b/Open-ILS/web/reports/oils_rpt.xhtml @@ -1,140 +1,140 @@ - + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + + ]> - - &reports.oils_rpt.title; - - - - - -
- &reports.common.logged_in_as; -
- -
- &reports.oils_rpt.insufficient_permissions; -
- - - -
- &reports.common.loading; -
- - - - - - - - - - - -
-
-
&reports.oils_rpt.my_folders;
-
-
-
-
-
-
&reports.oils_rpt.shared_folders;
-
-
-
-
-
- -
- - - - - - -
- &reports.oils_rpt.manage_folder_contents; - &reports.oils_rpt.manage_folder;
- - - - - - - -
- : - &reports.oils_rpt.created_by; -
- -
- -
-
- -
-
-
-
- -
- -
-
- &reports.oils_rpt.create_new_sub_folder;. &reports.oils_rpt.folder_type; -
- - - - - - - - - - - - - - - - -
&reports.oils_rpt.folder_name;
&reports.oils_rpt.share_folder; - -
&reports.oils_rpt.share_with;
- -
-
-
- - + + &reports.oils_rpt.title; + + + + + +
+ &reports.common.logged_in_as; +
+ +
+ &reports.oils_rpt.insufficient_permissions; +
+ + + +
+ &reports.common.loading; +
+ + + + + + + + + + + +
+
+
&reports.oils_rpt.my_folders;
+
+
+
+
+
+
&reports.oils_rpt.shared_folders;
+
+
+
+
+
+ +
+ + + + + + +
+ &reports.oils_rpt.manage_folder_contents; + &reports.oils_rpt.manage_folder;
+ + + + + + + +
+ : + &reports.oils_rpt.created_by; +
+ +
+ +
+
+ +
+
+
+
+ +
+ +
+
+ &reports.oils_rpt.create_new_sub_folder;. &reports.oils_rpt.folder_type; +
+ + + + + + + + + + + + + + + + +
&reports.oils_rpt.folder_name;
&reports.oils_rpt.share_folder; + +
&reports.oils_rpt.share_with;
+ +
+
+
+ + diff --git a/Open-ILS/web/reports/oils_rpt_builder.js b/Open-ILS/web/reports/oils_rpt_builder.js index 0b82c21dc7..36d69a90a5 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.js +++ b/Open-ILS/web/reports/oils_rpt_builder.js @@ -7,40 +7,40 @@ var rpt_strings = dojo.i18n.getLocalization("openils.reports", "reports"); var __dblclicks = {}; /* retain a cache of the selector value doubleclick event handlers */ function oilsInitReportBuilder() { - if(!oilsInitReports()) return false; - oilsReportBuilderReset(); - DOM.oils_rpt_table.onclick = - function(){hideMe(DOM.oils_rpt_column_editor)}; - oilsDrawRptTree( - function() { - hideMe(DOM.oils_rpt_tree_loading); - unHideMe(DOM.oils_rpt_table); - oilsRptBuilderDrawClone(new CGI().param('ct')); - } - ); + if(!oilsInitReports()) return false; + oilsReportBuilderReset(); + DOM.oils_rpt_table.onclick = + function(){hideMe(DOM.oils_rpt_column_editor)}; + oilsDrawRptTree( + function() { + hideMe(DOM.oils_rpt_tree_loading); + unHideMe(DOM.oils_rpt_table); + oilsRptBuilderDrawClone(new CGI().param('ct')); + } + ); - DOM.oils_rpt_builder_save_template.onclick = oilsReportBuilderSave; + DOM.oils_rpt_builder_save_template.onclick = oilsReportBuilderSave; } function oilsRptBuilderDrawClone(templateId) { - if(!templateId) return; - unHideMe(DOM.oils_rpt_builder_cloning); + if(!templateId) return; + unHideMe(DOM.oils_rpt_builder_cloning); - oilsRptFetchTemplate(templateId, - function(template) { oilsRptBuilderDrawClone2(template);} - ); + oilsRptFetchTemplate(templateId, + function(template) { oilsRptBuilderDrawClone2(template);} + ); } function oilsRptBuilderDrawClone2(template) { - appendClear( DOM.oils_rpt_build_cloning_name, template.name() ); - DOM.oils_rpt_builder_new_name.value = template.name(); - DOM.oils_rpt_builder_new_desc.value = template.description(); + appendClear( DOM.oils_rpt_build_cloning_name, template.name() ); + DOM.oils_rpt_builder_new_name.value = template.name(); + DOM.oils_rpt_builder_new_desc.value = template.description(); - _debug(formatJSON(template.data())); + _debug(formatJSON(template.data())); - /* manually shove data into the display selectors */ - var def = JSON2js(template.data()); + /* manually shove data into the display selectors */ + var def = JSON2js(template.data()); /* --------------------------------------------------------------- */ /* hack to determine the higest existing param in the template */ @@ -57,79 +57,79 @@ function oilsRptBuilderDrawClone2(template) { //x.blah(); /* --------------------------------------------------------------- */ - var table = def.from.table; - var node; - for( var i in oilsIDL ) { - node = oilsIDL[i]; - if( node.table == table ) { - setSelector(DOM.oils_rpt_builder_type_selector, node.name); - DOM.oils_rpt_builder_type_selector.onchange(); - break; - } - } + var table = def.from.table; + var node; + for( var i in oilsIDL ) { + node = oilsIDL[i]; + if( node.table == table ) { + setSelector(DOM.oils_rpt_builder_type_selector, node.name); + DOM.oils_rpt_builder_type_selector.onchange(); + break; + } + } - iterate(def.select, - function(item) { - oilsAddRptDisplayItem(item.path, item.alias, item.column.transform)}); + iterate(def.select, + function(item) { + oilsAddRptDisplayItem(item.path, item.alias, item.column.transform)}); - iterate(def.where, - function(item) { - oilsAddRptFilterItem(item.path, item.column.transform, oilsRptObjectKeys(item.condition)[0])}); + iterate(def.where, + function(item) { + oilsAddRptFilterItem(item.path, item.column.transform, oilsRptObjectKeys(item.condition)[0])}); - iterate(def.having, - function(item) { - oilsAddRptHavingItem(item.path, item.column.transform, oilsRptObjectKeys(item.condition)[0])}); + iterate(def.having, + function(item) { + oilsAddRptHavingItem(item.path, item.column.transform, oilsRptObjectKeys(item.condition)[0])}); - //oilsRpt.setTemplate(template); /* commented out with clone fix, *shouldn't* break anything */ - oilsRpt.templateObject = null; /* simplify debugging */ + //oilsRpt.setTemplate(template); /* commented out with clone fix, *shouldn't* break anything */ + oilsRpt.templateObject = null; /* simplify debugging */ } function oilsReportBuilderReset() { - var n = (oilsRpt) ? oilsRpt.name : ""; - oilsRpt = new oilsReport(); - oilsRpt.name = n; - oilsRptDisplaySelector = DOM.oils_rpt_display_selector; - oilsRptFilterSelector = DOM.oils_rpt_filter_selector; - oilsRptHavingSelector = DOM.oils_rpt_agg_filter_selector; - removeChildren(oilsRptDisplaySelector); - removeChildren(oilsRptFilterSelector); - removeChildren(oilsRptHavingSelector); - //removeChildren(oilsRptOrderBySelector); - //oilsRptResetParams(); + var n = (oilsRpt) ? oilsRpt.name : ""; + oilsRpt = new oilsReport(); + oilsRpt.name = n; + oilsRptDisplaySelector = DOM.oils_rpt_display_selector; + oilsRptFilterSelector = DOM.oils_rpt_filter_selector; + oilsRptHavingSelector = DOM.oils_rpt_agg_filter_selector; + removeChildren(oilsRptDisplaySelector); + removeChildren(oilsRptFilterSelector); + removeChildren(oilsRptHavingSelector); + //removeChildren(oilsRptOrderBySelector); + //oilsRptResetParams(); } function oilsReportBuilderSave() { - var tmpl = new rt(); - tmpl.name(DOM.oils_rpt_builder_new_name.value); - tmpl.description(DOM.oils_rpt_builder_new_desc.value); - tmpl.owner(USER.id()); - tmpl.folder(new CGI().param('folder')); - tmpl.data(js2JSON(oilsRpt.def)); - - if(!confirm(dojo.string.substitute( rpt_strings.RPT_BUILDER_CONFIRM_SAVE, [tmpl.name(), tmpl.description()] )) ) - return; - - debugFMObject(tmpl); - //return; /* XXX */ - - var req = new Request(OILS_RPT_CREATE_TEMPLATE, SESSION, tmpl); - req.request.alertEvent = false; - req.callback( - function(r) { - var res = r.getResultObject(); - if(checkILSEvent(res)) { - alertILSEvent(res); - } else { - if( res && res != '0' ) { - oilsRptAlertSuccess(); - _l('oils_rpt.xhtml'); - } - } - } - ); - - req.send(); + var tmpl = new rt(); + tmpl.name(DOM.oils_rpt_builder_new_name.value); + tmpl.description(DOM.oils_rpt_builder_new_desc.value); + tmpl.owner(USER.id()); + tmpl.folder(new CGI().param('folder')); + tmpl.data(js2JSON(oilsRpt.def)); + + if(!confirm(dojo.string.substitute( rpt_strings.RPT_BUILDER_CONFIRM_SAVE, [tmpl.name(), tmpl.description()] )) ) + return; + + debugFMObject(tmpl); + //return; /* XXX */ + + var req = new Request(OILS_RPT_CREATE_TEMPLATE, SESSION, tmpl); + req.request.alertEvent = false; + req.callback( + function(r) { + var res = r.getResultObject(); + if(checkILSEvent(res)) { + alertILSEvent(res); + } else { + if( res && res != '0' ) { + oilsRptAlertSuccess(); + _l('oils_rpt.xhtml'); + } + } + } + ); + + req.send(); } @@ -137,519 +137,519 @@ function oilsReportBuilderSave() { /* adds an item to the display window */ function oilsAddRptDisplayItem(path, name, tform, params) { - if( ! oilsAddSelectorItem( - { selector : oilsRptDisplaySelector, - val : path, - label : name, - path : path, - type : 'display', - transform : tform }) ) { - return; - } + if( ! oilsAddSelectorItem( + { selector : oilsRptDisplaySelector, + val : path, + label : name, + path : path, + type : 'display', + transform : tform }) ) { + return; + } - /* add the selected columns to the report output */ - name = (name) ? name : oilsRptPathCol(path); - if( !tform ) tform = 'Bare'; + /* add the selected columns to the report output */ + name = (name) ? name : oilsRptPathCol(path); + if( !tform ) tform = 'Bare'; - var aggregate = oilsRptGetIsAgg(tform); + var aggregate = oilsRptGetIsAgg(tform); - /* add this item to the select blob */ - var sel = { - relation: hex_md5(oilsRptPathRel(path)), - path : path, - alias: name, - column: { transform: tform, colname: oilsRptPathCol(path) } - }; + /* add this item to the select blob */ + var sel = { + relation: hex_md5(oilsRptPathRel(path)), + path : path, + alias: name, + column: { transform: tform, colname: oilsRptPathCol(path) } + }; - if( params ) sel.column.params = params; - oilsRptAddSelectList(sel, tform); - mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); - oilsRptDebug(); + if( params ) sel.column.params = params; + oilsRptAddSelectList(sel, tform); + mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); + oilsRptDebug(); } function oilsRptAddSelectList(obj, tform) { - if(!oilsRptGetIsAgg(tform)) { - var select = []; - var added = false; - for( var i = 0; i < oilsRpt.def.select.length; i++ ) { - var item = oilsRpt.def.select[i]; - - /* shove the item in question in front of the first agg tform */ - if( !added && oilsRptGetIsAgg( item.column.transform ) ) { - select.push(obj); - added = true; - } - select.push(item); - } - - /* if there is no existing agg tfrom to - insert in front of, add me on the end */ - if(!added) select.push(obj); - - oilsRpt.def.select = select; - - if( added ) { - /* re-draw the select display to get the order correct */ - var sel = oilsRptDisplaySelector; - while( sel.options.length > 0 ) sel.options[0] = null; - iterate(oilsRpt.def.select, - function(item) { - _debug('re-inserting display item ' + item.path); - oilsAddSelectorItem( - { selector: oilsRptDisplaySelector, - val:item.path, - label:item.alias, - path:item.path, - transform : item.column.transform, - type : 'display' - } - ) }); - } - - } else { - /* shove agg transforms onto the end */ - oilsRpt.def.select.push(obj); - } + if(!oilsRptGetIsAgg(tform)) { + var select = []; + var added = false; + for( var i = 0; i < oilsRpt.def.select.length; i++ ) { + var item = oilsRpt.def.select[i]; + + /* shove the item in question in front of the first agg tform */ + if( !added && oilsRptGetIsAgg( item.column.transform ) ) { + select.push(obj); + added = true; + } + select.push(item); + } + + /* if there is no existing agg tfrom to + insert in front of, add me on the end */ + if(!added) select.push(obj); + + oilsRpt.def.select = select; + + if( added ) { + /* re-draw the select display to get the order correct */ + var sel = oilsRptDisplaySelector; + while( sel.options.length > 0 ) sel.options[0] = null; + iterate(oilsRpt.def.select, + function(item) { + _debug('re-inserting display item ' + item.path); + oilsAddSelectorItem( + { selector: oilsRptDisplaySelector, + val:item.path, + label:item.alias, + path:item.path, + transform : item.column.transform, + type : 'display' + } + ) }); + } + + } else { + /* shove agg transforms onto the end */ + oilsRpt.def.select.push(obj); + } } function oilsRptGetIsAgg(tform) { - return OILS_RPT_TRANSFORMS[tform].aggregate; + return OILS_RPT_TRANSFORMS[tform].aggregate; } /* takes a column path and builds a from-clause object for the path */ function oilsRptBuildFromClause(path) { - /* the path is the full path (relation) from the source - object to the column in question (e.g. au-home_ou-aou-name)*/ - var parts = path.split(/-/); + /* the path is the full path (relation) from the source + object to the column in question (e.g. au-home_ou-aou-name)*/ + var parts = path.split(/-/); - /* the final from clause */ - var obj = {}; + /* the final from clause */ + var obj = {}; - /* reference to the current position in the from clause */ - var tobj = obj; + /* reference to the current position in the from clause */ + var tobj = obj; - var newpath = ""; + var newpath = ""; var last_is_left = false; /* true if our parent join is a 'left' join */ - /* walk the path, fleshing the from clause as we go */ - for( var i = 0; i < parts.length; i += 2 ) { + /* walk the path, fleshing the from clause as we go */ + for( var i = 0; i < parts.length; i += 2 ) { - var cls = parts[i]; /* class name (id) */ - var col = parts[i+1]; /* column name */ + var cls = parts[i]; /* class name (id) */ + var col = parts[i+1]; /* column name */ - /* a "node" is a class description from the IDL, it - contains relevant info, plus a list of "fields", - or column objects */ - var node = oilsIDL[cls]; - var pkey = oilsRptFindField(node, node.pkey); + /* a "node" is a class description from the IDL, it + contains relevant info, plus a list of "fields", + or column objects */ + var node = oilsIDL[cls]; + var pkey = oilsRptFindField(node, node.pkey); - /* a "field" is a parsed version of a column from the IDL, - contains datatype, column name, etc. */ - var field = oilsRptFindField(node, col); + /* a "field" is a parsed version of a column from the IDL, + contains datatype, column name, etc. */ + var field = oilsRptFindField(node, col); - /* re-construct the path as we go so - we know what all we've seen thus far */ - newpath = (newpath) ? newpath + '-'+ cls : cls; + /* re-construct the path as we go so + we know what all we've seen thus far */ + newpath = (newpath) ? newpath + '-'+ cls : cls; - /* extract relevant info */ - tobj.table = node.table; - tobj.path = newpath; - tobj.alias = hex_md5(newpath); + /* extract relevant info */ + tobj.table = node.table; + tobj.path = newpath; + tobj.alias = hex_md5(newpath); - _debug('field type is ' + field.type); - if( i == (parts.length - 2) ) break; + _debug('field type is ' + field.type); + if( i == (parts.length - 2) ) break; - /* we still have columns left in the path, keep adding join's */ - var path_col = col; - if(field.reltype != 'has_a') - col = pkey.name + '-' + col; + /* we still have columns left in the path, keep adding join's */ + var path_col = col; + if(field.reltype != 'has_a') + col = pkey.name + '-' + col; - tobj.join = {}; - tobj = tobj.join; + tobj.join = {}; + tobj = tobj.join; - tobj[col] = {}; - tobj = tobj[col]; - if( field.type == 'link' ) { - tobj.key = field.key; - if( field.reltype == 'has_many' || field.reltype == 'might_have' || last_is_left ) { - tobj.type = 'left'; + tobj[col] = {}; + tobj = tobj[col]; + if( field.type == 'link' ) { + tobj.key = field.key; + if( field.reltype == 'has_many' || field.reltype == 'might_have' || last_is_left ) { + tobj.type = 'left'; last_is_left = true; } else { last_is_left = false; } - } + } - newpath = newpath + '-'+ path_col; - } + newpath = newpath + '-'+ path_col; + } - _debug("built 'from' clause: path="+path+"\n"+formatJSON(js2JSON(obj))); - return obj; + _debug("built 'from' clause: path="+path+"\n"+formatJSON(js2JSON(obj))); + return obj; } function oilsMoveUpDisplayItems() { - var sel = oilsRptDisplaySelector; - var idx = sel.selectedIndex; - if( idx == 0 ) return; - var opt = sel.options[idx]; - sel.options[idx] = null; - idx--; - - var val = opt.getAttribute('value'); + var sel = oilsRptDisplaySelector; + var idx = sel.selectedIndex; + if( idx == 0 ) return; + var opt = sel.options[idx]; + sel.options[idx] = null; + idx--; + + var val = opt.getAttribute('value'); var label = opt.getAttribute('label'); var path = opt.getAttribute('path'); var evt_id = opt.getAttribute('listener'); - opt = insertSelectorVal(sel, idx, label, val); + opt = insertSelectorVal(sel, idx, label, val); - opt.setAttribute('path', path); - opt.setAttribute('title', label); + opt.setAttribute('path', path); + opt.setAttribute('title', label); opt.setAttribute('label', label); opt.setAttribute('value', val); opt.setAttribute('listener', evt_id); /* re-attach the double-click event */ - opt.addEventListener('dblclick', __dblclicks[evt_id], true ); + opt.addEventListener('dblclick', __dblclicks[evt_id], true ); - sel.options[idx].selected = true; + sel.options[idx].selected = true; - var arr = oilsRpt.def.select; - for( var i = 0; i < arr.length; i++ ) { - if( arr[i].path == val ) { - var other = arr[i-1]; - arr[i-1] = arr[i]; - arr[i] = other; - break; - } - } - oilsRptDebug(); + var arr = oilsRpt.def.select; + for( var i = 0; i < arr.length; i++ ) { + if( arr[i].path == val ) { + var other = arr[i-1]; + arr[i-1] = arr[i]; + arr[i] = other; + break; + } + } + oilsRptDebug(); } function oilsMoveDownDisplayItems() { - var sel = oilsRptDisplaySelector; - var idx = sel.selectedIndex; - if( idx == sel.options.length - 1 ) return; - var opt = sel.options[idx]; - sel.options[idx] = null; - idx++; - - //var val = opt.getAttribute('value'); - //insertSelectorVal(sel, idx, opt.innerHTML, val); - //insertSelectorVal(sel, idx, opt.getAttribute('label'), val); - - var val = opt.getAttribute('value'); + var sel = oilsRptDisplaySelector; + var idx = sel.selectedIndex; + if( idx == sel.options.length - 1 ) return; + var opt = sel.options[idx]; + sel.options[idx] = null; + idx++; + + //var val = opt.getAttribute('value'); + //insertSelectorVal(sel, idx, opt.innerHTML, val); + //insertSelectorVal(sel, idx, opt.getAttribute('label'), val); + + var val = opt.getAttribute('value'); var label = opt.getAttribute('label'); var path = opt.getAttribute('path'); var evt_id = opt.getAttribute('listener'); - opt = insertSelectorVal(sel, idx, label, val); + opt = insertSelectorVal(sel, idx, label, val); opt.setAttribute('value', val); - opt.setAttribute('path', path); - opt.setAttribute('title', label); + opt.setAttribute('path', path); + opt.setAttribute('title', label); opt.setAttribute('label', label); opt.setAttribute('listener', evt_id); /* re-attach the double-click event */ - opt.addEventListener('dblclick', __dblclicks[evt_id], true ); + opt.addEventListener('dblclick', __dblclicks[evt_id], true ); - sel.options[idx].selected = true; + sel.options[idx].selected = true; - var arr = oilsRpt.def.select; - for( var i = 0; i < arr.length; i++ ) { - if( arr[i].path == val ) { - var other = arr[i+1]; - arr[i+1] = arr[i]; - arr[i] = other; - break; - } - } - oilsRptDebug(); + var arr = oilsRpt.def.select; + for( var i = 0; i < arr.length; i++ ) { + if( arr[i].path == val ) { + var other = arr[i+1]; + arr[i+1] = arr[i]; + arr[i] = other; + break; + } + } + oilsRptDebug(); } /* removes a specific item from the display window */ /* function oilsDelDisplayItem(val) { - oilsDelSelectorItem(oilsRptDisplaySelector, val); + oilsDelSelectorItem(oilsRptDisplaySelector, val); } */ /* removes selected items from the display window */ function oilsDelSelectedDisplayItems() { - var list = oilsDelSelectedItems(oilsRptDisplaySelector); + var list = oilsDelSelectedItems(oilsRptDisplaySelector); - _debug('deleting list: ' + list); + _debug('deleting list: ' + list); - /* remove the de-selected columns from the report output */ - oilsRpt.def.select = grep( oilsRpt.def.select, - function(i) { - for( var j = 0; j < list.length; j++ ) { - var d = list[j]; /* path */ - var col = i.column; + /* remove the de-selected columns from the report output */ + oilsRpt.def.select = grep( oilsRpt.def.select, + function(i) { + for( var j = 0; j < list.length; j++ ) { + var d = list[j]; /* path */ + var col = i.column; - _debug('in delete, looking at list = '+d+' : col = ' + - col.colname + ' : relation = ' + i.relation + ' : encoded = ' + hex_md5(oilsRptPathRel(d)) ); + _debug('in delete, looking at list = '+d+' : col = ' + + col.colname + ' : relation = ' + i.relation + ' : encoded = ' + hex_md5(oilsRptPathRel(d)) ); - if( hex_md5(oilsRptPathRel(d)) == i.relation && oilsRptPathCol(d) == col.colname ) { - return false; - } - } - return true; - } - ); + if( hex_md5(oilsRptPathRel(d)) == i.relation && oilsRptPathCol(d) == col.colname ) { + return false; + } + } + return true; + } + ); - if(!oilsRpt.def.select) oilsRpt.def.select = []; - oilsRptPruneFromList(list); - oilsRptDebug(); + if(!oilsRpt.def.select) oilsRpt.def.select = []; + oilsRptPruneFromList(list); + oilsRptDebug(); } function oilsRptPruneFromList(pathlist) { - for( var j = 0; j < pathlist.length; j++ ) { - /* if there are no items left in the "select", "where", or "having" clauses - for the given relation, trim this relation from the "from" clause */ - var path = pathlist[j]; - var encrel = hex_md5(oilsRptPathRel(path)); + for( var j = 0; j < pathlist.length; j++ ) { + /* if there are no items left in the "select", "where", or "having" clauses + for the given relation, trim this relation from the "from" clause */ + var path = pathlist[j]; + var encrel = hex_md5(oilsRptPathRel(path)); - debug('seeing if we can prune from clause with relation = ' + encrel +' : path = ' + path); + debug('seeing if we can prune from clause with relation = ' + encrel +' : path = ' + path); - var func = function(i){ return (i.relation == hex_md5(oilsRptPathRel(path))); }; + var func = function(i){ return (i.relation == hex_md5(oilsRptPathRel(path))); }; - if( !grep(oilsRpt.def.select, func) && - !grep(oilsRpt.def.where, func) && - !grep(oilsRpt.def.having, func) ) { + if( !grep(oilsRpt.def.select, func) && + !grep(oilsRpt.def.where, func) && + !grep(oilsRpt.def.having, func) ) { - debug('looks like we can prune ' + path); + debug('looks like we can prune ' + path); - oilsRptPruneFromClause(oilsRptPathRel(pathlist[j])); - } - } + oilsRptPruneFromClause(oilsRptPathRel(pathlist[j])); + } + } } /* for each item in the path list, remove the associated data - from the "from" clause */ + from the "from" clause */ function oilsRptPruneFromClause(relation, node) { - var keys = oilsRptObjectKeys(node); - _debug("trying to remove relation: " + relation+'\n\tthis object has keys: '+keys); + var keys = oilsRptObjectKeys(node); + _debug("trying to remove relation: " + relation+'\n\tthis object has keys: '+keys); - if(!node) node = oilsRpt.def.from.join; - if(!node) return false; + if(!node) node = oilsRpt.def.from.join; + if(!node) return false; - for( var i in node ) { - var child_node = node[i]; - _debug("\tanalyzing child node: "+child_node.path); + for( var i in node ) { + var child_node = node[i]; + _debug("\tanalyzing child node: "+child_node.path); - // first, descend into the tree, and prune leaves - if( child_node.join ) { + // first, descend into the tree, and prune leaves + if( child_node.join ) { - oilsRptPruneFromClause(relation, child_node.join); - var join_keys = oilsRptObjectKeys(child_node.join); - _debug("\tchild has a sub-join for items : ["+ join_keys+"]"); + oilsRptPruneFromClause(relation, child_node.join); + var join_keys = oilsRptObjectKeys(child_node.join); + _debug("\tchild has a sub-join for items : ["+ join_keys+"]"); - if(join_keys.length == 0) { - _debug("\tdeleting join for object "+i); - delete child_node.join; - } - } - - if( !child_node.join ) { - - _debug("\tchild node has no sub-join, seeing if we should delete it"); - - var from_alias = child_node.alias; - var func = function(n){ return (n.relation == from_alias)}; - - if( !grep(oilsRpt.def.select, func) && - !grep(oilsRpt.def.where, func) && - !grep(oilsRpt.def.having, func) ) { - - /* we are not used by any other clauses */ - _debug("\tdeleting node with relation: "+ from_alias); - delete node[i]; - return true; - } - } - } + if(join_keys.length == 0) { + _debug("\tdeleting join for object "+i); + delete child_node.join; + } + } + + if( !child_node.join ) { + + _debug("\tchild node has no sub-join, seeing if we should delete it"); + + var from_alias = child_node.alias; + var func = function(n){ return (n.relation == from_alias)}; + + if( !grep(oilsRpt.def.select, func) && + !grep(oilsRpt.def.where, func) && + !grep(oilsRpt.def.having, func) ) { + + /* we are not used by any other clauses */ + _debug("\tdeleting node with relation: "+ from_alias); + delete node[i]; + return true; + } + } + } - return false; + return false; } function oilsRptMkFilterTags(path, tform, filter) { - var name = oilsRptMakeLabel(path); - if(tform) name += ' ('+tform+')'; - name += ' "' + filter + '"'; - var epath = path + ':'+filter+':'; - if(tform) epath += tform; + var name = oilsRptMakeLabel(path); + if(tform) name += ' ('+tform+')'; + name += ' "' + filter + '"'; + var epath = path + ':'+filter+':'; + if(tform) epath += tform; - return [ name, epath ]; + return [ name, epath ]; } function oilsAddRptFilterItem(path, tform, filter) { - _debug("Adding filter item for "+path+" tform="+tform+" filter="+filter); - - var name = oilsRptMkFilterTags(path, tform, filter); - var epath = name[1]; - name = name[0]; - - if( ! oilsAddSelectorItem( - { selector : oilsRptFilterSelector, - val : epath, - label : name, - path : path, - transform : tform, - operation : filter, - type : 'filter' - }) ) - return; - - var where = { - relation: hex_md5(oilsRptPathRel(path)), - path : path, - column: { transform: tform, colname: oilsRptPathCol(path) }, - condition : {} - }; + _debug("Adding filter item for "+path+" tform="+tform+" filter="+filter); + + var name = oilsRptMkFilterTags(path, tform, filter); + var epath = name[1]; + name = name[0]; + + if( ! oilsAddSelectorItem( + { selector : oilsRptFilterSelector, + val : epath, + label : name, + path : path, + transform : tform, + operation : filter, + type : 'filter' + }) ) + return; + + var where = { + relation: hex_md5(oilsRptPathRel(path)), + path : path, + column: { transform: tform, colname: oilsRptPathCol(path) }, + condition : {} + }; //_debug('NEXT PARAM = ' + oilsRptID2); //_debug('NEXT PARAM = ' + oilsRptNextParam()); - if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' ) - where.condition[filter] = null; - else where.condition[filter] = oilsRptNextParam(); + if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' ) + where.condition[filter] = null; + else where.condition[filter] = oilsRptNextParam(); - switch(tform) { - case 'substring' : where.column.params = oilsRptNextParam(); - } + switch(tform) { + case 'substring' : where.column.params = oilsRptNextParam(); + } - oilsRpt.def.where.push(where); - mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); - oilsRptDebug(); + oilsRpt.def.where.push(where); + mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); + oilsRptDebug(); } function oilsAddRptHavingItem(path, tform, filter) { - _debug("Adding filter item for "+path+" tform="+tform+" filter="+filter); + _debug("Adding filter item for "+path+" tform="+tform+" filter="+filter); - var name = oilsRptMkFilterTags(path, tform, filter); - var epath = name[1]; - name = name[0]; + var name = oilsRptMkFilterTags(path, tform, filter); + var epath = name[1]; + name = name[0]; - if( ! oilsAddSelectorItem( - { selector: oilsRptHavingSelector, - val:epath, - label:name, - path:path, - transform : tform, - operation : filter, - type : 'agg_filter' /* XXX */ - }) ) + if( ! oilsAddSelectorItem( + { selector: oilsRptHavingSelector, + val:epath, + label:name, + path:path, + transform : tform, + operation : filter, + type : 'agg_filter' /* XXX */ + }) ) - return; + return; - var having = { - relation: hex_md5(oilsRptPathRel(path)), - path : path, - column: { transform: tform, colname: oilsRptPathCol(path) }, - condition : {} - }; - if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' ) - having.condition[filter] = null; - else having.condition[filter] = oilsRptNextParam(); + var having = { + relation: hex_md5(oilsRptPathRel(path)), + path : path, + column: { transform: tform, colname: oilsRptPathCol(path) }, + condition : {} + }; + if( filter == 'is' || filter == 'is not' || filter == 'is blank' || filter == 'is not blank' ) + having.condition[filter] = null; + else having.condition[filter] = oilsRptNextParam(); - switch(tform) { - case 'substring' : having.column.params = oilsRptNextParam(); - } + switch(tform) { + case 'substring' : having.column.params = oilsRptNextParam(); + } - oilsRpt.def.having.push(having); - mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); - oilsRptDebug(); + oilsRpt.def.having.push(having); + mergeObjects( oilsRpt.def.from, oilsRptBuildFromClause(path)); + oilsRptDebug(); } function oilsDelSelectedFilterItems() { - _oilsDelSelectedFilterItems('where'); + _oilsDelSelectedFilterItems('where'); } function oilsDelSelectedAggFilterItems() { - _oilsDelSelectedFilterItems('having'); + _oilsDelSelectedFilterItems('having'); } function _oilsDelSelectedFilterItems(type) { - /* the values in this list are formed: :: */ - var list; + /* the values in this list are formed: :: */ + var list; if( type == 'where' ) - list = oilsDelSelectedItems(oilsRptFilterSelector); + list = oilsDelSelectedItems(oilsRptFilterSelector); else if( type == 'having' ) - list = oilsDelSelectedItems(oilsRptHavingSelector); - - _debug("deleting filter items " + list); - - for( var i = 0; i < list.length; i++ ) { - var enc_path = list[i]; - var data = oilsRptParseFilterEncPath(enc_path); - - _debug("trimming filter items with enc_path = " + enc_path); - _debug(data.path); - _debug(data.operation); - _debug(data.tform); - _debug(data.tform); - _debug(type); - _debug('---------------------'); - - oilsRpt.def[type] = grep( - oilsRpt.def[type], - function(f) { - return ! oilsRptFilterDataMatches( - f, data.path, data.operation, data.tform ); - } - ); - } + list = oilsDelSelectedItems(oilsRptHavingSelector); + + _debug("deleting filter items " + list); + + for( var i = 0; i < list.length; i++ ) { + var enc_path = list[i]; + var data = oilsRptParseFilterEncPath(enc_path); + + _debug("trimming filter items with enc_path = " + enc_path); + _debug(data.path); + _debug(data.operation); + _debug(data.tform); + _debug(data.tform); + _debug(type); + _debug('---------------------'); + + oilsRpt.def[type] = grep( + oilsRpt.def[type], + function(f) { + return ! oilsRptFilterDataMatches( + f, data.path, data.operation, data.tform ); + } + ); + } - if(!oilsRpt.def[type]) oilsRpt.def[type] = []; - oilsRptPruneFromList(list); - oilsRptDebug(); + if(!oilsRpt.def[type]) oilsRpt.def[type] = []; + oilsRptPruneFromList(list); + oilsRptDebug(); } function oilsRptParseFilterEncPath(item) { - return { - path: item.replace(/:.*/,''), - operation: item.replace(/.*:(.*):.*/,'$1'), - tform: item.replace(/.*?:.*?:(.*)/,'$1') - }; + return { + path: item.replace(/:.*/,''), + operation: item.replace(/.*:(.*):.*/,'$1'), + tform: item.replace(/.*?:.*?:(.*)/,'$1') + }; } function oilsRptFilterDataMatches(filter, path, operation, tform) { - var rel = hex_md5(oilsRptPathRel(path)); - var col = oilsRptPathCol(path); + var rel = hex_md5(oilsRptPathRel(path)); + var col = oilsRptPathCol(path); - if( col == filter.column.colname && - rel == filter.relation && - tform == filter.column.transform && - operation == oilsRptObjectKeys(filter.condition)[0] ) return true; + if( col == filter.column.colname && + rel == filter.relation && + tform == filter.column.transform && + operation == oilsRptObjectKeys(filter.condition)[0] ) return true; - return false; + return false; } /* adds an item to the display window */ /* function oilsAddRptAggFilterItem(val) { - oilsAddSelectorItem({selector:oilsRptHavingFilterSelector, val:val, label:val, path:val}); + oilsAddSelectorItem({selector:oilsRptHavingFilterSelector, val:val, label:val, path:val}); } */ /* removes a specific item from the display window */ /* function oilsDelAggFilterItem(val) { - oilsDelSelectorItem(oilsRptHavingFilterSelector, val); + oilsDelSelectorItem(oilsRptHavingFilterSelector, val); } */ @@ -658,71 +658,71 @@ function oilsDelAggFilterItem(val) { //function oilsAddSelectorItem(sel, val, name, path) { function oilsAddSelectorItem(args) { - var sel = args.selector; - var label = args.label; - var path = args.path; - var val = args.val; + var sel = args.selector; + var label = args.label; + var path = args.path; + var val = args.val; - label = (label) ? label : oilsRptMakeLabel(val); + label = (label) ? label : oilsRptMakeLabel(val); - var i; - for( i = 0; i < sel.options.length; i++ ) { - var opt = sel.options[i]; - if( opt.value == val ) return false; - } + var i; + for( i = 0; i < sel.options.length; i++ ) { + var opt = sel.options[i]; + if( opt.value == val ) return false; + } - var opt = insertSelectorVal( sel, -1, label, val ); - opt.setAttribute('title', label); - opt.setAttribute('path', path); + var opt = insertSelectorVal( sel, -1, label, val ); + opt.setAttribute('title', label); + opt.setAttribute('path', path); opt.setAttribute('label', label); var evt_id = oilsNextNumericId(); opt.setAttribute('listener', evt_id); - args.index = i; - delete args.selector; + args.index = i; + delete args.selector; var listener = function(){ oilsRptDrawDataWindow(path, args);}; - opt.addEventListener('dblclick', listener, true ); + opt.addEventListener('dblclick', listener, true ); __dblclicks[evt_id] = listener; - //function(){ oilsRptDrawDataWindow(path, args);} , true); + //function(){ oilsRptDrawDataWindow(path, args);} , true); - return true; + return true; } /* removes a specific item from the display window */ function oilsDelSelectorItem(sel, val) { - var opts = sel.options; - for( var i = 0; i < opts.length; i++ ) { - var opt = opts[i]; - if( opt.value == val ) { - if( i == opts.length - 1 ) - opts[i] = null; - else opts[i] = opts[i+1]; - return; - } - } + var opts = sel.options; + for( var i = 0; i < opts.length; i++ ) { + var opt = opts[i]; + if( opt.value == val ) { + if( i == opts.length - 1 ) + opts[i] = null; + else opts[i] = opts[i+1]; + return; + } + } } /* removes selected items from the display window */ function oilsDelSelectedItems(sel) { - var list = getSelectedList(sel); - for( var i = 0; i < list.length; i++ ) - oilsDelSelectorItem(sel, list[i]); - return list; + var list = getSelectedList(sel); + for( var i = 0; i < list.length; i++ ) + oilsDelSelectorItem(sel, list[i]); + return list; } /* hides the different field editor tabs */ function oilsRptHideEditorDivs() { - hideMe(DOM.oils_rpt_tform_div); - hideMe(DOM.oils_rpt_filter_div); - hideMe(DOM.oils_rpt_agg_filter_div); - hideMe(DOM.oils_rpt_order_by_div); + hideMe(DOM.oils_rpt_tform_div); + hideMe(DOM.oils_rpt_filter_div); + hideMe(DOM.oils_rpt_agg_filter_div); + hideMe(DOM.oils_rpt_order_by_div); - removeCSSClass(DOM.oils_rpt_tform_tab.parentNode, 'oils_rpt_tab_picker_selected'); - removeCSSClass(DOM.oils_rpt_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); - removeCSSClass(DOM.oils_rpt_agg_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); + removeCSSClass(DOM.oils_rpt_tform_tab.parentNode, 'oils_rpt_tab_picker_selected'); + removeCSSClass(DOM.oils_rpt_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); + removeCSSClass(DOM.oils_rpt_agg_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); } @@ -732,226 +732,226 @@ function oilsRptHideEditorDivs() { */ function oilsRptDrawDataWindow(path, args) { - args = (args) ? args : {}; + args = (args) ? args : {}; - for( var x in args ) - _debug("oilsRptDrawDataWindow(): args -> " + x + " = " + args[x]); + for( var x in args ) + _debug("oilsRptDrawDataWindow(): args -> " + x + " = " + args[x]); - var col = oilsRptPathCol(path); - var cls = oilsRptPathClass(path); - var field = oilsRptFindField(oilsIDL[cls], col); + var col = oilsRptPathCol(path); + var cls = oilsRptPathClass(path); + var field = oilsRptFindField(oilsIDL[cls], col); - appendClear(DOM.oils_rpt_editor_window_label, text(oilsRptMakeLabel(path))); - appendClear(DOM.oils_rpt_editor_window_datatype, text(field.datatype)); + appendClear(DOM.oils_rpt_editor_window_label, text(oilsRptMakeLabel(path))); + appendClear(DOM.oils_rpt_editor_window_datatype, text(field.datatype)); - _debug("setting update data window for column "+col+' on class '+cls); + _debug("setting update data window for column "+col+' on class '+cls); - var div = DOM.oils_rpt_column_editor; - /* set a preliminary top position so the page won't bounce around */ + var div = DOM.oils_rpt_column_editor; + /* set a preliminary top position so the page won't bounce around */ - /* XXX */ - //div.setAttribute('style','top:'+oilsMouseX+'px'); + /* XXX */ + //div.setAttribute('style','top:'+oilsMouseX+'px'); - /* unhide the div so we can determine the dimensions */ - unHideMe(div); + /* unhide the div so we can determine the dimensions */ + unHideMe(div); - /* don't let them see the floating div until the position is fully determined */ - div.style.visibility='hidden'; + /* don't let them see the floating div until the position is fully determined */ + div.style.visibility='hidden'; - oilsRptDrawTransformWindow(path, col, cls, field, args); - oilsRptDrawFilterWindow(path, col, cls, field, args); - oilsRptDrawHavingWindow(path, col, cls, field, args); - //oilsRptDrawOrderByWindow(path, col, cls, field); + oilsRptDrawTransformWindow(path, col, cls, field, args); + oilsRptDrawFilterWindow(path, col, cls, field, args); + oilsRptDrawHavingWindow(path, col, cls, field, args); + //oilsRptDrawOrderByWindow(path, col, cls, field); - //buildFloatingDiv(div, 600); + //buildFloatingDiv(div, 600); - //window.scrollTo(0,0); - window.scrollTo(0, 60); + //window.scrollTo(0,0); + window.scrollTo(0, 60); - /* now let them see it */ - div.style.visibility='visible'; - //args.type = (args.type) ? args.type : 'display'; - oilsRptSetDataWindowActions(div, args); + /* now let them see it */ + div.style.visibility='visible'; + //args.type = (args.type) ? args.type : 'display'; + oilsRptSetDataWindowActions(div, args); } function oilsRptSetDataWindowActions(div, args) { - /* give the tab links behavior */ - - DOM.oils_rpt_tform_tab.onclick = - function(){ - oilsRptHideEditorDivs(); - unHideMe(DOM.oils_rpt_tform_div) - addCSSClass(DOM.oils_rpt_tform_tab.parentNode, 'oils_rpt_tab_picker_selected'); - }; - - DOM.oils_rpt_filter_tab.onclick = - function(){ - oilsRptHideEditorDivs(); - unHideMe(DOM.oils_rpt_filter_div) - addCSSClass(DOM.oils_rpt_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); - }; - - DOM.oils_rpt_agg_filter_tab.onclick = - function(){ - oilsRptHideEditorDivs(); - unHideMe(DOM.oils_rpt_agg_filter_div) - addCSSClass(DOM.oils_rpt_agg_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); - }; - - /* - DOM.oils_rpt_order_by_tab.onclick = - function(){ - oilsRptHideEditorDivs(); - oilsRptDrawOrderByWindow(); - unHideMe(DOM.oils_rpt_order_by_div); - }; - */ - - DOM.oils_rpt_tform_submit.disabled = false; - DOM.oils_rpt_filter_submit.disabled = false; - DOM.oils_rpt_agg_filter_submit.disabled = false; - - if( !args.type ) { - DOM.oils_rpt_tform_tab.onclick(); - } else { - /* disable editing on existing items for now */ - if( args.type == 'display' ) { - DOM.oils_rpt_tform_tab.onclick(); - DOM.oils_rpt_tform_submit.disabled = true; - } - if( args.type == 'filter' ) { - DOM.oils_rpt_filter_tab.onclick(); - DOM.oils_rpt_filter_submit.disabled = true; - } - if( args.type == 'agg_filter' ) { - DOM.oils_rpt_agg_filter_tab.onclick(); - DOM.oils_rpt_agg_filter_submit.disabled = true; - } - } - - DOM.oils_rpt_column_editor_close_button.onclick = function(){hideMe(div);}; + /* give the tab links behavior */ + + DOM.oils_rpt_tform_tab.onclick = + function(){ + oilsRptHideEditorDivs(); + unHideMe(DOM.oils_rpt_tform_div) + addCSSClass(DOM.oils_rpt_tform_tab.parentNode, 'oils_rpt_tab_picker_selected'); + }; + + DOM.oils_rpt_filter_tab.onclick = + function(){ + oilsRptHideEditorDivs(); + unHideMe(DOM.oils_rpt_filter_div) + addCSSClass(DOM.oils_rpt_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); + }; + + DOM.oils_rpt_agg_filter_tab.onclick = + function(){ + oilsRptHideEditorDivs(); + unHideMe(DOM.oils_rpt_agg_filter_div) + addCSSClass(DOM.oils_rpt_agg_filter_tab.parentNode, 'oils_rpt_tab_picker_selected'); + }; + + /* + DOM.oils_rpt_order_by_tab.onclick = + function(){ + oilsRptHideEditorDivs(); + oilsRptDrawOrderByWindow(); + unHideMe(DOM.oils_rpt_order_by_div); + }; + */ + + DOM.oils_rpt_tform_submit.disabled = false; + DOM.oils_rpt_filter_submit.disabled = false; + DOM.oils_rpt_agg_filter_submit.disabled = false; + + if( !args.type ) { + DOM.oils_rpt_tform_tab.onclick(); + } else { + /* disable editing on existing items for now */ + if( args.type == 'display' ) { + DOM.oils_rpt_tform_tab.onclick(); + DOM.oils_rpt_tform_submit.disabled = true; + } + if( args.type == 'filter' ) { + DOM.oils_rpt_filter_tab.onclick(); + DOM.oils_rpt_filter_submit.disabled = true; + } + if( args.type == 'agg_filter' ) { + DOM.oils_rpt_agg_filter_tab.onclick(); + DOM.oils_rpt_agg_filter_submit.disabled = true; + } + } + + DOM.oils_rpt_column_editor_close_button.onclick = function(){hideMe(div);}; } function oilsRptDrawFilterWindow(path, col, cls, field, args) { - var tformPicker = new oilsRptTformPicker( { - node : DOM.oils_rpt_filter_tform_table, - datatype : field.datatype, - non_aggregate : true, - select : args.transform - } - ); + var tformPicker = new oilsRptTformPicker( { + node : DOM.oils_rpt_filter_tform_table, + datatype : field.datatype, + non_aggregate : true, + select : args.transform + } + ); - var filterPicker = new oilsRptFilterPicker({ - node : DOM.oils_rpt_filter_op_table, - datatype : field.datatype, - select : args.operation - } - ); + var filterPicker = new oilsRptFilterPicker({ + node : DOM.oils_rpt_filter_op_table, + datatype : field.datatype, + select : args.operation + } + ); - DOM.oils_rpt_filter_submit.onclick = function() { - oilsAddRptFilterItem( - path, tformPicker.getSelected(), filterPicker.getSelected()); - } + DOM.oils_rpt_filter_submit.onclick = function() { + oilsAddRptFilterItem( + path, tformPicker.getSelected(), filterPicker.getSelected()); + } } function oilsRptDrawHavingWindow(path, col, cls, field, args) { - var tformPicker = new oilsRptTformPicker( { - node : DOM.oils_rpt_agg_filter_tform_table, - datatype : field.datatype, - aggregate : true, - select : args.transform - } - ); - - var filterPicker = new oilsRptFilterPicker({ - node : DOM.oils_rpt_agg_filter_op_table, - datatype : field.datatype, - select : args.operation - } - ); - - DOM.oils_rpt_agg_filter_submit.onclick = function() { - oilsAddRptHavingItem( - path, tformPicker.getSelected(), filterPicker.getSelected()); - } + var tformPicker = new oilsRptTformPicker( { + node : DOM.oils_rpt_agg_filter_tform_table, + datatype : field.datatype, + aggregate : true, + select : args.transform + } + ); + + var filterPicker = new oilsRptFilterPicker({ + node : DOM.oils_rpt_agg_filter_op_table, + datatype : field.datatype, + select : args.operation + } + ); + + DOM.oils_rpt_agg_filter_submit.onclick = function() { + oilsAddRptHavingItem( + path, tformPicker.getSelected(), filterPicker.getSelected()); + } } /* draws the transform window */ function oilsRptDrawTransformWindow(path, col, cls, field, args) { - args = (args) ? args : {}; + args = (args) ? args : {}; - DOM.oils_rpt_tform_label_input.value = - (args.label) ? args.label : oilsRptMakeLabel(path); + DOM.oils_rpt_tform_label_input.value = + (args.label) ? args.label : oilsRptMakeLabel(path); - var dtype = field.datatype; + var dtype = field.datatype; - var tformPicker = new oilsRptTformPicker( { - node : DOM.oils_rpt_tform_table, - datatype : field.datatype, - non_aggregate : true, - aggregate : true, - select : args.transform - } - ); + var tformPicker = new oilsRptTformPicker( { + node : DOM.oils_rpt_tform_table, + datatype : field.datatype, + non_aggregate : true, + aggregate : true, + select : args.transform + } + ); - DOM.oils_rpt_tform_submit.onclick = - function(){ - oilsAddRptDisplayItem(path, - DOM.oils_rpt_tform_label_input.value, tformPicker.getSelected() ); - }; + DOM.oils_rpt_tform_submit.onclick = + function(){ + oilsAddRptDisplayItem(path, + DOM.oils_rpt_tform_label_input.value, tformPicker.getSelected() ); + }; - DOM.oils_rpt_tform_label_input.focus(); - DOM.oils_rpt_tform_label_input.select(); + DOM.oils_rpt_tform_label_input.focus(); + DOM.oils_rpt_tform_label_input.select(); - _debug("Building transform window for datatype "+dtype); + _debug("Building transform window for datatype "+dtype); } //function oilsRptDrawOrderByWindow(path, col, cls, field) { function oilsRptDrawOrderByWindow() { - var sel = DOM.oils_rpt_order_by_selector; - removeChildren(sel); - DOM.oils_rpt_order_by_submit.onclick = function() { - oilsRptAddOrderBy(getSelectorVal(sel)); - } + var sel = DOM.oils_rpt_order_by_selector; + removeChildren(sel); + DOM.oils_rpt_order_by_submit.onclick = function() { + oilsRptAddOrderBy(getSelectorVal(sel)); + } - var cols = oilsRpt.def.select; - for( var i = 0; i < cols.length; i++ ) { - var obj = cols[i]; - insertSelectorVal(sel, -1, obj.alias, obj.path); - } + var cols = oilsRpt.def.select; + for( var i = 0; i < cols.length; i++ ) { + var obj = cols[i]; + insertSelectorVal(sel, -1, obj.alias, obj.path); + } } function oilsRptAddOrderBy(path) { - var rel = hex_md5(oilsRptPathRel(path)); - var order_by = oilsRpt.def.order_by; - - /* if this item is already in the order by remove it and overwrite it */ - order_by = grep(oilsRpt.def.order_by, - function(i) {return (i.path != path)}); - - if(!order_by) order_by = []; - - /* find the column definition in the select blob */ - var obj = grep(oilsRpt.def.select, - function(i) {return (i.path == path)}); - - if(!obj) return; - obj = obj[0]; - - order_by.push({ - relation : obj.relation, - column : obj.column, - direction : getSelectorVal(DOM.oils_rpt_order_by_dir) - }); - - oilsRpt.def.order_by = order_by; - oilsRptDebug(); + var rel = hex_md5(oilsRptPathRel(path)); + var order_by = oilsRpt.def.order_by; + + /* if this item is already in the order by remove it and overwrite it */ + order_by = grep(oilsRpt.def.order_by, + function(i) {return (i.path != path)}); + + if(!order_by) order_by = []; + + /* find the column definition in the select blob */ + var obj = grep(oilsRpt.def.select, + function(i) {return (i.path == path)}); + + if(!obj) return; + obj = obj[0]; + + order_by.push({ + relation : obj.relation, + column : obj.column, + direction : getSelectorVal(DOM.oils_rpt_order_by_dir) + }); + + oilsRpt.def.order_by = order_by; + oilsRptDebug(); } diff --git a/Open-ILS/web/reports/oils_rpt_builder.xhtml b/Open-ILS/web/reports/oils_rpt_builder.xhtml index b65246f92e..6a75e36c1c 100644 --- a/Open-ILS/web/reports/oils_rpt_builder.xhtml +++ b/Open-ILS/web/reports/oils_rpt_builder.xhtml @@ -1,219 +1,219 @@ - + "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ + + ]> - - &reports.oils_rpt_builder.title; - - - - - - - -
- &reports.common.logged_in_as; -
- -
- &reports.oils_rpt_builder.reports_home; - - (&reports.oils_rpt_builder.cloning_template; "") - -
- -
- &reports.common.loading; -
- - - - -
- - - - - - - -
&reports.oils_rpt_builder.template_name;
&reports.oils_rpt_builder.template_description;