]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/evergreen/main/window.js
34fd48f7b44c6308378857b793b02d55a3ec76c7
[working/Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / evergreen / main / window.js
1 dump('entering main/window.js\n');
2
3 if (typeof main == 'undefined') main = {};
4 main.window = function () {
5         JSAN.use('util.error'); this.error = new util.error();
6         return this;
7 };
8
9 main.window.prototype = {
10         
11         // list of open window references, used for debugging in shell
12         'win_list' : [],        
13
14         // list of Top Level menu interface window references
15         'appshell_list' : [],   
16
17         // list of documents for debugging.  BROKEN
18         'doc_list' : [],        
19
20         // Windows need unique names.  This number helps.
21         'window_name_increment' : 0, 
22
23         // This number gets put into the title bar for Top Level menu interface windows
24         'appshell_name_increment' : 0,
25
26         // From: Bryan White on netscape.public.mozilla.xpfe, Oct 13, 2004
27         // Message-ID: <ckjh7a$18q1@ripley.netscape.com>
28         // Modified by Jason for Evergreen
29         'SafeWindowOpen' : function (url,title,features) {
30                 var w;
31
32                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
33                 const CI = Components.interfaces;
34                 const PB = Components.classes["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
35
36                 var blocked = false;
37                 try {
38                         // pref 'dom.disable_open_during_load' is the main popup blocker preference
39                         blocked = PB.getBoolPref("dom.disable_open_during_load");
40                         if(blocked) PB.setBoolPref("dom.disable_open_during_load",false);
41
42                         w = window.open(url,title,features);
43                 } catch(E) {
44                         this.error.sdump('D_ERROR','window.SafeWindowOpen: ' + E + '\n');
45                         throw(E);
46                 }
47                 if(blocked) PB.setBoolPref("dom.disable_open_during_load",true);
48
49                 return w;
50         },
51
52         'open' : function(url,title,features) {
53                 this.error.sdump('D_WIN',
54                         'opening ' + url + ', ' + title + ', ' + features + ' from ' + window + '\n');
55                 var w = this.SafeWindowOpen(url,title,features);
56                 /*
57                 setTimeout( 
58                         function() { 
59                                 try { w.title = title; } catch(E) { dump('**'+E+'\n'); }
60                                 try { w.document.title = title; } catch(E) { dump('**'+E+'\n'); }
61                         }, 0 
62                 );
63                 */
64                 return w;
65         }
66 }
67
68 dump('exiting main/window.js\n');