]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js
958376351503a0a6e227ab9ea7f3f0daf4448313
[Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / evergreen / main / main.js
1 dump('entering main/main.js\n');
2
3 function main_init() {
4         dump('entering main_init()\n');
5         try {
6                 var pref = Components.classes["@mozilla.org/preferences-service;1"]
7                         .getService(Components.interfaces.nsIPrefBranch);
8                 if (pref) {
9                         pref.setCharPref("capability.principal.codebase.p0.granted", "UniversalXPConnect UniversalPreferencesWrite UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
10                         pref.setCharPref("capability.principal.codebase.p0.id", "http://dev.gapines.org");
11                 }
12
13                 if (typeof JSAN == 'undefined') {
14                         throw(
15                                 "The JSAN library object is missing."
16                         );
17                 }
18                 /////////////////////////////////////////////////////////////////////////////
19
20                 JSAN.errorLevel = "die"; // none, warn, or die
21                 JSAN.addRepository('..');
22
23                 //JSAN.use('test.test'); test.test.hello_world();
24
25                 var mw = self;
26                 var G =  {};
27                 G.OpenILS = {};
28                 G.OpenSRF = {};
29
30                 JSAN.use('util.error');
31                 G.error = new util.error();
32                 G.error.sdump('D_ERROR','Testing');
33
34                 JSAN.use('main.window');
35                 G.window = new main.window();
36
37                 JSAN.use('auth.controller');
38                 G.auth = new auth.controller( { 'window' : mw } );
39
40                 JSAN.use('OpenILS.data');
41                 G.OpenILS.data = new OpenILS.data()
42                 G.OpenILS.data.entities = entities;
43                 G.OpenILS.data.stash('entities');
44
45                 G.auth.on_login = function() {
46
47                         G.OpenILS.data.session = G.auth.session.key;
48                         G.OpenILS.data.on_complete = function () {
49                                 
50                                 G.OpenILS.data.stash('list','hash');
51                                 G.OpenILS.data._debug_stash();
52
53                                 G.window.open('http://dev.gapines.org/xul/server/main/menu_frame.xul?session='+mw.escape(G.auth.session.key),'test','chrome');
54                         }
55                         G.OpenILS.data.init();
56                 }
57
58                 G.auth.init();
59
60                 /////////////////////////////////////////////////////////////////////////////
61
62         } catch(E) {
63                 var error = "!! This software has encountered an error.  Please tell your friendly " +
64                         "system administrator or software developer the following:\n" + E + '\n';
65                 try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); }
66                 alert(error);
67         }
68         dump('exiting main_init()\n');
69 }
70
71 dump('exiting main/main.js\n');