#(cd chrome/content/evergreen/util ; ${RETRIEVE_FIELDMAPPER} );
#(cd chrome/content/evergreen/util ; ${RETRIEVE_ORG_TREE} );
(cd chrome/content/evergreen/conf ; ${RETRIEVE_CLIENT_CONFIG} );
- (cd chrome/content/evergreen/OpenILS/util/ ; ${RETRIEVE_FM_ALL} );
+ #(cd chrome/content/evergreen/OpenILS/util/ ; ${RETRIEVE_FM_ALL} );
open-ils:
cp ../../../OpenSRF/src/javascript/*.js chrome/content/evergreen/OpenSRF/
function gen_fm_retrieval_func(classname,data) {
var app = data[0]; var method = data[1]; var params = data[2]; var cacheable = data[3];
return function () {
- try {
- obj.list[classname] = obj.G.network.request( app, method, params);
+
+ function convert() {
try {
if (obj.list[classname].constructor.name == 'Array') {
obj.hash[classname] =
obj.G.error.sdump('D_ERROR',E + '\n');
}
+
+ }
+
+ try {
+ obj.list[classname] = obj.G.network.request( app, method, params);
+ convert();
// if cacheable, store an offline copy
if (cacheable) {
var file = new util.file( obj.mw, obj.G, classname );
} catch(E) {
// if cacheable, try offline
if (cacheable) {
+ try {
+ var file = new util.file( obj.mw, obj.G, classname );
+ obj.list[classname] = file.get_object();
+ convert();
+ } catch(E) {
+ throw(E);
+ }
}
- throw(E); // for now
+ //throw(E); // for now
}
}
}
'open-ils.search',
'open-ils.search.actor.user.session',
[ obj.G.auth.session.key ],
- false
+ true
]
)
);
this.on_init_error(E);
}
- throw(E);
+ //throw(E);
+ if (typeof this.on_init == 'function') {
+ this.G.error.sdump('D_AUTH','auth.session.on_init() despite error\n');
+ this.on_init();
+ }
}
},
JSAN.use('main.network');
G.network = new main.network( mw, G );
+ G.test_array = [ "a", "b", "c" ];
+ G.test_object = { "a" : "b", "c" : "d", "e" : "f" };
+ G.test = function(t) {
+ dump(js2JSON( t ) + '\n');
+ }
+
JSAN.use('auth.controller');
G.auth = new auth.controller( mw, G );
G.OpenILS.data = new OpenILS.data( mw, G );
G.OpenILS.data.on_complete = function () {
- alert('spawn app_shell');
+ G.window.open('http://gapines.org/xul/test.xul','test','chrome');
}
G.OpenILS.data.init();
}
if (typeof main == 'undefined') main = {};
main.window = function (mw,G) {
- this.main_window = mw;
+ this.main_window = mw; this.mw = mw; this.G = G;
return this;
};
'window_name_increment' : 0,
// This number gets put into the title bar for Top Level menu interface windows
- 'appshell_name_increment' : 0
+ 'appshell_name_increment' : 0,
+ // From: Bryan White on netscape.public.mozilla.xpfe, Oct 13, 2004
+ // Message-ID: <ckjh7a$18q1@ripley.netscape.com>
+ // Modified by Jason for Evergreen
+ 'SafeWindowOpen' : function (url,title,features) {
+ var w;
+
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ const CI = Components.interfaces;
+ const PB = Components.classes["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
+
+ var blocked = false;
+ try {
+ // pref 'dom.disable_open_during_load' is the main popup blocker preference
+ blocked = PB.getBoolPref("dom.disable_open_during_load");
+ if(blocked) PB.setBoolPref("dom.disable_open_during_load",false);
+
+ w = window.open(url,title,features);
+ } catch(E) {
+ this.G.error.sdump('D_ERROR','window.SafeWindowOpen: ' + E + '\n');
+ throw(E);
+ }
+ if(blocked) PB.setBoolPref("dom.disable_open_during_load",true);
+
+ return w;
+ },
+
+ 'open' : function(url,title,features) {
+ this.G.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() {
+ try { w.title = title; } catch(E) { dump('**'+E+'\n'); }
+ try { w.document.title = title; } catch(E) { dump('**'+E+'\n'); }
+ }, 0
+ );
+ */
+ return w;
+ }
}
dump('exiting main/window.js\n');
'D_FILE' : true, 'D_EXPLODE' : false, 'D_FM_UTILS' : false, 'D_PRINT' : false, 'D_SES' : true,
'D_SES_FUNC' : false, 'D_SES_RESULT' : true, 'D_SPAWN' : false, 'D_STRING' : false,
- 'D_UTIL' : false, 'D_WIN' : false, 'D_WIDGETS' : false
+ 'D_UTIL' : false, 'D_WIN' : true, 'D_WIDGETS' : false
},
'filter_console_init' : function (p) {
if (this._input_stream || this._output_stream) throw('Must .close() first.');
this._create_input_stream();
- var data = this._input_stream(-1);
+ var data = this._input_stream.read(-1);
this.close();
var obj; try { obj = JSON2js( data ); } catch(E) { throw('Could not js-ify the JSON: '+E); }
var f = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
- f.init(file, 0x01, 0, 0);
+ f.init(this._file, 0x01, 0, 0);
this._input_stream = Components.classes["@mozilla.org/scriptableinputstream;1"]
.createInstance(Components.interfaces.nsIScriptableInputStream);
if (f) {