From: berick Date: Thu, 26 May 2011 19:13:48 +0000 (-0400) Subject: Repaired syntax errors and thinkos X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1cdc294001f2d05f3701a04eed7c98957957c763;p=evergreen%2Fpines.git Repaired syntax errors and thinkos * Syntax in AuthorityControlSet.js * Protect against empty kwargs hash * marcedit.js fixes: Load dojo class before use; Load in my_init(), before which dojo is not defined Signed-off-by: berick --- diff --git a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js index 4c8eb88539..46ad3946ca 100644 --- a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js +++ b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js @@ -28,6 +28,8 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { constructor : function(kwargs) { + kwargs = kwargs || {}; + if (!openils.AuthorityControlSet._remote_loaded) { // TODO -- push the raw tree into the oils cache for later reuse @@ -51,7 +53,7 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { ) ); openils.AuthorityControlSet._browse_axis_by_name[ba.code()] = ba; - ); + }); // loop over each acs dojo.forEach( openils.AuthorityControlSet._control_set_list, function (cs) { @@ -107,7 +109,7 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { csaf.bib_fields( acsbf_list ); openils.AuthorityControlSet._controlsets[''+cs.id()].bib_fields = [].concat( - openils.AuthorityControlSet._controlsets[''+cs.id()].bib_fields + openils.AuthorityControlSet._controlsets[''+cs.id()].bib_fields, acsbf_list ); @@ -142,7 +144,8 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { dojo.forEach( openils.AuthorityControlSet._controlsets[''+cs.id()].bib_fields, function (bf) { openils.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()] = {}; dojo.forEach( bf.authority_field().sf_list().split(''), function (sf_code) { - openils.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code] = { bf.authority_field().tag() : sf_code }; + openils.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code] = {}; + openils.AuthorityControlSet._controlsets[''+cs.id()].control_map[bf.tag()][sf_code][bf.authority_field().tag()] = sf_code; }); }); @@ -292,7 +295,7 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) { openils.AuthorityControlSet._controlsets = { // static sorta-LoC setup ... to be overwritten with server data - -1 : { + '-1' : { id : -1, name : 'Static LoC legacy mapping', description : 'Legacy mapping provided as a default', diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index deb2ee362a..f05eba47af 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -42,7 +42,7 @@ var show_auth_menu = false; function $(id) { return document.getElementById(id); } -var acs = new openils.AuthorityControlSet (); +var acs; // AuthorityControlSet function mangle_005() { var now = new Date(); @@ -155,6 +155,9 @@ function my_init() { JSAN.errorLevel = "die"; // none, warn, or die JSAN.addRepository('/xul/server/'); + dojo.require('openils.AuthorityControlSet'); + acs = new openils.AuthorityControlSet (); + // Fake xulG for standalone... try { window.xulG.record;