1 dump('entering main/main.js\n');
3 function grant_perms(url) {
4 var perms = "UniversalXPConnect UniversalPreferencesWrite UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead";
5 dump('Granting ' + perms + ' to ' + url + '\n');
6 var pref = Components.classes["@mozilla.org/preferences-service;1"]
7 .getService(Components.interfaces.nsIPrefBranch);
9 pref.setCharPref("capability.principal.codebase.p0.granted", perms);
10 pref.setCharPref("capability.principal.codebase.p0.id", url);
15 function main_init() {
16 dump('entering main_init()\n');
18 if (typeof JSAN == 'undefined') {
20 "The JSAN library object is missing."
23 /////////////////////////////////////////////////////////////////////////////
25 JSAN.errorLevel = "die"; // none, warn, or die
26 JSAN.addRepository('..');
28 //JSAN.use('test.test'); test.test.hello_world();
33 JSAN.use('util.error');
34 G.error = new util.error();
35 G.error.sdump('D_ERROR','Testing');
37 JSAN.use('util.window');
38 G.window = new util.window();
40 //G.window.open(urls.XUL_DEBUG_CONSOLE,'testconsole','chrome,resizable');
42 JSAN.use('auth.controller');
43 G.auth = new auth.controller( { 'window' : mw } );
45 JSAN.use('OpenILS.data');
46 G.data = new OpenILS.data()
47 G.data.on_error = G.auth.logoff;
48 G.data.entities = entities;
49 G.data.stash('entities');
51 G.auth.on_login = function() {
53 var url = G.auth.controller.view.server_prompt.value || urls.remote;
54 if (! url.match( '^http://' ) ) url = 'http://' + url;
56 G.data.server = url; G.data.stash('server');
60 var deck = document.getElementById('main_deck');
61 var iframe = document.createElement('iframe'); deck.appendChild(iframe);
62 iframe.setAttribute( 'src', url + '/xul/server/main/data.xul' );
68 iframe.contentWindow.xulG = xulG;
72 // XML_HTTP_SERVER will get reset to G.auth.controller.view.server_prompt.value
74 /////////////////////////////////////////////////////////////////////////////
77 var error = "!! This software has encountered an error. Please tell your friendly " +
78 "system administrator or software developer the following:\n" + E + '\n';
79 try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); }
82 dump('exiting main_init()\n');
85 dump('exiting main/main.js\n');