9790ed1d06462f26946d92cb7194bf309b98f68e
[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                 if (typeof JSAN == 'undefined') {
7                         throw(
8                                 "The JSAN library object is missing."
9                         );
10                 }
11                 /////////////////////////////////////////////////////////////////////////////
12
13                 JSAN.errorLevel = "die"; // none, warn, or die
14                 JSAN.addRepository('..');
15
16                 //JSAN.use('test.test'); test.test.hello_world();
17
18                 var mw = self;
19                 var G =  {};
20                 G.OpenILS = {};
21                 G.OpenSRF = {};
22
23                 JSAN.use('util.error');
24                 G.error = new util.error();
25                 G.error.sdump('D_ERROR','Testing');
26
27                 JSAN.use('main.window');
28                 G.window = new main.window();
29
30                 JSAN.use('main.network');
31                 G.network = new main.network();
32
33                 G.test_array = [ "a", "b", "c" ];
34                 G.test_object = { "a" : "b", "c" : "d", "e" : "f" };
35                 G.test = function(t) {
36                         dump(js2JSON( t ) + '\n');
37                 }
38
39                 JSAN.use('auth.controller');
40                 G.auth = new auth.controller( mw );
41
42                 G.auth.on_login = function() {
43
44                         JSAN.use('OpenILS.data');
45                         G.OpenILS.data = new OpenILS.data( G.auth );
46                         G.OpenILS.data.on_complete = function () {
47
48                                 G.window.open('http://gapines.org/xul/server/test.xul','test','chrome');
49                         }
50                         G.OpenILS.data.init();
51                 }
52
53                 G.auth.init();
54
55                 /////////////////////////////////////////////////////////////////////////////
56
57         } catch(E) {
58                 var error = "!! This software has encountered an error.  Please tell your friendly " +
59                         "system administrator or software developer the following:\n" + E + '\n';
60                 try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); }
61                 alert(error);
62         }
63         dump('exiting main_init()\n');
64 }
65
66 dump('exiting main/main.js\n');