From 59a1eeb6f60d79c3fcad828c5d4834c5da2359d5 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 3 Sep 2008 02:22:39 +0000 Subject: [PATCH] sort the attr defs by label. better handle events on the startup calls git-svn-id: svn://svn.open-ils.org/ILS/trunk@10516 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/vandelay/vandelay.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/vandelay/vandelay.js b/Open-ILS/web/vandelay/vandelay.js index 652bb3d2ee..ccf72c6c4e 100644 --- a/Open-ILS/web/vandelay/vandelay.js +++ b/Open-ILS/web/vandelay/vandelay.js @@ -61,12 +61,19 @@ function vlInit() { 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 @@ function vlInit() { 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(); } -- 2.11.0