dump('entering OpenILS/data.js\n');
if (typeof OpenILS == 'undefined') OpenILS = {};
-OpenILS.data = function (mw,G) {
+OpenILS.data = function (auth) {
- this.mw = mw; this.G = G;
+ this.auth = auth;
+
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('main.network'); this.network = new main.network();
var obj = this;
}
} catch(E) {
- obj.G.error.sdump('D_ERROR',E + '\n');
+ obj.error.sdump('D_ERROR',E + '\n');
}
}
try {
- obj.list[classname] = obj.G.network.request( app, method, params);
+ obj.list[classname] = obj.network.request( app, method, params);
convert();
// if cacheable, store an offline copy
if (cacheable) {
- var file = new util.file( obj.mw, obj.G, classname );
+ var file = new util.file( classname );
file.set_object( obj.list[classname] );
}
// if cacheable, try offline
if (cacheable) {
try {
- var file = new util.file( obj.mw, obj.G, classname );
+ var file = new util.file( classname );
obj.list[classname] = file.get_object();
convert();
} catch(E) {
[
'open-ils.search',
'open-ils.search.actor.user.session',
- [ obj.G.auth.session.key ],
+ [ obj.auth.session.key ],
false
]
);
}
);
- obj.G.error.sdump('D_DEBUG','_fm_objects = ' + js2JSON(this._fm_objects) + '\n');
+ obj.error.sdump('D_DEBUG','_fm_objects = ' + js2JSON(this._fm_objects) + '\n');
for (var i in this._fm_objects) {
this.chain.push( gen_fm_retrieval_func(i,this._fm_objects[i]) );
[
'open-ils.actor',
'open-ils.actor.org_unit.full_path.retrieve',
- [ obj.G.auth.session.key ],
+ [ obj.auth.session.key ],
true
]
)
[
'open-ils.circ',
'open-ils.circ.stat_cat.actor.retrieve.all',
- [ obj.G.auth.session.key, obj.list.au.home_ou() ],
+ [ obj.auth.session.key, obj.list.au.home_ou() ],
true
]
)();
dump('entering auth/controller.js\n');
if (typeof auth == 'undefined') auth = {};
-auth.controller = function (mw,G) {
-
- this.mw = mw; this.G = G;
+auth.controller = function (w) {
+ JSAN.use('util.error'); this.error = new util.error();
+ this.w = w;
return this;
};
'init' : function () {
var obj = this; // so the 'this' in event handlers don't confuse us
- var mw = obj.mw;
- var G = obj.G;
+ var w = obj.w;
// This talks to our ILS
JSAN.use('auth.session');
- obj.session = new auth.session(obj,mw,G);
+ obj.session = new auth.session(obj);
// Attach this object to the XUL through event listeners
- var cmd_login = mw.document.getElementById('cmd_login');
+ var cmd_login = w.document.getElementById('cmd_login');
if (cmd_login)
cmd_login.addEventListener('command',function () { obj.login(); },false);
- var cmd_logoff = mw.document.getElementById('cmd_logoff');
+ var cmd_logoff = w.document.getElementById('cmd_logoff');
if (cmd_logoff)
cmd_logoff.addEventListener('command',function () { obj.logoff(); },false);
- var cmd_close_window = mw.document.getElementById('cmd_close_window');
+ var cmd_close_window = w.document.getElementById('cmd_close_window');
if (cmd_close_window)
cmd_close_window.addEventListener('command',function () { obj.close(); },false);
- obj.view.name_prompt = mw.document.getElementById('name_prompt');
+ obj.view.name_prompt = w.document.getElementById('name_prompt');
if (obj.view.name_prompt) {
obj.view.name_prompt.addEventListener('keypress',handle_keypress,false);
obj.view.name_prompt.focus();
}
- obj.view.password_prompt = mw.document.getElementById('password_prompt');
+ obj.view.password_prompt = w.document.getElementById('password_prompt');
if (obj.view.password_prompt)
obj.view.password_prompt.addEventListener('keypress',handle_keypress,false);
- obj.view.submit_button = mw.document.getElementById('submit_button');
+ obj.view.submit_button = w.document.getElementById('submit_button');
- obj.view.progress_bar = mw.document.getElementById('auth_meter');
+ obj.view.progress_bar = w.document.getElementById('auth_meter');
function handle_keypress(ev) {
if (ev.keyCode && ev.keyCode == 13) {
}
if (typeof this.on_init == 'function') {
- this.G.error.sdump('D_AUTH','auth.controller.on_init()\n');
+ this.error.sdump('D_AUTH','auth.controller.on_init()\n');
this.on_init();
}
},
'login' : function() {
- this.G.error.sdump('D_AUTH','login with ' + this.view.name_prompt.value + ' and ' + this.view.password_prompt.value + '\n');
+ this.error.sdump('D_AUTH','login with ' + this.view.name_prompt.value + ' and ' + this.view.password_prompt.value + '\n');
this.view.name_prompt.disabled = true;
this.view.password_prompt.disabled = true;
this.view.submit_button.disabled = true;
try {
if (typeof this.on_login == 'function') {
- this.G.error.sdump('D_AUTH','auth.controller.session.on_init = ' +
+ this.error.sdump('D_AUTH','auth.controller.session.on_init = ' +
'auth.controller.on_login\n');
this.session.on_init = this.on_login;
}
} catch(E) {
var error = '!! ' + E + '\n';
- this.G.error.sdump('D_ERROR',error);
+ this.error.sdump('D_ERROR',error);
alert(error);
this.logoff();
if (typeof this.on_login_error == 'function') {
- this.G.error.sdump('D_AUTH','auth.controller.on_login_error()\n');
+ this.error.sdump('D_AUTH','auth.controller.on_login_error()\n');
this.on_login_error(E);
}
}
},
'logoff' : function() {
- this.G.error.sdump('D_AUTH','logoff' + this.mw + '\n');
+ this.error.sdump('D_AUTH','logoff' + this.w + '\n');
this.view.progress_bar.value = 0; this.view.progress_bar.setAttribute('real','0.0');
this.view.submit_button.disabled = false;
this.view.password_prompt.disabled = false;
this.session.close();
if (typeof this.on_logoff == 'function') {
- this.G.error.sdump('D_AUTH','auth.controller.on_logoff()\n');
+ this.error.sdump('D_AUTH','auth.controller.on_logoff()\n');
this.on_logoff();
}
},
'close' : function() {
- this.G.error.sdump('D_AUTH','close' + this.mw + '\n');
+ this.error.sdump('D_AUTH','close' + this.w + '\n');
this.logoff();
for (var w in this.G.window.appshell_list) {
this.G.window.appshell_list[w].close();
}
- this.mw.close(); /* Probably won't go any further */
+ this.w.close(); /* Probably won't go any further */
if (typeof this.on_close == 'function') {
- this.G.error.sdump('D_AUTH','auth.controller.on_close()\n');
+ this.error.sdump('D_AUTH','auth.controller.on_close()\n');
this.on_close();
}
dump('entering auth/session.js\n');
if (typeof auth == 'undefined') auth = {};
-auth.session = function (controller,mw,G) {
+auth.session = function (controller) {
- this.mw = mw; this.G = G; this.controller = controller;
+ JSAN.use('util.error'); this.error = new util.error();
+ JSAN.use('main.network'); this.network = new main.network();
+ this.controller = controller;
return this;
};
'init' : function () {
try {
- var init = this.G.network.request(
+ var init = this.network.request(
'open-ils.auth',
'open-ils.auth.authenticate.init',
[ this.controller.view.name_prompt.value ]
if (init) {
- this.key = this.G.network.request(
+ this.key = this.network.request(
'open-ils.auth',
'open-ils.auth.authenticate.complete',
[
]
);
- this.G.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
+ this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
if (Number(this.key) == 0) {
throw('Invalid name/password combination.');
}
if (typeof this.on_init == 'function') {
- this.G.error.sdump('D_AUTH','auth.session.on_init()\n');
+ this.error.sdump('D_AUTH','auth.session.on_init()\n');
this.on_init();
}
} else {
var error = 'open-ils.auth.authenticate.init returned false\n';
- this.G.error.sdump('D_ERROR',error);
+ this.error.sdump('D_ERROR',error);
this.controller.logoff();
throw(error);
}
} catch(E) {
var error = 'Error on auth.session.init(): ' + E + '\n';
- this.G.error.sdump('D_ERROR',error);
+ this.error.sdump('D_ERROR',error);
if (typeof this.on_init_error == 'function') {
- this.G.error.sdump('D_AUTH','auth.session.on_init_error()\n');
+ this.error.sdump('D_AUTH','auth.session.on_init_error()\n');
this.on_init_error(E);
}
//throw(E);
if (typeof this.on_init == 'function') {
- this.G.error.sdump('D_AUTH','auth.session.on_init() despite error\n');
+ this.error.sdump('D_AUTH','auth.session.on_init() despite error\n');
this.on_init();
}
}
},
'close' : function () {
- this.G.error.sdump('D_AUTH','auth.session.close()\n');
+ this.error.sdump('D_AUTH','auth.session.close()\n');
this.key = null;
if (typeof this.G.on_close == 'function') {
- this.G.error.sdump('D_AUTH','auth.session.on_close()\n');
+ this.error.sdump('D_AUTH','auth.session.on_close()\n');
this.G.on_close();
}
}
G.OpenSRF = {};
JSAN.use('util.error');
- G.error = new util.error( mw, G );
+ G.error = new util.error();
G.error.sdump('D_ERROR','Testing');
- dump('direct dump\n');
JSAN.use('main.window');
- G.window = new main.window( mw, G );
+ G.window = new main.window();
JSAN.use('main.network');
- G.network = new main.network( mw, G );
+ G.network = new main.network();
G.test_array = [ "a", "b", "c" ];
G.test_object = { "a" : "b", "c" : "d", "e" : "f" };
}
JSAN.use('auth.controller');
- G.auth = new auth.controller( mw, G );
+ G.auth = new auth.controller( mw );
G.auth.on_login = function() {
JSAN.use('OpenILS.data');
- G.OpenILS.data = new OpenILS.data( mw, G );
+ G.OpenILS.data = new OpenILS.data( G.auth );
G.OpenILS.data.on_complete = function () {
- alert('test');
- //G.window.open('http://gapines.org/xul/server/test.xul','test','chrome');
+ G.window.open('http://gapines.org/xul/server/test.xul','test','chrome');
}
G.OpenILS.data.init();
}
dump('entering main/network.js\n');
if (typeof main == 'undefined') main = {};
-main.network = function (mw,G) {
-
- this.mw = mw; this.G = G;
+main.network = function () {
+ JSAN.use('util.error'); this.error = new util.error();
// Place a test here for network connectivity
// this.offline = true;
try {
- this.G.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
+ this.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
var request = new RemoteRequest( app, name );
for(var index in params) {
request.addParam(params[index]);
if (f) {
request.setCompleteCallback(f);
request.send(false);
- this.G.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
+ this.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
return null;
} else {
request.send(true);
var result = request.getResultObject();
- this.G.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
+ this.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
return result;
}
dump('entering main/window.js\n');
if (typeof main == 'undefined') main = {};
-main.window = function (mw,G) {
- this.main_window = mw; this.mw = mw; this.G = G;
+main.window = function () {
+ JSAN.use('util.error'); this.error = new util.error();
return this;
};
main.window.prototype = {
- // pointer to the auth window
- 'main_window' : null,
-
// list of open window references, used for debugging in shell
'win_list' : [],
w = window.open(url,title,features);
} catch(E) {
- this.G.error.sdump('D_ERROR','window.SafeWindowOpen: ' + E + '\n');
+ this.error.sdump('D_ERROR','window.SafeWindowOpen: ' + E + '\n');
throw(E);
}
if(blocked) PB.setBoolPref("dom.disable_open_during_load",true);
},
'open' : function(url,title,features) {
- this.G.error.sdump('D_WIN',
+ this.error.sdump('D_WIN',
'opening ' + url + ', ' + title + ', ' + features + ' from ' + window + '\n');
var w = this.SafeWindowOpen(url,title,features);
- w.mw = this.mw; w.G = this.G;
/*
setTimeout(
function() {
dump('entering util/error.js\n');
if (typeof util == 'undefined') util = {};
-util.error = function (mw,G) {
+util.error = function () {
this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
.getService(Components.interfaces.nsIConsoleService);
dump('entering util/file.js\n');
if (typeof util == 'undefined') util = {};
-util.file = function (mw,G,fname) {
+util.file = function (fname) {
- this.mw = mw; this.G = G;
+ JSAN.use('util.error'); this.error = new util.error();
this.dirService = Components.classes["@mozilla.org/file/directory_service;1"].
getService( Components.interfaces.nsIProperties );
util.file.prototype = {
+ 'myPackageDir' : 'evergreen',
+
'name' : '',
'_file' : null,
'_input_stream' : null,
if (!fname) throw('Must specify a filename.');
this._file = this.dirService.get( "AChrom", Components.interfaces.nsIFile );
- this._file.append(this.mw.myPackageDir);
+ this._file.append(myPackageDir);
this._file.append("content");
this._file.append("conf");
this._file.append(fname);
- this.G.error.sdump('D_FILE',this._file.path);
+ this.error.sdump('D_FILE',this._file.path);
return this._file;
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file.get(): ' + E);
+ this.error.sdump('D_ERROR','util.file.get(): ' + E);
throw(E);
}
},
if (this._output_stream) { this._output_stream.close(); this._output_stream = null; }
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file.close(): ' + E);
+ this.error.sdump('D_ERROR','util.file.close(): ' + E);
throw(E);
}
},
this.close();
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file.set_object(): ' + E);
+ this.error.sdump('D_ERROR','util.file.set_object(): ' + E);
throw(E);
}
},
return obj;
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file.get_object(): ' + E);
+ this.error.sdump('D_ERROR','util.file.get_object(): ' + E);
throw(E);
}
},
}
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file._create_input_stream(): ' + E);
+ this.error.sdump('D_ERROR','util.file._create_input_stream(): ' + E);
throw(E);
}
},
return this._output_stream;
} catch(E) {
- this.G.error.sdump('D_ERROR','util.file._create_output_stream(): ' + E);
+ this.error.sdump('D_ERROR','util.file._create_output_stream(): ' + E);
throw(E);
}
}
pref("dom.max_script_run_time",60);
pref("javascript.options.strict",false);
+pref("javascript.options.showInConsole",true);
// This lets remote xul access link to local chrome
pref("security.checkloaduri", false);
pref("signed.applets.codebase_principal_support", true);
+