[open-ils-commits] r10516 - trunk/Open-ILS/web/vandelay

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 2 22:22:41 EDT 2008


Author: erickson
Date: 2008-09-02 22:22:39 -0400 (Tue, 02 Sep 2008)
New Revision: 10516

Modified:
   trunk/Open-ILS/web/vandelay/vandelay.js
Log:
sort the attr defs by label.  better handle events on the startup calls

Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js	2008-09-02 21:44:07 UTC (rev 10515)
+++ trunk/Open-ILS/web/vandelay/vandelay.js	2008-09-03 02:22:39 UTC (rev 10516)
@@ -61,12 +61,19 @@
             params: [authtoken, {id:{'!=':null}}],
             onresponse: function(r) {
                 var def = r.recv().content(); 
-                if(openils.Event.parse(def)) 
-                    return alert(def);
+                if(e = openils.Event.parse(def[0])) 
+                    return alert(e);
                 bibAttrDefs.push(def);
             },
             oncomplete: function() {
                 bibAttrsFetched = true;
+                bibAttrDefs = bibAttrDefs.sort(
+                    function(a, b) {
+                        if(a.description() > b.description()) return 1;
+                        if(a.description() < b.description()) return -1;
+                        return 0;
+                    }
+                );
                 if(authAttrsFetched) 
                     runStartupCommands();
             }
@@ -79,12 +86,19 @@
             params: [authtoken, {id:{'!=':null}}],
             onresponse: function(r) {
                 var def = r.recv().content(); 
-                if(openils.Event.parse(def)) 
-                    return alert(def);
+                if(e = openils.Event.parse(def[0])) 
+                    return alert(e);
                 authAttrDefs.push(def);
             },
             oncomplete: function() {
                 authAttrsFetched = true;
+                authAttrDefs = authAttrDefs.sort(
+                    function(a, b) {
+                        if(a.description() > b.description()) return 1;
+                        if(a.description() < b.description()) return -1;
+                        return 0;
+                    }
+                );
                 if(bibAttrsFetched) 
                     runStartupCommands();
             }



More information about the open-ils-commits mailing list