getting frame.contentWindow with remote xul, for the purpose of callbacks
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Dec 2005 20:49:52 +0000 (20:49 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Dec 2005 20:49:52 +0000 (20:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2291 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/main/controller.js
Open-ILS/xul/staff_client/chrome/content/evergreen/util/deck.js
Open-ILS/xul/staff_client/server/main/menu.js

index 25a6907..2b9d05a 100644 (file)
@@ -26,7 +26,7 @@ main.controller.prototype = {
                                                var ev_type = this.control_map[i][0][j];
                                                switch(ev_type) {
                                                        case 'render':
-                                                               this.render_list.push( this.control_map[i][1](cmd) ); 
+                                                               this.render_list.push( [i, this.control_map[i][1](cmd)] ); 
                                                        break;
                                                        default: cmd.addEventListener(ev_type,this.control_map[i][1],false);
                                                }
@@ -37,10 +37,14 @@ main.controller.prototype = {
                }
        },
 
-       'render' : function() {
+       'render' : function(id) {
                for (var i in this.render_list) {
                        try {
-                               this.render_list[i]();
+                               if (id) {
+                                       if (id == this.render_list[i][0]) this.render_list[i][1]();
+                               } else {
+                                       this.render_list[i][1]();
+                               }
                        } catch(E) {
                                var error = 'Problem in circ.checkout.render with\n' 
                                        + this.render_list[i] + '\n\n' + js2JSON(E);
index b4d936f..5d1cb21 100644 (file)
@@ -5,8 +5,18 @@ util.deck = function (id) {
 
        this.node = document.getElementById(id);
 
-       if (!this.node) throw('Could not find element ' + id);
-       if (this.node.nodeName != 'deck') throw(id + ' is not a deck');
+       JSAN.use('util.error'); this.error = new util.error();
+
+       if (!this.node) {
+               var error = 'util.deck: Could not find element ' + id;
+               this.error.sdump('D_ERROR',error);
+               throw(error);
+       }
+       if (this.node.nodeName != 'deck') {
+               var error = 'util.deck: ' + id + 'is not a deck';
+               this.error.sdump('D_ERROR',error);
+               throw(error);
+       }
 
        return this;
 };
@@ -22,23 +32,23 @@ util.deck.prototype = {
                return idx;
        },
 
-       'set_iframe' : function (url) {
+       'set_iframe' : function (url,params,content_params) {
                var idx = this.find_index(url);
                if (idx>-1) {
                        this.node.selectedIndex = idx;
                } else {
-                       this.new_iframe(url);
+                       this.new_iframe(url,params,content_params);
                }
                
                
        },
 
-       'reset_iframe' : function (url) {
+       'reset_iframe' : function (url,params,content_params) {
                this.remove_iframe(url);
-               this.new_iframe(url);
+               this.new_iframe(url,params,content_params);
        },
 
-       'new_iframe' : function (url) {
+       'new_iframe' : function (url,params,content_params) {
                var idx = this.find_index(url);
                if (idx>-1) throw('An iframe already exists in deck with url = ' + url);
 
@@ -47,6 +57,17 @@ util.deck.prototype = {
                iframe.setAttribute('flex','1');
                this.node.appendChild( iframe );
                this.node.selectedIndex = this.node.childNodes.length - 1;
+               if (content_params) {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               this.error.sdump('D_DECK', 'frame.contentWindow = ' + frame.contentWindow + '\n');
+                               iframe.contentWindow.IAMXUL = true;
+                               iframe.contentWindow.xulG = content_params;
+                       } catch(E) {
+                               dump('E: ' + E + '\n');
+                       }
+                       alert('new_iframe: got here3');
+               }
        },
 
        'remove_iframe' : function (url) {
index b1990c5..849a417 100644 (file)
@@ -49,7 +49,7 @@ main.menu.prototype = {
                        'cmd_circ_checkout' : [
                                ['command','keypress'],
                                function() { 
-                                       obj.set_tab(urls.remote_patron_barcode_entry + '?session='+obj.w.escape(session),{});
+                                       obj.set_tab(urls.remote_patron_barcode_entry + '?session='+obj.w.escape(session),{},{'yadda':'yadda'});
                                }
                        ],
                        'cmd_search_opac' : [
@@ -167,6 +167,8 @@ main.menu.prototype = {
                frame.setAttribute('src',url);
                panel.appendChild(frame);
                if (content_params) {
+                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                       this.error.sdump('D_MENU', 'frame.contentWindow = ' + frame.contentWindow + '\n');
                        frame.contentWindow.IAMXUL = true;
                        frame.contentWindow.xulG = content_params;
                }