From 0348f09e543bf296e12f27e94da1ca418e15b2a7 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 8 Dec 2005 20:49:52 +0000 Subject: [PATCH] getting frame.contentWindow with remote xul, for the purpose of callbacks git-svn-id: svn://svn.open-ils.org/ILS/trunk@2291 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../content/evergreen/main/controller.js | 10 ++++-- .../chrome/content/evergreen/util/deck.js | 35 +++++++++++++++---- Open-ILS/xul/staff_client/server/main/menu.js | 4 ++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/main/controller.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/main/controller.js index 25a6907e6c..2b9d05a4f5 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/main/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/main/controller.js @@ -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); diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/deck.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/deck.js index b4d936ff5c..5d1cb213e1 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/deck.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/deck.js @@ -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) { diff --git a/Open-ILS/xul/staff_client/server/main/menu.js b/Open-ILS/xul/staff_client/server/main/menu.js index b1990c5b71..849a417344 100644 --- a/Open-ILS/xul/staff_client/server/main/menu.js +++ b/Open-ILS/xul/staff_client/server/main/menu.js @@ -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; } -- 2.43.2