_debug('uEditInit(): ' + location.search);
cgi = new CGI();
- session = cgi.param('ses');
- if (xulG) if (xulG.ses) session = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
- clone = cgi.param('clone');
- if (xulG) if (xulG.clone) clone = xulG.clone;
- if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
+ session = cgi.param('ses');
+ clone = cgi.param('clone');
if(!session) throw "User session is not defined";
fetchUser(session);
fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
uEditBuildLibSelector();
- var usr = cgi.param('usr');
- if (xulG) if (xulG.usr) usr = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
- patron = fetchFleshedUser(usr);
+ patron = fetchFleshedUser(cgi.param('usr'));
if(!patron) patron = uEditNewPatron();
uEditDraw(
!patron.isnew() ) {
_debug("xulG clone spawning new interface...");
- var ses = cgi.param('ses');
- if (xulG) if (xulG.ses) ses = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
- window.xulG.spawn_editor({ses:ses,clone:cloneme});
+ window.xulG.spawn_editor({ses:cgi.param('ses'),clone:cloneme});
uEditRefresh();
} else {
var href = location.href;
href = href.replace(/\&?usr=\d+/, '');
href = href.replace(/\&?clone=\d+/, '');
- var id = cgi.param('usr');
- if (xulG) if (xulG.usr) id = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
+ var id = cgi.param('usr')
/* reload the current user if available */
if( id ) href += "&usr=" + id;
location.href = href;
hideMe($n(row, 'owner_link_div'));
} else {
-
- var ses = cgi.param('ses');
- if (xulG) if (xulG.ses) ses = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+
link.onclick =
- function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
+ function() { window.xulG.spawn_editor({ses:cgi.param('ses'),usr:id}) };
if( userCache[id] ) {
var usr = userCache[id];
'list' : {},
'hash' : {},
'tree' : {},
- 'cached_request' : {},
'temp' : '',
},
- // This should be invoked only once per application, in a persistant window
- 'init_observer_functions' : function() {
- try {
- var obj = this; // OpenILS.data
- obj.observers = {}; //
- obj.observers.id = 1; // Unique id for each observer function added
- obj.observers.id2path = {}; // Lookup for full_path via observer id
- obj.observers.cache = {}; // Observer funcs go in here
-
- // For a given path, this executes all the registered observer funcs
- obj.observers.dispatch = function(full_path, old_value, new_value) {
- obj.error.sdump('D_OBSERVERS', 'entering observers.dispatch\nfull_path = ' + full_path + '\nold_value = ' + js2JSON(old_value) + '\nnew_value = ' + js2JSON(new_value) + '\n');
- try {
- var path = full_path.split(/\./).pop();
- for (var i in obj.observers.cache[full_path]) {
- try {
- var o = obj.observers.cache[full_path][i];
- if (typeof o.func == 'function') o.func(path, old_value, new_value);
- } catch(E) {
- obj.error.sdump('D_ERROR','Error in OpenILS.data.observers.dispatch(): ' + js2JSON(E) );
- }
- }
- } catch(E) {
- obj.error.sdump('D_ERROR','Error in OpenILS.data.observers.dispatch(): ' + js2JSON(E) );
- }
- }
-
- // This registers an observer function for a given path
- obj.observers.add = function(full_path, func) {
- try {
- obj.error.sdump('D_OBSERVERS', 'entering observers.add\nfull_path = ' + full_path + '\nfunc = ' + func + '\n');
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS");
- var data_cache=new OpenILS( );
- var stash = data_cache.wrappedJSObject.OpenILS.prototype.data;
-
- var id = obj.observers.id++;
- if (typeof obj.observers.cache[ full_path ] == 'undefined') obj.observers.cache[ full_path ] = {};
- obj.observers.cache[ full_path ][ id ] = { 'func' : func, 'time_added' : new Date() };
- obj.observers.id2path[ id ] = [ full_path ];
-
- var path_list = full_path.split(/\./);
- var observed_prop = path_list.pop();
-
- // Convert soft path to object reference. Error if any but the last node is undefined
- for (var i in path_list) stash = stash[ path_list[i] ];
- stash.watch(
- observed_prop,
- function(p,old_value,new_value) {
- obj.observers.dispatch(full_path,old_value,new_value);
- return new_value;
- }
- );
-
- return id;
- } catch(E) {
- obj.error.sdump('D_ERROR','Error in OpenILS.data.observers.add(): ' + js2JSON(E) );
- }
- }
-
- // This unregisters an observer function for a given observer id
- obj.observers.remove = function(id) {
- try {
- obj.error.sdump('D_OBSERVERS', 'entering observers.remove\nid = ' + id + '\n');
- var path = obj.observers.id2path[ id ];
- delete obj.observers.cache[ path ][ id ];
- delete obj.observers.id2path[ id ];
- } catch(E) {
- obj.error.sdump('D_ERROR','Error in OpenILS.data.observers.remove(): ' + js2JSON(E) );
- }
- }
-
- // This purges observer functions for a given path
- obj.observers.purge = function(full_path) {
- obj.error.sdump('D_OBSERVERS', 'entering observers.purge\nfull_path = ' + full_path + '\n');
- try {
- var remove_these = [];
- for (var id in obj.observers.cache[ full_path ]) remove_these.push( id );
- for (var id in remove_these) delete obj.observers.id2path[ id ];
- delete obj.observers.cache[ full_path ];
- } catch(E) {
- obj.error.sdump('D_ERROR','Error in OpenILS.data.observers.purge(): ' + js2JSON(E) );
- }
- }
-
- obj.stash('observers'); // make this accessible globally
-
- } catch(E) {
- this.error.sdump('D_ERROR','Error in OpenILS.data.init_observer_functions(): ' + js2JSON(E) );
- }
- },
-
'stash' : function () {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
}
- function get_contentWindow(frame) {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- if (frame && frame.contentWindow) {
- if (typeof frame.contentWindow.wrappedJSObject != 'undefined') return frame.contentWindow.wrappedJSObject;
- return frame.contentWindow;
- } else {
- return null;
- }
- }
-
- function update_modal_xulG(v) {
- try {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- var key = location.pathname + location.search + location.hash;
- if (typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
- data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ] = v;
- data.stash('modal_xulG_stack');
- }
- } catch(E) {
- alert('FIXME: update_modal_xulG => ' + E);
- }
- }
-
- function xul_param(param_name,_params) {
- /* By default, this function looks for a CGI-style query param identified by param_name. If one isn't found, it then looks in xulG. If one still isn't found, and _params.stash_name is true, it looks in the global xpcom stash for the field identified by stash_name. If _params.concat is true, then it looks in all these places and concatenates the results. There are also options for converting JSON to javascript objects, and clearing the xpcom stash_name field after retrieval. Also added, ability to search a specific spot in the xpcom stash that implements a stack to hold xulG's for modal windows */
- try {
- dump('xul_param('+param_name+','+js2JSON(_params)+')\n');
- var value = undefined; if (!_params) _params = {};
- if (typeof _params.no_cgi == 'undefined') {
- var cgi = new CGI();
- if (cgi.param(param_name)) {
- var x = cgi.param(param_name);
- dump('\tfound via location.href = ' + x + '\n');
- if (typeof _params.JSON2js_if_cgi != 'undefined') {
- x = JSON2js( x );
- dump('\tJSON2js = ' + x + '\n');
- }
- if (typeof _params.concat == 'undefined') {
- //alert(param_name + ' x = ' + x);
- return x; // value
- } else {
- if (value) {
- if (value.constructor != Array) value = [ value ];
- value = value.concat(x);
- } else {
- value = x;
- }
- }
- }
- }
- if (typeof _params.no_xulG == 'undefined') {
- if (typeof _params.modal_xulG != 'undefined') {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- var key = location.pathname + location.search + location.hash;
- dump('xul_param, considering modal key = ' + key + '\n');
- if (typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
- xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
- }
- }
- if (typeof xulG == 'object' && typeof xulG[ param_name ] != 'undefined') {
- var x = xulG[ param_name ];
- dump('\tfound via xulG = ' + x + '\n');
- if (typeof _params.JSON2js_if_xulG != 'undefined') {
- x = JSON2js( x );
- dump('\tJSON2js = ' + x + '\n');
- }
- if (typeof _params.concat == 'undefined') {
- //alert(param_name + ' x = ' + x);
- return x; // value
- } else {
- if (value) {
- if (value.constructor != Array) value = [ value ];
- value = value.concat(x);
- } else {
- value = x;
- }
- }
- }
- }
- if (typeof _params.no_xpcom == 'undefined') {
- /* the field names used for temp variables in the global stash tend to be more unique than xuLG or CGI param names, to avoid collisions */
- if (typeof _params.stash_name != 'undefined') {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- if (typeof data[ _params.stash_name ] != 'undefined') {
- var x = data[ _params.stash_name ];
- dump('\tfound via xpcom = ' + x + '\n');
- if (typeof _params.JSON2js_if_xpcom != 'undefined') {
- x = JSON2js( x );
- dump('\tJSON2js = ' + x + '\n');
- }
- if (_params.clear_xpcom) {
- data[ _params.stash_name ] = undefined; data.stash( _params.stash_name );
- }
- if (typeof _params.concat == 'undefined') {
- //alert(param_name + ' x = ' + x);
- return x; // value
- } else {
- if (value) {
- if (value.constructor != Array) value = [ value ];
- value = value.concat(x);
- } else {
- value = x;
- }
- }
- }
- }
- }
- //alert(param_name + ' value = ' + value);
- return value;
- } catch(E) {
- dump('xul_param error: ' + E + '\n');
- }
- }
-
function get_bool(a) {
// Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false
// So false includes 'f', '', 0, null, and undefined
'AUTH_WORKSTATION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.workstation.register' },
'BILL_PAY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment' },
'BILLING_TYPE_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.billing_type.retrieve.all', 'secure' : false },
- 'BLOB_AU_PARTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.parts', 'cacheable' : true, 'ttl' : 120000 },
+ 'BLOB_AU_PARTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.parts' },
'BLOB_MARC_CALLNUMBERS_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc_cn.retrieve', 'secure' : false },
'BLOB_MOBTS_CIRC_MVR_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.fleshed' },
'BLOB_MOBTS_CIRC_MVR_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.fleshed' },
'FM_AU_IDS_RETRIEVE_VIA_HASH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.search.advanced' },
'FM_AU_LIST_RETRIEVE_VIA_GROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve' },
'FM_AU_RETRIEVE_VIA_SESSION' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.session.retrieve' },
- 'FM_AU_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve_by_barcode', 'cacheable' : true, 'ttl' : 60000 },
- 'FM_AU_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve', 'cacheable' : true, 'ttl' : 60000 },
- 'FM_AU_FLESHED_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve', 'cacheable' : true, 'ttl' : 60000 },
+ 'FM_AU_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve_by_barcode' },
+ 'FM_AU_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve' },
+ 'FM_AU_FLESHED_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve' },
'FM_AU_NEW_USERGROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.new' },
'FM_AU_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.update' },
- 'FM_AUN_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all', 'cacheable' : false, 'ttl' : 60000 },
+ 'FM_AUN_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all' },
'FM_AUN_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.create' },
'FM_AUN_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.delete' },
'FM_AUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.settings.retrieve' },
'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out' },
'FM_CIRC_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_checkout_history.retrieve' },
/*'FM_CIRC_COUNT_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count' },*/
- 'FM_CIRC_COUNT_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count', 'cacheable' : true, 'ttl' : 60000 },
+ 'FM_CIRC_COUNT_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count' },
'FM_CIRC_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.count' },
'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' },
'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false },
'FM_MOBTS_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions' },
'FM_MOBTS_TOTAL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.total' },
'FM_MOBTS_COUNT_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.count' },
- 'FM_MOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary', 'cacheable' : true, 'ttl' : 60000 },
+ 'FM_MOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary' },
'FM_PGT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.groups.tree.retrieve', 'secure' : false },
'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html', 'secure' : false },
'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' },
$('server').value = g.data.server_unadorned;
- addCSSClass(document.documentElement,xul_param('login_type',{'modal_xulG':true}))
+ g.cgi = new CGI();
+ addCSSClass(document.documentElement,g.cgi.param('login_type'))
- if (xul_param('desc_brief',{'modal_xulG':true})) {
+ if (g.cgi.param('desc_brief')) {
$('desc').hidden = false;
- $('desc_brief').appendChild( document.createTextNode( xul_param('desc_brief',{'modal_xulG':true}) ) );
+ $('desc_brief').appendChild( document.createTextNode( g.cgi.param('desc_brief') ) );
}
- if (xul_param('desc_full',{'modal_xulG':true})) {
+ if (g.cgi.param('desc_full')) {
$('desc').hidden = false;
- $('desc_full').appendChild( document.createTextNode( xul_param('desc_full',{'modal_xulG':true}) ) );
+ $('desc_full').appendChild( document.createTextNode( g.cgi.param('desc_full') ) );
}
$('username').focus();
'password_prompt' : $('password'),
'server_prompt' : $('server'),
},
- xul_param('login_type',{'modal_xulG':true}) || 'temp'
+ g.cgi.param('login_type') || 'temp'
);
g.session.on_init = function() {
- try {
- JSAN.use('util.network'); var n = new util.network();
- var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
- g.data.temporary_session = { // old way because of local chrome still out there
- 'key' : g.session.key,
- 'authtime' : g.session.authtime,
- 'usr' : js2JSON(staff)
- }
- g.data.stash('temporary_session');
- var my_xulG = { // new way, to minimize the use of global spaces
- 'temporary_session' : g.data.temporary_session
- };
- update_modal_xulG(my_xulG);
- window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert('simple_auth.session.on_init',E);
- }
+ JSAN.use('util.network'); var n = new util.network();
+ var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
+ g.data.temporary_session = { 'key' : g.session.key, 'authtime' : g.session.authtime, 'usr' : js2JSON(staff) };
+ g.data.stash('temporary_session');
+ window.close();
}
g.session.on_init_error = function() {
$('password').value = '';
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
XML_HTTP_SERVER = data.server_unadorned;
- var name = xul_param('tab_name') || xul_param('name') || null;
- var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
+ g.cgi = new CGI();
+ var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
+ if (!name) {
+ if (typeof window.xulG == 'object') {
+ name = window.xulG.name || window.xulG.tab_name || null;
+ }
+ }
+ var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
if (!url) url = urls.browser;
JSAN.use('util.browser'); g.browser = new util.browser();
var push_xulG = true;
- if (xul_param('no_xulG')) push_xulG = false;
+ if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
var alt_print = false;
- if (xul_param('alternate_print')) alt_print = true;
+ if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
var p = {
'url' : url,
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
}
- if (xul_param('show_nav_buttons')) {
+ if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
document.getElementById('back').hidden = false;
document.getElementById('forward').hidden = false;
}
- if (xul_param('show_print_button')) {
+ if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
document.getElementById('browser_print').hidden = false;
}
- if (xul_param('title')) {
- try { document.title = xul_param('title'); } catch(E) {}
- try { window.title = xul_param('title'); } catch(E) {}
+ if (g.cgi.param('title')) {
+ try { document.title = g.cgi.param('title'); } catch(E) {}
+ try { window.title = g.cgi.param('title'); } catch(E) {}
}
} catch(E) {
'D_EXPLODE' : false,
'D_FM_UTILS' : false,
'D_PRINT' : { 'dump' : true },
- 'D_OBSERVERS' : { 'dump' : true, 'console' : false },
- 'D_CACHE' : { 'dump' : true, 'console' : false },
- 'D_SES' : { 'dump' : true, 'console' : false },
+ 'D_SES' : { 'dump' : true },
'D_SES_FUNC' : false,
'D_SES_RESULT' : { 'dump' : true },
'D_SES_ERROR' : { 'dump' : true, 'console' : true },
'D_SPAWN' : false,
'D_STRING' : false,
'D_UTIL' : false,
- 'D_WIN' : { 'dump' : true },
+ 'D_WIN' : false,
'D_WIDGETS' : false
},
if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
xml += '</hbox></groupbox></vbox>';
JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_yns_xml = xml; data.stash('temp_yns_xml');
- var url = urls.XUL_FANCY_PROMPT; // + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
+ var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.temp_yns_xml = xml; data.stash('temp_yns_xml');
+ var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
+ window.open(
+ url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data.fancy_status == 'complete') {
- switch(fancy_prompt_data.fancy_submit) {
+ data.init({'via':'stash'});
+ if (data.fancy_prompt_data != '') {
+ switch(data.fancy_prompt_data.fancy_submit) {
case 'b1' : return 0; break;
case 'b2' : return 1; break;
case 'b3' : return 2; break;
if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
xml += '</hbox></groupbox></vbox>';
JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_yns_xml = xml; data.stash('temp_yns_xml');
- var url = urls.XUL_FANCY_PROMPT; // + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
+ var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.temp_yns_xml = xml; data.stash('temp_yns_xml');
+ var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
+ window.open(
+ url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data == 'complete') {
- switch(fancy_prompt_data.fancy_submit) {
+ data.init({'via':'stash'});
+ if (data.fancy_prompt_data != '') {
+ switch(data.fancy_prompt_data.fancy_submit) {
case 'b1' : return 0; break;
case 'b2' : return 1; break;
case 'b3' : return 2; break;
<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
<script>
<![CDATA[
-
- var xulG = {};
-
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for fancy_prompt.xul');
- //JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- //g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
- //g.data.fancy_prompt_data = {};
-
- xulG.fancy_status = 'incomplete';
+ JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
+ g.data.fancy_prompt_data = {};
- //var key = location.pathname + location.search + location.hash;
- //if (typeof g.data.modal_xulG_stack != 'undefined' && typeof g.data.modal_xulG_stack[key] != 'undefined') {
- // xulG = g.data.modal_xulG_stack[key][ g.data.modal_xulG_stack[key].length - 1 ];
- //}
+ g.cgi = new CGI();
- var top_xml = xul_param('top_xml',{'stash_name':xul_param('top_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
+ var top_xml = g.cgi.param('top_xml') || g.data[ g.cgi.param('top_xml_in_stash') ];
if (top_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( top_xml, 'text/xml' );
if (node) document.getElementById('fancy_prompt_topbar').appendChild(node);
}
- var my_xml = xul_param('xml',{'stash_name':xul_param('xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
+ var my_xml = g.cgi.param('xml') || g.data[ g.cgi.param('xml_in_stash') ];
if (my_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( my_xml, 'text/xml' );
if (node) document.getElementById('fancy_prompt_main').appendChild(node);
}
- var bot_xml = xul_param('bot_xml',{'stash_name':xul_param('bottom_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});;
+ var bot_xml = g.cgi.param('bot_xml') || g.data[ g.cgi.param('bottom_xml_in_stash') ];
if (bot_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( bot_xml, 'text/xml' );
nl[i].addEventListener('command',function(ev) { window.close(); },false);
}
- if (xul_param('title',{'modal_xulG':true})) {
- try { window.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
- try { document.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
+ if (g.cgi.param('title')) {
+ try { window.title = g.cgi.param('title'); } catch(E) {}
+ try { document.title = g.cgi.param('title'); } catch(E) {}
}
- if (xul_param('focus',{'modal_xulG':true})) document.getElementById(xul_param('focus',{'modal_xulG':true})).focus();
+ if (g.cgi.param('focus')) document.getElementById(g.cgi.param('focus')).focus();
} catch(E) {
var err_msg = "!! This software has encountered an error. Please tell your friendly " +
}
function fancy_save(ev) {
- try {
- //if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
- //g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
- //var nl = document.getElementsByAttribute('name','fancy_data');
- //for (var i = 0; i < nl.length; i++) {
- // g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
- //}
- //g.data.stash('fancy_prompt_data');
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- if (ev.target.id) xulG[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
- xulG[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
- var nl = document.getElementsByAttribute('name','fancy_data');
- for (var i = 0; i < nl.length; i++) {
- xulG[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
- }
- xulG.fancy_status = 'complete';
- var key = location.pathname + location.search + location.hash;
- data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ] = xulG;
- data.stash('modal_xulG_stack');
-
- window.close();
- } catch(E) {
- try { g.error.standard_unexpected_error_alert('fancy_save',E); } catch(F) { alert('fancy_save ' + E + ' ' + F); }
+ if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
+ g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
+ var nl = document.getElementsByAttribute('name','fancy_data');
+ for (var i = 0; i < nl.length; i++) {
+ g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
}
+ g.data.stash('fancy_prompt_data');
+ window.close();
}
]]>
</script>
'NETWORK_FAILURE' : null,
- 'simple_request' : function(method_id,params,f,override_params) {
- if (typeof api[method_id] == 'undefined') throw( 'Method not found for ' + method_id );
- var secure = true; if (typeof api[method_id].secure != 'undefined') secure = api[method_id].secure;
- return this.request(api[method_id].app,api[method_id].method,params,f,override_params,{ 'secure' : secure, 'method_id' : method_id });
- },
-
- 'cached_request' : function(method_id,params,f,override_params) {
- if (typeof api[method_id] == 'undefined') throw( 'Method not found for ' + method_id );
- var secure = true; if (typeof api[method_id].secure != 'undefined') secure = api[method_id].secure;
- return this.request(api[method_id].app,api[method_id].method,params,f,override_params,{ 'secure' : secure, 'want_cached' : true, 'method_id' : method_id });
+ 'simple_request' : function(id,params,f,o_params) {
+ var secure = true; if (typeof api[id].secure != 'undefined') secure = api[id].secure;
+ return this.request(api[id].app,api[id].method,params,f,o_params,secure);
},
'get_result' : function (req) {
return result;
},
- 'is_cacheable' : function(method_id) {
- return (api[method_id].cacheable);
- },
-
- 'request' : function (app,name,params,f,override_params,_params) {
-
- var obj = this;
-
- try {
-
- if (_params && _params.want_cached) if ( this.is_cacheable(_params.method_id) ) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- var key = (app + '+' + name + '+' + js2JSON(params)).replace(/\./g,'_');
- var x = data.cached_request[key];
- if (x) {
- obj.error.sdump('D_CACHE','Cached request found for key = \n' + key + '\n' + js2JSON(x) + '\n');
- switch(x.status) {
- case 'pending' :
- if ( Number(new Date()) - Number(x.status_time) > 60000 ) break; // if pending request is taking too long
- if (f) { // Setup a self-destroying observer on the pending request to handle this request
- obj.error.sdump('D_CACHE','Cached request pending, adding watch to handle current asynchronous request. key = \n' + key + '\n');
- var id = data.observers.add('cached_request.'+key+'.status',function(p,o,n) {
- obj.error.sdump('D_OBSERVERS','Entering watch function for key = \n' + key + '\np = ' + p + '\no = ' + js2JSON(o) + '\nn = ' + js2JSON(n) + '\nx = ' + js2JSON(x) + '\n');
- if (n == 'complete') {
- obj.error.sdump('D_CACHE','Cached request completed for key = \n' + key + '\nNow calling a previous async request watching this one.\n');
- f( { 'getResultObject' : function() { return JSON2js( js2JSON( x.request ) ); } } );
- setTimeout( function() { try { data.observers.remove(id); } catch(E) { alert(E); } }, 0 );
- }
- return n;
- }
- );
- return null;
- } else {
- obj.error.sdump('D_CACHE','Pending request and synchronous request collision with key = \n' + key + '\nFalling through...\n');
- }
- break;
- case 'complete' :
- if ( Number( new Date() ) < x.expire_time ) {
- if (f) {
- obj.error.sdump('D_CACHE','Cached request found completed, handling asynchronous request now. key = \n' + key + '\n');
- f( { 'getResultObject' : function() { return JSON2js( js2JSON( x.request ) ); } } );
- return null;
- } else {
- obj.error.sdump('D_CACHE','Cached request found completed, key = \n' + key + '\nreturning value =\n' + x.request + '\n');
- return JSON2js( js2JSON( x.request ) ); // FIXME -- cloning the object is a workaround, otherwise instanceOf somehow silently fails
- }
- } else {
- obj.error.sdump('D_CACHE','Cached request found completed, however, it has expired. key = \n' + key + '\nFalling through...\n');
- }
- break;
- }
- } else {
- obj.error.sdump('D_CACHE','Cached request not found for key = \n' + key + '\n');
- }
- }
-
- var request = this._request(app,name,params,f,override_params,_params);
+ 'request' : function (app,name,params,f,o_params,secure) {
+ var request = this._request(app,name,params,f,o_params,secure);
if (request) {
return this.get_result(request);
} else {
return null;
}
-
- } catch(E) {
- alert(E);
- }
},
- '_request' : function (app,name,params,f,override_params,_params) {
+ '_request' : function (app,name,params,f,o_params,secure) {
var obj = this;
try {
var sparams = js2JSON(params);
obj.error.sdump('D_SES','request '+app+' '+name+' '+obj.error.pretty_print(sparams.slice(1,sparams.length-1))+
- '\noverride_params = ' + override_params + '\n_params = ' + _params +
+ '\no_params = ' + o_params + '\nsecure = ' + secure +
'\nResult #' + (++obj.link_id) + ( f ? ' asynced' : ' synced' ) );
-
- var key; var x; var data;
- if (_params && obj.is_cacheable(_params.method_id)) {
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.init({'via':'stash'});
- key = (app + '+' + name + '+' + js2JSON(params)).replace(/\./g,'_');
- data.cached_request[key] = { 'test' : 'test', 'status' : 'pending', 'status_time' : Number(new Date()) };
- data.stash('cached_request');
- x = data.cached_request[key];
- obj.error.sdump('D_CACHE','Current request is cacheable, setting pending status for key = \n' + key + '\nUpdating cache with ' + js2JSON(x) + '\n');
- }
-
var request = new RemoteRequest( app, name );
- if (_params && _params.secure) {
+ if (secure) {
request.setSecure(true);
} else {
request.setSecure(false);
+ (json_string.length > 80 ? obj.error.pretty_print(json_string) : json_string)
+ '\n\nOriginal Request:\n\n'
+ 'request '+app+' '+name+' '+ sparams.slice(1,sparams.length-1));
- req = obj.rerequest_on_session_timeout(app,name,params,req,override_params,_params);
- req = obj.rerequest_on_perm_failure(app,name,params,req,override_params,_params);
- if (override_params) {
- req = obj.rerequest_on_override(app,name,params,req,override_params,_params);
- }
- req = obj.check_for_offline(app,name,params,req,override_params,_params);
- if (_params && obj.is_cacheable(_params.method_id)) {
- x.request = obj.get_result(req);
- x.status = 'complete'; x.status_time = Number(new Date()); x.expire_time = Number(x.status_time) + api[_params.method_id].ttl;
- data.stash('cached_request');
- obj.error.sdump('D_CACHE','Previously pending cached request is now complete for key = \n' + key + '\nUpdating cache with ' + js2JSON(x) + '\n');
+ req = obj.rerequest_on_session_timeout(app,name,params,req,o_params,secure);
+ req = obj.rerequest_on_perm_failure(app,name,params,req,o_params,secure);
+ if (o_params) {
+ req = obj.rerequest_on_override(app,name,params,req,o_params,secure);
}
+ req = obj.check_for_offline(app,name,params,req,o_params,secure);
f(req);
obj.NETWORK_FAILURE = null;
} catch(E) {
+ obj.link_id + '\n\n' + ( json_string.length > 80 ? obj.error.pretty_print(json_string) : json_string )
+ '\n\nOriginal Request:\n\n'
+ 'request '+app+' '+name+' '+ sparams.slice(1,sparams.length-1));
- request = obj.rerequest_on_session_timeout(app,name,params,request,override_params,_params);
- request = obj.rerequest_on_perm_failure(app,name,params,request,override_params,_params);
- if (override_params) {
- request = obj.rerequest_on_override(app,name,params,request,override_params,_params);
+ request = obj.rerequest_on_session_timeout(app,name,params,request,o_params,secure);
+ request = obj.rerequest_on_perm_failure(app,name,params,request,o_params,secure);
+ if (o_params) {
+ request = obj.rerequest_on_override(app,name,params,request,o_params,secure);
}
- request = obj.check_for_offline(app,name,params,request,override_params,_params);
+ request = obj.check_for_offline(app,name,params,request,o_params,secure);
obj.NETWORK_FAILURE = null;
- if (_params && obj.is_cacheable(_params.method_id)) {
- x.request = result;
- x.status = 'complete'; x.status_time = Number(new Date()); x.expire_time = Number(x.status_time) + api[_params.method_id].ttl;
- data.stash('cached_request');
- obj.error.sdump('D_CACHE','Previously pending cached request is now complete for key = \n' + key + '\nUpdating cache with ' + js2JSON(x) + '\n');
- }
return request;
}
}
},
- 'check_for_offline' : function (app,name,params,req,override_params,_params) {
+ 'check_for_offline' : function (app,name,params,req,o_params,secure) {
var obj = this;
var result = obj.get_result(req);
if (result != null) return req;
switch(r) {
case 0:
- req = obj._request(app,name,params,null,override_params,_params);
+ req = obj._request(app,name,params,null,o_params,secure);
if (obj.get_result(req)) proceed = true; /* daily WTF, why am I even doing this? :) */
return req;
break;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
var url = urls.XUL_AUTH_SIMPLE;
if (typeof xulG != 'undefined' && typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
- JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- url,
- //+ '?login_type=staff'
- //+ '&desc_brief=' + window.escape( text ? 'Session Expired' : 'Operator Change' )
- //+ '&desc_full=' + window.escape( text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session. Note that the previous session is still active.'),
- //'simple_auth' + (new Date()).toString(),
- 'Authorize',
- 'chrome,resizable,modal,width=700,height=500',
- {
- 'login_type' : 'staff',
- 'desc_brief' : text ? 'Session Expired' : 'Operator Change',
- 'desc_full' : text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session. Note that the previous session is still active.',
- //'simple_auth' : (new Date()).toString(),
- }
+ window.open(
+ url
+ + '?login_type=staff'
+ + '&desc_brief=' + window.escape( text ? 'Session Expired' : 'Operator Change' )
+ + '&desc_full=' + window.escape( text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session. Note that the previous session is still active.'),
+ 'simple_auth' + (new Date()).toString(),
+ 'chrome,resizable,modal,width=700,height=500'
);
JSAN.use('OpenILS.data');
var data = new OpenILS.data(); data.init({'via':'stash'});
- if (typeof my_xulG.temporary_session != 'undefined' && my_xulG.temporary_session != '') {
- data.session.key = my_xulG.temporary_session.key;
- data.session.authtime = my_xulG.temporary_session.authtime;
+ if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') {
+ data.session.key = data.temporary_session.key;
+ data.session.authtime = data.temporary_session.authtime;
data.stash('session');
if (! data.list.au ) data.list.au = [];
- data.list.au[0] = JSON2js( my_xulG.temporary_session.usr );
+ data.list.au[0] = JSON2js(data.temporary_session.usr);
data.stash('list');
obj.reset_titlebars(data);
return true;
- } else { alert('here2'); }
+ }
return false;
} catch(E) {
}
},
- 'rerequest_on_session_timeout' : function(app,name,params,req,override_params,_params) {
+ 'rerequest_on_session_timeout' : function(app,name,params,req,o_params,secure) {
try {
var obj = this;
var robj = obj.get_result(req);
if (obj.get_new_session(name,undefined,true)) {
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
params[0] = data.session.key;
- req = obj._request(app,name,params,null,override_params,_params);
+ req = obj._request(app,name,params,null,o_params,secure);
}
}
} catch(E) {
return req;
},
- 'rerequest_on_perm_failure' : function(app,name,params,req,override_params,_params) {
+ 'rerequest_on_perm_failure' : function(app,name,params,req,o_params,secure) {
try {
var obj = this;
var robj = obj.get_result(req);
if (location.href.match(/^chrome/)) {
//alert('Permission denied.');
} else {
- JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_AUTH_SIMPLE,
- //+ '?login_type=temp'
- //+ '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm)
- //+ '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action. Please notify your library administrator if you need this permission. If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name),
- //'simple_auth' + (new Date()).toString(),
- 'Authorize',
- 'chrome,resizable,modal,width=700,height=500',
- {
- 'login_type' : 'temp',
- 'desc_brief' : 'Permission Denied: ' + robj.ilsperm,
- 'desc_full' : 'Another staff member with the above permission may authorize this specific action. Please notify your library administrator if you need this permission. If you feel you have received this exception in error, please inform your friendly Evergreen developers or helpdesk staff of the above permission and this debug information: ' + name,
- //'simple_auth' : (new Date()).toString(),
- }
+ window.open(
+ urls.XUL_AUTH_SIMPLE
+ + '?login_type=temp'
+ + '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm)
+ + '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action. Please notify your library administrator if you need this permission. If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name),
+ 'simple_auth' + (new Date()).toString(),
+ 'chrome,resizable,modal,width=700,height=500'
);
JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- if (typeof my_xulG.temporary_session != 'undefined' && my_xulG.temporary_session != '') {
- params[0] = my_xulG.temporary_session.key;
- req = obj._request(app,name,params,null,override_params,_params);
+ var data = new OpenILS.data(); data.init({'via':'stash'});
+ if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') {
+ params[0] = data.temporary_session.key;
+ req = obj._request(app,name,params,null,o_params,secure);
}
}
}
return req;
},
- 'rerequest_on_override' : function (app,name,params,req,override_params,_params) {
+ 'rerequest_on_override' : function (app,name,params,req,o_params,secure) {
var obj = this;
try {
- if (!override_params.text) override_params.text = {};
+ if (!o_params.text) o_params.text = {};
function override(r) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
for (var i = 0; i < r.length; i++) {
var t1 = String(r[i].ilsevent).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
var t2 = String(r[i].textcode).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
- var t3 = String((override_params.text[r[i].ilsevent] ? override_params.text[r[i].ilsevent](r[i]) : '')).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ var t3 = String((o_params.text[r[i].ilsevent] ? o_params.text[r[i].ilsevent](r[i]) : '')).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
var t4 = String(r[i].desc).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
xml += '<row>' +
'<description style="color: red" tooltiptext="' + t1 + '">' + t2 + '</description>' +
'<description>Force this action?</description>' +
'<button accesskey="N" label="No" name="fancy_cancel"/>' +
'<button id="override" accesskey="Y" label="Yes" name="fancy_submit" value="override"/></hbox></groupbox></vbox>';
- //JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_override_xml = xml; data.stash('temp_override_xml');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_override_xml'
- //+ '&title=' + window.escape(override_params.title),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'title' : override_params.title }
+ JSAN.use('OpenILS.data');
+ var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.temp_override_xml = xml; data.stash('temp_override_xml');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_override_xml'
+ + '&title=' + window.escape(o_params.title),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data.fancy_status == 'complete') {
+ data.init({'via':'stash'});
+ if (data.fancy_prompt_data != '') {
req = obj._request(app,name + '.override',params);
}
return req;
var result = obj.get_result(req);
if (!result) return req;
- if ( (typeof result.ilsevent != 'undefined') && (override_params.overridable_events.indexOf(result.ilsevent) != -1) ) {
+ if ( (typeof result.ilsevent != 'undefined') && (o_params.overridable_events.indexOf(result.ilsevent) != -1) ) {
req = override([result]);
} else {
var found_good = false; var found_bad = false;
for (var i = 0; i < result.length; i++) {
- if ( (result[i].ilsevent != 'undefined') && (override_params.overridable_events.indexOf(result[i].ilsevent) != -1) ) {
+ if ( (result[i].ilsevent != 'undefined') && (o_params.overridable_events.indexOf(result[i].ilsevent) != -1) ) {
found_good = true;
} else {
found_bad = true;
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for util_browser.xul');
- var name = xul_param('tab_name') || xul_param('name') || null;
- var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
+ g.cgi = new CGI();
+ var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
+ if (!name) {
+ if (typeof window.xulG == 'object') {
+ name = window.xulG.name || window.xulG.tab_name || null;
+ }
+ }
+ var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
if (!url) url = urls.browser;
if (!g.browser) {
}
var push_xulG = true;
- if (xul_param('no_xulG')) push_xulG = false;
+ if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
var alt_print = false;
- if (xul_param('alternate_print')) alt_print = true;
+ if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
var p = {
'url' : url,
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
}
- if (xul_param('show_nav_buttons')) {
+ if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
document.getElementById('back').hidden = false;
document.getElementById('forward').hidden = false;
}
- if (xul_param('show_print_button')) {
+ if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
document.getElementById('browser_print').hidden = false;
}
- if (xul_param('title')) {
- try { document.title = xul_param('title'); } catch(E) {}
- try { window.title = xul_param('title'); } catch(E) {}
+ if (g.cgi.param('title')) {
+ try { document.title = g.cgi.param('title'); } catch(E) {}
+ try { window.title = g.cgi.param('title'); } catch(E) {}
}
} catch(E) {
return w;
},
- 'open' : function(url,title,features,my_xulG) {
+ 'open' : function(url,title,features) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var key;
if (!title) title = 'anon' + this.window_name_increment();
if (!features) features = 'chrome';
- this.error.sdump('D_WIN', 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
- var data;
- if (features.match(/modal/) && my_xulG) {
- JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.init({'via':'stash'});
- if (typeof data.modal_xulG_stack == 'undefined') data.modal_xulG_stack = {};
- /* FIXME - not a perfect key.. could imagine two top-level windows both opening modal windows */
- key = url;
- if (typeof xulG == 'object') if (typeof xulG.url_prefix == 'function') {
- key = key.replace( xulG.url_prefix('/'), '/' );
- }
- if (typeof data.modal_xulG_stack[key] == 'undefined') data.modal_xulG_stack[key] = [];
- data.modal_xulG_stack[key].push( my_xulG );
- data.stash('modal_xulG_stack');
- this.error.sdump('D_WIN','modal key = ' + key);
- }
+ this.error.sdump('D_WIN',
+ 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
var w = this.SafeWindowOpen(url,title,features);
- if (features.match(/modal/) && my_xulG) {
- var x = data.modal_xulG_stack[key].pop();
- data.stash('modal_xulG_stack');
- return x;
- } else {
- if (my_xulG) {
- if (get_contentWindow(w)) {
- get_contentWindow(w).xulG = my_xulG;
- } else {
- w.xulG = my_xulG;
- }
- }
- }
/*
setTimeout(
function() {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for holds.xul');
+ g.cgi = new CGI();
+
JSAN.use('patron.holds'); g.holds = new patron.holds();
g.holds.init(
{
'tree_id' : 'holds_pull_list',
- 'patron_id' : xul_param('patron_id'),
- 'docid' : xul_param('docid'),
- 'shelf' : xul_param('shelf'),
- 'pull' : xul_param('pull'),
+ 'patron_id' : g.cgi.param('patron_id'),
+ 'docid' : g.cgi.param('docid'),
+ 'shelf' : g.cgi.param('shelf'),
+ 'pull' : g.cgi.param('pull'),
}
);
window.refresh = function(p) { g.holds.retrieve(p); }
x.setAttribute(
'src',
window.xulG.url_prefix( urls.XUL_REMOTE_BROWSER )
- /*
+ '?url=' + window.escape(
urls.XUL_OFFLINE_UPLOAD_XACTS
+ '?ses=' + window.escape(ses())
+ '&delta=' + window.escape('0')
+ '&filename=' + window.escape( obj.transition_filename )
)
- */
);
var newG = {
- 'url' : urls.XUL_OFFLINE_UPLOAD_XACTS,
'url_prefix' : window.xulG.url_prefix,
'passthru_content_params' : {
- 'ses' : ses(),
- 'seskey' : seskey,
- 'ws' : obj.data.ws_name,
- 'delta' : 0,
- 'filename' : obj.transition_filename,
'url_prefix' : window.xulG.url_prefix,
'handle_event' : function(robj){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
}
};
- get_contentWindow(x).xulG = newG;
+ x.contentWindow.xulG = newG;
} catch(E) {
obj.error.standard_unexpected_error_alert('Error uploading xacts',E);
funcs.push(
function(idx,row){
return function(){
- obj.list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true, 'to_bottom' : true } );
- //if (idx == old_idx) obj.list.node.view.selection.select(idx);
+ obj.list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true } );
+ if (idx == old_idx) obj.list.node.view.selection.select(idx);
};
}(i,{ 'my' : obj.seslist[i] })
);
}
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
try {
- var url = urls.XUL_COPY_STATUS;
- //+ '?barcodes=' + window.escape( js2JSON(barcodes) );
+ var url = urls.XUL_COPY_STATUS
+ + '?barcodes=' + window.escape( js2JSON(barcodes) );
window.xulG.new_tab(
- url, {}, { 'barcodes' : barcodes }
+ url
);
} catch(E) {
alert(E);
'retrieve_patron' : function() {
var obj = this;
- var patrons = {};
try {
for (var i = 0; i < obj.sel_errors.length; i++) {
var error = obj.errors[ obj.sel_errors[i] ];
if ( ! error.command.patron_barcode ) continue;
if ( [ '', ' ', '???' ].indexOf( error.command.patron_barcode ) != -1 ) continue;
- patrons[ error.command.patron_barcode ] = true;
- }
- for (var barcode in patrons) {
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
try {
- var url = urls.XUL_PATRON_DISPLAY;
- //+ '?barcode=' + window.escape( error.command.patron_barcode );
+ var url = urls.XUL_PATRON_DISPLAY
+ + '?barcode=' + window.escape( error.command.patron_barcode );
window.xulG.new_tab(
- url, {}, { 'barcode' : barcode }
+ url
);
} catch(E) {
alert(E);
}
}
-
}
} catch(E) {
alert(E);
'Details:\n' + obj.error.pretty_print(js2JSON(error))
),
'offline_error_details',
- 'height=780,width=580,scrollbars=yes,chrome,resizable,modal'
+ 'height=240,width=320,scrollbars=yes,chrome,resizable,modal'
);
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for admin_offline_manage_xacts.xul');
+ g.cgi = new CGI();
+
JSAN.use('admin.offline_manage_xacts'); g.admin = new admin.offline_manage_xacts();
g.admin.init({});
g.printer_settings = function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var w = get_contentWindow(document.getElementById('sample'));
+ var w = document.getElementById('sample').contentWindow;
g.print.NSPrint(w ? w : window, false, {});
g.print.save_settings();
}
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
JSAN.use('util.error'); g.error = new util.error();
- g.error.sdump('D_TRACE','my_init() for upload_xacts.html');
+ g.error.sdump('D_TRACE','my_init() for offline_checkout.html');
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
try { window.xulG.set_tab_name('Upload Offline Transactions'); } catch(E) { alert(E); }
}
- JSAN.use('util.file'); g.file = new util.file( xul_param('filename') );
+ g.cgi = new CGI();
+
+ JSAN.use('util.file'); g.file = new util.file( g.cgi.param('filename') );
if (g.file._file.exists()) {
$('submit').disabled = false;
return;
}
- $( 'ws' ).setAttribute('value', xul_param('ws'));
- $( 'ses' ).setAttribute('value', xul_param('ses'));
- $( 'seskey' ).setAttribute('value', xul_param('seskey'));
- $( 'delta' ).setAttribute('value', xul_param('delta'));
+ $( 'ws' ).setAttribute('value', g.cgi.param('ws'));
+ $( 'ses' ).setAttribute('value', g.cgi.param('ses'));
+ $( 'seskey' ).setAttribute('value', g.cgi.param('seskey'));
+ $( 'delta' ).setAttribute('value', g.cgi.param('delta'));
$( 'form' ).setAttribute('action', xulG.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS_CGI));
<link rel="stylesheet" type="text/css" media="all" href="chrome://global/skin/" title="chrome_skin" />
<script type="text/javascript" src="/xul/server/main/JSAN.js"></script>
<script type="text/javascript" src="/xul/server/main/constants.js" />
- <script type="text/javascript" src="/xul/server/OpenILS/global_util.js" />
<script type="text/javascript" src="/opac/common/js/utils.js" />
<script type="text/javascript" src="/opac/common/js/CGI.js" />
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
-
- docid = xul_param('docid');
-
- var key = location.pathname + location.search + location.hash;
- if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
- var xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
- if (typeof xulG == 'object') {
- docid = xulG.docid;
- }
- }
+ g.cgi = new CGI();
+ docid = g.cgi.param('docid');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
if (docid > -1) {
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
data.last_record = docid; data.stash('last_record');
g.network.request(
}
function view_marc() {
- try {
- JSAN.use('util.window'); var win = new util.window();
- if (docid < 0) {
- alert('Item not cataloged.');
- } else {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- //win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
- win.open( urls.XUL_MARC_VIEW, 'marc_view', 'chrome,resizable,modal,width=400,height=400',{'noprint':1,'docid':docid});
- }
- } catch(E) {
- g.error.standard_unexpected_error_alert('spawning marc display',E);
+ JSAN.use('util.window'); var win = new util.window();
+ if (docid < 0) {
+ alert('Item not cataloged.');
+ } else {
+ win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
}
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(obj.docid)
- //+'&ou_ids=' + window.escape( js2JSON(list) )
- //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
+ +'?doc_id=' + window.escape(obj.docid)
+ +'&ou_ids=' + window.escape( js2JSON(list) )
+ +'©_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
title,
'chrome,resizable'
);
w.refresh = function() { obj.refresh_list(); }
- w.xulG = { 'doc_id':obj.docid, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut };
} catch(E) {
obj.error.standard_unexpected_error_alert('copy browser -> add copies',E);
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(obj.docid)
- //+'&ou_ids=' + window.escape( js2JSON(list) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
+ +'?doc_id=' + window.escape(obj.docid)
+ +'&ou_ids=' + window.escape( js2JSON(list) ),
title,
'chrome,resizable'
);
w.refresh = function() { obj.refresh_list() };
- w.xulG = { 'doc_id' : obj.docid, 'ou_ids' : list };
} catch(E) {
obj.error.standard_unexpected_error_alert('copy browser -> add volumes',E);
}
var title = list.length == 1 ? 'Volume' : 'Volumes';
JSAN.use('util.window'); var win = new util.window();
- //obj.data.volumes_temp = js2JSON( list );
- //obj.data.stash('volumes_temp');
- var my_xulG = win.open(
+ obj.data.volumes_temp = js2JSON( list );
+ obj.data.stash('volumes_temp');
+ var w = win.open(
window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
title,
- 'chrome,modal,resizable',
- { 'volumes' : list }
+ 'chrome,modal,resizable'
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- //obj.data.stash_retrieve();
- var volumes = my_xulG.volumes;
- if (!volumes) return;
+ obj.data.stash_retrieve();
+ var volumes = JSON2js( obj.data.volumes_temp );
+ obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
+ if (volumes=='') return;
volumes = util.functional.filter_list(
volumes,
xml += '</vbox>';
JSAN.use('OpenILS.data');
var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_transfer = xml; data.stash('temp_transfer');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_transfer'
- //+ '&title=' + window.escape('Volume Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
- { 'xml' : xml, 'title' : 'Volume Transfer' }
+ data.temp_transfer = xml; data.stash('temp_transfer');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_transfer'
+ + '&title=' + window.escape('Volume Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
);
+ data.init({'via':'stash'});
- if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
+ if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
var robj = obj.network.simple_request(
'FM_ACN_TRANSFER',
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_copy_browser.xul');
+ g.cgi = new CGI();
+
JSAN.use('cat.copy_browser'); g.copy_browser = new cat.copy_browser();
- g.copy_browser.init( { 'docid' : xul_param('docid') } );
+ g.copy_browser.init( { 'docid' : g.cgi.param('docid') } );
//if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
// try { window.xulG.set_tab_name('Holdings Maintenance'); } catch(E) { alert(E); }
var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'copy',bucket]);
- if (typeof robj == 'object') {
- if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
- alert('You already have a bucket with that name.');
- return;
- }
- throw robj;
- }
+ if (typeof robj == 'object') throw robj;
alert('Bucket "' + name + '" created.');
function(o) { return JSON2js(o)[1]; }
);
var url = urls.XUL_COPY_STATUS; // + '?barcodes=' + window.escape( js2JSON(barcodes) );
- //JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
- //data.temp_barcodes_for_copy_status = barcodes;
- //data.stash('temp_barcodes_for_copy_status');
- xulG.new_tab( url, {}, { 'barcodes' : barcodes });
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ data.temp_barcodes_for_copy_status = barcodes;
+ data.stash('temp_barcodes_for_copy_status');
+ xulG.new_tab( url, {}, {});
} catch(E) {
obj.error.standard_unexpected_error_alert('Copy Status from Copy Buckets',E);
}
g.error.sdump('D_TRACE','my_init() for copy_buckets.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- var copy_ids = xul_param(
- 'copy_ids',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'JSON2js_if_xpcom' : true,
- 'stash_name':'cb_temp_copy_ids',
- 'clear_xpcom' : true,
- }
- );
+ g.cgi = new CGI();
+ var copy_ids = [];
+ if (g.cgi.param('copy_ids')) copy_ids = copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
+ if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
+ copy_ids = copy_ids.concat( window.xulG.copy_ids );
+ if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
+ copy_ids = copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
+ g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
+ }
JSAN.use('cat.copy_buckets'); g.copy_buckets = new cat.copy_buckets();
g.copy_buckets.init(
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.copy_ids = xul_param(
- 'copy_ids',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'JSON2js_if_xpcom' : true,
- 'stash_name':'cb_temp_copy_ids',
- 'clear_xpcom' : true,
- }
- );
+ g.cgi = new CGI();
+ g.copy_ids = [];
+ if (g.cgi.param('copy_ids')) g.copy_ids = g.copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
+ if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
+ g.copy_ids = g.copy_ids.concat( window.xulG.copy_ids );
+ if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
+ g.copy_ids = g.copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
+ g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
+ }
$('desc').appendChild( document.createTextNode(
(g.copy_ids.length == 1 ?
var g = {};
-var xulG = {};
-
function my_init() {
try {
/******************************************************************************************************/
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
JSAN.use('util.network'); g.network = new util.network();
- g.docid = xul_param('docid',{'modal_xulG':true});
- g.handle_update = xul_param('handle_update',{'modal_xulG':true});
+ g.cgi = new CGI();
+
+ g.docid = g.cgi.param('docid');
+ g.handle_update = g.cgi.param('handle_update');
/******************************************************************************************************/
/* Get the copy ids from various sources and flesh them */
- var copy_ids = xul_param('copy_ids',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xulG':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copy_ids','clear_xpcom':true,'modal_xulG':true});
+ var copy_ids = [];
+ if (g.cgi.param('copy_ids')) copy_ids = JSON2js( g.cgi.param('copy_ids') );
+ if (window.xulG && window.xulG.copy_ids) copy_ids = copy_ids.concat( window.xulG.copy_ids );
+ if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) );
if (!copy_ids) copy_ids = [];
- if (copy_ids.length > 0) g.copies = g.network.simple_request(
- 'FM_ACP_FLESHED_BATCH_RETRIEVE',
+ if (copy_ids.length > 0) g.copies = g.network.request(
+ api.FM_ACP_FLESHED_BATCH_RETRIEVE.app,
+ api.FM_ACP_FLESHED_BATCH_RETRIEVE.method,
[ copy_ids ]
);
/* And other fleshed copies if any */
if (!g.copies) g.copies = [];
- var c = xul_param('copies',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copies','clear_xpcom':true,'modal_xulG':true})
- if (c) g.copies = g.copies.concat(c);
+ if (window.xulG && window.xulG.copies) g.copies = g.copies.concat( window.xulG.copies );
+ if (g.cgi.param('copies')) g.copies = g.copies.concat( JSON2js( g.cgi.param('copies') ) );
+ if (g.data.temp_copies != 'undefined' && g.data.temp_copies) g.copies = g.copies.concat( JSON2js( g.data.temp_copies ) );
+ g.data.temp_copies = null; g.data.stash('temp_copies');
/******************************************************************************************************/
/* We try to retrieve callnumbers for existing copies, but for new copies, we rely on this */
- g.callnumbers = xul_param('callnumbers',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_callnumbers','clear_xpcom':true,'modal_xulG':true});
+ if (window.xulG && window.xulG.callnumbers) g.callnumbers = window.xulG.callnumbers;
+ if (g.cgi.param('callnumbers')) g.callnumbers = JSON2js( g.cgi.param('callnumbers') );
+ if (g.data.temp_callnumbers != 'undefined') g.callnumbers = JSON2js( g.data.temp_callnumbers );
/******************************************************************************************************/
/* Is the interface an editor or a viewer, single or multi copy, existing copies or new copies? */
- if (xul_param('edit',{'modal_xulG':true}) == '1') {
+ if (g.cgi.param('edit') == '1') {
g.edit = true;
document.getElementById('caption').setAttribute('label','Copy Editor');
document.getElementById('save').setAttribute('hidden','false');
/* store the copies in the global xpcom stash */
g.stash_and_close = function() {
- try {
- if (g.handle_update) {
- try {
- var r = g.network.request(
- api.FM_ACP_FLESHED_BATCH_UPDATE.app,
- api.FM_ACP_FLESHED_BATCH_UPDATE.method,
- [ ses(), g.copies, true ]
- );
- if (typeof r.ilsevent != 'undefined') {
- g.error.standard_unexpected_error_alert('copy update',r);
- } else {
- alert('Items added/modified.');
- }
- /* FIXME -- revisit the return value here */
- } catch(E) {
- alert('copy update error: ' + js2JSON(E));
+ if (g.handle_update) {
+ try {
+ var r = g.network.request(
+ api.FM_ACP_FLESHED_BATCH_UPDATE.app,
+ api.FM_ACP_FLESHED_BATCH_UPDATE.method,
+ [ ses(), g.copies, true ]
+ );
+ if (typeof r.ilsevent != 'undefined') {
+ g.error.standard_unexpected_error_alert('copy update',r);
+ } else {
+ alert('Items added/modified.');
}
+ /* FIXME -- revisit the return value here */
+ } catch(E) {
+ alert('copy update error: ' + js2JSON(E));
}
- //g.data.temp_copies = js2JSON( g.copies );
- //g.data.stash('temp_copies');
- xulG.copies = g.copies;
- update_modal_xulG(xulG);
- window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert('stash and close',E);
}
+ g.data.temp_copies = js2JSON( g.copies );
+ g.data.stash('temp_copies');
+ g.error.sdump('D_CAT','in modal window, g.data.temp_copies = \n' + g.data.temp_copies + '\n');
+ window.close();
}
/******************************************************************************************************/
g.copy_notes = function() {
JSAN.use('util.window'); var win = new util.window();
- win.open(
- urls.XUL_COPY_NOTES,
- //+ '?copy_id=' + window.escape(g.copies[0].id()),
- 'Copy Notes','chrome,resizable,modal',
- { 'copy_id' : g.copies[0].id() }
- );
+ win.open(urls.XUL_COPY_NOTES + '?copy_id=' + window.escape(g.copies[0].id()),'Copy Notes','chrome,resizable,modal');
}
g.error.sdump('D_TRACE','my_init() for copy_notes.xul');
- g.copy_id = xul_param('copy_id',{'modal_xulG':true});
+ g.cgi = new CGI();
+ g.copy_id = g.cgi.param('copy_id');
refresh();
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1"><caption label="New Note"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows><row><label value="Public?"/><checkbox id="pub" name="fancy_data" checked="false"/></row><row><label value="Title"/><textbox id="title" name="fancy_data"/></row><row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row><row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/><button label="Add Note" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- //g.data.init({'via':'stash'});
- //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_note_xml'
- //+ '&focus=' + window.escape('title')
- //+ '&title=' + window.escape('Add Note'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'focus' : 'title', 'title' : 'Add Note' }
+ g.data.init({'via':'stash'});
+ g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_note_xml'
+ + '&focus=' + window.escape('title')
+ + '&title=' + window.escape('Add Note'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- //g.data.init({'via':'stash'});
- if (fancy_prompt_data.fancy_status == 'complete') {
+ g.data.init({'via':'stash'});
+ if (g.data.fancy_prompt_data != '') {
//alert(js2JSON(g.data.fancy_prompt_data));
var note = new acpn();
note.isnew(1);
- note.title( fancy_prompt_data.title );
- note.value( fancy_prompt_data.note );
- note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
+ note.title( g.data.fancy_prompt_data.title );
+ note.value( g.data.fancy_prompt_data.note );
+ note.pub( get_bool( g.data.fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
note.owning_copy( g.copy_id );
var r = g.network.simple_request('FM_ACPN_CREATE',[ ses(), note ]);
if (typeof r.ilsevent != 'undefined') throw(r);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_copy_summary.xul');
- var copy_id = xul_param('copy_id');
+ g.cgi = new CGI();
+ var copy_id = g.cgi.param('copy_id');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date'); JSAN.use('util.widgets');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
- var copy = xul_param('copy',{'stash_name':'temp_copy','clear_xpcom':true});
- var callnumber = xul_param('callnumber',{'stash_name':'temp_callnumber','clear_xpcom':true});
+ var copy;
+ if (g.data.temp_copy) {
+ copy = g.data.temp_copy; g.data.temp_copy = null; g.data.stash('temp_copy');
+ }
+ var callnumber;
+ if (g.data.temp_callnumber) {
+ callnumber = g.data.temp_callnumber; g.data.temp_callnumber = null; g.data.stash('temp_callnumber');
+ }
$('caption').setAttribute('tooltiptext','Copy ID = ' + (copy_id || copy.id() ) );
};
$('marc_editor').setAttribute('src',url);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- get_contentWindow($('marc_editor')).xulG = params;
+ $('marc_editor').contentWindow.xulG = params;
/* hide template widgets */
$('actions').hidden = true;
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat/marc_view.xul');
- var docid = xul_param('docid');
- var noprint = xul_param('noprint');
-
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
- var key = location.pathname + location.search + location.hash;
- if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
- var modal_xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
- if (typeof modal_xulG == 'object') {
- docid = modal_xulG.docid;
- if (modal_xulG.noprint) noprint = modal_xulG.noprint;
- }
- }
+ g.cgi = new CGI();
+ var docid = g.cgi.param('docid');
JSAN.use('util.network'); g.network = new util.network();
[ docid ],
function(req) {
marc_html = req.getResultObject();
- if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
+ if (g.cgi.param('noprint')||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
}
);
var holdings_obj;
var holds_obj;
- var iframe_method = 'reset_iframe'; // set_iframe
-
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.network'); g.network = new util.network();
- try { authtime = xul_param('authtime'); } catch(E) { g.error.sdump('D_ERROR',E); }
- try { docid = xul_param('docid'); } catch(E) { g.error.sdump('D_ERROR',E); }
- try { opac_url = xul_param('opac_url'); } catch(E) { g.error.sdump('D_ERROR',E); }
+ g.cgi = new CGI();
+ try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
+ try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
+ try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
JSAN.use('util.deck');
top_pane = new util.deck('top_pane');
}
function set_brief_view() {
- try {
- var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ); // + '?docid=' + window.escape(docid);
- dump('spawning ' + url + '\n');
- top_pane[iframe_method](
- url,
- {},
- {
- 'docid' : docid,
- 'set_tab_name' : function(n) {
- if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
- try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
- } else {
- dump('no set_tab_name\n');
- }
+ try {
+ var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
+ dump('spawning ' + url + '\n');
+ top_pane.set_iframe(
+ url,
+ {},
+ {
+ 'set_tab_name' : function(n) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+ try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
+ } else {
+ dump('no set_tab_name\n');
}
- }
- );
- } catch(E) {
- alert(E);
- }
+ }
+ }
+ );
+ } catch(E) {
+ alert(E);
+ }
}
function set_marc_view() {
- try {
- bottom_pane[iframe_method](
- xulG.url_prefix( urls.XUL_MARC_VIEW ), // + '?docid=' + window.escape(docid),
- {},
- {
- 'docid' : docid,
- }
- );
- } catch(E) {
- alert(E);
- }
+ try {
+ bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
+ } catch(E) {
+ alert(E);
+ }
}
function set_marc_edit() {
},
},
'url' : xulG.url_prefix( urls.XUL_MARC_EDIT ),
- 'name' : 'MarcEditor',
};
if (editor_obj) return;
JSAN.use('util.browser');
editor_obj = new util.browser();
editor_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=MarcEditor',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=MarcEditor',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'editor',
function set_copy_browser() {
try {
bottom_pane.node.selectedIndex = 2;
- xulG.docid = docid;
var content_params = {
'show_nav_buttons' : false,
'show_print_button' : false,
'passthru_content_params' : xulG,
- 'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ), // + '?docid=' + window.escape(docid),
- 'name' : 'HoldingsMaintenance',
+ 'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),
};
if (holdings_obj) return;
JSAN.use('util.browser');
holdings_obj = new util.browser();
holdings_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=HoldingsMaintenance',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=HoldingsMaintenance',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'holdings',
function set_hold_browser() {
try {
bottom_pane.node.selectedIndex = 3;
- xulG.docid = docid;
var content_params = {
'show_nav_buttons' : false,
'show_print_button' : false,
'passthru_content_params' : xulG,
- 'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ), // + '?docid=' + window.escape(docid),
- 'name' : 'Holds',
+ 'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),
};
if (holds_obj) return;
JSAN.use('util.browser');
holds_obj = new util.browser();
holds_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Holds',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Holds',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'holds',
win.attachEvt("rdetail", "recordRetrieved",
function(id){
try {
+ var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid)
+ dump('removing ' + url + '\n');
+ try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
docid = id;
- browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
- top_pane.clear(); bottom_pane.clear();
set_brief_view();
document.getElementById('nav').setAttribute('hidden','false');
} catch(E) {
);
},
'url_prefix' : xulG.url_prefix,
- 'name' : 'Catalog',
};
if (opac_url) content_params.url = opac_url;
if (browser_obj) return;
browser_obj = new util.browser();
browser_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Catalog',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'browser',
function remove_me() {
try {
- browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
- top_pane.clear(); bottom_pane.clear();
- document.getElementById('nav').setAttribute('hidden','true');
+ var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
+ dump('removing ' + url + '\n');
+ try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
+ document.getElementById('nav').setAttribute('hidden','true');
} catch(E) {
alert(E);
}
}
function add_to_bucket() {
- try {
- JSAN.use('util.window'); var win = new util.window();
- win.open(
- xulG.url_prefix(urls.XUL_RECORD_BUCKETS),
- //+ '?record_ids=' + js2JSON( [ docid ] ),
- 'sel_bucket_win' + win.window_name_increment(),
- 'chrome,resizable,modal,center',
- { 'record_ids' : [ docid ] }
- );
- } catch(E) {
- alert(E);
- }
+ try {
+ JSAN.use('util.window'); var win = new util.window();
+ win.open(
+ xulG.url_prefix(urls.XUL_RECORD_BUCKETS)
+ + '?record_ids=' + js2JSON( [ docid ] ),
+ 'sel_bucket_win' + win.window_name_increment(),
+ 'chrome,resizable,modal,center'
+ );
+ } catch(E) {
+ alert(E);
+ }
}
function refresh() {
var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
- if (typeof robj == 'object') {
- if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
- alert('You already have a bucket with that name.');
- return;
- }
- throw robj;
- }
-
+ if (typeof robj == 'object') throw robj;
alert('Bucket "' + name + '" created.');
xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
}
xml += '</tr></table></form>';
- //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
- //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
+ obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
+ obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
window.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_merge_mid'
- //+ '&top_xml_in_stash=temp_merge_top'
- //+ '&title=' + window.escape('Record Merging'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- {
- 'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Merging'
- }
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_merge_mid'
+ + '&top_xml_in_stash=temp_merge_top'
+ + '&title=' + window.escape('Record Merging'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
obj.data.stash_retrieve();
if (obj.data.fancy_prompt_data == '') { alert('Merge Aborted'); return; }
g.error.sdump('D_TRACE','my_init() for record_buckets.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- var record_ids = xul_param(
- 'record_ids',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'JSON2js_if_xpcom' : true,
- 'stash_name':'rb_temp_record_ids',
- 'clear_xpcom' : true,
- }
- );
+ g.cgi = new CGI();
+ var record_ids = [];
+ if (g.cgi.param('record_ids')) record_ids = record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
+ if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
+ record_ids = record_ids.concat( window.xulG.record_ids );
+ if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
+ record_ids = record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
+ g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
+ }
+
JSAN.use('cat.record_buckets'); g.record_buckets = new cat.record_buckets();
g.record_buckets.init(
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.record_ids = xul_param(
- 'record_ids',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'JSON2js_if_xpcom' : true,
- 'stash_name':'rb_temp_record_ids',
- 'clear_xpcom' : true,
- }
- );
+ g.cgi = new CGI();
+ g.record_ids = [];
+ if (g.cgi.param('record_ids')) g.record_ids = g.record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
+ if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
+ g.record_ids = g.record_ids.concat( window.xulG.record_ids );
+ if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
+ g.record_ids = g.record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
+ g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
+ }
$('desc').appendChild( document.createTextNode(
(g.record_ids.length == 1 ?
}
html += '</body></html>';
JSAN.use('util.window'); var win = new util.window();
- var loc = ( urls.XUL_REMOTE_BROWSER );
- //+ '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
+ var loc = ( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550');
- w.xulG = {
- 'url' : 'about:blank',
- 'show_print_button' : 1,
- 'alternate_print' : 1,
- 'no_xulG' : 1,
- 'title' : 'Spine Labels',
- 'on_url_load' : function(b) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- if (typeof w.xulG.written == 'undefined') {
- w.xulG.written = true;
- w.g.browser.get_content().document.write(html);
- w.g.browser.get_content().document.close();
- }
- } catch(E) {
- alert(E);
+ w.xulG = { 'on_url_load' : function(b) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ if (typeof w.xulG.written == 'undefined') {
+ w.xulG.written = true;
+ w.g.browser.get_content().document.write(html);
+ w.g.browser.get_content().document.close();
}
- },
- };
+ } catch(E) {
+ alert(E);
+ }
+ } };
} catch(E) {
g.error.standard_unexpected_error_alert('Preview and Print',E);
}
xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + params.docid + '"/>';
xml += '</vbox>';
- //data.temp_transfer = xml; data.stash('temp_transfer');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_transfer'
- //+ '&title=' + window.escape('Item Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
- { 'xml' : xml, 'title' : 'Item Transfer' }
+ data.temp_transfer = xml; data.stash('temp_transfer');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_transfer'
+ + '&title=' + window.escape('Item Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
+ data.stash_retrieve();
+ if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
JSAN.use('util.functional');
cat.util.spawn_copy_editor = function(list,edit) {
try {
var obj = {};
+ JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
JSAN.use('util.network'); obj.network = new util.network();
JSAN.use('util.error'); obj.error = new util.error();
title += ' Copy Attributes';
JSAN.use('util.window'); var win = new util.window();
- //JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
- //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
- //obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
- //obj.data.temp_copy_ids = js2JSON(list); obj.data.stash('temp_copy_ids');
- var my_xulG = win.open(
- //window.xulG.url_prefix(urls.XUL_COPY_EDITOR),
- (urls.XUL_COPY_EDITOR),
- // +'?handle_update=1&edit='+edit,
+ obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
+ obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
+ obj.data.temp_copy_ids = js2JSON(list);
+ obj.data.stash('temp_copy_ids');
+ var w = win.open(
+ window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
+ +'?handle_update=1&edit='+edit,
title,
- 'chrome,modal,resizable',
- {
- 'handle_update' : 1,
- 'edit' : edit,
- 'copy_ids' : js2JSON(list),
- }
+ 'chrome,modal,resizable'
);
- //obj.data.stash_retrieve();
- if (!my_xulG.copies) alert('Copies not modified.');
- //if (!obj.data.temp_copies) alert('Copies not modified.');
- //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
+ /* FIXME -- need to unique the temp space, and not rely on modalness of window */
+ obj.data.stash_retrieve();
+ if (!obj.data.temp_copies) alert('Copies not modified.');
+ obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
+ obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
+ obj.data.temp_copy_ids = undefined; obj.data.stash('temp_copy_ids');
} catch(E) {
JSAN.use('util.error'); var error = new util.error();
error.standard_unexpected_error_alert('error in cat.util.spawn_copy_editor',E);
JSAN.use('util.network'); g.network = new util.network();
+ g.cgi = new CGI();
+
/***********************************************************************************************************/
/* What record am I dealing with? Am I adding just copies or copies and volumes? */
- g.doc_id = xul_param('doc_id');
- document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + window.escape(g.doc_id));
- get_contentWindow(document.getElementById('summary')).xulG = { 'docid' : g.doc_id };
+ g.doc_id = g.cgi.param('doc_id');
+ document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + window.escape(g.doc_id));
- g.copy_shortcut = xul_param('copy_shortcut',{'JSON2js_if_cgi':true});
- g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));
+ g.copy_shortcut = g.cgi.param('copy_shortcut');
+ g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + g.cgi.param('ou_ids'));
+ if (g.copy_shortcut) g.copy_shortcut = JSON2js( g.copy_shortcut );
- var ou_ids = xul_param('ou_ids',{'JSON2js_if_cgi' : true, 'concat' : true});;
+ var ou_ids = [];
+ if (g.cgi.param('ou_ids'))
+ ou_ids = JSON2js( g.cgi.param('ou_ids') );
+ if (!ou_ids) ou_ids = [];
+ if (window.xulG && window.xulG.ou_ids)
+ ou_ids = ou_ids.concat( window.xulG.ou_ids );
/***********************************************************************************************************/
/* For the call number drop down */
JSAN.use('util.window'); var win = new util.window();
if (copies.length > 0) {
- //g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
- //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
- ////g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
- //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
- var my_xulG = win.open(
- urls.XUL_COPY_EDITOR,
- //+'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
+ g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
+ g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+ //g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
+ g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+ var w = win.open(
+ urls.XUL_COPY_EDITOR
+ +'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
title,
- 'chrome,modal,resizable',
- { 'edit' : 1, 'handle_update' : 1, 'docid' : g.doc_id, 'copies' : copies }
+ 'chrome,modal,resizable'
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- //g.data.stash_retrieve();
- //copies = JSON2js( g.data.temp_copies );
- copies = my_xulG.copies;
- //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
- //g.data.temp_copies = undefined; g.data.stash('temp_copies');
- //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+ g.data.stash_retrieve();
+ copies = JSON2js( g.data.temp_copies );
+ g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+ g.data.temp_copies = undefined; g.data.stash('temp_copies');
+ g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
if (!copies) {
alert('Items were not created.');
return;
<script>
<![CDATA[
- var xulG = {};
-
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ g.cgi = new CGI();
+
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.functional');
- g.volumes = xul_param('volumes',{'stash_name':'volumes_temp','clear_xpcom':true,'modal_xulG':true}); //JSON2js( g.data.volumes_temp );
- //g.data.volumes_temp = ''; g.data.stash('volumes_temp');
+ g.volumes = JSON2js( g.data.volumes_temp );
+ g.data.volumes_temp = ''; g.data.stash('volumes_temp');
var rows = document.getElementById('rows');
}
tb.setAttribute('value',g.volumes[i].label());
- tb.setAttribute('onchange','try { var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value ); } catch(E) { alert(E); }');
+ tb.setAttribute('onchange','var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value );');
}
} catch(E) {
}
g.stash_and_close = function() {
- try {
- //g.data.volumes_temp = js2JSON( g.volumes );
- //g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
- //g.data.stash('volumes_temp');
- xulG.volumes = g.volumes;
- update_modal_xulG(xulG);
- window.close();
- } catch(E) {
- alert('FIXME: volume editor -> ' + E);
- }
+ g.data.volumes_temp = js2JSON( g.volumes );
+ g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
+ g.data.stash('volumes_temp');
+ window.close();
}
]]>
n.setAttribute('toggle','1');
n.setAttribute('label','Results View');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- var f = get_contentWindow(document.getElementById('marc_frame'));
+ var f = document.getElementById('marc_frame').contentWindow;
f.xulG = { 'marcxml' : obj.results.records[ n.getAttribute('retrieve_id') ].marcxml };
f.my_init();
f.document.body.firstChild.focus();
},
'confirm_overlay' : function(record_ids) {
- var obj = this; // JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ var obj = this; JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
var top_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" >';
top_xml += '<description>Overlay this record?</description>';
xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
}
xml += '</tr></table></form>';
- // data.temp_merge_top = top_xml; data.stash('temp_merge_top');
- // data.temp_merge_mid = xml; data.stash('temp_merge_mid');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- // + '?xml_in_stash=temp_merge_mid'
- // + '&top_xml_in_stash=temp_merge_top'
- // + '&title=' + window.escape('Record Overlay'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Overlay' }
+ data.temp_merge_top = top_xml; data.stash('temp_merge_top');
+ data.temp_merge_mid = xml; data.stash('temp_merge_mid');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_merge_mid'
+ + '&top_xml_in_stash=temp_merge_top'
+ + '&title=' + window.escape('Record Overlay'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- //data.stash_retrieve();
- if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Overlay Aborted'); return false; }
+ data.stash_retrieve();
+ if (data.fancy_prompt_data == '') { alert('Overlay Aborted'); return false; }
return true;
},
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_z3950.xul');
+ g.cgi = new CGI();
+
JSAN.use('cat.z3950'); g.z3950 = new cat.z3950();
g.z3950.init(
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for checkin.xul');
- var tab_name;
- if (xul_param('hold_capture')) {
+ g.cgi = new CGI(); var tab_name;
+ if (g.cgi.param('hold_capture') == 1) {
document.getElementById('checkin_auto').checked = true;
document.getElementById('checkin_auto').hidden = true;
document.getElementById('checkin_effective_date_hbox').hidden = true;
this.check_disable();
- var robj = obj.network.cached_request(
+ var robj = obj.network.simple_request(
'FM_CIRC_COUNT_RETRIEVE_VIA_USER',
[ ses(), obj.patron_id ]
);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for checkout.xul');
- var patron_id = xul_param('patron_id');
+ g.cgi = new CGI();
+
+ var patron_id = g.cgi.param('patron_id') || xulG.patron_id;
JSAN.use('circ.checkout'); g.checkout = new circ.checkout();
g.checkout.init(
try {
g.error.standard_unexpected_error_alert('circ/checkout.xul',E);
} catch(F) {
- dump('FIXME: circ/checkout.xul -> ' + E + ' -> ' + F + '\n');
+ alert('FIXME: circ/checkout.xul -> ' + E);
}
}
}
function default_focus() {
try {
var x = document.getElementById('checkout_barcode_entry_textbox');
- if (!x) return;
if (x.disabled) {
document.getElementById('checkout_duedate_menu').inputField.focus();
} else {
x.focus();
}
} catch(E) {
- try { g.error.sdump('D_ERROR','checkout default_focus(): ' + js2JSON(E)); } catch(F) { dump('FIXME: circ/checkout.xul default_focus() -> ' + E + ' -> ' + F) }
+ g.error.sdump('D_ERROR','checkout default_focus(): ' + js2JSON(E));
}
}
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
- g.circ_id = xul_param('circ_id');
+ g.cgi = new CGI();
+ g.circ_id = g.cgi.param('circ_id');
- var caption = xul_param('caption'); if (caption) $('caption').setAttribute('label',caption);
- if (xul_param('no_border')) $('gb').setAttribute('style','border: none');
+ if (g.cgi.param('caption')) $('caption').setAttribute('label',g.cgi.param('caption'));
+ if (g.cgi.param('no_border')) $('gb').setAttribute('style','border: none');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
JSAN.use('util.window');
var win = new util.window();
var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(g.patron_id)
- //+ '&xact_id=' + window.escape( g.circ_id ),
+ urls.XUL_PATRON_BILL_WIZARD
+ + '?patron_id=' + window.escape(g.patron_id)
+ + '&xact_id=' + window.escape( g.circ_id ),
'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : g.patron_id, 'xact_id' : g.circ_id }
+ 'chrome,resizable,modal'
);
}
<![CDATA[
function $(id) { return document.getElementById(id); }
- var xulG = {};
-
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
- g.copy_id = xul_param('copy_id',{'modal_xulG':true});
- g.count = xul_param('count',{'modal_xulG':true});
+ g.cgi = new CGI();
+ g.copy_id = g.cgi.param('copy_id');
+ g.count = g.cgi.param('count');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
- $('top').setAttribute('src',urls.XUL_BIB_BRIEF);// + '?docid=' + g.callnumber.record());
- get_contentWindow($('top')).xulG = { 'docid' : g.callnumber.record() };
- $('mid').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + g.copy.id());
- get_contentWindow($('mid')).xulG = { 'copy_id' : g.copy.id() };
+ $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
+ $('mid').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + g.copy.id());
show_circs();
iframe.setAttribute('style','overflow: none; min-height: 100px;');
iframe.setAttribute('flex','1');
gb.appendChild(iframe);
- iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
- get_contentWindow(iframe).xulG = { 'circ_id' : g.circs[j].id() };
+ iframe.setAttribute('src', urls.XUL_CIRC_BRIEF + '?circ_id=' + g.circs[j].id() );
}
} catch(E) {
g.error.standard_unexpected_error_alert('error showing circs',E);
}
function retrieve_last() {
- try {
- //g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
- //g.data.stash('fancy_prompt_data');
- xulG.retrieve_these_patrons = [ g.circs[0].usr() ];
- update_modal_xulG(xulG);
- window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert('retrieve_last',E);
- }
+ g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
+ g.data.stash('fancy_prompt_data');
+ window.close();
}
function retrieve_all() {
- try {
- var patrons = []; var p_hash = {};
- for (var i = 0; i < g.circs.length; i++) {
- var usr = g.circs[i].usr();
- if (typeof p_hash[usr] != 'undefined') { continue; }
- p_hash[usr] = true;
- patrons.push( function(a){return a;}(usr) );
- }
- //g.data.fancy_prompt_data = js2JSON(patrons);
- //g.data.stash('fancy_prompt_data');
- xulG.retrieve_these_patrons = patrons;
- update_modal_xulG(xulG);
- window.close();
- } catch(E) {
- g.error.standard_unexpected_error_alert('retrieve_all',E);
+ var patrons = []; var p_hash = {};
+ for (var i = 0; i < g.circs.length; i++) {
+ var usr = g.circs[i].usr();
+ if (typeof p_hash[usr] != 'undefined') { continue; }
+ p_hash[usr] = true;
+ patrons.push( function(a){return a;}(usr) );
}
+ g.data.fancy_prompt_data = js2JSON(patrons);
+ g.data.stash('fancy_prompt_data');
+ window.close();
}
]]>
<![CDATA[
function $(id) { return document.getElementById(id); }
- var xulG = {};
-
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_copy_details.xul');
- g.copy_id = xul_param('copy_id',{'modal_xulG':true});
+ g.cgi = new CGI();
+ g.copy_id = g.cgi.param('copy_id');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
//g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
//if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
- $('top').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.callnumber.record());
- get_contentWindow($('top')).xulG = { 'docid' : g.callnumber.record() };
- //g.data.temp_copy = g.copy; g.data.stash('temp_copy');
- //g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber');
+ $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
+ g.data.temp_copy = g.copy; g.data.stash('temp_copy');
+ g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber');
$('item_summary').setAttribute('src',urls.XUL_COPY_SUMMARY);
- get_contentWindow($('item_summary')).xulG = { 'copy' : g.copy, 'callnumber' : g.callnumber };
$('r_last').disabled = true;
if (g.circ) {
$('r_last').disabled = false;
g.data.temp_circ = g.circ; g.data.stash('temp_circ');
- $('circ').setAttribute('src',urls.XUL_CIRC_BRIEF); // + '?no_border=1');
- get_contentWindow($('circ')).xulG = { 'no_border' : 1 };
+ $('circ').setAttribute('src',urls.XUL_CIRC_BRIEF + '?no_border=1');
if (g.circ.checkin_time()) {
$('circ_caption').setAttribute('label','Last Circulation');
} else {
function retrieve_last_patron() {
try {
- //g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
- //g.data.stash('fancy_prompt_data');
- xulG.retrieve_these_patrons = [ g.circ.user() ];
- update_modal_xulG(xulG);
+ g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
+ g.data.stash('fancy_prompt_data');
window.close();
} catch(E) {
alert(E);
function retrieve_hold_patron() {
try {
- //g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
- //g.data.stash('fancy_prompt_data');
- xulG.retrieve_these_patrons = [ g.hold.user() ];
- update_modal_xulG(xulG);
+ g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
+ g.data.stash('fancy_prompt_data');
window.close();
} catch(E) {
alert(E);
JSAN.use('util.barcode');
JSAN.use('util.date');
JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
- JSAN.use('util.sound'); this.sound = new util.sound();
}
circ.copy_status.prototype = {
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(r)
- //+'&ou_ids=' + window.escape( js2JSON(list) )
- //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
+ +'?doc_id=' + window.escape(r)
+ +'&ou_ids=' + window.escape( js2JSON(list) )
+ +'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
title,
- 'chrome,resizable',
- { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] }
+ 'chrome,resizable'
);
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
- //+'?doc_id=' + window.escape(r)
- //+'&ou_ids=' + window.escape( js2JSON(list) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
+ +'?doc_id=' + window.escape(r)
+ +'&ou_ids=' + window.escape( js2JSON(list) ),
title,
- 'chrome,resizable',
- { 'doc_id' : r, 'ou_ids' : list }
+ 'chrome,resizable'
);
}
var title = (list.length == 1 ? 'Volume' : 'Volumes') + ' for record # ' + rec;
JSAN.use('util.window'); var win = new util.window();
- //obj.data.volumes_temp = js2JSON( list );
- //obj.data.stash('volumes_temp');
- var my_xulG = win.open(
+ obj.data.volumes_temp = js2JSON( list );
+ obj.data.stash('volumes_temp');
+ var w = win.open(
window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
title,
- 'chrome,modal,resizable',
- { 'volumes' : list }
+ 'chrome,modal,resizable'
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- //obj.data.stash_retrieve();
- //var volumes = JSON2js( obj.data.volumes_temp );
- var volumes = my_xulG.volumes;
- if (!volumes) return;
+ obj.data.stash_retrieve();
+ var volumes = JSON2js( obj.data.volumes_temp );
+ obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
+ if (volumes=='') return;
volumes = util.functional.filter_list(
volumes,
xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
xml += '</vbox>';
JSAN.use('OpenILS.data');
- //var data = new OpenILS.data(); data.init({'via':'stash'});
- //data.temp_transfer = xml; data.stash('temp_transfer');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_transfer'
- //+ '&title=' + window.escape('Volume Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
- { 'xml' : xml, 'title' : 'Volume Transfer' }
+ var data = new OpenILS.data(); data.init({'via':'stash'});
+ data.temp_transfer = xml; data.stash('temp_transfer');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_transfer'
+ + '&title=' + window.escape('Volume Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
+ data.init({'via':'stash'});
+ if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
var robj = obj.network.simple_request(
'FM_ACN_TRANSFER',
if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
}
JSAN.use('circ.util');
- function handle_req(req) {
+ obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ], function(req) {
try {
var details = req.getResultObject();
if (details == null) {
} catch(E) {
obj.error.standard_unexpected_error_alert('',E);
}
- }
- var result = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ]);
- handle_req({'getResultObject':function(){return result;}}); // used to be async
+ } );
obj.controller.view.copy_status_barcode_entry_textbox.value = '';
obj.controller.view.copy_status_barcode_entry_textbox.focus();
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for copy_status.xul');
+ g.cgi = new CGI();
+
JSAN.use('circ.copy_status'); g.copy_status = new circ.copy_status();
g.copy_status.init(
{
try { window.xulG.set_tab_name('Item Status'); } catch(E) { alert(E); }
}
+ g.barcodes = [];
+ if (g.cgi.param('barcodes')) {
+ g.barcodes = g.barcodes.concat( JSON2js(g.cgi.param('barcodes')) );
+ }
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
+ if (g.data.temp_barcodes_for_copy_status) {
+ g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_copy_status );
+ g.data.temp_barcodes_for_copy_status = null; g.data.stash('temp_barcodes_for_copy_status');
+ }
- g.barcodes = xul_param(
- 'barcodes',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'stash_name':'temp_barcodes_for_copy_status',
- 'clear_xpcom' : true,
- }
- ) || [];
-
if (g.barcodes.length > 0) {
JSAN.use('util.exec'); var exec = new util.exec();
var funcs = [];
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for hold_capture.xul');
+ g.cgi = new CGI();
+
JSAN.use('circ.hold_capture'); g.hold_capture = new circ.hold_capture();
g.hold_capture.init(
{
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for in_house_use.xul');
+ g.cgi = new CGI();
+
JSAN.use('circ.in_house_use'); g.in_house_use = new circ.in_house_use();
g.in_house_use.init(
{
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for print_list.xul');
+ g.cgi = new CGI();
+
JSAN.use('circ.print_list_template_editor');
g.editor = new circ.print_list_template_editor();
if (typeof copy_id == 'object' && copy_id != null) copy_id = copy_id.id();
try {
- var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ); // + '?copy_id=' + copy_id;
- var my_xulG = obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal', { 'copy_id' : copy_id } );
+ obj.data.fancy_prompt_data = null; obj.data.stash('fancy_prompt_data');
+ var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ) + '?copy_id=' + copy_id;
+ obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal' );
+ obj.data.stash_retrieve();
- if (typeof my_xulG.retrieve_these_patrons == 'undefined') return;
- var patrons = my_xulG.retrieve_these_patrons;
+ if (! obj.data.fancy_prompt_data) return;
+ var patrons = JSON2js( obj.data.fancy_prompt_data );
for (var j = 0; j < patrons.length; j++) {
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
try {
- var url = urls.XUL_PATRON_DISPLAY; // + '?id=' + window.escape( patrons[j] );
- window.xulG.new_tab( url, {}, { 'id' : patrons[j] } );
+ var url = urls.XUL_PATRON_DISPLAY + '?id=' + window.escape( patrons[j] );
+ window.xulG.new_tab( url );
} catch(E) {
obj.error.standard_unexpected_error_alert('Problem retrieving patron.',E);
}
for (var i = 0; i < selection_list.length; i++) {
try {
if (typeof selection_list[i].copy_id == 'undefined' || selection_list[i].copy_id == null) continue;
- var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ); // + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
- var my_xulG = obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal', { 'copy_id' : selection_list[i].copy_id, 'count' : count } );
+ obj.data.fancy_prompt_data = null; obj.data.stash('fancy_prompt_data');
+ var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ) + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
+ obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal' );
+ obj.data.stash_retrieve();
- if (typeof my_xulG.retrieve_these_patrons == 'undefined') continue;
- var patrons = my_xulG.retrieve_these_patrons;
+ if (! obj.data.fancy_prompt_data) continue;
+ var patrons = JSON2js( obj.data.fancy_prompt_data );
for (var j = 0; j < patrons.length; j++) {
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
try {
- var url = urls.XUL_PATRON_DISPLAY; // + '?id=' + window.escape( patrons[j] );
- window.xulG.new_tab( url, {}, { 'id' : patrons[j] } );
+ var url = urls.XUL_PATRON_DISPLAY + '?id=' + window.escape( patrons[j] );
+ window.xulG.new_tab( url );
} catch(E) {
obj.error.standard_unexpected_error_alert('Problem retrieving patron.',E);
}
var c = [
{
- 'persist' : 'hidden width ordinal', 'id' : 'request_lib', 'label' : 'Request Lib (Full Name)', 'flex' : 1,
- 'primary' : false, 'hidden' : true,
- 'render' : function(my) { if (Number(my.ahr.request_lib())>=0) return data.hash.aou[ my.ahr.request_lib() ].name(); else return my.ahr.request_lib().name(); },
- },
- {
- 'persist' : 'hidden width ordinal', 'id' : 'request_lib_shortname', 'label' : 'Request Lib', 'flex' : 0,
- 'primary' : false, 'hidden' : true,
- 'render' : function(my) { if (Number(my.ahr.request_lib())>=0) return data.hash.aou[ my.ahr.request_lib() ].shortname(); else return my.ahr.request_lib().shortname(); },
- },
-
- {
'persist' : 'hidden width ordinal', 'id' : 'request_timestamp', 'label' : 'Request Timestamp', 'flex' : 0,
'primary' : false, 'hidden' : true,
'render' : function(my) { return my.ahr.request_time().toString(); },
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://open_ils_staff_client/skin/auth.css" type="text/css"?>
-<!-- Load these just to cache them -->
-<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/cat.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/circ.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/patron_summary.css" type="text/css"?>
-<?xml-stylesheet href="/xul/server/skin/simple_auth.css" type="text/css"?>
-
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<!-- LOCALIZATION -->
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('/xul/server/');
- function cache_me(msg,how) {
- try {
- switch(how) {
- case 'jsan' : JSAN.use(msg); break;
- case 'http' :
- var x = new XMLHttpRequest();
- x.open("GET",msg,true);
- x.send(null);
- break;
- }
- dump(msg + '\n');
- var x = document.getElementById('data_progress');
- if (x) {
- x.appendChild( document.createTextNode( msg + ' ') );
- }
- } catch(E) {
- dump(msg + '\n' + E);
- }
- }
-
- // load these just so they'll get cached
- cache_me('/xul/server//util/exec.js','http');
- cache_me('/xul/server//util/barcode.js','http');
- cache_me('/xul/server//util/controller.js','http');
- cache_me('/xul/server//util/deck.js','http');
- cache_me('/xul/server//util/fm_utils.js','http');
- cache_me('/xul/server//util/list.js','http');
- cache_me('/xul/server//util/network.js','http');
- cache_me('/xul/server//util/sound.js','http');
- cache_me('/xul/server//util/widgets.js','http');
- cache_me('/xul/server//util/browser.js','http');
- cache_me('/xul/server//util/error.js','http');
- cache_me('/xul/server//util/file.js','http');
- cache_me('/xul/server//util/functional.js','http');
- cache_me('/xul/server//util/money.js','http');
- cache_me('/xul/server//util/print.js','http');
- cache_me('/xul/server//util/text.js','http');
- cache_me('/xul/server//util/window.js','http');
-
- cache_me('/xul/server/util/fancy_prompt.xul','http');
- cache_me('/xul/server/util/browser.xul','http');
- cache_me('/xul/server/util/rbrowser.xul','http');
-
- cache_me('/xul/server//patron/display.js','http');
- cache_me('/xul/server//patron/bills.js','http');
- cache_me('/xul/server//patron/holds.js','http');
- cache_me('/xul/server//patron/items.js','http');
- cache_me('/xul/server//patron/search_form.js','http');
- cache_me('/xul/server//patron/search_result.js','http');
- cache_me('/xul/server//patron/summary.js','http');
- cache_me('/xul/server//patron/util.js','http');
-
- cache_me('/xul/server/patron/display.xul','http');
- cache_me('/xul/server/patron/display_overlay.xul','http');
- cache_me('/xul/server/patron/bills.xul','http');
- cache_me('/xul/server/patron/bills_overlay.xul','http');
- cache_me('/xul/server/patron/holds.xul','http');
- cache_me('/xul/server/patron/holds_overlay.xul','http');
- cache_me('/xul/server/patron/items.xul','http');
- cache_me('/xul/server/patron/items_overlay.xul','http');
- cache_me('/xul/server/patron/search_form.xul','http');
- cache_me('/xul/server/patron/search_form_overlay.xul','http');
- cache_me('/xul/server/patron/search_result.xul','http');
- cache_me('/xul/server/patron/search_result_overlay.xul','http');
- cache_me('/xul/server/patron/summary.xul','http');
- cache_me('/xul/server/patron/summary_overlay.xul','http');
- cache_me('/xul/server/patron/barcode_entry.xul','http');
-
- cache_me('/xul/server/patron/ue.xhtml','http');
- cache_me('/xul/server/admin/adminlib.js','http');
- cache_me('/xul/server/admin/admin.css','http');
- cache_me('/xul/server/patron/ue_config.js','http');
- cache_me('/xul/server/patron/ue_ui.js','http');
- cache_me('/xul/server/patron/ue.js','http');
- cache_me('/opac/common/js//config.js','http');
- cache_me('/opac/common/js/Cookie.js','http');
- cache_me('/opac/common/js/Cookies.js','http');
- cache_me('/opac/common/js/opac_utils.js','http');
- cache_me('/opac/common/js/init.js','http');
- cache_me('/opac/common/js/jscalendar/calendar-brown.css','http');
- cache_me('/opac/common/js/jscalendar/calendar.js','http');
- cache_me('/opac/common/js/jscalendar/lang/calendar-en.js','http');
- cache_me('/opac/common/js/jscalendar/calendar-setup.js','http');
- cache_me('/opac/common/js/jscalendar/img.gif','http');
-
- cache_me('/xul/server/skin/media/images/stop_sign.png','http');
- cache_me('/xul/server/skin/media/images/bad_barcode.png','http');
- cache_me('/xul/server/skin/media/images/grinder.gif','http');
- cache_me('/xul/server/skin/media/images/patron_left_arrow.png','http');
- cache_me('/xul/server/skin/media/images/skull.png','http');
- cache_me('/xul/server/skin/media/images/tools.png','http');
- cache_me('/xul/server/skin/media/images/up_arrow.gif','http');
- cache_me('/xul/server/skin/media/images/book_question.png','http');
- cache_me('/xul/server/skin/media/images/down_arrow.gif','http');
- cache_me('/xul/server/skin/media/images/icon_delete.gif','http');
- cache_me('/xul/server/skin/media/images/patron_right_arrow.png','http');
- cache_me('/xul/server/skin/media/images/turtle.gif','http');
- cache_me('/xul/server/skin/media/audio/bonus.wav','http');
- cache_me('/xul/server/skin/media/audio/question.wav','http');
- cache_me('/xul/server/skin/media/audio/redalert.wav','http');
- cache_me('/xul/server/skin/media/audio/toggled.wav','http');
-
- cache_me('/xul/server//circ/checkin.js','http');
- cache_me('/xul/server//circ/checkout.js','http');
- cache_me('/xul/server//circ/copy_status.js','http');
- cache_me('/xul/server//circ/hold_capture.js','http');
- cache_me('/xul/server//circ/in_house_use.js','http');
- cache_me('/xul/server//circ/util.js','http');
-
- cache_me('/xul/server/circ/checkout_overlay.xul','http');
- cache_me('/xul/server/circ/checkout.xul','http');
- cache_me('/xul/server/circ/checkin_overlay.xul','http');
- cache_me('/xul/server/circ/checkin.xul','http');
- cache_me('/xul/server/circ/circ_brief.xul','http');
- cache_me('/xul/server/circ/circ_summary.xul','http');
- cache_me('/xul/server/circ/copy_status.xul','http');
- cache_me('/xul/server/circ/copy_status_overlay.xul','http');
-
- // ----
-
JSAN.use('OpenILS.data');
g.data = new OpenILS.data()
g.data.on_error = xulG.auth.logoff;
g.data.stash('session');
g.data.on_complete = function () {
- g.data.stash('list','hash','tree','temp','cached_request');
-
- setInterval(
- function() {
- try {
- var remove_me = [];
- var n = Number( new Date() );
- for (var i in g.data.cached_request) {
- if (g.data.cached_request[i].expire_time < n && g.data.cached_request[i].status != 'pending') remove_me.push(i);
- }
- dump('trimming ' + remove_me.length + ' requests from cache\n');
- for (var i in remove_me) delete g.data.cached_request[i];
- } catch(E) {
- alert(E);
- }
- }, 180000
- );
-
+ g.data.stash('list','hash','tree','temp');
g.data._debug_stash();
document.getElementById('iframe').setAttribute(
}
g.data.init();
-
- g.data.init_observer_functions();
-
}
]]>
</script>
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
+ g.cgi = new CGI();
+
var tb = document.getElementById('barcode_tb');
tb.addEventListener(
'keypress',
try { window.xulG.set_tab_name('User Permission Editor'); } catch(E) { alert(E); }
}
- if (xul_param('error')) {
- var error = xul_param('error');
+ if (g.cgi.param('error')) {
+ var error = g.cgi.param('error');
alert(error);
}
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
+ g.cgi = new CGI();
+
var tb = document.getElementById('barcode_tb');
tb.addEventListener(
'keypress',
try { window.xulG.set_tab_name('Check Out'); } catch(E) { alert(E); }
}
- if (xul_param('error')) {
- var error = xul_param('error');
+ if (g.cgi.param('error')) {
+ var error = g.cgi.param('error');
alert(error);
}
function $(id) { return document.getElementById(id); }
function retrieve_patron() {
- g.patron_id = xul_param('patron_id');
+ g.patron_id = g.cgi.param('patron_id');
if (g.patron_id) {
JSAN.use('patron.util');
if (get_bool(r_circ.phone_renewal() ) ) r += 'PHONE ';
$('renewal').value = r || 'No';
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
- get_contentWindow($('copy_summary')).xulG = { 'copy_id' : r_circ.target_copy() };
+ $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
$('copy_summary').hidden=false;
g.network.simple_request(
g.error.sdump('D_TRACE','my_init() for bill_details.xul');
- g.mbts_id = xul_param('mbts_id');
+ g.cgi = new CGI();
+
+ g.mbts_id = g.cgi.param('mbts_id');
retrieve_patron();
function $(id) { return document.getElementById(id); }
function retrieve_patron() {
- g.patron_id = xul_param('patron_id');
+ g.patron_id = g.cgi.param('patron_id');
if (g.patron_id) {
JSAN.use('patron.util');
function retrieve_mbts_for_list() {
//var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
var method = 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY';
- if (xul_param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
+ if (g.cgi.param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
if (g.mbts_ids.ilsevent) {
switch(g.mbts_ids.ilsevent) {
$('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
$('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
- get_contentWindow($('copy_summary')).xulG = { 'copy_id' : r_circ.target_copy() };
+ $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
$('copy_summary').hidden=false;
g.network.simple_request(
g.error.sdump('D_TRACE','my_init() for bill_history.xul');
+ g.cgi = new CGI();
+
retrieve_patron();
init_lists();
false
);
- if (xul_param('current')) {
+ if (g.cgi.param('current')) {
$('caption').setAttribute('label','Current Bills');
document.title = 'Current Bills';
} else {
JSAN.use('util.window');
var win = new util.window();
var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(g.patron_id)
- //+ '&xact_id=' + window.escape( g.bill_list_selection[0] ),
+ urls.XUL_PATRON_BILL_WIZARD
+ + '?patron_id=' + window.escape(g.patron_id)
+ + '&xact_id=' + window.escape( g.bill_list_selection[0] ),
'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : g.patron_id, 'xact_id' : g.bill_list_selection[0] }
+ 'chrome,resizable,modal'
);
g.bill_list.clear();
retrieve_mbts_for_list();
function handle_details() {
JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_DETAILS,
- //+ '?patron_id=' + window.escape(g.patron_id)
- //+ '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_DETAILS
+ + '?patron_id=' + window.escape(g.patron_id)
+ + '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
'test_billdetails',
- 'chrome,resizable',
- {
- 'patron_id' : g.patron_id,
- 'mbts_id' : g.bill_list_selection[0],
- 'refresh' : function() {
- if (typeof window.refresh == 'function') window.refresh();
- if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
- },
- }
+ 'chrome,resizable'
);
+ w.xulG = { 'refresh' : function() {
+ if (typeof window.refresh == 'function') window.refresh();
+ if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
+ } };
}
function print_bills() {
try {
g.bill_list.on_all_fleshed = function() {
try {
- var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';
+ var template = 'bills_historical'; if (g.cgi.param('current')) template = 'bills_current';
JSAN.use('patron.util');
var params = {
'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id),
}
function retrieve_patron() {
- g.patron_id = xul_param('patron_id',{'modal_xulG':true});
+ g.patron_id = g.cgi.param('patron_id');
if (g.patron_id) {
JSAN.use('patron.util');
ml.setAttribute('id','billing_type');
document.getElementById('menu_placeholder').appendChild(ml);
+ g.cgi = new CGI();
+
retrieve_patron();
$('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
$('bill_amount').focus();
- if (xul_param('xact_id',{'modal_xulG':true})) {
- g.mbts_id = xul_param('xact_id',{'modal_xulG':true});
+ if (g.cgi.param('xact_id')) {
+ g.mbts_id = g.cgi.param('xact_id');
$('summary').hidden = false;
retrieve_mbts();
retrieve_circ();
function patron_bill_finish() {
try {
- var xact_id = xul_param('xact_id',{'modal_xulG':true});
+ var xact_id = g.cgi.param('xact_id');
if (!xact_id) {
var grocery = new mg();
grocery.isnew('1');
try {
JSAN.use('util.window');
var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_WIZARD
+ + '?patron_id=' + window.escape(obj.patron_id),
'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : obj.patron_id }
+ 'chrome,resizable,modal'
);
obj.refresh();
} catch(E) {
JSAN.use('util.window');
var win = new util.window();
//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_HISTORY,
- //+ '?patron_id=' + window.escape(obj.patron_id),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_HISTORY
+ + '?patron_id=' + window.escape(obj.patron_id),
'billhistory',
//'chrome,resizable,modal'
- 'chrome,resizable',
- {
- 'patron_id' : obj.patron_id,
- 'refresh' : function() { obj.refresh(); }
- }
+ 'chrome,resizable'
);
+ w.xulG = { 'refresh' : function() { obj.refresh(); } };
+ //w.refresh = function() { obj.refresh(); };
} catch(E) {
obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E);
}
JSAN.use('util.window');
var win = new util.window();
//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_HISTORY,
- //+ '?current=1&patron_id=' + window.escape(obj.patron_id),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_HISTORY
+ + '?current=1&patron_id=' + window.escape(obj.patron_id),
'billhistory',
//'chrome,resizable,modal'
- 'chrome,resizable',
- {
- 'current' : 1,
- 'patron_id' : obj.patron_id,
- 'refresh' : function() { obj.refresh(); },
- }
+ 'chrome,resizable'
);
+ w.xulG = { 'refresh' : function() { obj.refresh(); } };
+ //w.refresh = function() { obj.refresh(); };
} catch(E) {
obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);
}
var win = new util.window();
switch(obj.controller.view.payment_type.value) {
case 'credit_card_payment' :
- //obj.OpenILS.data.temp = '';
- //obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
+ obj.OpenILS.data.temp = '';
+ obj.OpenILS.data.stash('temp');
+ var w = win.open(
urls.XUL_PATRON_BILL_CC_INFO,
'billccinfo',
'chrome,resizable,modal'
);
- //obj.OpenILS.data.stash_retrieve();
- payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
+ obj.OpenILS.data.stash_retrieve();
+ /* FIXME -- need unique temp space name */
+ payment_blob = JSON2js( obj.OpenILS.data.temp );
break;
case 'check_payment' :
- //obj.OpenILS.data.temp = '';
- //obj.OpenILS.data.stash('temp');
- var my_xulG = win.open(
+ obj.OpenILS.data.temp = '';
+ obj.OpenILS.data.stash('temp');
+ var w = win.open(
urls.XUL_PATRON_BILL_CHECK_INFO,
'billcheckinfo',
'chrome,resizable,modal'
);
- //obj.OpenILS.data.stash_retrieve();
- payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
+ obj.OpenILS.data.stash_retrieve();
+ /* FIXME -- need unique temp space name */
+ payment_blob = JSON2js( obj.OpenILS.data.temp );
break;
}
if (payment_blob=='' || payment_blob.cancelled=='true') { alert('cancelled'); return; }
'command',
function(ev) {
JSAN.use('util.window'); var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_DETAILS,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&mbts_id=' + window.escape(my.mobts.id()),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_DETAILS
+ + '?patron_id=' + window.escape(obj.patron_id)
+ + '&mbts_id=' + window.escape(my.mobts.id()),
'test' + my.mobts.id(),
- 'chrome,resizable',
- {
- 'patron_id' : obj.patron_id,
- 'mbts_id' : my.mobts.id(),
- 'refresh' : function() { obj.refresh(); },
- }
+ 'chrome,resizable'
);
+ w.xulG = { 'refresh' : function() { obj.refresh(); } };
},
false
);
function(ev) {
JSAN.use('util.window');
var win = new util.window();
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&xact_id=' + window.escape( my.mobts.id() ),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_WIZARD
+ + '?patron_id=' + window.escape(obj.patron_id)
+ + '&xact_id=' + window.escape( my.mobts.id() ),
'billwizard',
- 'chrome,resizable,modal',
- {
- 'patron_id' : obj.patron_id,
- 'xact_id' : my.mobts.id(),
- }
+ 'chrome,resizable,modal'
);
obj.refresh();
},
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for bills.xul');
+ g.cgi = new CGI();
+
JSAN.use('patron.bills'); g.bills = new patron.bills();
g.bills.init(
{
- 'patron_id' : xul_param('patron_id'),
+ 'patron_id' : g.cgi.param('patron_id'),
}
);
window.refresh = function(p) { g.bills.refresh(p); }
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.checkout_window = get_contentWindow(frame);
+ obj.checkout_window = frame.contentWindow;
}
JSAN.use('util.controller'); obj.controller = new util.controller();
function(ev) {
obj.reset_nav_styling('cmd_patron_items');
var frame = obj.right_deck.set_iframe(
- urls.XUL_PATRON_ITEMS,
- //+ '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_ITEMS
+ + '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
- 'patron_id' : obj.patron.id(),
'on_list_change' : function(b) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
obj.summary_window.g.summary.controller.render('patron_checkouts');
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.items_window = get_contentWindow(frame);
+ obj.items_window = frame.contentWindow;
}
],
'cmd_patron_edit' : [
obj.error.sdump('D_TRACE', 'Editor would like to search for: ' + js2JSON(s) );
obj.data.stash_retrieve();
var loc = xulG.url_prefix(urls.XUL_PATRON_DISPLAY);
- //loc += '?doit=1&query=' + window.escape(js2JSON(s));
- xulG.new_tab( loc, {}, { 'doit' : 1, 'query' : s } );
+ loc += '?doit=1&query=' + window.escape(js2JSON(s));
+ xulG.new_tab( loc, {}, {} );
}
function spawn_editor(p) {
var url = urls.XUL_PATRON_EDIT;
- //var param_count = 0;
- //for (var i in p) {
- // if (param_count++ == 0) url += '?'; else url += '&';
- // url += i + '=' + window.escape(p[i]);
- //}
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
+ var param_count = 0;
+ for (var i in p) {
+ if (param_count++ == 0) url += '?'; else url += '&';
+ url += i + '=' + window.escape(p[i]);
+ }
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
xulG.new_tab(
loc,
{},
{
- 'url' : url,
'show_print_button' : true ,
'tab_name' : 'Editing Related Patron' ,
'passthru_content_params' : {
'spawn_editor' : spawn_editor,
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
- 'params' : p,
}
}
);
}
obj.right_deck.set_iframe(
- urls.XUL_REMOTE_BROWSER,
- //+ '?url=' + window.escape(
- // urls.XUL_PATRON_EDIT
- // + '?ses=' + window.escape( ses() )
- // + '&usr=' + window.escape( obj.patron.id() )
- //),
+ urls.XUL_REMOTE_BROWSER
+ + '?url=' + window.escape(
+ urls.XUL_PATRON_EDIT
+ + '?ses=' + window.escape( ses() )
+ + '&usr=' + window.escape( obj.patron.id() )
+ ),
{}, {
- 'url' : urls.XUL_PATRON_EDIT,
'show_print_button' : true,
'passthru_content_params' : {
- 'params' : {
- 'ses' : ses(),
- 'usr' : obj.patron.id(),
- },
'on_save' : function(p) {
try {
if (obj.barcode) obj.barcode = p.card().barcode();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- //obj.summary_window.g.summary.retrieve();
- obj.refresh_all();
+ obj.summary_window.g.summary.retrieve();
} catch(E) {
alert(E);
}
function(ev) {
obj.reset_nav_styling('cmd_patron_info');
obj.right_deck.set_iframe(
- urls.XUL_PATRON_INFO, // + '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_INFO + '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
- 'patron_id' : obj.patron.id(),
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
}
function(ev) {
obj.reset_nav_styling('cmd_patron_holds');
obj.right_deck.set_iframe(
- urls.XUL_PATRON_HOLDS,
- //+ '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_HOLDS
+ + '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
- 'patron_id' : obj.patron.id(),
'on_list_change' : function(h) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- //obj.summary_window.g.summary.controller.render('patron_holds');
- //obj.summary_window.g.summary.controller.render('patron_standing');
- obj.refresh_all();
+ obj.summary_window.g.summary.controller.render('patron_holds');
+ obj.summary_window.g.summary.controller.render('patron_standing');
},
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
function(ev) {
obj.reset_nav_styling('cmd_patron_bills');
var f = obj.right_deck.set_iframe(
- urls.XUL_PATRON_BILLS,
- //+ '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_BILLS
+ + '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
- 'patron_id' : obj.patron.id(),
'url_prefix' : xulG.url_prefix,
'on_money_change' : function(b) {
//alert('test');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- //obj.summary_window.g.summary.retrieve(true);
- //obj.items_window.g.items.retrieve(true);
- obj.refresh_all();
+ obj.summary_window.g.summary.retrieve(true);
+ obj.items_window.g.items.retrieve(true);
}
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.bill_window = get_contentWindow(f);
+ obj.bill_window = f.contentWindow;
}
],
'patron_name' : [
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window = get_contentWindow(frame);
+ obj.summary_window = frame.contentWindow;
} else {
obj.render_search_form(params);
}
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
obj.controller.view.cmd_search_form.setAttribute('disabled','true');
- var loc = urls.XUL_PATRON_SEARCH_FORM;
- var my_xulG = {
- 'clear_left_deck' : function() { setTimeout( function() { obj.left_deck.clear_all_except(loc); obj.render_search_form(params); }, 0); },
- 'on_submit' : function(query) {
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
- var list_frame = obj.right_deck.reset_iframe(
- urls.XUL_PATRON_SEARCH_RESULT, // + '?' + query,
- {},
- {
- 'query' : query,
- 'on_select' : function(list) {
- if (!list) return;
- if (list.length < 1) return;
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
- obj.controller.view.cmd_search_form.setAttribute('disabled','false');
- obj.retrieve_ids = list;
- obj.controller.view.patron_name.setAttribute('value','Retrieving...');
- document.documentElement.setAttribute('class','');
- setTimeout(
- function() {
- var frame = obj.left_deck.set_iframe(
- urls.XUL_PATRON_SUMMARY, // + '?id=' + window.escape(list[0]),
- {},
- {
- 'id' : list[0],
- 'on_finished' : function(patron) {
- obj.patron = patron;
- obj.controller.render();
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege(
- "UniversalXPConnect"
- );
- obj.summary_window = get_contentWindow(frame);
- obj.patron = obj.summary_window.g.summary.patron;
- obj.controller.render('patron_name');
- }, 0
- );
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_result = get_contentWindow(list_frame);
- }
- };
-
+ var loc = urls.XUL_PATRON_SEARCH_FORM + '?blah=blah';
if (params['query']) {
- my_xulG.query = JSON2js(params['query']);
- if (params.doit) my_xulG.doit = 1;
+ var query = JSON2js(params['query']);
+ for (var i in query) {
+ loc += '&'+window.escape(i)+'='+window.escape(query[i].value);
+ }
+ if (params.doit) {
+ loc += '&doit=1';
+ }
}
-
var form_frame = obj.left_deck.set_iframe(
loc,
{},
- my_xulG
+ {
+ 'clear_left_deck' : function() { setTimeout( function() { obj.left_deck.clear_all_except(loc); obj.render_search_form(params); }, 0); },
+ 'on_submit' : function(query) {
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ var list_frame = obj.right_deck.reset_iframe(
+ urls.XUL_PATRON_SEARCH_RESULT + '?' + query,
+ {},
+ {
+ 'on_select' : function(list) {
+ if (!list) return;
+ if (list.length < 1) return;
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
+ obj.controller.view.cmd_search_form.setAttribute('disabled','false');
+ obj.retrieve_ids = list;
+ obj.controller.view.patron_name.setAttribute('value','Retrieving...');
+ document.documentElement.setAttribute('class','');
+ setTimeout(
+ function() {
+ var frame = obj.left_deck.set_iframe(
+ urls.XUL_PATRON_SUMMARY + '?id=' + window.escape(list[0]),
+ {},
+ {
+ 'on_finished' : function(patron) {
+ obj.patron = patron;
+ obj.controller.render();
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege(
+ "UniversalXPConnect"
+ );
+ obj.summary_window = frame.contentWindow;
+ obj.patron = obj.summary_window.g.summary.patron;
+ obj.controller.render('patron_name');
+ }, 0
+ );
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ obj.search_result = list_frame.contentWindow;
+ }
+ }
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_window = get_contentWindow(form_frame);
+ obj.search_window = form_frame.contentWindow;
obj._checkout_spawned = true;
},
for (var i = 0; i < obj.right_deck.node.childNodes.length; i++) {
try {
var f = obj.right_deck.node.childNodes[i];
- var w = get_contentWindow(f);
+ var w = f.contentWindow;
if (url) {
if (w.location.href == url) w.refresh(true);
} else {
'refresh_all' : function() {
var obj = this;
- obj.OpenILS.data.cached_request = {}; obj.OpenILS.data.stash('cached_request'); /* FIXME - do a more selective purging here */
obj.controller.view.patron_name.setAttribute(
'value','Retrieving...'
);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron_display.xul');
+ g.cgi = new CGI();
+
JSAN.use('patron.display'); g.patron = new patron.display();
g.patron.init( {
- 'barcode' : xul_param('barcode'),
- 'id' : xul_param('id'),
- 'query' : xul_param('query'),
- 'doit' : xul_param('doit'),
+ 'barcode' : g.cgi.param('barcode') || xulG.barcode ,
+ 'id' : g.cgi.param('id') || xulG.id,
+ 'query' : g.cgi.param('query') || xulG.query,
+ 'doit' : g.cgi.param('doit') || xulG.doit,
} );
//document.documentElement.style.setProperty('font-size-adjust','1','important');
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var node = g.patron.right_deck.node.selectedPanel;
- if (node && get_contentWindow(node) && typeof get_contentWindow(node).default_focus == 'function') {
- get_contentWindow(node).default_focus();
+ if (node && node.contentWindow && typeof node.contentWindow.default_focus == 'function') {
+ node.contentWindow.default_focus();
} else {
var node = g.patron.left_deck.node.selectedPanel;
- if (node && get_contentWindow(node) && typeof get_contentWindow(node).default_focus == 'function') {
- get_contentWindow(node).default_focus();
+ if (node && node.contentWindow && typeof node.contentWindow.default_focus == 'function') {
+ node.contentWindow.default_focus();
}
}
} catch(E) {
g.error.sdump('D_TRACE','my_init() for hold_notices.xul');
- g.ahr_id = xul_param('ahr_id');
+ g.cgi = new CGI();
+ g.ahr_id = g.cgi.param('ahr_id');
g.ahr = g.network.simple_request('FM_AHR_RETRIEVE',[ ses(), g.ahr_id ]);
if (typeof g.ahr.ilsevent != 'undefined') { throw(g.ahr); }
g.ahr = g.ahr[0];
a_list_of_one();
- document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.ahr.target());
- get_contentWindow(document.getElementById('bib_brief')).xulG = { 'docid' : g.ahr.target() };
+ document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.ahr.target());
refresh();
xml += '<row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row>';
xml += '<row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/>';
xml += '<button label="Add Notification Record" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- //g.data.init({'via':'stash'});
- //g.data.temp_notification_xml = xml; g.data.stash('temp_notification_xml');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = window.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_notification_xml'
- //+ '&focus=' + window.escape('method')
- //+ '&title=' + window.escape('Add Notification Record'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'focus' : 'method', 'title' : 'Add Notification Record' }
+ g.data.init({'via':'stash'});
+ g.data.temp_notification_xml = xml; g.data.stash('temp_notification_xml');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_notification_xml'
+ + '&focus=' + window.escape('method')
+ + '&title=' + window.escape('Add Notification Record'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data.fancy_status == 'complete') {
+ g.data.init({'via':'stash'});
+ if (g.data.fancy_prompt_data != '') {
var notification = new ahn();
notification.isnew(1);
notification.hold(g.ahr_id);
- notification.method( fancy_prompt_data.method );
- notification.note( fancy_prompt_data.note );
+ notification.method( g.data.fancy_prompt_data.method );
+ notification.note( g.data.fancy_prompt_data.note );
var r = g.network.simple_request('FM_AHN_CREATE',[ ses(), notification ]); if (typeof r.ilsevent != 'undefined') throw(r);
setTimeout(function(){refresh();},0);
}
for (var i = 0; i < obj.retrieve_ids.length; i++) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
win.open(
- xulG.url_prefix(urls.XUL_HOLD_NOTICES), // + '?ahr_id=' + obj.retrieve_ids[i].id,
+ xulG.url_prefix(urls.XUL_HOLD_NOTICES)
+ + '?ahr_id=' + obj.retrieve_ids[i].id,
'hold_notices_' + obj.retrieve_ids[i].id,
- 'chrome,resizable',
- { 'ahr_id' : obj.retrieve_ids[i].id }
+ 'chrome,resizable'
);
}
} catch(E) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Pick Up Library' }
+ obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_mid'
+ + '&bottom_xml_in_stash=temp_bot'
+ + '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var selection = fancy_prompt_data.selection;
+ obj.data.init({'via':'stash'});
+ if (obj.data.fancy_prompt_data == '') { return; }
+ var selection = obj.data.fancy_prompt_data.selection;
var msg = 'Are you sure you would like to change the Hold Range for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + obj.data.hash.aout[selection].opac_label() + '"?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Pick Up Library' }
+ obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_mid'
+ + '&bottom_xml_in_stash=temp_bot'
+ + '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var pickup_lib = fancy_prompt_data.lib;
+ obj.data.init({'via':'stash'});
+ if (obj.data.fancy_prompt_data == '') { return; }
+ var pickup_lib = obj.data.fancy_prompt_data.lib;
var msg = 'Are you sure you would like to change the Pick Up Lib for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to ' + obj.data.hash.aou[pickup_lib].shortname() + '?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Choose a Hold Notification Phone Number')
- //+ '&focus=phone',
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Hold Notification Phone Number', 'focus' : 'phone' }
+ obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_mid'
+ + '&bottom_xml_in_stash=temp_bot'
+ + '&title=' + window.escape('Choose a Hold Notification Phone Number')
+ + '&focus=phone',
+ 'fancy_prompt', 'chrome,resizable,modal'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var phone = fancy_prompt_data.phone;
+ obj.data.init({'via':'stash'});
+ if (obj.data.fancy_prompt_data == '') { return; }
+ var phone = obj.data.fancy_prompt_data.phone;
var msg = 'Are you sure you would like to change the Notification Phone Number for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + phone + '"?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
bot_xml += '<spacer flex="1"/><button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Set Email Notification for Holds'),
- 'fancy_prompt', 'chrome,resizable,modal',
- { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Set Email Notification for Holds' }
+ obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_mid'
+ + '&bottom_xml_in_stash=temp_bot'
+ + '&title=' + window.escape('Set Email Notification for Holds'),
+ 'fancy_prompt', 'chrome,resizable,modal'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
- var email = fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
+ obj.data.init({'via':'stash'});
+ if (obj.data.fancy_prompt_data == '') { return; }
+ var email = obj.data.fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
var msg = 'Are you sure you would like ' + ( get_bool( email ) ? 'enable' : 'disable' ) + ' email notification for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
var patron_id = obj.retrieve_ids[i].usr;
if (seen[patron_id]) continue; seen[patron_id] = true;
xulG.new_tab(
- xulG.url_prefix(urls.XUL_PATRON_DISPLAY), // + '?id=' + patron_id,
+ xulG.url_prefix(urls.XUL_PATRON_DISPLAY) + '?id=' + patron_id,
{},
- { 'id' : patron_id }
+ {}
);
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for holds.xul');
+ g.cgi = new CGI();
+
JSAN.use('patron.holds'); g.holds = new patron.holds();
g.holds.init(
{
- 'patron_id' : xul_param('patron_id'),
- 'docid' : xul_param('docid'),
- 'shelf' : xul_param('shelf'),
- 'pull' : xul_param('pull'),
+ 'patron_id' : g.cgi.param('patron_id'),
+ 'docid' : g.cgi.param('docid'),
+ 'shelf' : g.cgi.param('shelf'),
+ 'pull' : g.cgi.param('pull'),
}
);
window.refresh = function(p) { g.holds.retrieve(p); }
<script>
<![CDATA[
- // FIXME - change this to load each tab/sub-interface as needed and not all at once
-
function $(id) { return document.getElementById(id); }
function my_init() {
g.error.sdump('D_TRACE','my_init() for patron_info.xul');
- g.patron_id = xul_param('patron_id');
+ g.cgi = new CGI();
+ g.patron_id = g.cgi.param('patron_id');
try{
- $('notes_frame').setAttribute('src',urls.XUL_PATRON_INFO_NOTES);
- get_contentWindow($('notes_frame')).xulG =
- { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
+ $('notes_frame').setAttribute('src',urls.XUL_PATRON_INFO_NOTES + '?patron_id=' + window.escape(g.patron_id));
+ $('notes_frame').contentWindow.xulG = xulG;
}catch(E){alert(E);}
try{
- $('stat_cats_frame').setAttribute('src',urls.XUL_PATRON_INFO_STAT_CATS);
- get_contentWindow($('stat_cats_frame')).xulG =
- { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
+ $('stat_cats_frame').setAttribute('src',urls.XUL_PATRON_INFO_STAT_CATS + '?patron_id=' + window.escape(g.patron_id));
+ $('stat_cats_frame').contentWindow.xulG = xulG;
}catch(E){alert(E);}
try{
- $('surveys_frame').setAttribute('src',urls.XUL_PATRON_INFO_SURVEYS);
- get_contentWindow($('surveys_frame')).xulG =
- { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
+ $('surveys_frame').setAttribute('src',urls.XUL_PATRON_INFO_SURVEYS + '?patron_id=' + window.escape(g.patron_id));
+ $('surveys_frame').contentWindow.xulG = xulG;
}catch(E){alert(E);}
try{
- $('group_frame').setAttribute('src',urls.XUL_PATRON_INFO_GROUP);
- get_contentWindow($('group_frame')).xulG =
- { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
+ $('group_frame').setAttribute('src',urls.XUL_PATRON_INFO_GROUP + '?patron_id=' + window.escape(g.patron_id));
+ $('group_frame').contentWindow.xulG = xulG;
}catch(E){alert(E);}
} catch(E) {
function refresh() {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- for (var i in [ 'notes_frame', 'stat_cats_frame', 'surveys_frame', 'group_frame' ]) {
- if (get_contentWindow($(i)) && typeof get_contentWindow($(i)).refresh == 'function') {
- get_contentWindow($(i)).refresh();
- }
+ if ($('notes_frame').contentWindow && typeof $('notes_frame').contentWindow.refresh == 'function') {
+ $('notes_frame').contentWindow.refresh();
+ }
+ if ($('stat_cats_frame').contentWindow && typeof $('stat_cats_frame').contentWindow.refresh == 'function') {
+ $('stat_cats_frame').contentWindow.refresh();
+ }
+ if ($('surveys_frame').contentWindow && typeof $('surveys_frame').contentWindow.refresh == 'function') {
+ $('surveys_frame').contentWindow.refresh();
+ }
+ if ($('group_frame').contentWindow && typeof $('group_frame').contentWindow.refresh == 'function') {
+ $('group_frame').contentWindow.refresh();
}
} catch(E) {
alert(E);
g.error.sdump('D_TRACE','my_init() for patron_info_group.xul');
- g.patron_id = xul_param('patron_id');
+ g.cgi = new CGI();
+ g.patron_id = g.cgi.param('patron_id');
tree_init();
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
for (var i = 0; i < g.sel_list.length; i++) {
try {
- var url = urls.XUL_PATRON_DISPLAY// + '?id=' + window.escape( g.sel_list[i] );
+ var url = urls.XUL_PATRON_DISPLAY
+ + '?id=' + window.escape( g.sel_list[i] );
window.xulG.new_tab(
- url,
- { 'tab_name' : 'Retrieving Patron..' },
- {
- 'id' : g.sel_list[i],
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- }
+ url, { 'tab_name' : 'Retrieving Patron..' }, {}
);
} catch(E) {
g.error.standard_unexpected_error_alert('Failed to retrieve patron.',E);
if (! g.sel_list ) return;
try {
for (var i = 0; i < g.sel_list.length; i++) {
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER );
- //+ '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses='
- //+ window.escape( ses() ) + '&clone=' + g.sel_list[i] );
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') xulG.new_tab(
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER )
+ + '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses='
+ + window.escape( ses() ) + '&clone=' + g.sel_list[i] );
+ xulG.new_tab(
loc,
{},
{
- 'url' : urls.XUL_PATRON_EDIT, // + '?ses=' + window.escape(ses()) + '&clone=' + g.sel_list[i],
'show_print_button' : true ,
'tab_name' : 'Register Patron Clone for Group' ,
'passthru_content_params' : {
- 'ses' : ses(),
- 'clone' : g.sel_list[i],
'spawn_search' : spawn_search,
'spawn_editor' : spawn_editor,
'on_save' : function() { refresh(); },
function spawn_editor(p) {
var url = urls.XUL_PATRON_EDIT;
- var passthru = {
- 'spawn_search' : spawn_search,
- 'spawn_editor' : spawn_editor,
- 'on_save' : function() { refresh(); },
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- };
+ var param_count = 0;
for (var i in p) {
- passthru[i] = p[i];
+ if (param_count++ == 0) url += '?'; else url += '&';
+ url += i + '=' + window.escape(p[i]);
}
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') xulG.new_tab(
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+ xulG.new_tab(
loc,
{},
{
- 'url' : url,
'show_print_button' : true ,
'tab_name' : 'Editing Related Patron' ,
- 'passthru_content_params' : passthru,
+ 'passthru_content_params' : {
+ 'spawn_search' : spawn_search,
+ 'spawn_editor' : spawn_editor,
+ 'on_save' : function() { refresh(); },
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ },
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
}
try {
g.error.sdump('D_TRACE', 'Editor would like to search for: ' + js2JSON(s) );
var loc = xulG.url_prefix(urls.XUL_PATRON_DISPLAY);
- //loc += '?doit=1&query=' + window.escape(js2JSON(s));
- if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function')
- xulG.new_tab( loc, {}, {'doit':1,'query':s} );
+ loc += '?doit=1&query=' + window.escape(js2JSON(s));
+ xulG.new_tab( loc, {}, {} );
} catch(E) {
g.error.standard_unexpected_error_alert('spawn search',E);
}
var bot_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto"><hbox>';
bot_xml += '</hbox></vbox>';
- //g.data.temp_top = top_xml; g.data.stash('temp_top');
- //g.data.temp_mid = xml; g.data.stash('temp_mid');
- //g.data.temp_bot = bot_xml; g.data.stash('temp_bot');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_mid'
- //+ '&top_xml_in_stash=temp_top'
- //+ '&bottom_xml_in_stash=temp_bot'
- //+ '&title=' + window.escape('Move Patron into a Usergroup'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'top_xml' : top_xml, 'bottom_xml' : bot_xml, 'title' : 'Move Patron into a Usergroup' }
+ g.data.temp_top = top_xml; g.data.stash('temp_top');
+ g.data.temp_mid = xml; g.data.stash('temp_mid');
+ g.data.temp_bot = bot_xml; g.data.stash('temp_bot');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_mid'
+ + '&top_xml_in_stash=temp_top'
+ + '&bottom_xml_in_stash=temp_bot'
+ + '&title=' + window.escape('Move Patron into a Usergroup'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data.fancy_status == 'incomplete') { continue; }
+ g.data.init({'via':'stash'});
+ if (g.data.fancy_prompt_data == '') { continue; }
else {
var patron_c;
switch(direction) {
g.error.sdump('D_TRACE','my_init() for patron_info.xul');
- g.patron_id = xul_param('patron_id');
-
- g.new_note = false;
+ g.cgi = new CGI();
+ g.patron_id = g.cgi.param('patron_id');
refresh();
}
function retrieve_notes() {
- if (g.new_note) {
- g.notes = g.network.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
- g.new_note = false;
- } else {
- g.notes = g.network.cached_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
- }
+ g.notes = g.network.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
}
function apply(node,field,value) {
var r = g.error.yns_alert('Delete the note titled "' + g.notes[id].title() + '" created on ' + g.notes[id].create_date().toString().substr(0,10) + '?','Delete Note','Yes','No',null,'Check here to confirm this action');
if (r == 0) {
g.network.simple_request('FM_AUN_DELETE',[ses(),g.notes[id].id()]);
- setTimeout(function(){ g.new_note = true; alert('Note deleted.'); refresh();},0);
+ setTimeout(function(){ alert('Note deleted.'); refresh();},0);
}
} }(i),
false
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1"><caption label="New Note"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows><row><label value="Patron Visible?"/><checkbox id="pub" name="fancy_data"/></row><row><label value="Title"/><textbox id="title" name="fancy_data"/></row><row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row><row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/><button label="Add Note" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- //g.data.init({'via':'stash'});
- //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
- JSAN.use('util.window'); var win = new util.window();
- var fancy_prompt_data = win.open(
- urls.XUL_FANCY_PROMPT,
- //+ '?xml_in_stash=temp_note_xml'
- //+ '&focus=' + window.escape('title')
- //+ '&title=' + window.escape('Add Note'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'focus' : 'title', 'title' : 'Add Note' }
+ g.data.init({'via':'stash'});
+ g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_note_xml'
+ + '&focus=' + window.escape('title')
+ + '&title=' + window.escape('Add Note'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
);
- if (fancy_prompt_data.fancy_status == 'complete') {
+ g.data.init({'via':'stash'});
+ if (g.data.fancy_prompt_data != '') {
//alert(js2JSON(g.data.fancy_prompt_data));
var note = new aun();
note.isnew(1);
- note.title( fancy_prompt_data.title );
- note.value( fancy_prompt_data.note );
- note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
+ note.title( g.data.fancy_prompt_data.title );
+ note.value( g.data.fancy_prompt_data.note );
+ note.pub( get_bool( g.data.fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
note.usr( g.patron_id );
var r = g.network.simple_request('FM_AUN_CREATE',[ ses(), note ]);
if (typeof r.ilsevent != 'undefined') throw(r);
- setTimeout(function(){ g.new_note = true; alert('Note added.'); refresh();},0);
+ setTimeout(function(){ alert('Note added.'); refresh();},0);
}
} catch(E) {
g.error.standard_unexpected_error_alert('The note was not likely created.',E);
g.error.sdump('D_TRACE','my_init() for patron_info_stat_cats.xul');
- g.patron_id = xul_param('patron_id');
+ g.cgi = new CGI();
+ g.patron_id = g.cgi.param('patron_id');
refresh();
g.error.sdump('D_TRACE','my_init() for patron_info_surveys.xul');
- g.patron_id = xul_param('patron_id');
+ g.cgi = new CGI();
+ g.patron_id = g.cgi.param('patron_id');
refresh();
try {
var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
if (!retrieve_ids || retrieve_ids.length == 0) return;
- JSAN.use('util.window'); var win = new util.window();
+ JSAN.use('util.window');
+ var win = new util.window();
for (var i = 0; i < retrieve_ids.length; i++) {
var circ_id = retrieve_ids[i].circ_id;
- var my_xulG = win.open(
- urls.XUL_PATRON_BILL_WIZARD,
- //+ '?patron_id=' + window.escape(obj.patron_id)
- //+ '&xact_id=' + window.escape( circ_id ),
+ var w = win.open(
+ urls.XUL_PATRON_BILL_WIZARD
+ + '?patron_id=' + window.escape(obj.patron_id)
+ + '&xact_id=' + window.escape( circ_id ),
'billwizard',
- 'chrome,resizable,modal',
- { 'patron_id' : obj.patron_id, 'xact_id' : circ_id }
+ 'chrome,resizable,modal'
);
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
try { g.error.sdump('D_TRACE','my_init() for items.xul'); } catch(E) { dump(E); }
+ g.cgi = new CGI();
+
JSAN.use('patron.items'); g.items = new patron.items();
g.items.init(
{
- 'patron_id' : xul_param('patron_id'),
+ 'patron_id' : g.cgi.param('patron_id'),
}
);
for (var i = 0; i < keys.length; i++) {
query[keys[i]] = g.cgi.param(keys[i]);
}
- if (typeof xulG != 'undefined') if (xulG.query) {
- for (var i in xulG.query) {
- query[i] = xulG.query[i];
- }
- }
JSAN.use('patron.search_result'); g.search_result = new patron.search_result();
g.search_result.init( { 'query' : query } );
function(e) {
return function() {
e.setAttribute('value','...');
- obj.network.cached_request(
+ obj.network.simple_request(
'FM_MOUS_RETRIEVE',
[ ses(), obj.patron.id() ],
function(req) {
var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) e4.setAttribute('value','...');
var e5 = document.getElementById( 'patron_lost' ); if (e5) e5.setAttribute('value','...');
var e6 = document.getElementById( 'patron_noncat' ); if (e6) e6.setAttribute('value','...');
- obj.network.cached_request(
+ obj.network.simple_request(
'FM_CIRC_COUNT_RETRIEVE_VIA_USER',
[ ses(), obj.patron.id() ],
function(req) {
- try {
- var robj = req.getResultObject();
- e.setAttribute('value', robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
- if (e2) e2.setAttribute('value', robj.overdue );
- if (e3) e3.setAttribute('value', robj.claims_returned );
- if (e4) e4.setAttribute('value', robj.long_overdue );
- if (e5) e5.setAttribute('value', robj.lost );
- } catch(E) {
- alert(E);
- }
+ var robj = req.getResultObject();
+ e.setAttribute('value', robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
+ if (e2) e2.setAttribute('value', robj.overdue );
+ if (e3) e3.setAttribute('value', robj.claims_returned );
+ if (e4) e4.setAttribute('value', robj.long_overdue );
+ if (e5) e5.setAttribute('value', robj.lost );
}
);
obj.network.simple_request(
try {
var robj;
if (obj.barcode && obj.barcode != 'null') {
- robj = obj.network.simple_request(
- 'FM_AU_RETRIEVE_VIA_BARCODE',
+ robj = obj.network.request(
+ api.FM_AU_RETRIEVE_VIA_BARCODE.app,
+ api.FM_AU_RETRIEVE_VIA_BARCODE.method,
[ ses(), obj.barcode ]
);
} else if (obj.id && obj.id != 'null') {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron_summary.xul');
- var patron_id = xul_param('id');
- var patron_bc = xul_param('barcode');
+ g.cgi = new CGI();
+
+ var patron_id = g.cgi.param('id');
+ if (typeof window.xulG == 'object' && typeof window.xulG.id != 'undefined') patron_id = window.xulG.id;
+ var patron_bc = g.cgi.param('barcode');
+ if (typeof window.xulG == 'object' && typeof window.xulG.barcode != 'undefined') patron_bc = window.xulG.barcode;
JSAN.use('patron.summary'); g.summary = new patron.summary();
g.summary.init( {
'barcode' : patron_bc,
'id' : patron_id,
- 'show_name' : xul_param('show_name'),
+ 'show_name' : g.cgi.param('show_name'),
} );
window.refresh = function () { g.summary.retrieve(); }
_debug('uEditInit(): ' + location.search);
cgi = new CGI();
- session = cgi.param('ses');
- if (xulG) if (xulG.ses) session = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
- clone = cgi.param('clone');
- if (xulG) if (xulG.clone) clone = xulG.clone;
- if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
+ session = cgi.param('ses');
+ clone = cgi.param('clone');
if(!session) throw "User session is not defined";
fetchUser(session);
fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
uEditBuildLibSelector();
- var usr = cgi.param('usr');
- if (xulG) if (xulG.usr) usr = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
- patron = fetchFleshedUser(usr);
+ patron = fetchFleshedUser(cgi.param('usr'));
if(!patron) patron = uEditNewPatron();
_debug("xulG funcs defined...");
if( !patron.isnew() && cloneme ) {
_debug("calling spawn_editor to clone user...");
- var ses = cgi.param('ses');
- if (xulG.ses) ses = xulG.ses;
- if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
- window.xulG.spawn_editor({ses:ses,clone:cloneme});
+ window.xulG.spawn_editor({ses:cgi.param('ses'),clone:cloneme});
}
window.xulG.on_save(newuser, cloneme);
var href = location.href;
href = href.replace(/\&?usr=\d+/, '');
href = href.replace(/\&?clone=\d+/, '');
- var id = cgi.param('usr');
- if (xulG) if (xulG.usr) id = xulG.usr;
- if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
+ var id = cgi.param('usr')
/* reload the current user if available */
if( id ) href += "&usr=" + id;
location.href = href;
hideMe($n(row, 'owner_link_div'));
} else {
-
- var ses = cgi.param('ses');
- if (xulG.ses) ses = xulG.ses;
- if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+
link.onclick =
- function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
+ function() { window.xulG.spawn_editor({ses:cgi.param('ses'),usr:id}) };
if( userCache[id] ) {
nnode.appendChild(text(
var x = document.getElementById('editor').elements;
cgi = new CGI();
- if (cgi.param('adv')) adv_mode = true;
- if (xulG) if (xulG.adv) adv_mode = true;
- if (xulG) if (xulG.params) if (xulG.params.adv) adv_mode = true;
+ if (cgi.param('adv')) adv_mode = true;
apply_adv_mode(document.getElementById('editor'));
- ses_id = cgi.param('ses');
- if (xulG) if (xulG.ses) ses_id = xulG.ses;
- if (xulG) if (xulG.params) if (xulG.params.ses) ses_id = xulG.params.ses;
+ ses_id = cgi.param('ses');
- var usr_id = cgi.param('usr');
- if (xulG) if (xulG.usr_id) usr_id = xulG.usr_id;
- if (xulG) if (xulG.params) if (xulG.params.usr_id) usr_id = xulG.params.usr_id;
-
- var usr_barcode = cgi.param('barcode');
- if (xulG) if (xulG.usr_barcode) usr_ibarcode = xulG.usr_barcode;
- if (xulG) if (xulG.params) if (xulG.params.usr_barcode) usr_ibarcode = xulG.params.usr_barcode;
+ var usr_id = cgi.param('usr');
+ var usr_barcode = cgi.param('barcode');
try {
var req;
uEditSetVal( patron, "ident_value", $('ue_primary_ident'), null, err );
*/
- //FIXME - I think this file is deprecated, but there's this syntax error sitting here
- //var identdata = uEditParseIdent(
+ var identdata = uEditParseIdent(
var it1 = getSelectorVal($('ue_primary_ident_type'));
var name = getSelectorName($('ue_primary_ident_type'));
patron.util.retrieve_au_via_id = function(session, id, f) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.cached_request(
- 'FM_AU_RETRIEVE_VIA_ID',
+ var patron_obj = network.request(
+ api.FM_AU_RETRIEVE_VIA_ID.app,
+ api.FM_AU_RETRIEVE_VIA_ID.method,
[ session, id ],
f
);
patron.util.retrieve_name_via_id = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var parts = network.cached_request(
+ var parts = network.simple_request(
'BLOB_AU_PARTS_RETRIEVE',
[ session, id, ['family_name', 'first_given_name', 'second_given_name', 'home_ou' ] ]
);
patron.util.retrieve_fleshed_au_via_id = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.cached_request(
+ var patron_obj = network.simple_request(
'FM_AU_FLESHED_RETRIEVE_VIA_ID',
[ session, id ]
);
patron.util.retrieve_fleshed_au_via_barcode = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.cached_request(
+ var patron_obj = network.simple_request(
'FM_AU_RETRIEVE_VIA_BARCODE',
[ session, id ]
);
removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
JSAN.use('util.network'); var net = new util.network();
- net.cached_request('FM_MOUS_RETRIEVE',[ ses(), patron.id() ], function(req) {
+ net.simple_request('FM_MOUS_RETRIEVE',[ ses(), patron.id() ], function(req) {
if (req.getResultObject().balance_owed() > 0) addCSSClass(document.documentElement,'PATRON_HAS_BILLS');
});
- net.cached_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER',[ ses(), patron.id() ], function(req) {
- try {
- var co = req.getResultObject();
- if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
- } catch(E) {
- alert(E);
- }
+ net.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER',[ ses(), patron.id() ], function(req) {
+ var co = req.getResultObject();
+ if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
});
- net.cached_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : patron.id() } ], function(req) {
+ net.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : patron.id() } ], function(req) {
var notes = req.getResultObject();
if (notes.length > 0) addCSSClass(document.documentElement,'PATRON_HAS_NOTES');
});