a little polish
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Mar 2006 14:59:26 +0000 (14:59 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Mar 2006 14:59:26 +0000 (14:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3318 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/auth/controller.js
Open-ILS/xul/staff_client/chrome/content/main/main.js

index 1179485..e9f1856 100644 (file)
@@ -15,6 +15,9 @@ auth.controller.prototype = {
                var obj = this;  // so the 'this' in event handlers don't confuse us
                var w = obj.w;
 
                var obj = this;  // so the 'this' in event handlers don't confuse us
                var w = obj.w;
 
+               JSAN.use('OpenILS.data');
+               obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+
                // MVC
                JSAN.use('util.controller'); obj.controller = new util.controller();
                obj.controller.init(
                // MVC
                JSAN.use('util.controller'); obj.controller = new util.controller();
                obj.controller.init(
@@ -73,6 +76,21 @@ auth.controller.prototype = {
                                        'ws_deck' : [
                                                ['render'],
                                                function(e) { return function() {
                                        'ws_deck' : [
                                                ['render'],
                                                function(e) { return function() {
+                                                       try {
+                                                       JSAN.use('util.widgets'); util.widgets.remove_children(e);
+                                                       if (obj.data.ws_info && obj.data.ws_info[ obj.controller.view.server_prompt.value ]) {
+                                                               var ws = obj.data.ws_info[ obj.controller.view.server_prompt.value ];
+                                                               var x = document.createElement('description');
+                                                               e.appendChild(x);
+                                                               x.appendChild(
+                                                                       document.createTextNode(
+                                                                               ws.name + ' @  ' + ws.lib_shortname
+                                                                       )
+                                                               );
+                                                       }
+                                                       } catch(E) {
+                                                               alert(E);
+                                                       }
                                                } }
                                        ],
                                        'menu_spot' : [
                                                } }
                                        ],
                                        'menu_spot' : [
@@ -111,6 +129,12 @@ auth.controller.prototype = {
                        }
                }
 
                        }
                }
 
+               obj.controller.view.server_prompt.addEventListener(
+                       'change',
+                       function () { obj.controller.render('ws_deck'); },
+                       false
+               );
+
                // This talks to our ILS
                JSAN.use('auth.session');
                obj.session = new auth.session(obj.controller.view);
                // This talks to our ILS
                JSAN.use('auth.session');
                obj.session = new auth.session(obj.controller.view);
@@ -189,6 +213,8 @@ auth.controller.prototype = {
                        if (w != window) w.close();
                }
 
                        if (w != window) w.close();
                }
 
+               this.controller.render('ws_deck');
+
                this.session.close();
 
                if (typeof this.on_logoff == 'function') {
                this.session.close();
 
                if (typeof this.on_logoff == 'function') {
index 10691eb..3d2a054 100644 (file)
@@ -53,11 +53,8 @@ function main_init() {
                try {
                        G.file.get('ws_info');
                        G.ws_info = G.file.get_object();
                try {
                        G.file.get('ws_info');
                        G.ws_info = G.file.get_object();
-                       // { server_name : { 'id' : ..., 'name' : ..., 'owning_lib' : ... }, ... : ... }
-                       // alert('retrieved ws_info from filesystem: ' + js2JSON(G.ws_info) );
                } catch(E) {
                        G.ws_info = {};
                } catch(E) {
                        G.ws_info = {};
-                       //alert('could not retrieve ws_info from filesystem');
                }
                G.data.ws_info = G.ws_info; G.data.stash('ws_info');
 
                }
                G.data.ws_info = G.ws_info; G.data.stash('ws_info');
 
@@ -84,6 +81,7 @@ function main_init() {
                        } else {
                                xulG.file = G.file;
                                var deck = G.auth.controller.view.ws_deck;
                        } else {
                                xulG.file = G.file;
                                var deck = G.auth.controller.view.ws_deck;
+                               JSAN.use('util.widgets'); util.widgets.remove_children('ws_deck');
                                var iframe = document.createElement('iframe'); deck.appendChild(iframe);
                                iframe.setAttribute( 'src', url + '/xul/server/main/ws_info.xul' );
                                iframe.contentWindow.xulG = xulG;
                                var iframe = document.createElement('iframe'); deck.appendChild(iframe);
                                iframe.setAttribute( 'src', url + '/xul/server/main/ws_info.xul' );
                                iframe.contentWindow.xulG = xulG;