From 06f93604a133ed09c59531d2927a48abf4295de4 Mon Sep 17 00:00:00 2001 From: pines Date: Sun, 13 May 2007 08:27:00 +0000 Subject: [PATCH] modal xulG infrastructure for util.window git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@7289 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/chrome/content/util/window.js | 33 ++++++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/window.js b/Open-ILS/xul/staff_client/chrome/content/util/window.js index e21e1a1426..c7a73bfd6d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/window.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/window.js @@ -71,13 +71,40 @@ util.window.prototype = { return w; }, - 'open' : function(url,title,features) { + 'open' : function(url,title,features,my_xulG) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var key; if (!title) title = 'anon' + this.window_name_increment(); if (!features) features = 'chrome'; - this.error.sdump('D_WIN', - 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n'); + this.error.sdump('D_WIN', 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n'); + var data; + if (features.match(/modal/) && my_xulG) { + JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.init({'via':'stash'}); + if (typeof data.modal_xulG_stack == 'undefined') data.modal_xulG_stack = {}; + /* FIXME - not a perfect key.. could imagine two top-level windows both opening modal windows */ + key = url; + if (typeof xulG == 'object') if (typeof xulG.url_prefix == 'function') { + key = key.replace( xulG.url_prefix('/'), '/' ); + } + if (typeof data.modal_xulG_stack[key] == 'undefined') data.modal_xulG_stack[key] = []; + data.modal_xulG_stack[key].push( my_xulG ); + data.stash('modal_xulG_stack'); + this.error.sdump('D_WIN','modal key = ' + key); + } var w = this.SafeWindowOpen(url,title,features); + if (features.match(/modal/) && my_xulG) { + var x = data.modal_xulG_stack[key].pop(); + data.stash('modal_xulG_stack'); + return x; + } else { + if (my_xulG) { + if (w.contentWindow) { + w.contentWindow.xulG = my_xulG; + } else { + w.xulG = my_xulG; + } + } + } /* setTimeout( function() { -- 2.11.0