Repaired syntax errors and thinkos
authorberick <berick@esilibrary.com>
Thu, 26 May 2011 19:13:48 +0000 (15:13 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 11 Jul 2011 17:48:28 +0000 (13:48 -0400)
 * 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 <berick@esilibrary.com>
Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
Open-ILS/xul/staff_client/server/cat/marcedit.js

index 4c8eb88..46ad394 100644 (file)
@@ -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',
index deb2ee3..f05eba4 100644 (file)
@@ -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;