From b228af4f48afc2aee74b7a7b1fe3e62fc43afaed Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 23 Oct 2009 16:26:24 +0000 Subject: [PATCH] Change each tab to 4 spaces in the staff client javascript files. Did this to effect the change: find . -name '*.js' -exec sed -i 's/\t/ /g' {} \; Statements like dump('\t\tFoo\n'); are unaffected. I imagine we'll need to realign and reindent things as we encounter visual ugliness. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14577 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/OpenILS/data.js | 1658 +++---- .../chrome/content/OpenILS/global_util.js | 372 +- .../chrome/content/OpenILS/util/fmall.js | 24 +- .../staff_client/chrome/content/admin/survey.js | 386 +- .../staff_client/chrome/content/auth/controller.js | 942 ++-- .../staff_client/chrome/content/auth/session.js | 234 +- .../xul/staff_client/chrome/content/cat/opac.js | 500 +- .../staff_client/chrome/content/circ/offline.js | 266 +- .../chrome/content/circ/offline_checkin.js | 176 +- .../chrome/content/circ/offline_checkout.js | 506 +- .../chrome/content/circ/offline_in_house_use.js | 200 +- .../chrome/content/circ/offline_register.js | 614 +-- .../chrome/content/circ/offline_renew.js | 416 +- .../xul/staff_client/chrome/content/circ/util.js | 508 +- .../staff_client/chrome/content/main/constants.js | 636 +-- .../xul/staff_client/chrome/content/main/main.js | 622 +-- .../xul/staff_client/chrome/content/main/menu.js | 1868 ++++---- .../xul/staff_client/chrome/content/test/test.js | 6 +- .../staff_client/chrome/content/util/barcode.js | 48 +- .../staff_client/chrome/content/util/browser.js | 474 +- .../staff_client/chrome/content/util/clipboard.js | 6 +- .../staff_client/chrome/content/util/controller.js | 100 +- .../xul/staff_client/chrome/content/util/date.js | 276 +- .../xul/staff_client/chrome/content/util/deck.js | 350 +- .../xul/staff_client/chrome/content/util/error.js | 1062 ++--- .../xul/staff_client/chrome/content/util/exec.js | 122 +- .../xul/staff_client/chrome/content/util/file.js | 518 +- .../staff_client/chrome/content/util/fm_utils.js | 196 +- .../staff_client/chrome/content/util/functional.js | 186 +- .../xul/staff_client/chrome/content/util/list.js | 2234 ++++----- .../xul/staff_client/chrome/content/util/money.js | 108 +- .../staff_client/chrome/content/util/mozilla.js | 46 +- .../staff_client/chrome/content/util/network.js | 678 +-- .../xul/staff_client/chrome/content/util/print.js | 658 +-- .../xul/staff_client/chrome/content/util/sound.js | 106 +- .../staff_client/chrome/content/util/sprintf.js | 96 +- .../xul/staff_client/chrome/content/util/text.js | 38 +- .../staff_client/chrome/content/util/widgets.js | 602 +-- .../xul/staff_client/chrome/content/util/window.js | 202 +- Open-ILS/xul/staff_client/components/nsOpenILS.js | 2 +- Open-ILS/xul/staff_client/external/template.js | 58 +- Open-ILS/xul/staff_client/server/admin/adminlib.js | 134 +- .../xul/staff_client/server/admin/cash_reports.js | 168 +- .../xul/staff_client/server/admin/closed_dates.js | 540 +-- .../staff_client/server/admin/copy_locations.js | 270 +- .../staff_client/server/admin/hold_pull_list.js | 142 +- .../server/admin/hold_pull_list_classic.js | 366 +- .../xul/staff_client/server/admin/non_cat_types.js | 270 +- .../server/admin/offline_manage_xacts.js | 1754 +++---- .../staff_client/server/admin/printer_settings.js | 70 +- .../staff_client/server/admin/stat_cat_editor.js | 488 +- .../xul/staff_client/server/admin/transit_list.js | 866 ++-- .../xul/staff_client/server/admin/upload_xacts.js | 86 +- .../xul/staff_client/server/cat/copy_browser.js | 3278 ++++++------- .../xul/staff_client/server/cat/copy_buckets.js | 1108 ++--- .../xul/staff_client/server/cat/copy_editor.js | 1840 +++---- Open-ILS/xul/staff_client/server/cat/marcedit.js | 3634 +++++++------- .../xul/staff_client/server/cat/record_buckets.js | 1478 +++--- .../xul/staff_client/server/cat/spine_labels.js | 542 +-- Open-ILS/xul/staff_client/server/cat/util.js | 674 +-- .../staff_client/server/cat/volume_copy_creator.js | 816 ++-- Open-ILS/xul/staff_client/server/cat/z3950.js | 1094 ++--- .../server/circ/backdate_post_checkin.js | 2 +- Open-ILS/xul/staff_client/server/circ/checkin.js | 790 ++-- Open-ILS/xul/staff_client/server/circ/checkout.js | 1612 +++---- .../xul/staff_client/server/circ/copy_status.js | 2050 ++++---- .../xul/staff_client/server/circ/in_house_use.js | 612 +-- .../server/circ/print_list_template_editor.js | 750 +-- Open-ILS/xul/staff_client/server/circ/renew.js | 590 +-- Open-ILS/xul/staff_client/server/circ/util.js | 4996 ++++++++++---------- .../staff_client/server/main/verify_credentials.js | 2 +- Open-ILS/xul/staff_client/server/patron/bills.js | 2054 ++++---- Open-ILS/xul/staff_client/server/patron/display.js | 958 ++-- .../server/patron/edit_standing_penalty.js | 2 +- .../xul/staff_client/server/patron/hold_cancel.js | 2 +- Open-ILS/xul/staff_client/server/patron/holds.js | 1434 +++--- Open-ILS/xul/staff_client/server/patron/items.js | 1518 +++--- .../server/patron/new_standing_penalty.js | 2 +- .../xul/staff_client/server/patron/search_form.js | 560 +-- .../staff_client/server/patron/search_result.js | 404 +- .../server/patron/standing_penalties.js | 2 +- Open-ILS/xul/staff_client/server/patron/summary.js | 1230 ++--- Open-ILS/xul/staff_client/server/patron/ue.js | 962 ++-- .../xul/staff_client/server/patron/ue_config.js | 1900 ++++---- Open-ILS/xul/staff_client/server/patron/ue_ui.js | 622 +-- .../xul/staff_client/server/patron/user_edit.js | 740 +-- Open-ILS/xul/staff_client/server/patron/util.js | 1316 +++--- 87 files changed, 31414 insertions(+), 31414 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index 17b5dae82e..1cf9ab14c2 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -11,851 +11,851 @@ OpenILS.data = function () { throw(E); } - return this; + return this; } OpenILS.data.prototype = { - 'list' : {}, - 'hash' : {}, - 'tree' : {}, - - 'temp' : '', - - 'data_progress' : function(msg) { - try { - var x = document.getElementById('data_progress'); - if (x) { - x.appendChild( document.createTextNode( msg ) ); - } - } catch(E) { - this.error.sdump('D_ERROR',msg + '\n' + E); - } - }, - - 'init' : function (params) { - - try { - if (params && params.via == 'stash') { - this.stash_retrieve(); - } else { - this.network_retrieve(); - } - - } catch(E) { - this.error.sdump('D_ERROR','Error in OpenILS.data.init(' - +js2JSON(params)+'): ' + js2JSON(E) ); - } - - - }, - - // 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] ]; - - /* - - // experiment with storing only json in cache to avoid the [ ] -> { '0' : .., '1' : .. } bug - - if (stash[observed_prop] && getKeys( obj.observers.cache[ full_path ] ).length == 0) { - stash['_' + observed_prop] = js2JSON(stash[observed_prop]); - } - - stash.__defineSetter__(observed_prop, function(x) { this['_'+observed_prop] = js2JSON(x); }); - stash.__defineGetter__(observed_prop, function() { return JSON2js(this['_'+observed_prop]); }); - */ - - 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"); - const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - var data_cache=new OpenILS( ); - for (var i = 0; i < arguments.length; i++) { - try { - if (arguments[i] != 'hash' && arguments[i] != 'list') this.error.sdump('D_DATA_STASH','stashing ' + arguments[i] + ' : ' + this[arguments[i]] + (typeof this[arguments[i]] == 'object' ? ' = ' + (this[arguments[i]]) : '') + '\n'); - } catch(F) { alert(F); } - data_cache.wrappedJSObject.OpenILS.prototype.data[arguments[i]] = this[arguments[i]]; - } - } catch(E) { - this.error.sdump('D_ERROR','Error in OpenILS.data.stash(): ' + js2JSON(E) ); - } - }, - - 'lookup' : function(key,value) { - try { - var obj = this; var found; - if (obj.hash[key] && obj.hash[key][value]) return obj.hash[key][value]; - switch(key) { - case 'acpl': - found = obj.network.simple_request('FM_ACPL_RETRIEVE_VIA_ID.authoritative',[ value ]); - break; - default: return undefined; break; - } - if (typeof found.ilsevent != 'undefined') throw(found); - if (!obj.hash[key]) obj.hash[key] = {}; - obj.hash[key][value] = found; obj.list[key].push( found ); obj.stash('hash','list'); - return found; - } catch(E) { - this.error.sdump('D_ERROR','Error in OpenILS.data.lookup('+key+','+value+'): ' + js2JSON(E) ); - return undefined; - } - }, - - '_debug_stash' : function() { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - var data_cache=new OpenILS( ); - for (var i in data_cache.wrappedJSObject.OpenILS.prototype.data) { - dump('_debug_stash ' + i + '\n'); - } - } catch(E) { - this.error.sdump('D_ERROR','Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); - } - }, - - '_fm_objects' : { - - 'pgt' : [ api.FM_PGT_RETRIEVE.app, api.FM_PGT_RETRIEVE.method, [], true ], - 'cit' : [ api.FM_CIT_RETRIEVE.app, api.FM_CIT_RETRIEVE.method, [], true ], - 'citm' : [ api.FM_CITM_RETRIEVE.app, api.FM_CITM_RETRIEVE.method, [], true ], - /* - 'cst' : [ api.FM_CST_RETRIEVE.app, api.FM_CST_RETRIEVE.method, [], true ], - */ - /* - 'acpl' : [ api.FM_ACPL_RETRIEVE.app, api.FM_ACPL_RETRIEVE.method, [], true ], - */ - 'ccs' : [ api.FM_CCS_RETRIEVE.app, api.FM_CCS_RETRIEVE.method, [], true ], - 'aou' : [ api.FM_AOU_RETRIEVE.app, api.FM_AOU_RETRIEVE.method, [], true ], - 'aout' : [ api.FM_AOUT_RETRIEVE.app, api.FM_AOUT_RETRIEVE.method, [], true ], - 'crahp' : [ api.FM_CRAHP_RETRIEVE.app, api.FM_CRAHP_RETRIEVE.method, [], true ] - }, - - 'stash_retrieve' : function() { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - var data_cache=new OpenILS( ); - var dc = data_cache.wrappedJSObject.OpenILS.prototype.data; - for (var i in dc) { - this.error.sdump('D_DATA_RETRIEVE','Retrieving ' + i + ' : ' + dc[i] + '\n'); - this[i] = dc[i]; - } - if (typeof this.on_complete == 'function') { - - this.on_complete(); - } - } catch(E) { - this.error.sdump('D_ERROR','Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); - } - }, - - 'print_list_defaults' : function() { - var obj = this; - //if (typeof obj.print_list_templates == 'undefined') { - { - obj.print_list_types = [ - 'offline_checkout', - 'offline_checkin', - 'offline_renew', - 'offline_inhouse_use', - 'items', - 'bills', - 'payment', - 'holds', - /* 'patrons' */ - ]; - obj.print_list_templates = { - 'item_status' : { - 'type' : 'items', - 'header' : 'The following items have been examined:
    ', - 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'transit_list' : { - 'type' : 'transits', - 'header' : 'Transits:
    ', - 'line_item' : '
  1. From: %transit_source% To: %transit_dest_lib%
    \r\nWhen: %transit_source_send_time%
    \r\nBarcode: %transit_item_barcode% Title: %transit_item_title%
    \r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'items_out' : { - 'type' : 'items', - 'header' : 'Welcome to %LIBRARY%!
\r\nYou have the following items:
    ', - 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' - }, - 'renew' : { - 'type' : 'items', - 'header' : 'Welcome to %LIBRARY%!
\r\nYou have renewed the following items:
    ', - 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' - }, - 'checkout' : { - 'type' : 'items', - 'header' : 'Welcome to %LIBRARY%!
\r\nYou checked out the following items:
    ', - 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' - }, - 'offline_checkout' : { - 'type' : 'offline_checkout', - 'header' : 'Patron %patron_barcode%
\r\nYou checked out the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%
    \r\nDue: %due_date%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' - }, - 'checkin' : { - 'type' : 'items', - 'header' : 'You checked in the following items:
    ', - 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Call Number: %call_number%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'bill_payment' : { - 'type' : 'payment', - 'header' : 'Welcome to %LIBRARY%!
A receipt of your transaction:
Original Balance: $%original_balance%
Payment Method: %payment_type%
Payment Received: $%payment_received%
Payment Applied: $%payment_applied%
Billings Voided: %voided_balance%
Change Given: $%change_given%
New Balance: $%new_balance%

Note: %note%

Specific bills:

', - 'line_item' : 'Bill #%bill_id% %last_billing_type% Received: $%payment%
%barcode% %title%

', - 'footer' : '


%SHORTNAME% %TODAY_TRIM%

' - }, - 'bills_historical' : { - 'type' : 'bills', - 'header' : 'Welcome to %LIBRARY%!
You had the following bills:
    ', - 'line_item' : '
    Bill #%id%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'bills_current' : { - 'type' : 'bills', - 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', - 'line_item' : '
    Bill #%id%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'bills_main_view' : { - 'type' : 'bills', - 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', - 'line_item' : '
    Bill #%id% %title%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' - }, - 'offline_checkin' : { - 'type' : 'offline_checkin', - 'header' : 'You checked in the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' - }, - 'offline_renew' : { - 'type' : 'offline_renew', - 'header' : 'You renewed the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' - }, - 'offline_inhouse_use' : { - 'type' : 'offline_inhouse_use', - 'header' : 'You marked the following in-house items used:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %count%', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' - }, - 'in_house_use' : { - 'type' : 'items', - 'header' : 'You marked the following in-house items used:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %uses%\r\n
    %alert_message%', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' - }, - 'holds' : { - 'type' : 'holds', - 'header' : 'Welcome to %LIBRARY%!
\r\nYou have the following titles on hold:
    ', - 'line_item' : '
  1. %title%\r\n', - 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' - }, + 'list' : {}, + 'hash' : {}, + 'tree' : {}, + + 'temp' : '', + + 'data_progress' : function(msg) { + try { + var x = document.getElementById('data_progress'); + if (x) { + x.appendChild( document.createTextNode( msg ) ); + } + } catch(E) { + this.error.sdump('D_ERROR',msg + '\n' + E); + } + }, + + 'init' : function (params) { + + try { + if (params && params.via == 'stash') { + this.stash_retrieve(); + } else { + this.network_retrieve(); + } + + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data.init(' + +js2JSON(params)+'): ' + js2JSON(E) ); + } + + + }, + + // 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] ]; + + /* + + // experiment with storing only json in cache to avoid the [ ] -> { '0' : .., '1' : .. } bug + + if (stash[observed_prop] && getKeys( obj.observers.cache[ full_path ] ).length == 0) { + stash['_' + observed_prop] = js2JSON(stash[observed_prop]); + } + + stash.__defineSetter__(observed_prop, function(x) { this['_'+observed_prop] = js2JSON(x); }); + stash.__defineGetter__(observed_prop, function() { return JSON2js(this['_'+observed_prop]); }); + */ + + 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"); + const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + var data_cache=new OpenILS( ); + for (var i = 0; i < arguments.length; i++) { + try { + if (arguments[i] != 'hash' && arguments[i] != 'list') this.error.sdump('D_DATA_STASH','stashing ' + arguments[i] + ' : ' + this[arguments[i]] + (typeof this[arguments[i]] == 'object' ? ' = ' + (this[arguments[i]]) : '') + '\n'); + } catch(F) { alert(F); } + data_cache.wrappedJSObject.OpenILS.prototype.data[arguments[i]] = this[arguments[i]]; + } + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data.stash(): ' + js2JSON(E) ); + } + }, + + 'lookup' : function(key,value) { + try { + var obj = this; var found; + if (obj.hash[key] && obj.hash[key][value]) return obj.hash[key][value]; + switch(key) { + case 'acpl': + found = obj.network.simple_request('FM_ACPL_RETRIEVE_VIA_ID.authoritative',[ value ]); + break; + default: return undefined; break; + } + if (typeof found.ilsevent != 'undefined') throw(found); + if (!obj.hash[key]) obj.hash[key] = {}; + obj.hash[key][value] = found; obj.list[key].push( found ); obj.stash('hash','list'); + return found; + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data.lookup('+key+','+value+'): ' + js2JSON(E) ); + return undefined; + } + }, + + '_debug_stash' : function() { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + var data_cache=new OpenILS( ); + for (var i in data_cache.wrappedJSObject.OpenILS.prototype.data) { + dump('_debug_stash ' + i + '\n'); + } + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); + } + }, + + '_fm_objects' : { + + 'pgt' : [ api.FM_PGT_RETRIEVE.app, api.FM_PGT_RETRIEVE.method, [], true ], + 'cit' : [ api.FM_CIT_RETRIEVE.app, api.FM_CIT_RETRIEVE.method, [], true ], + 'citm' : [ api.FM_CITM_RETRIEVE.app, api.FM_CITM_RETRIEVE.method, [], true ], + /* + 'cst' : [ api.FM_CST_RETRIEVE.app, api.FM_CST_RETRIEVE.method, [], true ], + */ + /* + 'acpl' : [ api.FM_ACPL_RETRIEVE.app, api.FM_ACPL_RETRIEVE.method, [], true ], + */ + 'ccs' : [ api.FM_CCS_RETRIEVE.app, api.FM_CCS_RETRIEVE.method, [], true ], + 'aou' : [ api.FM_AOU_RETRIEVE.app, api.FM_AOU_RETRIEVE.method, [], true ], + 'aout' : [ api.FM_AOUT_RETRIEVE.app, api.FM_AOUT_RETRIEVE.method, [], true ], + 'crahp' : [ api.FM_CRAHP_RETRIEVE.app, api.FM_CRAHP_RETRIEVE.method, [], true ] + }, + + 'stash_retrieve' : function() { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + const OpenILS=new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + var data_cache=new OpenILS( ); + var dc = data_cache.wrappedJSObject.OpenILS.prototype.data; + for (var i in dc) { + this.error.sdump('D_DATA_RETRIEVE','Retrieving ' + i + ' : ' + dc[i] + '\n'); + this[i] = dc[i]; + } + if (typeof this.on_complete == 'function') { + + this.on_complete(); + } + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data._debug_stash(): ' + js2JSON(E) ); + } + }, + + 'print_list_defaults' : function() { + var obj = this; + //if (typeof obj.print_list_templates == 'undefined') { + { + obj.print_list_types = [ + 'offline_checkout', + 'offline_checkin', + 'offline_renew', + 'offline_inhouse_use', + 'items', + 'bills', + 'payment', + 'holds', + /* 'patrons' */ + ]; + obj.print_list_templates = { + 'item_status' : { + 'type' : 'items', + 'header' : 'The following items have been examined:
    ', + 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'transit_list' : { + 'type' : 'transits', + 'header' : 'Transits:
    ', + 'line_item' : '
  1. From: %transit_source% To: %transit_dest_lib%
    \r\nWhen: %transit_source_send_time%
    \r\nBarcode: %transit_item_barcode% Title: %transit_item_title%
    \r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'items_out' : { + 'type' : 'items', + 'header' : 'Welcome to %LIBRARY%!
\r\nYou have the following items:
    ', + 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' + }, + 'renew' : { + 'type' : 'items', + 'header' : 'Welcome to %LIBRARY%!
\r\nYou have renewed the following items:
    ', + 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' + }, + 'checkout' : { + 'type' : 'items', + 'header' : 'Welcome to %LIBRARY%!
\r\nYou checked out the following items:
    ', + 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Due: %due_date%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' + }, + 'offline_checkout' : { + 'type' : 'offline_checkout', + 'header' : 'Patron %patron_barcode%
\r\nYou checked out the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%
    \r\nDue: %due_date%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' + }, + 'checkin' : { + 'type' : 'items', + 'header' : 'You checked in the following items:
    ', + 'line_item' : '
  1. %title%
    \r\nBarcode: %barcode% Call Number: %call_number%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'bill_payment' : { + 'type' : 'payment', + 'header' : 'Welcome to %LIBRARY%!
A receipt of your transaction:
Original Balance: $%original_balance%
Payment Method: %payment_type%
Payment Received: $%payment_received%
Payment Applied: $%payment_applied%
Billings Voided: %voided_balance%
Change Given: $%change_given%
New Balance: $%new_balance%

Note: %note%

Specific bills:

', + 'line_item' : 'Bill #%bill_id% %last_billing_type% Received: $%payment%
%barcode% %title%

', + 'footer' : '


%SHORTNAME% %TODAY_TRIM%

' + }, + 'bills_historical' : { + 'type' : 'bills', + 'header' : 'Welcome to %LIBRARY%!
You had the following bills:
    ', + 'line_item' : '
    Bill #%id%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'bills_current' : { + 'type' : 'bills', + 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', + 'line_item' : '
    Bill #%id%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'bills_main_view' : { + 'type' : 'bills', + 'header' : 'Welcome to %LIBRARY%!
You have the following bills:
    ', + 'line_item' : '
    Bill #%id% %title%
    Date:%xact_start%
    Type:%xact_type%
    Last Billing:%last_billing_type%
    %last_billing_note%
    Total Billed:$%total_owed%
    Last Payment:%last_payment_type%
    %last_payment_note%
    Total Paid:$%total_paid%
    Balance:$%balance_owed%

    ', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\n
\r\n' + }, + 'offline_checkin' : { + 'type' : 'offline_checkin', + 'header' : 'You checked in the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' + }, + 'offline_renew' : { + 'type' : 'offline_renew', + 'header' : 'You renewed the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' + }, + 'offline_inhouse_use' : { + 'type' : 'offline_inhouse_use', + 'header' : 'You marked the following in-house items used:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %count%', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' + }, + 'in_house_use' : { + 'type' : 'items', + 'header' : 'You marked the following in-house items used:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %uses%\r\n
    %alert_message%', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n' + }, + 'holds' : { + 'type' : 'holds', + 'header' : 'Welcome to %LIBRARY%!
\r\nYou have the following titles on hold:
    ', + 'line_item' : '
  1. %title%\r\n', + 'footer' : '

%SHORTNAME% %TODAY_TRIM%
\r\nYou were helped by %STAFF_FIRSTNAME%
\r\n
\r\n' + }, 'hold_slip' : { - 'type' : 'holds', - 'header' : 'This item needs to be routed to %route_to%:
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', + 'type' : 'holds', + 'header' : 'This item needs to be routed to %route_to%:
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', 'line_item' : '%formatted_note%
\r\n', 'footer' : '
\r\nRequest date: %request_date%
\r\nSlip Date: %TODAY_TRIM%
\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%
\r\n
\r\n' }, 'transit_slip' : { - 'type' : 'transits', - 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\n', + 'type' : 'transits', + 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\n', 'line_item' : 'Barcode: %item_barcode%
\r\nTitle: %item_title%
\r\nAuthor: %item_author%
\r\n
\r\n', 'footer' : 'Slip Date: %TODAY_TRIM%
\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%
\r\n
\r\n' }, 'hold_transit_slip' : { - 'type' : 'transits', - 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\nAuthor: %item_author%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', + 'type' : 'transits', + 'header' : 'This item needs to be routed to %route_to%:
\r\n%route_to_org_fullname%
\r\n%street1%
\r\n%street2%
\r\n%city_state_zip%
\r\n
\r\nBarcode: %item_barcode%
\r\nTitle: %item_title%
\r\nAuthor: %item_author%
\r\n
\r\n%hold_for_msg%
\r\nBarcode: %PATRON_BARCODE%
\r\nNotify by phone: %notify_by_phone%
\r\nNotify by email: %notify_by_email%
\r\n', 'line_item' : '%formatted_note%
\r\n', 'footer' : '
\r\nRequest date: %request_date%
\r\nSlip Date: %TODAY_TRIM%
\r\nPrinted by %STAFF_FIRSTNAME% at %SHORTNAME%
\r\n
\r\n' } - }; - - obj.stash( 'print_list_templates', 'print_list_types' ); - } - }, - - 'network_retrieve' : function() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var obj = this; - - - JSAN.use('util.file'); var file = new util.file('print_list_templates'); - obj.print_list_defaults(); - obj.data_progress('Default print templates set. '); - if (file._file.exists()) { - try { - var x = file.get_object(); - if (x) { - for (var i in x) { - obj.print_list_templates[i] = x[i]; - } - obj.stash('print_list_templates'); - obj.data_progress('Saved print templates retrieved from file. '); - } - } catch(E) { - alert(E); - } - } - file.close(); - - JSAN.use('util.file'); var file = new util.file('global_font_adjust'); - if (file._file.exists()) { - try { - var x = file.get_object(); - if (x) { - obj.global_font_adjust = x; - obj.stash('global_font_adjust'); - obj.data_progress('Saved font settings retrieved from file. '); - } - } catch(E) { - alert(E); - } - } - file.close(); - - JSAN.use('util.file'); var file = new util.file('no_sound'); - if (file._file.exists()) { - try { - var x = file.get_content(); - if (x) { - obj.no_sound = x; - obj.stash('no_sound'); - obj.data_progress('Saved sound settings retrieved from file. '); - } - } catch(E) { - alert(E); - } - } - file.close(); - - JSAN.use('util.file'); var file = new util.file('print_strategy'); - if (file._file.exists()) { - try { - var x = file.get_content(); - if (x) { - obj.print_strategy = x; - obj.stash('print_strategy'); - obj.data_progress('Print strategy retrieved from file. '); - } - } catch(E) { - alert(E); - } - } - file.close(); - - JSAN.use('util.functional'); - JSAN.use('util.fm_utils'); - - function gen_fm_retrieval_func(classname,data) { - var app = data[0]; var method = data[1]; var params = data[2]; var cacheable = data[3]; - return function () { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - - function convert() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - try { - if (obj.list[classname].constructor.name == 'Array') { - obj.hash[classname] = - util.functional.convert_object_list_to_hash( - obj.list[classname] - ); - } - } catch(E) { - - obj.error.sdump('D_ERROR',E + '\n'); - } - - } - - try { - var level = obj.error.sdump_levels.D_SES_RESULT; - if (classname == 'aou' || classname == 'my_aou') - obj.error.sdump_levels.D_SES_RESULT = false; - var robj = obj.network.request( app, method, params); - if (robj != null && typeof robj.ilsevent != 'undefined') { - obj.error.standard_unexpected_error_alert('The staff client failed to retrieve expected data from this call, "' + method + '"',robj); - throw(robj); - } - obj.list[classname] = robj == null ? [] : robj; - obj.error.sdump_levels.D_SES_RESULT = level; - convert(); - obj.data_progress('Retrieved list for ' + classname + ' objects. '); - - } catch(E) { - // if cacheable, try offline - if (cacheable) { - /* FIXME -- we're going to revisit caching and do it differently - try { - var file = new util.file( classname ); - obj.list[classname] = file.get_object(); file.close(); - convert(); - } catch(E) { - throw(E); - } - */ - throw(E); // for now - } else { - throw(E); // for now - } - } - } - } - - this.chain = []; - - this.chain.push( - function() { - try { - var robj = obj.network.simple_request('CIRC_MODIFIER_LIST',[]); - if (typeof robj.ilsevent != 'undefined') throw(robj); - obj.list.circ_modifier = robj; - obj.data_progress('Retrieved circ modifier list. '); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'cnal', - [ - api.FM_CNAL_RETRIEVE.app, - api.FM_CNAL_RETRIEVE.method, - [ obj.session.key ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'csp', - [ - api.FM_CSP_PCRUD_SEARCH.app, - api.FM_CSP_PCRUD_SEARCH.method, - [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"csp":"id"}} ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'ahrcc', - [ - api.FM_AHRCC_PCRUD_SEARCH.app, - api.FM_AHRCC_PCRUD_SEARCH.method, - [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"ahrcc":"label"}} ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'au', - [ - api.FM_AU_RETRIEVE_VIA_SESSION.app, - api.FM_AU_RETRIEVE_VIA_SESSION.method, - [ obj.session.key ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - obj.list.au = [ obj.list.au ]; - } - ); - - this.chain.push( - function() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var f = gen_fm_retrieval_func( - 'my_asv', - [ - api.FM_ASV_RETRIEVE_REQUIRED.app, - api.FM_ASV_RETRIEVE_REQUIRED.method, - [ obj.session.key ], - true - ] - ); - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var f = gen_fm_retrieval_func( - 'asv', - [ - api.FM_ASV_RETRIEVE.app, - api.FM_ASV_RETRIEVE.method, - [ obj.session.key ], - true - ] - ); - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - obj.error.sdump('D_DEBUG','_fm_objects = ' + js2JSON(this._fm_objects) + '\n'); - - for (var i in this._fm_objects) { - this.chain.push( gen_fm_retrieval_func(i,this._fm_objects[i]) ); - } - - // The previous org_tree call returned a tree, not a list or hash. - this.chain.push( - function () { - obj.tree.aou = obj.list.aou; - obj.list.aou = util.fm_utils.flatten_ou_branch( obj.tree.aou ); - for (var i = 0; i < obj.list.aou.length; i++) { - var c = obj.list.aou[i].children(); - if (!c) c = []; - c = c.sort( - function( a, b ) { - if (a.shortname() < b.shortname()) return -1; - if (a.shortname() > b.shortname()) return 1; - return 0; - } - ); - obj.list.aou[i].children( c ); - } - obj.list.aou = util.fm_utils.flatten_ou_branch( obj.tree.aou ); - obj.hash.aou = util.functional.convert_object_list_to_hash( obj.list.aou ); - } - ); - - // The previous pgt call returned a tree, not a list or hash. - this.chain.push( - function () { - obj.tree.pgt = obj.list.pgt; - obj.list.pgt = util.fm_utils.flatten_ou_branch( obj.tree.pgt ); - obj.hash.pgt = util.functional.convert_object_list_to_hash( obj.list.pgt ); - } - ); - - // Do these after we get the user object - - this.chain.push( - function() { - try { - var robj = obj.network.simple_request('FM_AOUS_RETRIEVE',[ obj.session.key, obj.list.au[0].ws_ou() ]); - if (typeof robj.ilsevent != 'undefined') throw(robj); - obj.hash.aous = robj; - obj.data_progress('Retrieved org unit settings. '); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - - function() { - - gen_fm_retrieval_func('my_aou', - [ - api.FM_AOU_RETRIEVE_RELATED_VIA_SESSION.app, - api.FM_AOU_RETRIEVE_RELATED_VIA_SESSION.method, - [ obj.session.key, obj.list.au[0].ws_ou() ], /* use ws_ou and not home_ou */ - true - ] - )(); - } - ); - - this.chain.push( - - function () { - - gen_fm_retrieval_func( 'my_actsc', - [ - api.FM_ACTSC_RETRIEVE_VIA_AOU.app, - api.FM_ACTSC_RETRIEVE_VIA_AOU.method, - [ obj.session.key, obj.list.au[0].ws_ou() ], - true - ] - )(); - } - ); - - this.chain.push( - - function () { - - gen_fm_retrieval_func( 'my_asc', - [ - api.FM_ASC_RETRIEVE_VIA_AOU.app, - api.FM_ASC_RETRIEVE_VIA_AOU.method, - [ obj.session.key, obj.list.au[0].ws_ou() ], - true - ] - )(); - } - ); - - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'cnct', - [ - api.FM_CNCT_RETRIEVE.app, - api.FM_CNCT_RETRIEVE.method, - [ obj.list.au[0].ws_ou() ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'my_cnct', - [ - api.FM_CNCT_RETRIEVE.app, - api.FM_CNCT_RETRIEVE.method, - [ obj.list.au[0].ws_ou() ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'acpl', - [ - api.FM_ACPL_RETRIEVE.app, - api.FM_ACPL_RETRIEVE.method, - [ obj.list.au[0].ws_ou() ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - this.chain.push( - function() { - var f = gen_fm_retrieval_func( - 'cbt', - [ - api.FM_CBT_RETRIEVE.app, - api.FM_CBT_RETRIEVE.method, - [ obj.session.key, obj.list.au[0].ws_ou() ], - false - ] - ); - try { - f(); - } catch(E) { - var error = 'Error: ' + js2JSON(E); - obj.error.sdump('D_ERROR',error); - throw(E); - } - } - ); - - if (typeof this.on_complete == 'function') { - - this.chain.push( this.on_complete ); - } - JSAN.use('util.exec'); this.exec = new util.exec(); - this.exec.on_error = function(E) { - - if (typeof obj.on_error == 'function') { - return obj.on_error(E); /* false breaks chain */ - } else { - alert('oops: ' + E ); - return false; /* break chain */ - } - - } - - this.exec.chain( this.chain ); - - } + }; + + obj.stash( 'print_list_templates', 'print_list_types' ); + } + }, + + 'network_retrieve' : function() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var obj = this; + + + JSAN.use('util.file'); var file = new util.file('print_list_templates'); + obj.print_list_defaults(); + obj.data_progress('Default print templates set. '); + if (file._file.exists()) { + try { + var x = file.get_object(); + if (x) { + for (var i in x) { + obj.print_list_templates[i] = x[i]; + } + obj.stash('print_list_templates'); + obj.data_progress('Saved print templates retrieved from file. '); + } + } catch(E) { + alert(E); + } + } + file.close(); + + JSAN.use('util.file'); var file = new util.file('global_font_adjust'); + if (file._file.exists()) { + try { + var x = file.get_object(); + if (x) { + obj.global_font_adjust = x; + obj.stash('global_font_adjust'); + obj.data_progress('Saved font settings retrieved from file. '); + } + } catch(E) { + alert(E); + } + } + file.close(); + + JSAN.use('util.file'); var file = new util.file('no_sound'); + if (file._file.exists()) { + try { + var x = file.get_content(); + if (x) { + obj.no_sound = x; + obj.stash('no_sound'); + obj.data_progress('Saved sound settings retrieved from file. '); + } + } catch(E) { + alert(E); + } + } + file.close(); + + JSAN.use('util.file'); var file = new util.file('print_strategy'); + if (file._file.exists()) { + try { + var x = file.get_content(); + if (x) { + obj.print_strategy = x; + obj.stash('print_strategy'); + obj.data_progress('Print strategy retrieved from file. '); + } + } catch(E) { + alert(E); + } + } + file.close(); + + JSAN.use('util.functional'); + JSAN.use('util.fm_utils'); + + function gen_fm_retrieval_func(classname,data) { + var app = data[0]; var method = data[1]; var params = data[2]; var cacheable = data[3]; + return function () { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + function convert() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + try { + if (obj.list[classname].constructor.name == 'Array') { + obj.hash[classname] = + util.functional.convert_object_list_to_hash( + obj.list[classname] + ); + } + } catch(E) { + + obj.error.sdump('D_ERROR',E + '\n'); + } + + } + + try { + var level = obj.error.sdump_levels.D_SES_RESULT; + if (classname == 'aou' || classname == 'my_aou') + obj.error.sdump_levels.D_SES_RESULT = false; + var robj = obj.network.request( app, method, params); + if (robj != null && typeof robj.ilsevent != 'undefined') { + obj.error.standard_unexpected_error_alert('The staff client failed to retrieve expected data from this call, "' + method + '"',robj); + throw(robj); + } + obj.list[classname] = robj == null ? [] : robj; + obj.error.sdump_levels.D_SES_RESULT = level; + convert(); + obj.data_progress('Retrieved list for ' + classname + ' objects. '); + + } catch(E) { + // if cacheable, try offline + if (cacheable) { + /* FIXME -- we're going to revisit caching and do it differently + try { + var file = new util.file( classname ); + obj.list[classname] = file.get_object(); file.close(); + convert(); + } catch(E) { + throw(E); + } + */ + throw(E); // for now + } else { + throw(E); // for now + } + } + } + } + + this.chain = []; + + this.chain.push( + function() { + try { + var robj = obj.network.simple_request('CIRC_MODIFIER_LIST',[]); + if (typeof robj.ilsevent != 'undefined') throw(robj); + obj.list.circ_modifier = robj; + obj.data_progress('Retrieved circ modifier list. '); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'cnal', + [ + api.FM_CNAL_RETRIEVE.app, + api.FM_CNAL_RETRIEVE.method, + [ obj.session.key ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'csp', + [ + api.FM_CSP_PCRUD_SEARCH.app, + api.FM_CSP_PCRUD_SEARCH.method, + [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"csp":"id"}} ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'ahrcc', + [ + api.FM_AHRCC_PCRUD_SEARCH.app, + api.FM_AHRCC_PCRUD_SEARCH.method, + [ obj.session.key, {"id":{"!=":null}}, {"order_by":{"ahrcc":"label"}} ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'au', + [ + api.FM_AU_RETRIEVE_VIA_SESSION.app, + api.FM_AU_RETRIEVE_VIA_SESSION.method, + [ obj.session.key ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + obj.list.au = [ obj.list.au ]; + } + ); + + this.chain.push( + function() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var f = gen_fm_retrieval_func( + 'my_asv', + [ + api.FM_ASV_RETRIEVE_REQUIRED.app, + api.FM_ASV_RETRIEVE_REQUIRED.method, + [ obj.session.key ], + true + ] + ); + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var f = gen_fm_retrieval_func( + 'asv', + [ + api.FM_ASV_RETRIEVE.app, + api.FM_ASV_RETRIEVE.method, + [ obj.session.key ], + true + ] + ); + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + obj.error.sdump('D_DEBUG','_fm_objects = ' + js2JSON(this._fm_objects) + '\n'); + + for (var i in this._fm_objects) { + this.chain.push( gen_fm_retrieval_func(i,this._fm_objects[i]) ); + } + + // The previous org_tree call returned a tree, not a list or hash. + this.chain.push( + function () { + obj.tree.aou = obj.list.aou; + obj.list.aou = util.fm_utils.flatten_ou_branch( obj.tree.aou ); + for (var i = 0; i < obj.list.aou.length; i++) { + var c = obj.list.aou[i].children(); + if (!c) c = []; + c = c.sort( + function( a, b ) { + if (a.shortname() < b.shortname()) return -1; + if (a.shortname() > b.shortname()) return 1; + return 0; + } + ); + obj.list.aou[i].children( c ); + } + obj.list.aou = util.fm_utils.flatten_ou_branch( obj.tree.aou ); + obj.hash.aou = util.functional.convert_object_list_to_hash( obj.list.aou ); + } + ); + + // The previous pgt call returned a tree, not a list or hash. + this.chain.push( + function () { + obj.tree.pgt = obj.list.pgt; + obj.list.pgt = util.fm_utils.flatten_ou_branch( obj.tree.pgt ); + obj.hash.pgt = util.functional.convert_object_list_to_hash( obj.list.pgt ); + } + ); + + // Do these after we get the user object + + this.chain.push( + function() { + try { + var robj = obj.network.simple_request('FM_AOUS_RETRIEVE',[ obj.session.key, obj.list.au[0].ws_ou() ]); + if (typeof robj.ilsevent != 'undefined') throw(robj); + obj.hash.aous = robj; + obj.data_progress('Retrieved org unit settings. '); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + + function() { + + gen_fm_retrieval_func('my_aou', + [ + api.FM_AOU_RETRIEVE_RELATED_VIA_SESSION.app, + api.FM_AOU_RETRIEVE_RELATED_VIA_SESSION.method, + [ obj.session.key, obj.list.au[0].ws_ou() ], /* use ws_ou and not home_ou */ + true + ] + )(); + } + ); + + this.chain.push( + + function () { + + gen_fm_retrieval_func( 'my_actsc', + [ + api.FM_ACTSC_RETRIEVE_VIA_AOU.app, + api.FM_ACTSC_RETRIEVE_VIA_AOU.method, + [ obj.session.key, obj.list.au[0].ws_ou() ], + true + ] + )(); + } + ); + + this.chain.push( + + function () { + + gen_fm_retrieval_func( 'my_asc', + [ + api.FM_ASC_RETRIEVE_VIA_AOU.app, + api.FM_ASC_RETRIEVE_VIA_AOU.method, + [ obj.session.key, obj.list.au[0].ws_ou() ], + true + ] + )(); + } + ); + + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'cnct', + [ + api.FM_CNCT_RETRIEVE.app, + api.FM_CNCT_RETRIEVE.method, + [ obj.list.au[0].ws_ou() ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'my_cnct', + [ + api.FM_CNCT_RETRIEVE.app, + api.FM_CNCT_RETRIEVE.method, + [ obj.list.au[0].ws_ou() ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'acpl', + [ + api.FM_ACPL_RETRIEVE.app, + api.FM_ACPL_RETRIEVE.method, + [ obj.list.au[0].ws_ou() ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + this.chain.push( + function() { + var f = gen_fm_retrieval_func( + 'cbt', + [ + api.FM_CBT_RETRIEVE.app, + api.FM_CBT_RETRIEVE.method, + [ obj.session.key, obj.list.au[0].ws_ou() ], + false + ] + ); + try { + f(); + } catch(E) { + var error = 'Error: ' + js2JSON(E); + obj.error.sdump('D_ERROR',error); + throw(E); + } + } + ); + + if (typeof this.on_complete == 'function') { + + this.chain.push( this.on_complete ); + } + JSAN.use('util.exec'); this.exec = new util.exec(); + this.exec.on_error = function(E) { + + if (typeof obj.on_error == 'function') { + return obj.on_error(E); /* false breaks chain */ + } else { + alert('oops: ' + E ); + return false; /* break chain */ + } + + } + + this.exec.chain( this.chain ); + + } } dump('exiting OpenILS/data.js\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index 583740d336..4872a2f4a1 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -1,6 +1,6 @@ - function $(id) { return document.getElementById(id); } + function $(id) { return document.getElementById(id); } - function ses(a,params) { + function ses(a,params) { try { if (!params) params = {}; var data; @@ -29,26 +29,26 @@ alert(location.href + '\nError in global_utils.js, ses(): ' + E); throw(E); } - } + } - function font_helper() { - try { - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - removeCSSClass(document.documentElement,'ALL_FONTS_LARGER'); - removeCSSClass(document.documentElement,'ALL_FONTS_SMALLER'); - removeCSSClass(document.documentElement,'ALL_FONTS_XX_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_X_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_MEDIUM'); - removeCSSClass(document.documentElement,'ALL_FONTS_LARGE'); - removeCSSClass(document.documentElement,'ALL_FONTS_X_LARGE'); - removeCSSClass(document.documentElement,'ALL_FONTS_XX_LARGE'); - addCSSClass(document.documentElement,data.global_font_adjust); - } catch(E) { + function font_helper() { + try { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + removeCSSClass(document.documentElement,'ALL_FONTS_LARGER'); + removeCSSClass(document.documentElement,'ALL_FONTS_SMALLER'); + removeCSSClass(document.documentElement,'ALL_FONTS_XX_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_X_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_MEDIUM'); + removeCSSClass(document.documentElement,'ALL_FONTS_LARGE'); + removeCSSClass(document.documentElement,'ALL_FONTS_X_LARGE'); + removeCSSClass(document.documentElement,'ALL_FONTS_XX_LARGE'); + addCSSClass(document.documentElement,data.global_font_adjust); + } catch(E) { var Strings = $('offlineStrings') || $('commonStrings'); - alert(Strings.getFormattedString('openils.global_util.font_size.error', [E])); - } - } + alert(Strings.getFormattedString('openils.global_util.font_size.error', [E])); + } + } function persist_helper() { try { @@ -145,20 +145,20 @@ } } - function getKeys(o) { - var keys = []; - for (var k in o) keys.push(k); - return keys; - } + function getKeys(o) { + var keys = []; + for (var k in o) keys.push(k); + return keys; + } - function get_contentWindow(frame) { + function get_contentWindow(frame) { try { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (frame && frame.contentWindow) { try { if (typeof frame.contentWindow.wrappedJSObject != 'undefined') { - return frame.contentWindow.wrappedJSObject; - } + return frame.contentWindow.wrappedJSObject; + } } catch(E) { var Strings = $('offlineStrings') || $('commonStrings'); alert(Strings.getFormattedString('openils.global_util.content_window_jsobject.error', [frame, E])); @@ -171,174 +171,174 @@ var Strings = $('offlineStrings') || $('commonStrings'); alert(Strings.getFormattedString('openils.global_util.content_window.error', [frame, E])); } - } + } - 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 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 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, and '0' == false (newer JSON is returning '0' instead of 0 in cases) - // So false includes 'f', '', '0', 0, null, and undefined - if (a == 'f') return false; - if (a == 'F') return false; - if (a == '0') return false; - if (a) return true; else return false; - } + function get_bool(a) { + // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false, and '0' == false (newer JSON is returning '0' instead of 0 in cases) + // So false includes 'f', '', '0', 0, null, and undefined + if (a == 'f') return false; + if (a == 'F') return false; + if (a == '0') return false; + if (a) return true; else return false; + } - function get_db_true() { - return 't'; - } + function get_db_true() { + return 't'; + } - function get_db_false() { - return 'f'; - } + function get_db_false() { + return 'f'; + } - function copy_to_clipboard(ev) { - try { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var text; - if (typeof ev == 'object') { - if (typeof ev.target != 'undefined') { - if (typeof ev.target.textContent != 'undefined') if (ev.target.textContent) text = ev.target.textContent; - if (typeof ev.target.value != 'undefined') if (ev.target.value) text = ev.target.value; - } - } else if (typeof ev == 'string') { - text = ev; - } - const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] - .getService(Components.interfaces.nsIClipboardHelper); - gClipboardHelper.copyString(text); + function copy_to_clipboard(ev) { + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var text; + if (typeof ev == 'object') { + if (typeof ev.target != 'undefined') { + if (typeof ev.target.textContent != 'undefined') if (ev.target.textContent) text = ev.target.textContent; + if (typeof ev.target.value != 'undefined') if (ev.target.value) text = ev.target.value; + } + } else if (typeof ev == 'string') { + text = ev; + } + const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] + .getService(Components.interfaces.nsIClipboardHelper); + gClipboardHelper.copyString(text); var Strings = $('offlineStrings') || $('commonStrings'); - alert(Strings.getFormattedString('openils.global_util.clipboard', [text])); - } catch(E) { + alert(Strings.getFormattedString('openils.global_util.clipboard', [text])); + } catch(E) { var Strings = $('offlineStrings') || $('commonStrings'); - alert(Strings.getFormattedString('openils.global_util.clipboard.error', [E])); - } - } + alert(Strings.getFormattedString('openils.global_util.clipboard.error', [E])); + } + } - function clear_the_cache() { - try { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; - var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); - } catch(E) { + function clear_the_cache() { + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; + var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); + } catch(E) { var Strings = $('offlineStrings') || $('commonStrings'); - alert(Strings.getFormattedString('openils.global_util.clear_cache.error', [E])); - } - } + alert(Strings.getFormattedString('openils.global_util.clear_cache.error', [E])); + } + } - function toOpenWindowByType(inType, uri) { - var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"; - window.open(uri, "_blank", winopts); - } + function toOpenWindowByType(inType, uri) { + var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"; + window.open(uri, "_blank", winopts); + } - function url_prefix(url) { - if (url.match(/^\//)) url = urls.remote + url; - if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url; - dump('url_prefix = ' + url + '\n'); - return url; - } + function url_prefix(url) { + if (url.match(/^\//)) url = urls.remote + url; + if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url; + dump('url_prefix = ' + url + '\n'); + return url; + } diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/util/fmall.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/util/fmall.js index 2032b12336..a1384ace65 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/util/fmall.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/util/fmall.js @@ -1,15 +1,15 @@ try { - if (typeof JSAN == 'undefined') { - throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); - } - JSAN.errorLevel = "die"; // none, warn, or die - JSAN.addRepository('..'); - JSAN.use('OpenILS.data'); - var data = new OpenILS.data(); data.init({'via':'stash'}); - var url = data.server + urls.fieldmapper; - dump('url = ' + url + '\n'); - var js = JSAN._loadJSFromUrl( url ); - eval( js ); + if (typeof JSAN == 'undefined') { + throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); + } + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); + JSAN.use('OpenILS.data'); + var data = new OpenILS.data(); data.init({'via':'stash'}); + var url = data.server + urls.fieldmapper; + dump('url = ' + url + '\n'); + var js = JSAN._loadJSFromUrl( url ); + eval( js ); } catch(E) { - alert('fmall.js: ' + E); + alert('fmall.js: ' + E); } diff --git a/Open-ILS/xul/staff_client/chrome/content/admin/survey.js b/Open-ILS/xul/staff_client/chrome/content/admin/survey.js index 8bed642ac3..42b37a5fde 100644 --- a/Open-ILS/xul/staff_client/chrome/content/admin/survey.js +++ b/Open-ILS/xul/staff_client/chrome/content/admin/survey.js @@ -60,225 +60,225 @@ function render_lib_menu() { function survey_init() { - dump('survey_init()\n'); - render_lib_menu(); - SURVEY['asv'] = new asv(); SURVEY['asv'].isnew('1'); - SURVEY['num_of_questions'] = 0; - document.getElementById('survey_name').focus(); + dump('survey_init()\n'); + render_lib_menu(); + SURVEY['asv'] = new asv(); SURVEY['asv'].isnew('1'); + SURVEY['num_of_questions'] = 0; + document.getElementById('survey_name').focus(); } function save_survey() { - SURVEY.asv.description( - document.getElementById('survey_description').value - ); - SURVEY.asv.name( - document.getElementById('survey_name').value - ); - SURVEY.asv.owner( - document.getElementById('lib_menulist').value - ); - var survey_start = document.getElementById('survey_start').value; - if (survey_start) { - SURVEY.asv.start_date( - survey_start - ); - } else { - SURVEY.asv.start_date( - null - ); - } - var survey_end = document.getElementById('survey_end').value; - if (survey_end) { - SURVEY.asv.end_date( - survey_end - ); - } else { - SURVEY.asv.end_date( - null - ); - } - if ( document.getElementById('required_checkbox').checked ) { - SURVEY.asv.required('1'); - } else { - SURVEY.asv.required('0'); - } - if ( document.getElementById('opac_checkbox').checked ) { - SURVEY.asv.opac('1'); - } else { - SURVEY.asv.opac('0'); - } - if ( document.getElementById('poll_checkbox').checked ) { - SURVEY.asv.poll('1'); - } else { - SURVEY.asv.poll('0'); - } - - if ( document.getElementById('patron_summary_checkbox').checked ) { - SURVEY.asv.usr_summary('1'); - } else { - SURVEY.asv.usr_summary('0'); - } - g.error.sdump('D_SURVEY', 'before survey = ' + js2JSON( SURVEY.asv ) + '\n'); - try { - var result = g.network.request( - api.FM_ASV_CREATE.app, - api.FM_ASV_CREATE.method, - [ ses(), SURVEY.asv ] - ); - if (! (result instanceof asv) ) { - throw('save_survey: result not an asv'); - } else { - var surveys_list = g.OpenILS.data.list.asv; - var surveys_hash = g.OpenILS.data.hash.asv; - surveys_list.push( result ); - surveys_hash[ result.id() ] = result; - g.OpenILS.data.stash('list','hash'); - } - } catch(E) { - var err = ('Survey failed: ' + js2JSON(E) + '\n'); - g.error.sdump('D_ERROR',err); - alert(err); - throw(err); - } - g.error.sdump('D_SURVEY', 'after survey = ' + js2JSON( SURVEY.asv ) + '\n'); + SURVEY.asv.description( + document.getElementById('survey_description').value + ); + SURVEY.asv.name( + document.getElementById('survey_name').value + ); + SURVEY.asv.owner( + document.getElementById('lib_menulist').value + ); + var survey_start = document.getElementById('survey_start').value; + if (survey_start) { + SURVEY.asv.start_date( + survey_start + ); + } else { + SURVEY.asv.start_date( + null + ); + } + var survey_end = document.getElementById('survey_end').value; + if (survey_end) { + SURVEY.asv.end_date( + survey_end + ); + } else { + SURVEY.asv.end_date( + null + ); + } + if ( document.getElementById('required_checkbox').checked ) { + SURVEY.asv.required('1'); + } else { + SURVEY.asv.required('0'); + } + if ( document.getElementById('opac_checkbox').checked ) { + SURVEY.asv.opac('1'); + } else { + SURVEY.asv.opac('0'); + } + if ( document.getElementById('poll_checkbox').checked ) { + SURVEY.asv.poll('1'); + } else { + SURVEY.asv.poll('0'); + } + + if ( document.getElementById('patron_summary_checkbox').checked ) { + SURVEY.asv.usr_summary('1'); + } else { + SURVEY.asv.usr_summary('0'); + } + g.error.sdump('D_SURVEY', 'before survey = ' + js2JSON( SURVEY.asv ) + '\n'); + try { + var result = g.network.request( + api.FM_ASV_CREATE.app, + api.FM_ASV_CREATE.method, + [ ses(), SURVEY.asv ] + ); + if (! (result instanceof asv) ) { + throw('save_survey: result not an asv'); + } else { + var surveys_list = g.OpenILS.data.list.asv; + var surveys_hash = g.OpenILS.data.hash.asv; + surveys_list.push( result ); + surveys_hash[ result.id() ] = result; + g.OpenILS.data.stash('list','hash'); + } + } catch(E) { + var err = ('Survey failed: ' + js2JSON(E) + '\n'); + g.error.sdump('D_ERROR',err); + alert(err); + throw(err); + } + g.error.sdump('D_SURVEY', 'after survey = ' + js2JSON( SURVEY.asv ) + '\n'); } var original_description; function setDescription(e,t) { - var page = document.getElementById(e); - var desc = page.getAttribute('description'); - if (!original_description) original_description = desc; - var value = document.getElementById(t).value; - page.setAttribute('description',original_description + ' ' + value); + var page = document.getElementById(e); + var desc = page.getAttribute('description'); + if (!original_description) original_description = desc; + var value = document.getElementById(t).value; + page.setAttribute('description',original_description + ' ' + value); } var new_id = -1; function add_answer(e, my_asvq_id) { - var row = e.target.parentNode; - var rows = row.parentNode; - var answer = e.target.previousSibling; answer.select(); - - if (! answer.value ) { return; } - - /* XUL */ - var n_row = document.createElement('row'); - rows.insertBefore( n_row, row ); - var label_1 = document.createElement('label'); - n_row.appendChild( label_1 ); - var label_2 = document.createElement('label'); - label_2.setAttribute('value', answer.value ); - n_row.appendChild( label_2 ); - - /* OBJECT */ - - var my_asva = new asva(); my_asva.isnew('1'); my_asva.id( new_id-- ); - my_asva.answer( answer.value ); - - JSAN.use('util.functional'); - var my_asvq = util.functional.find_id_object_in_list( SURVEY.asv.questions(), my_asvq_id ); - if (my_asvq.answers() == null) { - my_asvq.answers( [] ); - } - - my_asvq.answers().push( my_asva ); - - var num_of_answers = my_asvq.answers().length; - var last_number = 96 + num_of_answers; - var next_number = 97 + num_of_answers; - var last_letter = String.fromCharCode( last_number ); - var next_letter = String.fromCharCode( next_number ); - label_1.setAttribute('value', last_letter + ')' ); - row.firstChild.setAttribute('value', next_letter + ')' ); - - if (num_of_answers == 26) { - rows.removeChild(row); - } + var row = e.target.parentNode; + var rows = row.parentNode; + var answer = e.target.previousSibling; answer.select(); + + if (! answer.value ) { return; } + + /* XUL */ + var n_row = document.createElement('row'); + rows.insertBefore( n_row, row ); + var label_1 = document.createElement('label'); + n_row.appendChild( label_1 ); + var label_2 = document.createElement('label'); + label_2.setAttribute('value', answer.value ); + n_row.appendChild( label_2 ); + + /* OBJECT */ + + var my_asva = new asva(); my_asva.isnew('1'); my_asva.id( new_id-- ); + my_asva.answer( answer.value ); + + JSAN.use('util.functional'); + var my_asvq = util.functional.find_id_object_in_list( SURVEY.asv.questions(), my_asvq_id ); + if (my_asvq.answers() == null) { + my_asvq.answers( [] ); + } + + my_asvq.answers().push( my_asva ); + + var num_of_answers = my_asvq.answers().length; + var last_number = 96 + num_of_answers; + var next_number = 97 + num_of_answers; + var last_letter = String.fromCharCode( last_number ); + var next_letter = String.fromCharCode( next_number ); + label_1.setAttribute('value', last_letter + ')' ); + row.firstChild.setAttribute('value', next_letter + ')' ); + + if (num_of_answers == 26) { + rows.removeChild(row); + } } function add_question() { - SURVEY.num_of_questions++; - var question = document.getElementById('new_question'); + SURVEY.num_of_questions++; + var question = document.getElementById('new_question'); - if (! question.value ) { return; } + if (! question.value ) { return; } - document.getElementById('survey_add').canAdvance = true; + document.getElementById('survey_add').canAdvance = true; - var my_asvq = new asvq(); my_asvq.isnew('1'); my_asvq.id( new_id-- ); - my_asvq.question( question.value ); + var my_asvq = new asvq(); my_asvq.isnew('1'); my_asvq.id( new_id-- ); + my_asvq.question( question.value ); - if ( SURVEY.asv.questions() == null ) { - SURVEY.asv.questions( [] ); - } + if ( SURVEY.asv.questions() == null ) { + SURVEY.asv.questions( [] ); + } - SURVEY.asv.questions().push( my_asvq ); + SURVEY.asv.questions().push( my_asvq ); - add_question_row(my_asvq); + add_question_row(my_asvq); - document.getElementById('new_question_label').setAttribute('value', '#' + (SURVEY.num_of_questions + 1) ); - //question.select(); - if (last_answer) last_answer.focus(); + document.getElementById('new_question_label').setAttribute('value', '#' + (SURVEY.num_of_questions + 1) ); + //question.select(); + if (last_answer) last_answer.focus(); } function add_question_row(my_asvq) { - var rows = document.getElementById('page2_grid1_rows'); - var row = document.createElement('row'); - rows.insertBefore(row, document.getElementById('page2_grid1_row1')); - - var label_number = document.createElement('label'); - label_number.setAttribute('value','#' + SURVEY['num_of_questions']); - row.appendChild(label_number); - - var grid = document.createElement('grid'); - row.appendChild(grid); - var g_cols = document.createElement('columns'); - grid.appendChild(g_cols); - var g_col_1 = document.createElement('column'); - g_cols.appendChild(g_col_1); - var g_col_2 = document.createElement('column'); - g_col_2.setAttribute('flex','1'); - g_cols.appendChild(g_col_2); - var g_col_3 = document.createElement('column'); - g_cols.appendChild(g_col_3); - var g_rows = document.createElement('rows'); - grid.appendChild(g_rows); - var g_row_1 = document.createElement('row'); - g_rows.appendChild(g_row_1); - var g_label_1 = document.createElement('label'); - g_row_1.appendChild(g_label_1); - var g_label_2 = document.createElement('label'); - g_label_2.setAttribute('value', my_asvq.question() ); - g_row_1.appendChild(g_label_2); - var g_row_2 = document.createElement('row'); - g_rows.appendChild(g_row_2); - var g_label2_1 = document.createElement('label'); - g_label2_1.setAttribute('value', 'a)' ); - g_row_2.appendChild(g_label2_1); - var g_tb = document.createElement('textbox'); - g_tb.setAttribute('flex','1'); - g_row_2.appendChild(g_tb); - if (last_button) last_button.setAttribute('accesskey',''); - var g_b = document.createElement('button'); - var strbundle = document.getElementById("offlineStrings"); - g_b.setAttribute('label', strbundle.getString('staff.admin.survey.save_response.label')); - g_b.setAttribute('accesskey', strbundle.getString('staff.admin.survey.save_response.label')); - g_b.setAttribute('oncommand','add_answer(event,' + my_asvq.id() + ');'); - g_row_2.appendChild(g_b); - - var blank = document.createElement('row'); - rows.insertBefore( blank , document.getElementById('page2_grid1_row1') ); - var blank2 = document.createElement('label'); - blank2.setAttribute('value', ' '); - blank.appendChild( blank2 ); - - last_answer = g_tb; - last_button = g_b; + var rows = document.getElementById('page2_grid1_rows'); + var row = document.createElement('row'); + rows.insertBefore(row, document.getElementById('page2_grid1_row1')); + + var label_number = document.createElement('label'); + label_number.setAttribute('value','#' + SURVEY['num_of_questions']); + row.appendChild(label_number); + + var grid = document.createElement('grid'); + row.appendChild(grid); + var g_cols = document.createElement('columns'); + grid.appendChild(g_cols); + var g_col_1 = document.createElement('column'); + g_cols.appendChild(g_col_1); + var g_col_2 = document.createElement('column'); + g_col_2.setAttribute('flex','1'); + g_cols.appendChild(g_col_2); + var g_col_3 = document.createElement('column'); + g_cols.appendChild(g_col_3); + var g_rows = document.createElement('rows'); + grid.appendChild(g_rows); + var g_row_1 = document.createElement('row'); + g_rows.appendChild(g_row_1); + var g_label_1 = document.createElement('label'); + g_row_1.appendChild(g_label_1); + var g_label_2 = document.createElement('label'); + g_label_2.setAttribute('value', my_asvq.question() ); + g_row_1.appendChild(g_label_2); + var g_row_2 = document.createElement('row'); + g_rows.appendChild(g_row_2); + var g_label2_1 = document.createElement('label'); + g_label2_1.setAttribute('value', 'a)' ); + g_row_2.appendChild(g_label2_1); + var g_tb = document.createElement('textbox'); + g_tb.setAttribute('flex','1'); + g_row_2.appendChild(g_tb); + if (last_button) last_button.setAttribute('accesskey',''); + var g_b = document.createElement('button'); + var strbundle = document.getElementById("offlineStrings"); + g_b.setAttribute('label', strbundle.getString('staff.admin.survey.save_response.label')); + g_b.setAttribute('accesskey', strbundle.getString('staff.admin.survey.save_response.label')); + g_b.setAttribute('oncommand','add_answer(event,' + my_asvq.id() + ');'); + g_row_2.appendChild(g_b); + + var blank = document.createElement('row'); + rows.insertBefore( blank , document.getElementById('page2_grid1_row1') ); + var blank2 = document.createElement('label'); + blank2.setAttribute('value', ' '); + blank.appendChild( blank2 ); + + last_answer = g_tb; + last_button = g_b; } function page1_check_advance() { - if ( document.getElementById('survey_name').value ) { - document.getElementById('survey_add').canAdvance = true; - } else { - document.getElementById('survey_add').canAdvance = false; - } + if ( document.getElementById('survey_name').value ) { + document.getElementById('survey_add').canAdvance = true; + } else { + document.getElementById('survey_add').canAdvance = false; + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js index c48565c83a..a71295e51a 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/controller.js @@ -3,63 +3,63 @@ dump('entering auth/controller.js\n'); if (typeof auth == 'undefined') auth = {}; auth.controller = function (params) { - JSAN.use('util.error'); this.error = new util.error(); - this.w = params.window; + JSAN.use('util.error'); this.error = new util.error(); + this.w = params.window; - return this; + return this; }; auth.controller.prototype = { - 'init' : function () { - - var obj = this; // so the 'this' in event handlers don't confuse us - var w = obj.w; - - JSAN.use('OpenILS.data'); - obj.data = new OpenILS.data(); obj.data.init({'via':'stash'}); - - // MVC - JSAN.use('util.controller'); obj.controller = new util.controller(); - obj.controller.init( - { - 'control_map' : { - 'cmd_login' : [ - ['command'], - function() { - obj.login(); - } - ], - 'cmd_standalone' : [ - ['command'], - function() { - obj.standalone(); - } - ], - 'cmd_standalone_import' : [ - ['command'], - function() { - obj.standalone_import(); - } - ], - 'cmd_standalone_export' : [ - ['command'], - function() { - obj.standalone_export(); - } - ], - 'cmd_clear_cache' : [ - ['command'], - function() { - obj.debug('clear_cache'); - } - ], - 'cmd_js_console' : [ - ['command'], - function() { - obj.debug('js_console'); - } - ], + 'init' : function () { + + var obj = this; // so the 'this' in event handlers don't confuse us + var w = obj.w; + + JSAN.use('OpenILS.data'); + obj.data = new OpenILS.data(); obj.data.init({'via':'stash'}); + + // MVC + JSAN.use('util.controller'); obj.controller = new util.controller(); + obj.controller.init( + { + 'control_map' : { + 'cmd_login' : [ + ['command'], + function() { + obj.login(); + } + ], + 'cmd_standalone' : [ + ['command'], + function() { + obj.standalone(); + } + ], + 'cmd_standalone_import' : [ + ['command'], + function() { + obj.standalone_import(); + } + ], + 'cmd_standalone_export' : [ + ['command'], + function() { + obj.standalone_export(); + } + ], + 'cmd_clear_cache' : [ + ['command'], + function() { + obj.debug('clear_cache'); + } + ], + 'cmd_js_console' : [ + ['command'], + function() { + obj.debug('js_console'); + } + ], 'cmd_debugger' : [ ['command'], function() { @@ -84,30 +84,30 @@ auth.controller.prototype = { start_js_shell(); } ], - 'cmd_override' : [ - ['command'], - function() { - obj.override(); - } - ], - 'cmd_logoff' : [ - ['command'], - function() { - obj.logoff() - } - ], - 'cmd_close_window' : [ - ['command'], - function() { - obj.close() - } - ], - 'cmd_test_server' : [ - ['command'], - function() { - obj.test_server( obj.controller.view.server_prompt.value ); - } - ], + 'cmd_override' : [ + ['command'], + function() { + obj.override(); + } + ], + 'cmd_logoff' : [ + ['command'], + function() { + obj.logoff() + } + ], + 'cmd_close_window' : [ + ['command'], + function() { + obj.close() + } + ], + 'cmd_test_server' : [ + ['command'], + function() { + obj.test_server( obj.controller.view.server_prompt.value ); + } + ], 'ssl_exception' : [ ['render'], function(e) { @@ -136,13 +136,13 @@ auth.controller.prototype = { 'prefetchCert' : true } ); - obj.test_server( obj.controller.view.server_prompt.value ); + obj.test_server( obj.controller.view.server_prompt.value ); } ], - 'server_prompt' : [ - ['keypress'], - handle_keypress - ], + 'server_prompt' : [ + ['keypress'], + handle_keypress + ], 'server_menu' : [ ['render'], function(e) { @@ -156,405 +156,405 @@ auth.controller.prototype = { }; } ], - 'name_prompt' : [ - ['keypress'], - handle_keypress - ], - 'password_prompt' : [ - ['keypress'], - handle_keypress - ], - 'submit_button' : [ - ['render'], - function(e) { return function() {} } - ], - 'apply_locale_btn' : [ - ['render'], - function(e) { return function() {} } - ], - 'progress_bar' : [ - ['render'], - function(e) { return function() {} } - ], - 'status' : [ - ['render'], - function(e) { return function() { - } } - ], - 'ws_deck' : [ - ['render'], - function(e) { return function() { - try { - JSAN.use('util.widgets'); util.widgets.remove_children(e); - var x = document.createElement('description'); - e.appendChild(x); - if (obj.data.ws_info - && obj.data.ws_info[ obj.controller.view.server_prompt.value ]) { - var ws = obj.data.ws_info[ obj.controller.view.server_prompt.value ]; - x.appendChild( - document.createTextNode( - ws.name /*+ ' @ ' + ws.lib_shortname*/ - ) - ); - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - JSAN.use('util.file'); var file = new util.file('last_ws_server'); - file.set_object(obj.controller.view.server_prompt.value); - file.close(); - } else { - x.appendChild( - document.createTextNode( - document.getElementById('authStrings').getString('staff.auth.controller.not_configured') - ) - ); - } - } catch(E) { - alert(E); - } - } } - ], - 'menu_spot' : [ - ['render'], - function(e) { return function() { - } } - ], - - } - } - ); - obj.controller.view.name_prompt.focus(); - - function handle_keypress(ev) { - try { - if (ev.keyCode && ev.keyCode == 13) { - switch(this) { - case obj.controller.view.server_prompt: - ev.preventDefault(); - obj.controller.view.name_prompt.focus(); obj.controller.view.name_prompt.select(); - break; - case obj.controller.view.name_prompt: - ev.preventDefault(); - obj.controller.view.password_prompt.focus(); obj.controller.view.password_prompt.select(); - break; - case obj.controller.view.password_prompt: - ev.preventDefault(); - obj.controller.view.submit_button.focus(); - obj.login(); - break; - default: break; - } - } - } catch(E) { - alert(E); - } - } - - obj.controller.view.server_prompt.addEventListener( - 'change', - function (ev) { - obj.test_server(ev.target.value); - obj.controller.render('ws_deck'); - }, - false - ); + 'name_prompt' : [ + ['keypress'], + handle_keypress + ], + 'password_prompt' : [ + ['keypress'], + handle_keypress + ], + 'submit_button' : [ + ['render'], + function(e) { return function() {} } + ], + 'apply_locale_btn' : [ + ['render'], + function(e) { return function() {} } + ], + 'progress_bar' : [ + ['render'], + function(e) { return function() {} } + ], + 'status' : [ + ['render'], + function(e) { return function() { + } } + ], + 'ws_deck' : [ + ['render'], + function(e) { return function() { + try { + JSAN.use('util.widgets'); util.widgets.remove_children(e); + var x = document.createElement('description'); + e.appendChild(x); + if (obj.data.ws_info + && obj.data.ws_info[ obj.controller.view.server_prompt.value ]) { + var ws = obj.data.ws_info[ obj.controller.view.server_prompt.value ]; + x.appendChild( + document.createTextNode( + ws.name /*+ ' @ ' + ws.lib_shortname*/ + ) + ); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + JSAN.use('util.file'); var file = new util.file('last_ws_server'); + file.set_object(obj.controller.view.server_prompt.value); + file.close(); + } else { + x.appendChild( + document.createTextNode( + document.getElementById('authStrings').getString('staff.auth.controller.not_configured') + ) + ); + } + } catch(E) { + alert(E); + } + } } + ], + 'menu_spot' : [ + ['render'], + function(e) { return function() { + } } + ], + + } + } + ); + obj.controller.view.name_prompt.focus(); + + function handle_keypress(ev) { + try { + if (ev.keyCode && ev.keyCode == 13) { + switch(this) { + case obj.controller.view.server_prompt: + ev.preventDefault(); + obj.controller.view.name_prompt.focus(); obj.controller.view.name_prompt.select(); + break; + case obj.controller.view.name_prompt: + ev.preventDefault(); + obj.controller.view.password_prompt.focus(); obj.controller.view.password_prompt.select(); + break; + case obj.controller.view.password_prompt: + ev.preventDefault(); + obj.controller.view.submit_button.focus(); + obj.login(); + break; + default: break; + } + } + } catch(E) { + alert(E); + } + } + + obj.controller.view.server_prompt.addEventListener( + 'change', + function (ev) { + obj.test_server(ev.target.value); + obj.controller.render('ws_deck'); + }, + false + ); obj.controller.view.server_prompt.addEventListener( 'command', function (ev) { obj.controller.view.name_prompt.focus(); obj.controller.view.name_prompt.select(); - obj.test_server(ev.target.value); - obj.controller.render('ws_deck'); + obj.test_server(ev.target.value); + obj.controller.render('ws_deck'); }, false ); - // This talks to our ILS - JSAN.use('auth.session'); - obj.session = new auth.session(obj.controller.view); - - obj.controller.render(); - obj.test_server( obj.controller.view.server_prompt.value ); - obj.controller.render('ws_deck'); - - if (typeof this.on_init == 'function') { - this.error.sdump('D_AUTH','auth.controller.on_init()\n'); - this.on_init(); - } - }, - - 'test_server' : function(url) { - var obj = this; - if (!url) { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - JSAN.use('util.file'); var file = new util.file('last_ws_server'); - if (file._file.exists()) { - url = file.get_object(); file.close(); - obj.controller.view.server_prompt.value = url; - } - } - obj.controller.view.submit_button.disabled = true; - obj.controller.view.server_prompt.disabled = true; - var s = document.getElementById('status'); - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_hostname')); - s.setAttribute('style','color: orange;'); - document.getElementById('version').value = ''; - if (!url) { - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.prompt_hostname')); - s.setAttribute('style','color: red;'); - obj.controller.view.server_prompt.disabled = false; - obj.controller.view.server_prompt.focus(); - return; - } - try { - if ( ! url.match(/^https:\/\//) ) url = 'https://' + url; - var x = new XMLHttpRequest(); - dump('server url = ' + url + '\n'); - x.open("GET",url,true); - x.onreadystatechange = function() { - try { - if (x.readyState != 4) return; - s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); - if (x.status == 200) { - s.setAttribute('style','color: green;'); - } else { - s.setAttribute('style','color: red;'); - } - obj.test_version(url); - } catch(E) { - obj.controller.view.server_prompt.disabled = false; - obj.controller.view.server_prompt.focus(); - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); - s.setAttribute('style','color: red;'); - obj.error.sdump('D_ERROR',E); - } - } - x.send(null); - } catch(E) { - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); - s.setAttribute('style','color: brown;'); - obj.error.sdump('D_ERROR',E); - obj.controller.view.server_prompt.disabled = false; - obj.controller.view.server_prompt.focus(); - } - }, - - 'test_version' : function(url) { - var obj = this; - var s = document.getElementById('version'); - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_version')); - s.setAttribute('style','color: orange;'); - try { - var x = new XMLHttpRequest(); - var url2 = url + '/xul/server/'; - dump('version url = ' + url2 + '\n'); - x.open("GET",url2,true); - x.onreadystatechange = function() { - try { - if (x.readyState != 4) return; - s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); - if (x.status == 200) { - s.setAttribute('style','color: green;'); - obj.controller.view.submit_button.disabled = false; - } else { - s.setAttribute('style','color: red;'); - obj.test_upgrade_instructions(url); - } - obj.controller.view.server_prompt.disabled = false; - } catch(E) { - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); - s.setAttribute('style','color: red;'); - obj.error.sdump('D_ERROR',E); - obj.controller.view.server_prompt.disabled = false; - } - } - x.send(null); - } catch(E) { - s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); - s.setAttribute('style','color: brown;'); - obj.error.sdump('D_ERROR',E); - obj.controller.view.server_prompt.disabled = false; - } - }, - - 'test_upgrade_instructions' : function(url) { - var obj = this; - try { - var x = new XMLHttpRequest(); - var url2 = url + '/xul/versions.html'; - dump('upgrade url = ' + url2 + '\n'); - x.open("GET",url2,true); - x.onreadystatechange = function() { - try { - if (x.readyState != 4) return; - if (x.status == 200) { - window.open('data:text/html,'+window.escape(x.responseText),'upgrade','chrome,resizable,modal,centered'); - } else { - alert(document.getElementById('authStrings').getString('staff.auth.controller.version_mismatch')); - } - obj.controller.view.server_prompt.disabled = false; - } catch(E) { - obj.error.sdump('D_ERROR',E); - obj.controller.view.server_prompt.disabled = false; - } - } - x.send(null); - } catch(E) { - obj.error.sdump('D_ERROR',E); - obj.controller.view.server_prompt.disabled = false; - } - }, - - 'login' : function() { - - var obj = this; - - this.error.sdump('D_AUTH', - document.getElementById('authStrings').getFormattedString( - 'staff.auth.controller.error_login', [ - this.controller.view.name_prompt.value, - this.controller.view.password_prompt.value, - this.controller.view.server_prompt.value - ] - ) - ); - this.controller.view.server_prompt.disabled = true; - this.controller.view.name_prompt.disabled = true; - this.controller.view.password_prompt.disabled = true; - this.controller.view.submit_button.disabled = true; - this.controller.view.apply_locale_btn.disabled = true; - XML_HTTP_SERVER = this.controller.view.server_prompt.value; - - try { - - if (typeof this.on_login == 'function') { - this.error.sdump('D_AUTH','auth.controller.session.on_init = ' + - 'auth.controller.on_login\n'); - this.session.on_init = this.on_login; - this.session.on_error = function() { obj.logoff(); }; - } - - this.session.init(); - - } catch(E) { - var error = '!! ' + E + '\n'; - this.error.sdump('D_ERROR',error); - alert(error); - this.logoff(); - if (E == 'open-ils.auth.authenticate.init returned false\n') { - this.controller.view.server_prompt.focus(); - this.controller.view.server_prompt.select(); - } - - if (typeof this.on_login_error == 'function') { - this.error.sdump('D_AUTH','auth.controller.on_login_error()\n'); - this.on_login_error(E); - } - } - - }, - - 'standalone' : function() { - var obj = this; - try { - if (typeof this.on_standalone == 'function') { - obj.on_standalone(); - } - } catch(E) { - var error = '!! ' + E + '\n'; - obj.error.sdump('D_ERROR',error); - alert(error); - } - }, - - 'standalone_import' : function() { - var obj = this; - try { - if (typeof this.on_standalone_import == 'function') { - obj.on_standalone_import(); - } - } catch(E) { - var error = '!! ' + E + '\n'; - obj.error.sdump('D_ERROR',error); - alert(error); - } - }, - - 'standalone_export' : function() { - var obj = this; - try { - if (typeof this.on_standalone_export == 'function') { - obj.on_standalone_export(); - } - } catch(E) { - var error = '!! ' + E + '\n'; - obj.error.sdump('D_ERROR',error); - alert(error); - } - }, - - 'debug' : function(action) { - var obj = this; - try { - if (typeof this.on_debug == 'function') { - obj.on_debug(action); - } - } catch(E) { - var error = '!! ' + E + '\n'; - obj.error.sdump('D_ERROR',error); - alert(error); - } - }, - - 'logoff' : function() { - - this.error.sdump('D_AUTH','logoff' + this.w + '\n'); - this.controller.view.progress_bar.value = 0; - this.controller.view.progress_bar.setAttribute('real','0.0'); - this.controller.view.submit_button.disabled = false; - this.controller.view.apply_locale_btn.disabled = false; - this.controller.view.password_prompt.disabled = false; - this.controller.view.password_prompt.value = ''; - this.controller.view.name_prompt.disabled = false; - this.controller.view.name_prompt.focus(); - this.controller.view.name_prompt.select(); - this.controller.view.server_prompt.disabled = false; - - var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(); - var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); - var enumerator = windowManagerInterface.getEnumerator(null); - - var w; // close all other windows - while ( w = enumerator.getNext() ) { - if (w != window) w.close(); - } - - this.controller.render('ws_deck'); - - this.session.close(); - - /* FIXME - need some locking or object destruction for the async tests */ - /* this.test_server( this.controller.view.server_prompt.value ); */ - - if (typeof this.on_logoff == 'function') { - this.error.sdump('D_AUTH','auth.controller.on_logoff()\n'); - this.on_logoff(); - } - - }, - 'close' : function() { - - this.error.sdump('D_AUTH','close' + this.w + '\n'); - - if (window.confirm(document.getElementById('authStrings').getString('staff.auth.controller.confirm_close'))) { - this.logoff(); - this.w.close(); /* Probably won't go any further */ - - if (typeof this.on_close == 'function') { - this.error.sdump('D_AUTH','auth.controller.on_close()\n'); - this.on_close(); - } - } - - } + // This talks to our ILS + JSAN.use('auth.session'); + obj.session = new auth.session(obj.controller.view); + + obj.controller.render(); + obj.test_server( obj.controller.view.server_prompt.value ); + obj.controller.render('ws_deck'); + + if (typeof this.on_init == 'function') { + this.error.sdump('D_AUTH','auth.controller.on_init()\n'); + this.on_init(); + } + }, + + 'test_server' : function(url) { + var obj = this; + if (!url) { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + JSAN.use('util.file'); var file = new util.file('last_ws_server'); + if (file._file.exists()) { + url = file.get_object(); file.close(); + obj.controller.view.server_prompt.value = url; + } + } + obj.controller.view.submit_button.disabled = true; + obj.controller.view.server_prompt.disabled = true; + var s = document.getElementById('status'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_hostname')); + s.setAttribute('style','color: orange;'); + document.getElementById('version').value = ''; + if (!url) { + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.prompt_hostname')); + s.setAttribute('style','color: red;'); + obj.controller.view.server_prompt.disabled = false; + obj.controller.view.server_prompt.focus(); + return; + } + try { + if ( ! url.match(/^https:\/\//) ) url = 'https://' + url; + var x = new XMLHttpRequest(); + dump('server url = ' + url + '\n'); + x.open("GET",url,true); + x.onreadystatechange = function() { + try { + if (x.readyState != 4) return; + s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); + if (x.status == 200) { + s.setAttribute('style','color: green;'); + } else { + s.setAttribute('style','color: red;'); + } + obj.test_version(url); + } catch(E) { + obj.controller.view.server_prompt.disabled = false; + obj.controller.view.server_prompt.focus(); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); + s.setAttribute('style','color: red;'); + obj.error.sdump('D_ERROR',E); + } + } + x.send(null); + } catch(E) { + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_hostname')); + s.setAttribute('style','color: brown;'); + obj.error.sdump('D_ERROR',E); + obj.controller.view.server_prompt.disabled = false; + obj.controller.view.server_prompt.focus(); + } + }, + + 'test_version' : function(url) { + var obj = this; + var s = document.getElementById('version'); + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.testing_version')); + s.setAttribute('style','color: orange;'); + try { + var x = new XMLHttpRequest(); + var url2 = url + '/xul/server/'; + dump('version url = ' + url2 + '\n'); + x.open("GET",url2,true); + x.onreadystatechange = function() { + try { + if (x.readyState != 4) return; + s.setAttribute('value', document.getElementById('authStrings').getFormattedString('staff.auth.controller.status', [x.status, x.statusText])); + if (x.status == 200) { + s.setAttribute('style','color: green;'); + obj.controller.view.submit_button.disabled = false; + } else { + s.setAttribute('style','color: red;'); + obj.test_upgrade_instructions(url); + } + obj.controller.view.server_prompt.disabled = false; + } catch(E) { + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); + s.setAttribute('style','color: red;'); + obj.error.sdump('D_ERROR',E); + obj.controller.view.server_prompt.disabled = false; + } + } + x.send(null); + } catch(E) { + s.setAttribute('value', document.getElementById('authStrings').getString('staff.auth.controller.error_version')); + s.setAttribute('style','color: brown;'); + obj.error.sdump('D_ERROR',E); + obj.controller.view.server_prompt.disabled = false; + } + }, + + 'test_upgrade_instructions' : function(url) { + var obj = this; + try { + var x = new XMLHttpRequest(); + var url2 = url + '/xul/versions.html'; + dump('upgrade url = ' + url2 + '\n'); + x.open("GET",url2,true); + x.onreadystatechange = function() { + try { + if (x.readyState != 4) return; + if (x.status == 200) { + window.open('data:text/html,'+window.escape(x.responseText),'upgrade','chrome,resizable,modal,centered'); + } else { + alert(document.getElementById('authStrings').getString('staff.auth.controller.version_mismatch')); + } + obj.controller.view.server_prompt.disabled = false; + } catch(E) { + obj.error.sdump('D_ERROR',E); + obj.controller.view.server_prompt.disabled = false; + } + } + x.send(null); + } catch(E) { + obj.error.sdump('D_ERROR',E); + obj.controller.view.server_prompt.disabled = false; + } + }, + + 'login' : function() { + + var obj = this; + + this.error.sdump('D_AUTH', + document.getElementById('authStrings').getFormattedString( + 'staff.auth.controller.error_login', [ + this.controller.view.name_prompt.value, + this.controller.view.password_prompt.value, + this.controller.view.server_prompt.value + ] + ) + ); + this.controller.view.server_prompt.disabled = true; + this.controller.view.name_prompt.disabled = true; + this.controller.view.password_prompt.disabled = true; + this.controller.view.submit_button.disabled = true; + this.controller.view.apply_locale_btn.disabled = true; + XML_HTTP_SERVER = this.controller.view.server_prompt.value; + + try { + + if (typeof this.on_login == 'function') { + this.error.sdump('D_AUTH','auth.controller.session.on_init = ' + + 'auth.controller.on_login\n'); + this.session.on_init = this.on_login; + this.session.on_error = function() { obj.logoff(); }; + } + + this.session.init(); + + } catch(E) { + var error = '!! ' + E + '\n'; + this.error.sdump('D_ERROR',error); + alert(error); + this.logoff(); + if (E == 'open-ils.auth.authenticate.init returned false\n') { + this.controller.view.server_prompt.focus(); + this.controller.view.server_prompt.select(); + } + + if (typeof this.on_login_error == 'function') { + this.error.sdump('D_AUTH','auth.controller.on_login_error()\n'); + this.on_login_error(E); + } + } + + }, + + 'standalone' : function() { + var obj = this; + try { + if (typeof this.on_standalone == 'function') { + obj.on_standalone(); + } + } catch(E) { + var error = '!! ' + E + '\n'; + obj.error.sdump('D_ERROR',error); + alert(error); + } + }, + + 'standalone_import' : function() { + var obj = this; + try { + if (typeof this.on_standalone_import == 'function') { + obj.on_standalone_import(); + } + } catch(E) { + var error = '!! ' + E + '\n'; + obj.error.sdump('D_ERROR',error); + alert(error); + } + }, + + 'standalone_export' : function() { + var obj = this; + try { + if (typeof this.on_standalone_export == 'function') { + obj.on_standalone_export(); + } + } catch(E) { + var error = '!! ' + E + '\n'; + obj.error.sdump('D_ERROR',error); + alert(error); + } + }, + + 'debug' : function(action) { + var obj = this; + try { + if (typeof this.on_debug == 'function') { + obj.on_debug(action); + } + } catch(E) { + var error = '!! ' + E + '\n'; + obj.error.sdump('D_ERROR',error); + alert(error); + } + }, + + 'logoff' : function() { + + this.error.sdump('D_AUTH','logoff' + this.w + '\n'); + this.controller.view.progress_bar.value = 0; + this.controller.view.progress_bar.setAttribute('real','0.0'); + this.controller.view.submit_button.disabled = false; + this.controller.view.apply_locale_btn.disabled = false; + this.controller.view.password_prompt.disabled = false; + this.controller.view.password_prompt.value = ''; + this.controller.view.name_prompt.disabled = false; + this.controller.view.name_prompt.focus(); + this.controller.view.name_prompt.select(); + this.controller.view.server_prompt.disabled = false; + + var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(); + var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); + var enumerator = windowManagerInterface.getEnumerator(null); + + var w; // close all other windows + while ( w = enumerator.getNext() ) { + if (w != window) w.close(); + } + + this.controller.render('ws_deck'); + + this.session.close(); + + /* FIXME - need some locking or object destruction for the async tests */ + /* this.test_server( this.controller.view.server_prompt.value ); */ + + if (typeof this.on_logoff == 'function') { + this.error.sdump('D_AUTH','auth.controller.on_logoff()\n'); + this.on_logoff(); + } + + }, + 'close' : function() { + + this.error.sdump('D_AUTH','close' + this.w + '\n'); + + if (window.confirm(document.getElementById('authStrings').getString('staff.auth.controller.confirm_close'))) { + this.logoff(); + this.w.close(); /* Probably won't go any further */ + + if (typeof this.on_close == 'function') { + this.error.sdump('D_AUTH','auth.controller.on_close()\n'); + this.on_close(); + } + } + + } } dump('exiting auth/controller.js\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/auth/session.js b/Open-ILS/xul/staff_client/chrome/content/auth/session.js index db1cff8883..405c303e9e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/auth/session.js +++ b/Open-ILS/xul/staff_client/chrome/content/auth/session.js @@ -4,128 +4,128 @@ dump('entering auth/session.js\n'); if (typeof auth == 'undefined') auth = {}; auth.session = function (view,login_type) { - JSAN.use('util.error'); this.error = new util.error(); - JSAN.use('util.network'); this.network = new util.network(); - this.view = view; - this.login_type = login_type || 'staff'; + JSAN.use('util.error'); this.error = new util.error(); + JSAN.use('util.network'); this.network = new util.network(); + this.view = view; + this.login_type = login_type || 'staff'; - return this; + return this; }; auth.session.prototype = { - 'init' : function () { - - var obj = this; - - try { - var init = this.network.request( - api.AUTH_INIT.app, - api.AUTH_INIT.method, - [ this.view.name_prompt.value ] - ); - - if (init) { - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); - - var params = { - 'username' : this.view.name_prompt.value, - 'password' : hex_md5( - init + - hex_md5( - this.view.password_prompt.value - ) - ), - 'type' : 'temp', - }; - - if (data.ws_info[ this.view.server_prompt.value ]) { - params.type = this.login_type; - params.workstation = data.ws_info[ this.view.server_prompt.value ].name; - data.ws_name = params.workstation; data.stash('ws_name'); - } - - var robj = this.network.simple_request( 'AUTH_COMPLETE', [ params ]); - - switch (Number(robj.ilsevent)) { - case 0: - this.key = robj.payload.authtoken; - this.authtime = robj.payload.authtime; - break; - case 1520 /* WORKSTATION_NOT_FOUND */: - alert(document.getElementById('authStrings').getFormattedString('staff.auth.session.unregistered', [params.workstation])); - delete(params.workstation); - delete(data.ws_info[ this.view.server_prompt.value ]); - data.stash('ws_info'); - data.ws_name = null; data.stash('ws_name'); - params.type = 'temp'; - robj = this.network.simple_request('AUTH_COMPLETE',[ params ]); - if (robj.ilsevent == 0) { - this.key = robj.payload.authtoken; - this.authtime = robj.payload.authtime; - } else { - //this.error.standard_unexpected_error_alert('auth.session.init',robj); - throw(robj); - } - break; - default: - //obj.error.standard_unexpected_error_alert('auth.session.init',robj); - throw(robj); - break; - } - - this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n'); - - if (typeof this.on_init == 'function') { - this.error.sdump('D_AUTH','auth.session.on_init()\n'); - this.on_init(); - } - - } else { - - var error = document.getElementById('authStrings').getString('staff.auth.session.init_false') + '\n'; - this.error.sdump('D_ERROR',error); - throw(error); - } - - } catch(E) { - alert(document.getElementById('authStrings').getString('staff.auth.session.login_failed')); - //obj.error.standard_unexpected_error_alert('Error on auth.session.init()',E); - - if (typeof this.on_init_error == 'function') { - this.error.sdump('D_AUTH','auth.session.on_init_error()\n'); - this.on_init_error(E); - } - if (typeof this.on_error == 'function') { - this.error.sdump('D_AUTH','auth.session.on_error()\n'); - this.on_error(); - } - - //throw(E); - /* This was for testing - if (typeof this.on_init == 'function') { - this.error.sdump('D_AUTH','auth.session.on_init() despite error\n'); - this.on_init(); - } - */ - } - }, - - 'close' : function () { - var obj = this; - obj.error.sdump('D_AUTH','auth.session.close()\n'); - if (obj.key) obj.network.request( - api.AUTH_DELETE.app, - api.AUTH_DELETE.method, - [ obj.key ], - function(req) {} - ); - obj.key = null; - if (typeof obj.on_close == 'function') { - obj.error.sdump('D_AUTH','auth.session.on_close()\n'); - obj.on_close(); - } - } + 'init' : function () { + + var obj = this; + + try { + var init = this.network.request( + api.AUTH_INIT.app, + api.AUTH_INIT.method, + [ this.view.name_prompt.value ] + ); + + if (init) { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); + + var params = { + 'username' : this.view.name_prompt.value, + 'password' : hex_md5( + init + + hex_md5( + this.view.password_prompt.value + ) + ), + 'type' : 'temp', + }; + + if (data.ws_info[ this.view.server_prompt.value ]) { + params.type = this.login_type; + params.workstation = data.ws_info[ this.view.server_prompt.value ].name; + data.ws_name = params.workstation; data.stash('ws_name'); + } + + var robj = this.network.simple_request( 'AUTH_COMPLETE', [ params ]); + + switch (Number(robj.ilsevent)) { + case 0: + this.key = robj.payload.authtoken; + this.authtime = robj.payload.authtime; + break; + case 1520 /* WORKSTATION_NOT_FOUND */: + alert(document.getElementById('authStrings').getFormattedString('staff.auth.session.unregistered', [params.workstation])); + delete(params.workstation); + delete(data.ws_info[ this.view.server_prompt.value ]); + data.stash('ws_info'); + data.ws_name = null; data.stash('ws_name'); + params.type = 'temp'; + robj = this.network.simple_request('AUTH_COMPLETE',[ params ]); + if (robj.ilsevent == 0) { + this.key = robj.payload.authtoken; + this.authtime = robj.payload.authtime; + } else { + //this.error.standard_unexpected_error_alert('auth.session.init',robj); + throw(robj); + } + break; + default: + //obj.error.standard_unexpected_error_alert('auth.session.init',robj); + throw(robj); + break; + } + + this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n'); + + if (typeof this.on_init == 'function') { + this.error.sdump('D_AUTH','auth.session.on_init()\n'); + this.on_init(); + } + + } else { + + var error = document.getElementById('authStrings').getString('staff.auth.session.init_false') + '\n'; + this.error.sdump('D_ERROR',error); + throw(error); + } + + } catch(E) { + alert(document.getElementById('authStrings').getString('staff.auth.session.login_failed')); + //obj.error.standard_unexpected_error_alert('Error on auth.session.init()',E); + + if (typeof this.on_init_error == 'function') { + this.error.sdump('D_AUTH','auth.session.on_init_error()\n'); + this.on_init_error(E); + } + if (typeof this.on_error == 'function') { + this.error.sdump('D_AUTH','auth.session.on_error()\n'); + this.on_error(); + } + + //throw(E); + /* This was for testing + if (typeof this.on_init == 'function') { + this.error.sdump('D_AUTH','auth.session.on_init() despite error\n'); + this.on_init(); + } + */ + } + }, + + 'close' : function () { + var obj = this; + obj.error.sdump('D_AUTH','auth.session.close()\n'); + if (obj.key) obj.network.request( + api.AUTH_DELETE.app, + api.AUTH_DELETE.method, + [ obj.key ], + function(req) {} + ); + obj.key = null; + if (typeof obj.on_close == 'function') { + obj.error.sdump('D_AUTH','auth.session.on_close()\n'); + obj.on_close(); + } + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index 12018b0439..133e6c5363 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -8,74 +8,74 @@ var hold_browser_reset = true; function $(id) { return document.getElementById(id); } function my_init() { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); } - 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 cat/opac.xul'); + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); } + 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 cat/opac.xul'); - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - XML_HTTP_SERVER = g.data.server_unadorned; + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + XML_HTTP_SERVER = g.data.server_unadorned; //JSAN.addRepository('http://' + g.data.server_unadorned + '/xul/server/'); //JSAN._loadJSFromUrl('http://' + g.data.server_unadorned + '/xul/server/cat/util.js'); - JSAN.use('util.network'); g.network = new util.network(); + JSAN.use('util.network'); g.network = new util.network(); - 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); } + 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'); - bottom_pane = new util.deck('bottom_pane'); + JSAN.use('util.deck'); + top_pane = new util.deck('top_pane'); + bottom_pane = new util.deck('bottom_pane'); - set_opac(); + set_opac(); - } catch(E) { - var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["cat/opac.xul", E]); - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + } catch(E) { + var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["cat/opac.xul", E]); + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function set_brief_view() { - 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(document.getElementById('offlineStrings').getFormattedString("cat.bib_record", [n])); } catch(E) { alert(E); } - } else { - dump('no set_tab_name\n'); - } - } - } - ); + 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(document.getElementById('offlineStrings').getFormattedString("cat.bib_record", [n])); } catch(E) { alert(E); } + } else { + dump('no set_tab_name\n'); + } + } + } + ); } function set_marc_view() { - g.view = 'marc_view'; - if (marc_view_reset) { - bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG); + g.view = 'marc_view'; + if (marc_view_reset) { + bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG); marc_view_reset = false; - } else { - bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG); - } + } else { + bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG); + } } function set_marc_edit() { - g.view = 'marc_edit'; - var a = xulG.url_prefix( urls.XUL_MARC_EDIT ); - var b = {}; - var c = { - 'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid }, + g.view = 'marc_edit'; + var a = xulG.url_prefix( urls.XUL_MARC_EDIT ); + var b = {}; + var c = { + 'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid }, /* // FIXME - disable this until we find a good way of pulling remote JSAN libraries into chrome 'fast_add_item' : function(doc_id,cn_label,cp_barcode) { try { @@ -85,186 +85,186 @@ function set_marc_edit() { } }, */ - 'save' : { - 'label' : document.getElementById('offlineStrings').getString('cat.save_record'), - 'func' : function (new_marcxml) { - try { - var r = g.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), docid, new_marcxml ]); + 'save' : { + 'label' : document.getElementById('offlineStrings').getString('cat.save_record'), + 'func' : function (new_marcxml) { + try { + var r = g.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), docid, new_marcxml ]); marc_view_reset = true; copy_browser_reset = true; hold_browser_reset = true; - if (typeof r.ilsevent != 'undefined') { - throw(r); - } else { - alert(document.getElementById('offlineStrings').getString("cat.save.success")); + if (typeof r.ilsevent != 'undefined') { + throw(r); + } else { + alert(document.getElementById('offlineStrings').getString("cat.save.success")); return { 'id' : r.id(), 'oncomplete' : function() {} }; - } - } catch(E) { - g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E); - } - } - } - }; - if (marc_edit_reset) { - bottom_pane.reset_iframe( a,b,c ); + } + } catch(E) { + g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E); + } + } + } + }; + if (marc_edit_reset) { + bottom_pane.reset_iframe( a,b,c ); marc_edit_reset = false; - } else { - bottom_pane.set_iframe( a,b,c ); - } + } else { + bottom_pane.set_iframe( a,b,c ); + } } function set_copy_browser() { - g.view = 'copy_browser'; - if (copy_browser_reset) { - bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG); + g.view = 'copy_browser'; + if (copy_browser_reset) { + bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG); copy_browser_reset =false; - } else { - bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG); - } + } else { + bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),{},xulG); + } } function set_hold_browser() { - g.view = 'hold_browser'; - if (hold_browser_reset) { - bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG); + g.view = 'hold_browser'; + if (hold_browser_reset) { + bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG); hold_browser_reset = false; - } else { - bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG); - } + } else { + bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),{},xulG); + } } function set_opac() { - g.view = 'opac'; - try { - var content_params = { - 'show_nav_buttons' : true, - 'show_print_button' : true, - 'passthru_content_params' : { - 'authtoken' : ses(), - 'authtime' : ses('authtime'), - 'window_open' : function(a,b,c) { - try { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite'); - return window.open(a,b,c); - } catch(E) { - g.error.standard_unexpected_error_alert('window_open',E); - } - } - }, - 'on_url_load' : function(f) { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var win; - try { - if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') { - win = f.contentWindow.wrappedJSObject; - } else { - win = f.contentWindow; - } - } catch(E) { - win = f.contentWindow; - } - win.attachEvt("rdetail", "recordRetrieved", - function(id){ - try { - if (docid == id) return; - docid = id; - refresh_display(id); - } catch(E) { - g.error.standard_unexpected_error_alert('rdetail -> recordRetrieved',E); - } - } - ); - - g.f_record_start = null; g.f_record_prev = null; g.f_record_next = null; g.f_record_end = null; - $('record_start').disabled = true; $('record_next').disabled = true; - $('record_prev').disabled = true; $('record_end').disabled = true; - $('record_pos').setAttribute('value',''); + g.view = 'opac'; + try { + var content_params = { + 'show_nav_buttons' : true, + 'show_print_button' : true, + 'passthru_content_params' : { + 'authtoken' : ses(), + 'authtime' : ses('authtime'), + 'window_open' : function(a,b,c) { + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite'); + return window.open(a,b,c); + } catch(E) { + g.error.standard_unexpected_error_alert('window_open',E); + } + } + }, + 'on_url_load' : function(f) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var win; + try { + if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') { + win = f.contentWindow.wrappedJSObject; + } else { + win = f.contentWindow; + } + } catch(E) { + win = f.contentWindow; + } + win.attachEvt("rdetail", "recordRetrieved", + function(id){ + try { + if (docid == id) return; + docid = id; + refresh_display(id); + } catch(E) { + g.error.standard_unexpected_error_alert('rdetail -> recordRetrieved',E); + } + } + ); + + g.f_record_start = null; g.f_record_prev = null; g.f_record_next = null; g.f_record_end = null; + $('record_start').disabled = true; $('record_next').disabled = true; + $('record_prev').disabled = true; $('record_end').disabled = true; + $('record_pos').setAttribute('value',''); - win.attachEvt("rdetail", "nextPrevDrawn", - function(rIndex,rCount){ - $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1+rIndex), rCount ? rCount : 1])); - if (win.rdetailNext) { - g.f_record_next = function() { - g.view_override = g.view; - win.rdetailNext(); - } - $('record_next').disabled = false; - } - if (win.rdetailPrev) { - g.f_record_prev = function() { - g.view_override = g.view; - win.rdetailPrev(); - } - $('record_prev').disabled = false; - } - if (win.rdetailStart) { - g.f_record_start = function() { - g.view_override = g.view; - win.rdetailStart(); - } - $('record_start').disabled = false; - } - if (win.rdetailEnd) { - g.f_record_end = function() { - g.view_override = g.view; - win.rdetailEnd(); - } - $('record_end').disabled = false; - } - } - ); - }, - 'url_prefix' : xulG.url_prefix, - }; - if (opac_url) { content_params.url = opac_url; } else { content_params.url = xulG.url_prefix( urls.browser ); } - browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params); + win.attachEvt("rdetail", "nextPrevDrawn", + function(rIndex,rCount){ + $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1+rIndex), rCount ? rCount : 1])); + if (win.rdetailNext) { + g.f_record_next = function() { + g.view_override = g.view; + win.rdetailNext(); + } + $('record_next').disabled = false; + } + if (win.rdetailPrev) { + g.f_record_prev = function() { + g.view_override = g.view; + win.rdetailPrev(); + } + $('record_prev').disabled = false; + } + if (win.rdetailStart) { + g.f_record_start = function() { + g.view_override = g.view; + win.rdetailStart(); + } + $('record_start').disabled = false; + } + if (win.rdetailEnd) { + g.f_record_end = function() { + g.view_override = g.view; + win.rdetailEnd(); + } + $('record_end').disabled = false; + } + } + ); + }, + 'url_prefix' : xulG.url_prefix, + }; + if (opac_url) { content_params.url = opac_url; } else { content_params.url = xulG.url_prefix( urls.browser ); } + browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params); /* // Remember to use the REMOTE_BROWSER if we ever try to move this to remote xul again - browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog', {}, content_params); + browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog', {}, content_params); */ - } catch(E) { - g.error.sdump('D_ERROR','set_opac: ' + E); - } + } catch(E) { + g.error.sdump('D_ERROR','set_opac: ' + E); + } } function bib_in_new_tab() { - try { - var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href; - var content_params = { 'session' : ses(), 'authtime' : ses('authtime'), 'opac_url' : url }; - xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params); - } catch(E) { - g.error.sdump('D_ERROR',E); - } + try { + var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href; + var content_params = { 'session' : ses(), 'authtime' : ses('authtime'), 'opac_url' : url }; + xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params); + } catch(E) { + g.error.sdump('D_ERROR',E); + } } function remove_me() { - 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'); } - $('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'); } + $('nav').setAttribute('hidden','true'); } function add_to_bucket() { - JSAN.use('util.window'); var win = new util.window(); - win.open( - xulG.url_prefix(urls.XUL_RECORD_BUCKETS_QUICK) - + '?record_ids=' + js2JSON( [ docid ] ), - 'sel_bucket_win' + win.window_name_increment(), - 'chrome,resizable,modal,center' - ); + JSAN.use('util.window'); var win = new util.window(); + win.open( + xulG.url_prefix(urls.XUL_RECORD_BUCKETS_QUICK) + + '?record_ids=' + js2JSON( [ docid ] ), + 'sel_bucket_win' + win.window_name_increment(), + 'chrome,resizable,modal,center' + ); } function mark_for_overlay() { - g.data.marked_record = docid; - g.data.stash('marked_record'); - var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]); + g.data.marked_record = docid; + g.data.stash('marked_record'); + var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]); if (typeof robj.ilsevent == 'undefined') { g.data.marked_record_mvr = robj; } else { g.data.marked_record_mvr = null; - g.error.standard_unexpected_error_alert('in mark_for_overlay',robj); + g.error.standard_unexpected_error_alert('in mark_for_overlay',robj); } g.data.stash('marked_record_mvr'); if (g.data.marked_record_mvr) { @@ -275,86 +275,86 @@ function mark_for_overlay() { } function delete_record() { - if (g.error.yns_alert( - document.getElementById('offlineStrings').getFormattedString('cat.opac.delete_record.confirm', [docid]), - document.getElementById('offlineStrings').getString('cat.opac.delete_record'), - document.getElementById('offlineStrings').getString('cat.opac.delete'), - document.getElementById('offlineStrings').getString('cat.opac.cancel'), - null, - document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) { - var robj = g.network.simple_request('FM_BRE_DELETE',[ses(),docid]); - if (typeof robj.ilsevent != 'undefined') { - alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n'); - } else { - alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted')); - refresh_display(docid); - } - } + if (g.error.yns_alert( + document.getElementById('offlineStrings').getFormattedString('cat.opac.delete_record.confirm', [docid]), + document.getElementById('offlineStrings').getString('cat.opac.delete_record'), + document.getElementById('offlineStrings').getString('cat.opac.delete'), + document.getElementById('offlineStrings').getString('cat.opac.cancel'), + null, + document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) { + var robj = g.network.simple_request('FM_BRE_DELETE',[ses(),docid]); + if (typeof robj.ilsevent != 'undefined') { + alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n'); + } else { + alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted')); + refresh_display(docid); + } + } } function undelete_record() { if (g.error.yns_alert( - document.getElementById('offlineStrings').getFormattedString('cat.opac.undelete_record.confirm', [docid]), - document.getElementById('offlineStrings').getString('cat.opac.undelete_record'), - document.getElementById('offlineStrings').getString('cat.opac.undelete'), - document.getElementById('offlineStrings').getString('cat.opac.cancel'), - null, - document.getElementById('offlineStrings').getString('cat.opac.record_undeleted.confirm')) == 0) { + document.getElementById('offlineStrings').getFormattedString('cat.opac.undelete_record.confirm', [docid]), + document.getElementById('offlineStrings').getString('cat.opac.undelete_record'), + document.getElementById('offlineStrings').getString('cat.opac.undelete'), + document.getElementById('offlineStrings').getString('cat.opac.cancel'), + null, + document.getElementById('offlineStrings').getString('cat.opac.record_undeleted.confirm')) == 0) { var robj = g.network.simple_request('FM_BRE_UNDELETE',[ses(),docid]); if (typeof robj.ilsevent != 'undefined') { - alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_undeleted.error', [docid, robj.textcode, robj.desc]) + '\n'); + alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_undeleted.error', [docid, robj.textcode, robj.desc]) + '\n'); } else { - alert(document.getElementById('offlineStrings').getString('cat.opac.record_undeleted')); - refresh_display(docid); + alert(document.getElementById('offlineStrings').getString('cat.opac.record_undeleted')); + refresh_display(docid); } } } function refresh_display(id) { - try { + try { marc_view_reset = true; marc_edit_reset = true; copy_browser_reset = true; hold_browser_reset = true; - while(top_pane.node.lastChild) top_pane.node.removeChild( top_pane.node.lastChild ); - var children = bottom_pane.node.childNodes; - for (var i = 0; i < children.length; i++) { - if (children[i] != browser_frame) bottom_pane.node.removeChild(children[i]); - } + while(top_pane.node.lastChild) top_pane.node.removeChild( top_pane.node.lastChild ); + var children = bottom_pane.node.childNodes; + for (var i = 0; i < children.length; i++) { + if (children[i] != browser_frame) bottom_pane.node.removeChild(children[i]); + } - set_brief_view(); - $('nav').setAttribute('hidden','false'); - var settings = g.network.simple_request( - 'FM_AUS_RETRIEVE', - [ ses(), g.data.list.au[0].id() ] - ); - var view = settings['staff_client.catalog.record_view.default']; - if (g.view_override) { - view = g.view_override; - g.view_override = null; - } - switch(view) { - case 'marc_view' : set_marc_view(); break; - case 'marc_edit' : set_marc_edit(); break; - case 'copy_browser' : set_copy_browser(); break; - case 'hold_browser' : set_hold_browser(); break; - case 'opac' : - default: set_opac(); break; - } - } catch(E) { - g.error.standard_unexpected_error_alert('in refresh_display',E); - } + set_brief_view(); + $('nav').setAttribute('hidden','false'); + var settings = g.network.simple_request( + 'FM_AUS_RETRIEVE', + [ ses(), g.data.list.au[0].id() ] + ); + var view = settings['staff_client.catalog.record_view.default']; + if (g.view_override) { + view = g.view_override; + g.view_override = null; + } + switch(view) { + case 'marc_view' : set_marc_view(); break; + case 'marc_edit' : set_marc_edit(); break; + case 'copy_browser' : set_copy_browser(); break; + case 'hold_browser' : set_hold_browser(); break; + case 'opac' : + default: set_opac(); break; + } + } catch(E) { + g.error.standard_unexpected_error_alert('in refresh_display',E); + } } function set_default() { - var robj = g.network.simple_request( - 'FM_AUS_UPDATE', - [ ses(), g.data.list.au[0].id(), { 'staff_client.catalog.record_view.default' : g.view } ] - ) - if (typeof robj.ilsevent != 'undefined') { - if (robj.ilsevent != 0) g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString('cat.preference.error'), robj); - } + var robj = g.network.simple_request( + 'FM_AUS_UPDATE', + [ ses(), g.data.list.au[0].id(), { 'staff_client.catalog.record_view.default' : g.view } ] + ) + if (typeof robj.ilsevent != 'undefined') { + if (robj.ilsevent != 0) g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString('cat.preference.error'), robj); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline.js index 4d083e328c..e34e7930f8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline.js @@ -2,153 +2,153 @@ dump('entering circ.offline.js\n'); if (typeof circ == 'undefined') circ = {}; circ.offline = function (params) { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - JSAN.use('util.error'); this.error = new util.error(); - } catch(E) { - dump('circ.offline: ' + E + '\n'); - } + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + JSAN.use('util.error'); this.error = new util.error(); + } catch(E) { + dump('circ.offline: ' + E + '\n'); + } } circ.offline.prototype = { - 'init' : function( params ) { + 'init' : function( params ) { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var obj = this; + var obj = this; - JSAN.use('util.deck'); obj.deck = new util.deck('main'); + JSAN.use('util.deck'); obj.deck = new util.deck('main'); - JSAN.use('util.controller'); obj.controller = new util.controller(); - obj.controller.init( - { - control_map : { - 'cmd_broken' : [ - ['command'], - function() { alert('Not Yet Implemented'); } - ], - 'cmd_checkout' : [ - ['command'], - function() { obj.deck.set_iframe('offline_checkout.xul',{},{}); } - ], - 'cmd_renew' : [ - ['command'], - function() { obj.deck.set_iframe('offline_renew.xul',{},{}); } - ], - 'cmd_in_house_use' : [ - ['command'], - function() { obj.deck.set_iframe('offline_in_house_use.xul',{},{}); } - ], - 'cmd_checkin' : [ - ['command'], - function() { obj.deck.set_iframe('offline_checkin.xul',{},{}); } - ], - 'cmd_register_patron' : [ - ['command'], - function() { obj.deck.set_iframe('offline_register.xul',{},{}); } - ], - 'cmd_print_last_receipt' : [ - ['command'], - function() { - JSAN.use('util.print'); var print = new util.print(); - print.reprint_last(); - } - ], - 'cmd_exit' : [ - ['command'], - function() { try { xulG.close_tab(); } catch(E) { window.close(); } } - ], - } - } - ); + JSAN.use('util.controller'); obj.controller = new util.controller(); + obj.controller.init( + { + control_map : { + 'cmd_broken' : [ + ['command'], + function() { alert('Not Yet Implemented'); } + ], + 'cmd_checkout' : [ + ['command'], + function() { obj.deck.set_iframe('offline_checkout.xul',{},{}); } + ], + 'cmd_renew' : [ + ['command'], + function() { obj.deck.set_iframe('offline_renew.xul',{},{}); } + ], + 'cmd_in_house_use' : [ + ['command'], + function() { obj.deck.set_iframe('offline_in_house_use.xul',{},{}); } + ], + 'cmd_checkin' : [ + ['command'], + function() { obj.deck.set_iframe('offline_checkin.xul',{},{}); } + ], + 'cmd_register_patron' : [ + ['command'], + function() { obj.deck.set_iframe('offline_register.xul',{},{}); } + ], + 'cmd_print_last_receipt' : [ + ['command'], + function() { + JSAN.use('util.print'); var print = new util.print(); + print.reprint_last(); + } + ], + 'cmd_exit' : [ + ['command'], + function() { try { xulG.close_tab(); } catch(E) { window.close(); } } + ], + } + } + ); - obj.receipt_init(); + obj.receipt_init(); - obj.patron_init(); + obj.patron_init(); - } catch(E) { - this.error.sdump('D_ERROR','circ.offline.init: ' + E + '\n'); - } - }, + } catch(E) { + this.error.sdump('D_ERROR','circ.offline.init: ' + E + '\n'); + } + }, - 'receipt_init' : function() { - function backup_receipt_templates() { - data.print_list_templates = { - 'offline_checkout' : { - 'type' : 'offline_checkout', - 'header' : 'Patron %patron_barcode%
\r\nYou checked out the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%
    \r\nDue: %due_date%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', - }, - 'offline_checkin' : { - 'type' : 'offline_checkin', - 'header' : 'You checked in the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', - }, - 'offline_renew' : { - 'type' : 'offline_renew', - 'header' : 'You renewed the following items:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\n', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', - }, - 'offline_inhouse_use' : { - 'type' : 'offline_inhouse_use', - 'header' : 'You marked the following in-house items used:
    ', - 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %count%', - 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', - }, - }; - data.stash('print_list_templates'); - } + 'receipt_init' : function() { + function backup_receipt_templates() { + data.print_list_templates = { + 'offline_checkout' : { + 'type' : 'offline_checkout', + 'header' : 'Patron %patron_barcode%
\r\nYou checked out the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%
    \r\nDue: %due_date%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', + }, + 'offline_checkin' : { + 'type' : 'offline_checkin', + 'header' : 'You checked in the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', + }, + 'offline_renew' : { + 'type' : 'offline_renew', + 'header' : 'You renewed the following items:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\n', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', + }, + 'offline_inhouse_use' : { + 'type' : 'offline_inhouse_use', + 'header' : 'You marked the following in-house items used:
    ', + 'line_item' : '
  1. Barcode: %barcode%\r\nUses: %count%', + 'footer' : '

%TODAY_TRIM%
\r\n
\r\n', + }, + }; + data.stash('print_list_templates'); + } - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - JSAN.use('util.file'); var file = new util.file('print_list_templates'); - if (file._file.exists()) { - try { - var x = file.get_object(); - if (x) { - data.print_list_templates = x; - data.stash('print_list_templates'); - } else { - backup_receipt_templates(); - } - } catch(E) { - alert(E); - backup_receipt_templates(); - } - } else { - backup_receipt_templates(); - } - file.close(); - }, + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + JSAN.use('util.file'); var file = new util.file('print_list_templates'); + if (file._file.exists()) { + try { + var x = file.get_object(); + if (x) { + data.print_list_templates = x; + data.stash('print_list_templates'); + } else { + backup_receipt_templates(); + } + } catch(E) { + alert(E); + backup_receipt_templates(); + } + } else { + backup_receipt_templates(); + } + file.close(); + }, - 'patron_init' : function() { - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - JSAN.use('util.file'); var file = new util.file('offline_patron_list'); - if (file._file.exists()) { - var lines = file.get_content().split(/\n/); - var hash = {}; - for (var i = 0; i < lines.length; i++) { - hash[ lines[i].split(/\s+/)[0] ] = lines[i].split(/\s+/)[1]; - } - delete(lines); - data.bad_patrons = hash; - data.stash('bad_patrons'); - var file2 = new util.file('offline_patron_list.date'); - if (file2._file.exists()) { - data.bad_patrons_date = file2.get_content(); - data.stash('bad_patrons_date'); - } - file2.close(); - } else { - data.bad_patrons = {}; - data.stash('bad_patrons'); - } - file.close(); - }, + 'patron_init' : function() { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + JSAN.use('util.file'); var file = new util.file('offline_patron_list'); + if (file._file.exists()) { + var lines = file.get_content().split(/\n/); + var hash = {}; + for (var i = 0; i < lines.length; i++) { + hash[ lines[i].split(/\s+/)[0] ] = lines[i].split(/\s+/)[1]; + } + delete(lines); + data.bad_patrons = hash; + data.stash('bad_patrons'); + var file2 = new util.file('offline_patron_list.date'); + if (file2._file.exists()) { + data.bad_patrons_date = file2.get_content(); + data.stash('bad_patrons_date'); + } + file2.close(); + } else { + data.bad_patrons = {}; + data.stash('bad_patrons'); + } + file.close(); + }, } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js index 68b6d74d51..6208f32012 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkin.js @@ -1,116 +1,116 @@ var offlineStrings; function my_init() { - try { - offlineStrings = $('offlineStrings'); - - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } - 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 offline_checkin.xul'); - - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } - } + try { + offlineStrings = $('offlineStrings'); + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } + 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 offline_checkin.xul'); + + if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { + try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } + } - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - JSAN.use('util.list'); g.list = new util.list('checkin_list'); - JSAN.use('circ.util'); - g.list.init( { - 'columns' : circ.util.offline_checkin_columns(), - 'map_row_to_column' : circ.util.std_map_row_to_column(), - } ); + JSAN.use('util.list'); g.list = new util.list('checkin_list'); + JSAN.use('circ.util'); + g.list.init( { + 'columns' : circ.util.offline_checkin_columns(), + 'map_row_to_column' : circ.util.std_map_row_to_column(), + } ); - JSAN.use('util.date'); + JSAN.use('util.date'); - $('i_barcode').addEventListener('keypress',handle_keypress,false); - $('i_barcode').focus(); + $('i_barcode').addEventListener('keypress',handle_keypress,false); + $('i_barcode').focus(); - $('enter').addEventListener('command',handle_enter,false); + $('enter').addEventListener('command',handle_enter,false); - $('submit').addEventListener('command',next_patron,false); + $('submit').addEventListener('command',next_patron,false); - JSAN.use('util.file'); - var file = new util.file('offline_delta'); - if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } + JSAN.use('util.file'); + var file = new util.file('offline_delta'); + if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } - } catch(E) { - var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_checkin.xul", E]); - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + } catch(E) { + var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_checkin.xul", E]); + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function $(id) { return document.getElementById(id); } function handle_keypress(ev) { - if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; - switch(ev.target) { - case $('i_barcode') : handle_enter(); break; - default: break; - } + if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; + switch(ev.target) { + case $('i_barcode') : handle_enter(); break; + default: break; + } } function handle_enter(ev) { - JSAN.use('util.barcode'); - if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { - var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - $('i_barcode').value = ''; - $('i_barcode').focus(); - },0 - ); - } else { - append_to_list(); - } - } else { - append_to_list(); - } + JSAN.use('util.barcode'); + if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { + var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + $('i_barcode').value = ''; + $('i_barcode').focus(); + },0 + ); + } else { + append_to_list(); + } + } else { + append_to_list(); + } } function append_to_list() { - try { + try { - var my = {}; + var my = {}; - my.type = 'checkin'; - my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; - /* I18N to-do: enable localized date formats */ - my.backdate = util.date.formatted_date(new Date(),"%F %H:%M:%s"); + my.type = 'checkin'; + my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; + /* I18N to-do: enable localized date formats */ + my.backdate = util.date.formatted_date(new Date(),"%F %H:%M:%s"); - var i_barcode = $('i_barcode').value; - if (! i_barcode) return; - my.barcode = i_barcode; - - g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); + var i_barcode = $('i_barcode').value; + if (! i_barcode) return; + my.barcode = i_barcode; + + g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); - var x = $('i_barcode'); x.value = ''; x.focus(); + var x = $('i_barcode'); x.value = ''; x.focus(); - } catch(E) { + } catch(E) { - dump(E+'\n'); alert(E); + dump(E+'\n'); alert(E); - } + } } function next_patron() { - try { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; row.delta = g.delta; - file.append_object(row); - } - file.close(); - - if ($('print_receipt').checked) { - try { + try { + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; row.delta = g.delta; + file.append_object(row); + } + file.close(); + + if ($('print_receipt').checked) { + try { var params = { 'template' : 'offline_checkin', 'callback' : function() { @@ -119,16 +119,16 @@ function next_patron() { } }; g.list.print( params ); - } catch(E) { - g.error.sdump('D_ERROR','print: ' + E); - alert('print: ' + E); - } - } else { + } catch(E) { + g.error.sdump('D_ERROR','print: ' + E); + alert('print: ' + E); + } + } else { g.list.clear(); var x = $('i_barcode'); x.value = ''; x.focus(); } - } catch(E) { - dump(E+'\n'); alert(E); - } + } catch(E) { + dump(E+'\n'); alert(E); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js index 2648cef087..a1dd912674 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline_checkout.js @@ -1,276 +1,276 @@ var offlineStrings; function my_init() { - try { - offlineStrings = $('offlineStrings'); - - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } - 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 offline_checkout.xul'); - - JSAN.use('util.widgets'); JSAN.use('util.file'); - - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } - } - - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - - JSAN.use('util.list'); g.list = new util.list('checkout_list'); - JSAN.use('circ.util'); - g.list.init( { - 'columns' : circ.util.offline_checkout_columns(), - 'map_row_to_column' : circ.util.std_map_row_to_column(), - } ); - - JSAN.use('util.date'); - var today = new Date(); - var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); - todayPlus = util.date.formatted_date(todayPlus,"%F"); - - $('duedate').setAttribute('value',todayPlus); - $('duedate').addEventListener('change',check_date,false); - - $('p_barcode').addEventListener('change',test_patron,false); - - $('p_barcode').addEventListener('keypress',handle_keypress,false); - $('p_barcode').focus(); - - $('i_barcode').addEventListener('keypress',handle_keypress,false); - $('enter').addEventListener('command',handle_enter,false); - - $('duedate_menu').addEventListener('command',handle_duedate_menu,false); - - $('submit').addEventListener('command',function(ev){ - save_xacts(); next_patron(); - },false); - $('cancel').addEventListener('command',function(ev){ - next_patron('cancel'); - },false); - - var file; var list_data; var ml; - - file = new util.file('offline_cnct_list'); - if (file._file.exists()) { - list_data = file.get_object(); file.close(); - ml = util.widgets.make_menulist( - [ [offlineStrings.getString('circ.offline_checkout.nonbarcoded'), ''] ].concat(list_data[0]), - list_data[1] - ); - ml.setAttribute('id','noncat_type_menu'); $('x_noncat_type').appendChild(ml); - ml.addEventListener( - 'command', - function(ev) { - var count = window.prompt(offlineStrings.getString('circ.offline_checkout.items'),1,ml.getAttribute('label')); - append_to_list('noncat',count); - ml.value = ''; - }, - false - ); - } else { - alert(offlineStrings.getString('circ.offline_checkout.download.warning')); - } - - var file = new util.file('offline_delta'); - if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } - - } catch(E) { - var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_checkout.xul", E]); - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + try { + offlineStrings = $('offlineStrings'); + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } + 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 offline_checkout.xul'); + + JSAN.use('util.widgets'); JSAN.use('util.file'); + + if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { + try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } + } + + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + + JSAN.use('util.list'); g.list = new util.list('checkout_list'); + JSAN.use('circ.util'); + g.list.init( { + 'columns' : circ.util.offline_checkout_columns(), + 'map_row_to_column' : circ.util.std_map_row_to_column(), + } ); + + JSAN.use('util.date'); + var today = new Date(); + var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); + todayPlus = util.date.formatted_date(todayPlus,"%F"); + + $('duedate').setAttribute('value',todayPlus); + $('duedate').addEventListener('change',check_date,false); + + $('p_barcode').addEventListener('change',test_patron,false); + + $('p_barcode').addEventListener('keypress',handle_keypress,false); + $('p_barcode').focus(); + + $('i_barcode').addEventListener('keypress',handle_keypress,false); + $('enter').addEventListener('command',handle_enter,false); + + $('duedate_menu').addEventListener('command',handle_duedate_menu,false); + + $('submit').addEventListener('command',function(ev){ + save_xacts(); next_patron(); + },false); + $('cancel').addEventListener('command',function(ev){ + next_patron('cancel'); + },false); + + var file; var list_data; var ml; + + file = new util.file('offline_cnct_list'); + if (file._file.exists()) { + list_data = file.get_object(); file.close(); + ml = util.widgets.make_menulist( + [ [offlineStrings.getString('circ.offline_checkout.nonbarcoded'), ''] ].concat(list_data[0]), + list_data[1] + ); + ml.setAttribute('id','noncat_type_menu'); $('x_noncat_type').appendChild(ml); + ml.addEventListener( + 'command', + function(ev) { + var count = window.prompt(offlineStrings.getString('circ.offline_checkout.items'),1,ml.getAttribute('label')); + append_to_list('noncat',count); + ml.value = ''; + }, + false + ); + } else { + alert(offlineStrings.getString('circ.offline_checkout.download.warning')); + } + + var file = new util.file('offline_delta'); + if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } + + } catch(E) { + var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_checkout.xul", E]); + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function $(id) { return document.getElementById(id); } function test_patron(ev) { - try { - var barcode = ev.target.value; - JSAN.use('util.barcode'); - if ( ($('strict_p_barcode').checked) && (! util.barcode.check(barcode)) ) { - var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - - } - - if (g.data.bad_patrons[barcode]) { - var code; - switch(g.data.bad_patrons[barcode]) { - case 'L' : code = offlineStrings.getString('common.barcode.status.warning.lost'); break; - case 'E' : code = offlineStrings.getString('common.barcode.status.warning.expired'); break; - case 'B' : code = offlineStrings.getString('common.barcode.status.warning.barred'); break; - case 'D' : code = offlineStrings.getString('common.barcode.status.warning.blocked'); break; - default : code = offlineStrings.getFormattedString('common.barcode.status.warning.blocked', [g.data.bad_patrons[barcode]]); break; - } - - var msg = offlineStrings.getFormattedString('common.barcode.status.warning', [g.data.bad_patrons_date.substr(0,15), barcode, code]); - var r = g.error.yns_alert(msg,offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - } - } catch(E) { - alert(E); - } + try { + var barcode = ev.target.value; + JSAN.use('util.barcode'); + if ( ($('strict_p_barcode').checked) && (! util.barcode.check(barcode)) ) { + var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + + } + + if (g.data.bad_patrons[barcode]) { + var code; + switch(g.data.bad_patrons[barcode]) { + case 'L' : code = offlineStrings.getString('common.barcode.status.warning.lost'); break; + case 'E' : code = offlineStrings.getString('common.barcode.status.warning.expired'); break; + case 'B' : code = offlineStrings.getString('common.barcode.status.warning.barred'); break; + case 'D' : code = offlineStrings.getString('common.barcode.status.warning.blocked'); break; + default : code = offlineStrings.getFormattedString('common.barcode.status.warning.blocked', [g.data.bad_patrons[barcode]]); break; + } + + var msg = offlineStrings.getFormattedString('common.barcode.status.warning', [g.data.bad_patrons_date.substr(0,15), barcode, code]); + var r = g.error.yns_alert(msg,offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + } + } catch(E) { + alert(E); + } } function check_date(ev) { - JSAN.use('util.date'); - try { - if (! util.date.check('YYYY-MM-DD',ev.target.value) ) { throw(offlineStrings.getString('common.date.invalid')); } - if (util.date.check_past('YYYY-MM-DD',ev.target.value) ) { throw(offlineStrings.getString('circ.offline_checkout.date.early')); } - if (util.date.formatted_date(new Date(),'%F') == ev.target.value) { throw(offlineStrings.getString('circ.offline_checkout.date.early')); } - } catch(E) { - alert(E); - var today = new Date(); - var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); - todayPlus = util.date.formatted_date(todayPlus,"%F"); - ev.target.value = todayPlus; - } + JSAN.use('util.date'); + try { + if (! util.date.check('YYYY-MM-DD',ev.target.value) ) { throw(offlineStrings.getString('common.date.invalid')); } + if (util.date.check_past('YYYY-MM-DD',ev.target.value) ) { throw(offlineStrings.getString('circ.offline_checkout.date.early')); } + if (util.date.formatted_date(new Date(),'%F') == ev.target.value) { throw(offlineStrings.getString('circ.offline_checkout.date.early')); } + } catch(E) { + alert(E); + var today = new Date(); + var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); + todayPlus = util.date.formatted_date(todayPlus,"%F"); + ev.target.value = todayPlus; + } } function handle_keypress(ev) { - if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; - switch(ev.target) { - case $('p_barcode') : /*$('p_barcode').disabled = true;*/ setTimeout( function() { $('i_barcode').focus(); },0 ); break; - case $('i_barcode') : handle_enter(); break; - default: break; - } + if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; + switch(ev.target) { + case $('p_barcode') : /*$('p_barcode').disabled = true;*/ setTimeout( function() { $('i_barcode').focus(); },0 ); break; + case $('i_barcode') : handle_enter(); break; + default: break; + } } function handle_enter(ev) { - JSAN.use('util.barcode'); - if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { - var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - $('i_barcode').value = ''; - $('i_barcode').focus(); - },0 - ); - } else { - append_to_list('barcode'); - } - } else { - append_to_list('barcode'); - } + JSAN.use('util.barcode'); + if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { + var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + $('i_barcode').value = ''; + $('i_barcode').focus(); + },0 + ); + } else { + append_to_list('barcode'); + } + } else { + append_to_list('barcode'); + } } function handle_duedate_menu(ev) { - if (ev.target.value=='0') return; - JSAN.use('util.date'); - var today = new Date(); - var todayPlus = new Date(); - todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); - todayPlus = util.date.formatted_date(todayPlus,'%F'); - $('duedate').setAttribute('value',todayPlus); - $('duedate').value = todayPlus; + if (ev.target.value=='0') return; + JSAN.use('util.date'); + var today = new Date(); + var todayPlus = new Date(); + todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); + todayPlus = util.date.formatted_date(todayPlus,'%F'); + $('duedate').setAttribute('value',todayPlus); + $('duedate').value = todayPlus; } function append_to_list(checkout_type,count) { - try { - - var my = {}; - - my.type = 'checkout'; - my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; - my.checkout_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); - - var p_barcode = $('p_barcode').value; - if (! p_barcode) { - g.error.yns_alert(offlineStrings.getString('circ.barcode.enter'),offlineStrings.getString('circ.offline_checkout.required_field'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); - return; - } else { - - // Need to validate patron barcode against bad patron list - my.patron_barcode = p_barcode; - } - - var due_date = $('duedate').value; // Need to validate this - my.due_date = due_date; - - var i_barcode = $('i_barcode').value; - switch(checkout_type) { - case 'barcode' : - if (! i_barcode) return; - - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - if (rows[i].barcode == i_barcode) { - g.error.yns_alert(offlineStrings.getString('circ.duplicate_scan.msg'),offlineStrings.getString('circ.duplicate_scan.field'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); - return; - } - } - - my.barcode = i_barcode; - break; - case 'noncat' : - count = parseInt(count); if (! (count>0) ) { - g.error.yns_alert(offlineStrings.getString('circ.offline_checkout.valid_count'),offlineStrings.getString('circ.offline_checkout.required_value'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); - return; - } - my.barcode = $('noncat_type_menu').getAttribute('label'); - my.noncat = 1; - my.noncat_type = JSON2js($('noncat_type_menu').value)[0]; - my.noncat_count = count; - break; - default: alert(offlineStrings.getString('common.error.default')); break; - } - - g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); - - var x = $('i_barcode'); x.value = ''; x.focus(); - - } catch(E) { - - dump(E+'\n'); alert(E); - - } + try { + + var my = {}; + + my.type = 'checkout'; + my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; + my.checkout_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); + + var p_barcode = $('p_barcode').value; + if (! p_barcode) { + g.error.yns_alert(offlineStrings.getString('circ.barcode.enter'),offlineStrings.getString('circ.offline_checkout.required_field'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); + return; + } else { + + // Need to validate patron barcode against bad patron list + my.patron_barcode = p_barcode; + } + + var due_date = $('duedate').value; // Need to validate this + my.due_date = due_date; + + var i_barcode = $('i_barcode').value; + switch(checkout_type) { + case 'barcode' : + if (! i_barcode) return; + + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + if (rows[i].barcode == i_barcode) { + g.error.yns_alert(offlineStrings.getString('circ.duplicate_scan.msg'),offlineStrings.getString('circ.duplicate_scan.field'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); + return; + } + } + + my.barcode = i_barcode; + break; + case 'noncat' : + count = parseInt(count); if (! (count>0) ) { + g.error.yns_alert(offlineStrings.getString('circ.offline_checkout.valid_count'),offlineStrings.getString('circ.offline_checkout.required_value'),offlineStrings.getString('common.ok'),null,null,offlineStrings.getString('common.confirm')); + return; + } + my.barcode = $('noncat_type_menu').getAttribute('label'); + my.noncat = 1; + my.noncat_type = JSON2js($('noncat_type_menu').value)[0]; + my.noncat_count = count; + break; + default: alert(offlineStrings.getString('common.error.default')); break; + } + + g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); + + var x = $('i_barcode'); x.value = ''; x.focus(); + + } catch(E) { + + dump(E+'\n'); alert(E); + + } } function save_xacts() { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; row.delta = g.delta; - if (row.noncat == 1) { - delete(row.barcode); - } else { - delete(row.noncat); - delete(row.noncat_type); - delete(row.noncat_count); - } - file.append_object(row); - } - file.close(); + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; row.delta = g.delta; + if (row.noncat == 1) { + delete(row.barcode); + } else { + delete(row.noncat); + delete(row.noncat_type); + delete(row.noncat_count); + } + file.append_object(row); + } + file.close(); } function next_patron(cancel) { - try { - - if ($('print_receipt').checked && (cancel!='cancel')) { - try { - var params = { - 'patron_barcode' : $('p_barcode').value, - 'template' : 'offline_checkout', + try { + + if ($('print_receipt').checked && (cancel!='cancel')) { + try { + var params = { + 'patron_barcode' : $('p_barcode').value, + 'template' : 'offline_checkout', 'callback' : function() { g.list.clear(); var x = $('i_barcode'); x.value = ''; @@ -278,20 +278,20 @@ function next_patron(cancel) { x.setAttribute('disabled','false'); x.disabled = false; x.focus(); } - }; - g.list.print( params ); - } catch(E) { - g.error.sdump('D_ERROR','print: ' + E); - alert('print: ' + E); - } - } else { + }; + g.list.print( params ); + } catch(E) { + g.error.sdump('D_ERROR','print: ' + E); + alert('print: ' + E); + } + } else { g.list.clear(); var x = $('i_barcode'); x.value = ''; x = $('p_barcode'); x.value = ''; x.setAttribute('disabled','false'); x.disabled = false; x.focus(); - } - } catch(E) { - dump(E+'\n'); alert(E); - } + } + } catch(E) { + dump(E+'\n'); alert(E); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js index aeda8e5d0e..113189df2b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline_in_house_use.js @@ -1,136 +1,136 @@ var offlineStrings; function my_init() { - try { - offlineStrings = document.getElementById('offlineStrings'); - - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } - 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 offline_checkout.xul'); - - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } - } - - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - - JSAN.use('util.list'); g.list = new util.list('checkout_list'); - JSAN.use('circ.util'); - g.list.init( { - 'columns' : circ.util.offline_inhouse_use_columns(), - 'map_row_to_column' : circ.util.std_map_row_to_column(), - } ); - - $('i_barcode').addEventListener('keypress',handle_keypress,false); - $('enter').addEventListener('command',handle_enter,false); - $('submit').addEventListener('command',next_patron,false); - - $('i_barcode').focus(); - - JSAN.use('util.file'); - var file = new util.file('offline_delta'); - if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } - - } catch(E) { - var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_in_house_use.xul", E]); - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + try { + offlineStrings = document.getElementById('offlineStrings'); + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } + 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 offline_checkout.xul'); + + if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { + try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } + } + + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + + JSAN.use('util.list'); g.list = new util.list('checkout_list'); + JSAN.use('circ.util'); + g.list.init( { + 'columns' : circ.util.offline_inhouse_use_columns(), + 'map_row_to_column' : circ.util.std_map_row_to_column(), + } ); + + $('i_barcode').addEventListener('keypress',handle_keypress,false); + $('enter').addEventListener('command',handle_enter,false); + $('submit').addEventListener('command',next_patron,false); + + $('i_barcode').focus(); + + JSAN.use('util.file'); + var file = new util.file('offline_delta'); + if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } + + } catch(E) { + var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_in_house_use.xul", E]); + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function $(id) { return document.getElementById(id); } function handle_keypress(ev) { - if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; - switch(ev.target) { - case $('i_barcode') : handle_enter(); break; - default: break; - } + if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; + switch(ev.target) { + case $('i_barcode') : handle_enter(); break; + default: break; + } } function handle_enter(ev) { - JSAN.use('util.barcode'); - if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { - var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - $('i_barcode').value = ''; - $('i_barcode').focus(); - },0 - ); - } else { - append_to_list(); - } - } else { - append_to_list(); - } + JSAN.use('util.barcode'); + if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { + var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + $('i_barcode').value = ''; + $('i_barcode').focus(); + },0 + ); + } else { + append_to_list(); + } + } else { + append_to_list(); + } } function append_to_list() { - try { + try { - JSAN.use('util.date'); + JSAN.use('util.date'); - var my = {}; + var my = {}; - my.type = 'in_house_use'; - my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; - /* I18N to-do: enable localized date formats */ - my.use_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); + my.type = 'in_house_use'; + my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; + /* I18N to-do: enable localized date formats */ + my.use_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); - var i_barcode = $('i_barcode').value; - if (! i_barcode) return; - my.barcode = i_barcode; + var i_barcode = $('i_barcode').value; + if (! i_barcode) return; + my.barcode = i_barcode; - var count = $('count').value; - if (!Number(count) || count < 1) count = 1; - my.count = count; + var count = $('count').value; + if (!Number(count) || count < 1) count = 1; + my.count = count; - g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); + g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); - var x = $('i_barcode'); x.value = ''; x.focus(); + var x = $('i_barcode'); x.value = ''; x.focus(); - } catch(E) { + } catch(E) { - dump(E+'\n'); alert(E); + dump(E+'\n'); alert(E); - } + } } function next_patron() { - try { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; row.delta = g.delta; - file.append_object(row); - } - file.close(); - - if ($('print_receipt').checked) { - try { - var params = { - 'template' : 'offline_inhouse_use', + try { + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; row.delta = g.delta; + file.append_object(row); + } + file.close(); + + if ($('print_receipt').checked) { + try { + var params = { + 'template' : 'offline_inhouse_use', 'callback' : function() { g.list.clear(); var x = $('i_barcode'); x.value = ''; x.focus(); } - }; - g.list.print( params ); - } catch(E) { - g.error.sdump('D_ERROR','print: ' + E); - alert('print: ' + E); - } - } else { + }; + g.list.print( params ); + } catch(E) { + g.error.sdump('D_ERROR','print: ' + E); + alert('print: ' + E); + } + } else { g.list.clear(); var x = $('i_barcode'); x.value = ''; x.focus(); } - } catch(E) { - dump(E+'\n'); alert(E); - } + } catch(E) { + dump(E+'\n'); alert(E); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline_register.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline_register.js index f2c94d0596..68d0a985a9 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline_register.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline_register.js @@ -1,334 +1,334 @@ var offlineStrings; function my_init() { - try { - offlineStrings = $('offlineStrings'); - - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } - 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 offline_register.xul'); - - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } - } - - $('barcode').addEventListener('change',test_patron,false); - $('barcode').addEventListener('keypress',handle_keypress,false); - $('submit').addEventListener('command',next_patron,false); - - JSAN.use('util.file'); - JSAN.use('util.widgets'); - - var file; var list_data; var ml; var errors = ''; - - file = new util.file('offline_ou_list'); - if (file._file.exists()) { - list_data = file.get_object(); file.close(); - ml = util.widgets.make_menulist( list_data[0], list_data[1] ); - ml.setAttribute('id','home_ou'); $('x_home_ou').appendChild(ml); - } else { - errors += offlineStrings.getString('circ.offline_register.missing.library.list') + "\n"; - } - - file = new util.file('offline_pgt_list'); - if (file._file.exists()) { - list_data = file.get_object(); file.close(); - ml = util.widgets.make_menulist( list_data[0], list_data[1] ); - ml.setAttribute('id','profile'); $('x_profile').appendChild(ml); - } else { - errors += offlineStrings.getString('circ.offline_register.missing.profile.list') + "\n"; - } - - file = new util.file('offline_cit_list'); - if (file._file.exists()) { - list_data = file.get_object(); file.close(); - ml = util.widgets.make_menulist( list_data[0], list_data[1] ); - ml.setAttribute('id','ident_type'); $('x_ident_type').appendChild(ml); - } else { - errors += offlineStrings.getString('circ.offline_register.missing.id.type.list') + "\n"; - } - - file = new util.file('offline_asv_list'); - if (file._file.exists()) { - list_data = file.get_object(); file.close(); - render_surveys('x_surveys', list_data); - } else { - errors += offlineStrings.getString('circ.offline_register.missing.required.surveys'); - } - - if (errors != '') { - alert(offlineStrings.getString('circ.offline_register.missing.files.error') + errors); - location.href = 'about:blank'; - } - - $('passwd').value = parseInt(Math.random()*8999+1000); - - $('dob').addEventListener('change',handle_check_date,false); - $('barcode').focus(); - - var file = new util.file('offline_delta'); - if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } - - } catch(E) { - var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_register.xul", E]); - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + try { + offlineStrings = $('offlineStrings'); + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw(offlineStrings.getString('common.jsan.missing')); } + 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 offline_register.xul'); + + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + + if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { + try { window.xulG.set_tab_name(offlineStrings.getString('circ.standalone')); } catch(E) { alert(E); } + } + + $('barcode').addEventListener('change',test_patron,false); + $('barcode').addEventListener('keypress',handle_keypress,false); + $('submit').addEventListener('command',next_patron,false); + + JSAN.use('util.file'); + JSAN.use('util.widgets'); + + var file; var list_data; var ml; var errors = ''; + + file = new util.file('offline_ou_list'); + if (file._file.exists()) { + list_data = file.get_object(); file.close(); + ml = util.widgets.make_menulist( list_data[0], list_data[1] ); + ml.setAttribute('id','home_ou'); $('x_home_ou').appendChild(ml); + } else { + errors += offlineStrings.getString('circ.offline_register.missing.library.list') + "\n"; + } + + file = new util.file('offline_pgt_list'); + if (file._file.exists()) { + list_data = file.get_object(); file.close(); + ml = util.widgets.make_menulist( list_data[0], list_data[1] ); + ml.setAttribute('id','profile'); $('x_profile').appendChild(ml); + } else { + errors += offlineStrings.getString('circ.offline_register.missing.profile.list') + "\n"; + } + + file = new util.file('offline_cit_list'); + if (file._file.exists()) { + list_data = file.get_object(); file.close(); + ml = util.widgets.make_menulist( list_data[0], list_data[1] ); + ml.setAttribute('id','ident_type'); $('x_ident_type').appendChild(ml); + } else { + errors += offlineStrings.getString('circ.offline_register.missing.id.type.list') + "\n"; + } + + file = new util.file('offline_asv_list'); + if (file._file.exists()) { + list_data = file.get_object(); file.close(); + render_surveys('x_surveys', list_data); + } else { + errors += offlineStrings.getString('circ.offline_register.missing.required.surveys'); + } + + if (errors != '') { + alert(offlineStrings.getString('circ.offline_register.missing.files.error') + errors); + location.href = 'about:blank'; + } + + $('passwd').value = parseInt(Math.random()*8999+1000); + + $('dob').addEventListener('change',handle_check_date,false); + $('barcode').focus(); + + var file = new util.file('offline_delta'); + if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } + + } catch(E) { + var err_msg = offlineStrings.getFormattedString('common.exception', ["circ/offline_register.xul", E]); + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function $(id) { return document.getElementById(id); } function test_patron(ev) { - try { - var barcode = ev.target.value; - JSAN.use('util.barcode'); - if ( ! util.barcode.check(ev.target.value) ) { - var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - - } - if (g.data.bad_patrons[barcode]) { - var code; - switch(g.data.bad_patrons[barcode]) { - case 'L' : code = offlineStrings.getString('common.barcode.status.warning.lost'); break; - case 'E' : code = offlineStrings.getString('common.barcode.status.warning.expired'); break; - case 'B' : code = offlineStrings.getString('common.barcode.status.warning.barred'); break; - case 'D' : code = offlineStrings.getString('common.barcode.status.warning.blocked'); break; - default : code = offlineStrings.getFormattedString('common.barcode.status.warning.blocked', [g.data.bad_patrons[barcode]]); break; - } - - var msg = offlineStrings.getFormattedString('common.barcode.status.warning', [g.data.bad_patrons_date.substr(0,15), barcode, code]); - var r = g.error.yns_alert(msg,offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - } - } catch(E) { - alert(E); - } + try { + var barcode = ev.target.value; + JSAN.use('util.barcode'); + if ( ! util.barcode.check(ev.target.value) ) { + var r = g.error.yns_alert(offlineStrings.getString('circ.bad_checkdigit'),offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + + } + if (g.data.bad_patrons[barcode]) { + var code; + switch(g.data.bad_patrons[barcode]) { + case 'L' : code = offlineStrings.getString('common.barcode.status.warning.lost'); break; + case 'E' : code = offlineStrings.getString('common.barcode.status.warning.expired'); break; + case 'B' : code = offlineStrings.getString('common.barcode.status.warning.barred'); break; + case 'D' : code = offlineStrings.getString('common.barcode.status.warning.blocked'); break; + default : code = offlineStrings.getFormattedString('common.barcode.status.warning.blocked', [g.data.bad_patrons[barcode]]); break; + } + + var msg = offlineStrings.getFormattedString('common.barcode.status.warning', [g.data.bad_patrons_date.substr(0,15), barcode, code]); + var r = g.error.yns_alert(msg,offlineStrings.getString('circ.barcode.warning'),offlineStrings.getString('common.ok'),offlineStrings.getString('common.clear'),null,offlineStrings.getString('common.confirm')); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + } + } catch(E) { + alert(E); + } } function handle_check_date(ev) { - ev.target.value = check_date(ev.target.value); + ev.target.value = check_date(ev.target.value); } function check_date(value) { - JSAN.use('util.date'); - try { - if (! util.date.check('YYYY-MM-DD',value) ) { throw(offlineStrings.getString('common.date.invalid')); } - if (! util.date.check_past('YYYY-MM-DD',value) ) { throw(offlineStrings.getString('circ.offline_register.future.birth.date')); } - if ( util.date.formatted_date(new Date(),'%F') == value) { throw(offlineStrings.getString('circ.offline_register.invalid.birth.date')); } - } catch(E) { - alert(E); - value = ''; - } - return value; + JSAN.use('util.date'); + try { + if (! util.date.check('YYYY-MM-DD',value) ) { throw(offlineStrings.getString('common.date.invalid')); } + if (! util.date.check_past('YYYY-MM-DD',value) ) { throw(offlineStrings.getString('circ.offline_register.future.birth.date')); } + if ( util.date.formatted_date(new Date(),'%F') == value) { throw(offlineStrings.getString('circ.offline_register.invalid.birth.date')); } + } catch(E) { + alert(E); + value = ''; + } + return value; } function render_surveys(node,obj) { - node = util.widgets.get(node); - util.widgets.remove_children(node); - - for (var i in obj) { - var survey = obj[i]; - var x_gb = document.createElement('groupbox'); node.appendChild(x_gb); - var x_cp = document.createElement('caption'); - x_cp.setAttribute('label',i); x_gb.appendChild(x_cp); - var x_d = document.createElement('description'); - x_d.appendChild( document.createTextNode( survey.description ) ); x_gb.appendChild(x_d); - for (var j = 0; j < survey.questions.length; j++) { - var question = survey.questions[j]; - var x_d = document.createElement('description'); - x_d.appendChild( document.createTextNode( (j+1) + ') ' + question.question ) ); - x_gb.appendChild( x_d ); - var x_hb = document.createElement('hbox'); x_hb.setAttribute('flex','1'); - x_gb.appendChild(x_hb); - var x_spacer = document.createElement('spacer'); x_spacer.setAttribute('flex','1'); - x_hb.appendChild(x_spacer); - var x_ml = util.widgets.make_menulist( [ [offlineStrings.getString('circ.offline_register.survey.prompt'),''] ].concat(question.answers) ); - x_ml.setAttribute('name','survey'); x_hb.appendChild(x_ml); - } - } + node = util.widgets.get(node); + util.widgets.remove_children(node); + + for (var i in obj) { + var survey = obj[i]; + var x_gb = document.createElement('groupbox'); node.appendChild(x_gb); + var x_cp = document.createElement('caption'); + x_cp.setAttribute('label',i); x_gb.appendChild(x_cp); + var x_d = document.createElement('description'); + x_d.appendChild( document.createTextNode( survey.description ) ); x_gb.appendChild(x_d); + for (var j = 0; j < survey.questions.length; j++) { + var question = survey.questions[j]; + var x_d = document.createElement('description'); + x_d.appendChild( document.createTextNode( (j+1) + ') ' + question.question ) ); + x_gb.appendChild( x_d ); + var x_hb = document.createElement('hbox'); x_hb.setAttribute('flex','1'); + x_gb.appendChild(x_hb); + var x_spacer = document.createElement('spacer'); x_spacer.setAttribute('flex','1'); + x_hb.appendChild(x_spacer); + var x_ml = util.widgets.make_menulist( [ [offlineStrings.getString('circ.offline_register.survey.prompt'),''] ].concat(question.answers) ); + x_ml.setAttribute('name','survey'); x_hb.appendChild(x_ml); + } + } } function handle_keypress(ev) { - if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; - switch(ev.target) { - case $('barcode') : setTimeout( function() { $('family_name').focus(); },0 ); break; - default: break; - } + if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; + switch(ev.target) { + case $('barcode') : setTimeout( function() { $('family_name').focus(); },0 ); break; + default: break; + } } function check_patron(obj) { - var errors = ''; - if (! obj.user.billing_address.post_code ) { - errors += offlineStrings.getString('circ.offline_register.missing.post_code') + "\n"; - $('post_code').focus(); - $('post_code').parentNode.setAttribute('style','background-color: red'); - } else { - $('post_code').parentNode.setAttribute('style',''); - } - if (! obj.user.billing_address.state ) { - errors += offlineStrings.getString('circ.offline_register.missing.state') + "\n"; - $('state').focus(); - $('state').parentNode.setAttribute('style','background-color: red'); - } else { - $('state').parentNode.setAttribute('style',''); - } - if (! obj.user.billing_address.city ) { - errors += offlineStrings.getString('circ.offline_register.missing.city') + "\n"; - $('city').focus(); - $('city').parentNode.setAttribute('style','background-color: red'); - } else { - $('city').parentNode.setAttribute('style',''); - } - if (! obj.user.billing_address.street1 ) { - errors += offlineStrings.getString('circ.offline_register.missing.street1') + "\n"; - $('street1').focus(); - $('street1').parentNode.setAttribute('style','background-color: red'); - } else { - $('street1').parentNode.setAttribute('style',''); - } - if (! obj.user.ident_value ) { - errors += offlineStrings.getString('circ.offline_register.missing.ident_value') + "\n"; - $('ident_value').focus(); - $('ident_value').parentNode.setAttribute('style','background-color: red'); - } else { - $('ident_value').parentNode.setAttribute('style',''); - } - if (! obj.user.ident_type ) { - errors += offlineStrings.getString('circ.offline_register.missing.ident_type') + "\n"; - $('ident_type').focus(); - $('ident_type').parentNode.setAttribute('style','background-color: red'); - } else { - $('ident_type').parentNode.setAttribute('style',''); - } - if (! obj.user.dob ) { - errors += offlineStrings.getString('circ.offline_register.missing.dob') + "\n"; - $('dob').focus(); - $('dob').parentNode.parentNode.setAttribute('style','background-color: red'); - } else { - $('dob').parentNode.parentNode.setAttribute('style',''); - } - if (! obj.user.first_given_name ) { - errors += offlineStrings.getString('circ.offline_register.missing.first_given_name') + "\n"; - $('first_given_name').focus(); - $('first_given_name').parentNode.setAttribute('style','background-color: red'); - } else { - $('first_given_name').parentNode.setAttribute('style',''); - } - if (! obj.user.family_name ) { - errors += offlineStrings.getString('circ.offline_register.missing.family_name') + "\n"; - $('family_name').focus(); - $('family_name').parentNode.setAttribute('style','background-color: red'); - } else { - $('family_name').parentNode.setAttribute('style',''); - } - if (! obj.user.passwd ) { - errors += offlineStrings.getString('circ.offline_register.missing.passwd') + "\n"; - $('passwd').focus(); - $('passwd').parentNode.setAttribute('style','background-color: red'); - } else { - $('passwd').parentNode.setAttribute('style',''); - } - if (! obj.user.card.barcode ) { - errors += offlineStrings.getString('circ.offline_register.missing.barcode') + "\n"; - $('barcode').focus(); - $('barcode').parentNode.setAttribute('style','background-color: red'); - } else { - $('barcode').parentNode.setAttribute('style',''); - } - if (! obj.user.profile ) { - errors += offlineStrings.getString('circ.offline_register.missing.profile') + "\n"; - $('profile').focus(); - $('profile').parentNode.setAttribute('style','background-color: red'); - } else { - $('profile').parentNode.setAttribute('style',''); - } - if (! obj.user.home_ou ) { - errors += offlineStrings.getString('circ.offline_register.missing.home_ou') + "\n"; - $('home_ou').focus(); - $('home_ou').parentNode.setAttribute('style','background-color: red'); - } else { - $('home_ou').parentNode.setAttribute('style',''); - } - if (errors != '') throw(errors); + var errors = ''; + if (! obj.user.billing_address.post_code ) { + errors += offlineStrings.getString('circ.offline_register.missing.post_code') + "\n"; + $('post_code').focus(); + $('post_code').parentNode.setAttribute('style','background-color: red'); + } else { + $('post_code').parentNode.setAttribute('style',''); + } + if (! obj.user.billing_address.state ) { + errors += offlineStrings.getString('circ.offline_register.missing.state') + "\n"; + $('state').focus(); + $('state').parentNode.setAttribute('style','background-color: red'); + } else { + $('state').parentNode.setAttribute('style',''); + } + if (! obj.user.billing_address.city ) { + errors += offlineStrings.getString('circ.offline_register.missing.city') + "\n"; + $('city').focus(); + $('city').parentNode.setAttribute('style','background-color: red'); + } else { + $('city').parentNode.setAttribute('style',''); + } + if (! obj.user.billing_address.street1 ) { + errors += offlineStrings.getString('circ.offline_register.missing.street1') + "\n"; + $('street1').focus(); + $('street1').parentNode.setAttribute('style','background-color: red'); + } else { + $('street1').parentNode.setAttribute('style',''); + } + if (! obj.user.ident_value ) { + errors += offlineStrings.getString('circ.offline_register.missing.ident_value') + "\n"; + $('ident_value').focus(); + $('ident_value').parentNode.setAttribute('style','background-color: red'); + } else { + $('ident_value').parentNode.setAttribute('style',''); + } + if (! obj.user.ident_type ) { + errors += offlineStrings.getString('circ.offline_register.missing.ident_type') + "\n"; + $('ident_type').focus(); + $('ident_type').parentNode.setAttribute('style','background-color: red'); + } else { + $('ident_type').parentNode.setAttribute('style',''); + } + if (! obj.user.dob ) { + errors += offlineStrings.getString('circ.offline_register.missing.dob') + "\n"; + $('dob').focus(); + $('dob').parentNode.parentNode.setAttribute('style','background-color: red'); + } else { + $('dob').parentNode.parentNode.setAttribute('style',''); + } + if (! obj.user.first_given_name ) { + errors += offlineStrings.getString('circ.offline_register.missing.first_given_name') + "\n"; + $('first_given_name').focus(); + $('first_given_name').parentNode.setAttribute('style','background-color: red'); + } else { + $('first_given_name').parentNode.setAttribute('style',''); + } + if (! obj.user.family_name ) { + errors += offlineStrings.getString('circ.offline_register.missing.family_name') + "\n"; + $('family_name').focus(); + $('family_name').parentNode.setAttribute('style','background-color: red'); + } else { + $('family_name').parentNode.setAttribute('style',''); + } + if (! obj.user.passwd ) { + errors += offlineStrings.getString('circ.offline_register.missing.passwd') + "\n"; + $('passwd').focus(); + $('passwd').parentNode.setAttribute('style','background-color: red'); + } else { + $('passwd').parentNode.setAttribute('style',''); + } + if (! obj.user.card.barcode ) { + errors += offlineStrings.getString('circ.offline_register.missing.barcode') + "\n"; + $('barcode').focus(); + $('barcode').parentNode.setAttribute('style','background-color: red'); + } else { + $('barcode').parentNode.setAttribute('style',''); + } + if (! obj.user.profile ) { + errors += offlineStrings.getString('circ.offline_register.missing.profile') + "\n"; + $('profile').focus(); + $('profile').parentNode.setAttribute('style','background-color: red'); + } else { + $('profile').parentNode.setAttribute('style',''); + } + if (! obj.user.home_ou ) { + errors += offlineStrings.getString('circ.offline_register.missing.home_ou') + "\n"; + $('home_ou').focus(); + $('home_ou').parentNode.setAttribute('style','background-color: red'); + } else { + $('home_ou').parentNode.setAttribute('style',''); + } + if (errors != '') throw(errors); } function next_patron() { - try { - var obj = {} - obj.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; - obj.type = 'register'; - obj.user = {}; - obj.user.card = { 'barcode' : $('barcode').value }; - obj.user.profile = $('profile').value; - obj.user.passwd = $('passwd').value; - obj.user.ident_type = $('ident_type').value; - obj.user.ident_value = $('ident_value').value; - obj.user.first_given_name = $('first_given_name').value; - obj.user.family_name = $('family_name').value; - obj.user.home_ou = $('home_ou').value; - obj.user.dob = $('dob').value; - obj.user.billing_address = {}; - obj.user.billing_address.street1 = $('street1').value; - obj.user.billing_address.street2 = $('street2').value; - obj.user.billing_address.city = $('city').value; - obj.user.billing_address.state = $('state').value; - obj.user.billing_address.country = $('country').value; - obj.user.billing_address.post_code = $('post_code').value; - obj.user.survey_responses = []; - - var nl = document.getElementsByAttribute('name','survey'); - for (var i = 0; i < nl.length; i++) { - var value = nl[i].value; if (value == '') continue; - var values = JSON2js( value ); - var response = { 'survey' : values[2], 'question' : values[1], 'answer' : values[0] }; - obj.user.survey_responses.push( response ); - } - - try { - check_patron(obj); - } catch(E) { - alert(offlineStrings.getString('circ.offline_register.missing.alert') + "\n" + E); - return; - } - - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - obj.delta = g.delta; - file.append_object(obj); - file.close(); - - alert(offlineStrings.getString('circ.offline_register.patron.saved')); - - $('passwd').value = parseInt(Math.random()*8999+1000); - $('barcode').value = ''; $('ident_value').value = ''; $('first_given_name').value = ''; - $('family_name').value = ''; $('dob').value = ''; $('street1').value = ''; - $('street2').value = ''; - - file = new util.file('offline_asv_list'); var list_data = file.get_object(); file.close(); - render_surveys('x_surveys', list_data); - - $('barcode').focus(); - - } catch(E) { - dump(E+'\n'); alert(E); - } + try { + var obj = {} + obj.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; + obj.type = 'register'; + obj.user = {}; + obj.user.card = { 'barcode' : $('barcode').value }; + obj.user.profile = $('profile').value; + obj.user.passwd = $('passwd').value; + obj.user.ident_type = $('ident_type').value; + obj.user.ident_value = $('ident_value').value; + obj.user.first_given_name = $('first_given_name').value; + obj.user.family_name = $('family_name').value; + obj.user.home_ou = $('home_ou').value; + obj.user.dob = $('dob').value; + obj.user.billing_address = {}; + obj.user.billing_address.street1 = $('street1').value; + obj.user.billing_address.street2 = $('street2').value; + obj.user.billing_address.city = $('city').value; + obj.user.billing_address.state = $('state').value; + obj.user.billing_address.country = $('country').value; + obj.user.billing_address.post_code = $('post_code').value; + obj.user.survey_responses = []; + + var nl = document.getElementsByAttribute('name','survey'); + for (var i = 0; i < nl.length; i++) { + var value = nl[i].value; if (value == '') continue; + var values = JSON2js( value ); + var response = { 'survey' : values[2], 'question' : values[1], 'answer' : values[0] }; + obj.user.survey_responses.push( response ); + } + + try { + check_patron(obj); + } catch(E) { + alert(offlineStrings.getString('circ.offline_register.missing.alert') + "\n" + E); + return; + } + + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + obj.delta = g.delta; + file.append_object(obj); + file.close(); + + alert(offlineStrings.getString('circ.offline_register.patron.saved')); + + $('passwd').value = parseInt(Math.random()*8999+1000); + $('barcode').value = ''; $('ident_value').value = ''; $('first_given_name').value = ''; + $('family_name').value = ''; $('dob').value = ''; $('street1').value = ''; + $('street2').value = ''; + + file = new util.file('offline_asv_list'); var list_data = file.get_object(); file.close(); + render_surveys('x_surveys', list_data); + + $('barcode').focus(); + + } catch(E) { + dump(E+'\n'); alert(E); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js b/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js index b7795a3490..601e3e963a 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/offline_renew.js @@ -1,249 +1,249 @@ var offlineStrings; function my_init() { - try { - offlineStrings = $('offlineStrings'); - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); } - 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 offline_renew.xul'); - - if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { - try { window.xulG.set_tab_name('Standalone'); } catch(E) { alert(E); } - } - - JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - - JSAN.use('util.list'); g.list = new util.list('checkout_list'); - JSAN.use('circ.util'); - g.list.init( { - 'columns' : circ.util.offline_renew_columns(), - 'map_row_to_column' : circ.util.std_map_row_to_column(), - } ); - - JSAN.use('util.date'); - var today = new Date(); - var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); - todayPlus = util.date.formatted_date(todayPlus,"%F"); - - $('duedate').setAttribute('value',todayPlus); - $('duedate').addEventListener('change',check_date,false); - - $('p_barcode').addEventListener('change',test_patron,false); - - $('p_barcode').addEventListener('keypress',handle_keypress,false); - $('p_barcode').focus(); - - $('i_barcode').addEventListener('keypress',handle_keypress,false); - $('enter').addEventListener('command',handle_enter,false); - - $('duedate_menu').addEventListener('command',handle_duedate_menu,false); - - $('submit').addEventListener('command',next_patron,false); - $('cancel').addEventListener('command',function(){next_patron('cancel');},false); - - JSAN.use('util.file'); - var file = new util.file('offline_delta'); - if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } - - } catch(E) { - var err_msg = "!! This software has encountered an error. Please tell your friendly " + - "system administrator or software developer the following:\ncirc/offline_renew.xul\n" + E + '\n'; - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); - } + try { + offlineStrings = $('offlineStrings'); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); } + 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 offline_renew.xul'); + + if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') { + try { window.xulG.set_tab_name('Standalone'); } catch(E) { alert(E); } + } + + JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); + + JSAN.use('util.list'); g.list = new util.list('checkout_list'); + JSAN.use('circ.util'); + g.list.init( { + 'columns' : circ.util.offline_renew_columns(), + 'map_row_to_column' : circ.util.std_map_row_to_column(), + } ); + + JSAN.use('util.date'); + var today = new Date(); + var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); + todayPlus = util.date.formatted_date(todayPlus,"%F"); + + $('duedate').setAttribute('value',todayPlus); + $('duedate').addEventListener('change',check_date,false); + + $('p_barcode').addEventListener('change',test_patron,false); + + $('p_barcode').addEventListener('keypress',handle_keypress,false); + $('p_barcode').focus(); + + $('i_barcode').addEventListener('keypress',handle_keypress,false); + $('enter').addEventListener('command',handle_enter,false); + + $('duedate_menu').addEventListener('command',handle_duedate_menu,false); + + $('submit').addEventListener('command',next_patron,false); + $('cancel').addEventListener('command',function(){next_patron('cancel');},false); + + JSAN.use('util.file'); + var file = new util.file('offline_delta'); + if (file._file.exists()) { g.delta = file.get_object()[0]; file.close(); } else { g.delta = 0; } + + } catch(E) { + var err_msg = "!! This software has encountered an error. Please tell your friendly " + + "system administrator or software developer the following:\ncirc/offline_renew.xul\n" + E + '\n'; + try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } + alert(err_msg); + } } function $(id) { return document.getElementById(id); } function test_patron(ev) { - try { - var barcode = ev.target.value; - JSAN.use('util.barcode'); - if ( ($('strict_p_barcode').checked) && (! util.barcode.check(barcode)) ) { - var r = g.error.yns_alert('This barcode has a bad checkdigit.','Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - - } - - if (g.data.bad_patrons[barcode]) { - var msg = 'Warning: As of ' + g.data.bad_patrons_date.substr(0,15) + ', this barcode (' + barcode + ') was flagged '; - switch(g.data.bad_patrons[barcode]) { - case 'L' : msg += 'Lost'; break; - case 'E' : msg += 'Expired'; break; - case 'B' : msg += 'Barred'; break; - case 'D' : msg += 'Blocked'; break; - default : msg += ' with an unknown code: ' + g.data.bad_patrons[barcode]; break; - } - var r = g.error.yns_alert(msg,'Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } - } - } catch(E) { - alert(E); - } + try { + var barcode = ev.target.value; + JSAN.use('util.barcode'); + if ( ($('strict_p_barcode').checked) && (! util.barcode.check(barcode)) ) { + var r = g.error.yns_alert('This barcode has a bad checkdigit.','Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + + } + + if (g.data.bad_patrons[barcode]) { + var msg = 'Warning: As of ' + g.data.bad_patrons_date.substr(0,15) + ', this barcode (' + barcode + ') was flagged '; + switch(g.data.bad_patrons[barcode]) { + case 'L' : msg += 'Lost'; break; + case 'E' : msg += 'Expired'; break; + case 'B' : msg += 'Barred'; break; + case 'D' : msg += 'Blocked'; break; + default : msg += ' with an unknown code: ' + g.data.bad_patrons[barcode]; break; + } + var r = g.error.yns_alert(msg,'Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } + } + } catch(E) { + alert(E); + } } function handle_keypress(ev) { - if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; - switch(ev.target) { - case $('p_barcode') : setTimeout( function() { $('i_barcode').focus(); },0 ); break; - case $('i_barcode') : handle_enter(); break; - default: break; - } + if ( (! ev.keyCode) || (ev.keyCode != 13) ) return; + switch(ev.target) { + case $('p_barcode') : setTimeout( function() { $('i_barcode').focus(); },0 ); break; + case $('i_barcode') : handle_enter(); break; + default: break; + } } function handle_enter(ev) { - JSAN.use('util.barcode'); - if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { - var r = g.error.yns_alert('This barcode has a bad checkdigit.','Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); - if (r == 1) { - setTimeout( - function() { - ev.target.value = ''; - ev.target.focus(); - },0 - ); - } else { - append_to_list('barcode'); - } - } else { - append_to_list('barcode'); - } + JSAN.use('util.barcode'); + if ( ($('strict_i_barcode').checked) && (! util.barcode.check($('i_barcode').value)) ) { + var r = g.error.yns_alert('This barcode has a bad checkdigit.','Barcode Warning','Ok','Clear',null,'Check here to confirm this message'); + if (r == 1) { + setTimeout( + function() { + ev.target.value = ''; + ev.target.focus(); + },0 + ); + } else { + append_to_list('barcode'); + } + } else { + append_to_list('barcode'); + } } function handle_duedate_menu(ev) { - if (ev.target.value=='0') return; - JSAN.use('util.date'); - var today = new Date(); - var todayPlus = new Date(); - todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); - todayPlus = util.date.formatted_date(todayPlus,'%F'); - $('duedate').setAttribute('value',todayPlus); - $('duedate').value = todayPlus; + if (ev.target.value=='0') return; + JSAN.use('util.date'); + var today = new Date(); + var todayPlus = new Date(); + todayPlus.setTime( today.getTime() + 24*60*60*1000*ev.target.value ); + todayPlus = util.date.formatted_date(todayPlus,'%F'); + $('duedate').setAttribute('value',todayPlus); + $('duedate').value = todayPlus; } function check_date(ev) { - JSAN.use('util.date'); - try { - if (! util.date.check('YYYY-MM-DD',ev.target.value) ) { throw('Invalid Date'); } - if (util.date.check_past('YYYY-MM-DD',ev.target.value) ) { throw('Due date needs to be after today.'); } - if ( util.date.formatted_date(new Date(),'%F') == ev.target.value) { throw('Due date needs to be after today.'); } - } catch(E) { - alert(E); - var today = new Date(); - var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); - todayPlus = util.date.formatted_date(todayPlus,"%F"); - ev.target.value = todayPlus; - } + JSAN.use('util.date'); + try { + if (! util.date.check('YYYY-MM-DD',ev.target.value) ) { throw('Invalid Date'); } + if (util.date.check_past('YYYY-MM-DD',ev.target.value) ) { throw('Due date needs to be after today.'); } + if ( util.date.formatted_date(new Date(),'%F') == ev.target.value) { throw('Due date needs to be after today.'); } + } catch(E) { + alert(E); + var today = new Date(); + var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*14 ); + todayPlus = util.date.formatted_date(todayPlus,"%F"); + ev.target.value = todayPlus; + } } function append_to_list(checkout_type,count) { - try { - - var my = {}; - - my.type = 'renew'; - my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; - my.checkout_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); - - var p_barcode = $('p_barcode').value; - if (! p_barcode) { - /* Not strictly necessary for a renewal - alert('Please enter a patron barcode first.'); - return; - */ - } else { - - // Need to validate patron barcode against bad patron list - my.patron_barcode = p_barcode; - } - - var due_date = $('duedate').value; // Need to validate this - my.due_date = due_date; - - var i_barcode = $('i_barcode').value; - switch(checkout_type) { - case 'barcode' : - if (! i_barcode) return; - - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - if (rows[i].barcode == i_barcode) { - g.error.yns_alert('This barcode has already been scanned.','Duplicate Scan','Ok',null,null,'Check here to confirm this message'); - return; - } - } + try { + + var my = {}; + + my.type = 'renew'; + my.timestamp = parseInt( new Date().getTime() / 1000) + g.delta; + my.checkout_time = util.date.formatted_date(new Date(),"%F %H:%M:%s"); + + var p_barcode = $('p_barcode').value; + if (! p_barcode) { + /* Not strictly necessary for a renewal + alert('Please enter a patron barcode first.'); + return; + */ + } else { + + // Need to validate patron barcode against bad patron list + my.patron_barcode = p_barcode; + } + + var due_date = $('duedate').value; // Need to validate this + my.due_date = due_date; + + var i_barcode = $('i_barcode').value; + switch(checkout_type) { + case 'barcode' : + if (! i_barcode) return; + + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + if (rows[i].barcode == i_barcode) { + g.error.yns_alert('This barcode has already been scanned.','Duplicate Scan','Ok',null,null,'Check here to confirm this message'); + return; + } + } - my.barcode = i_barcode; - break; - default: alert("Please report that this happened."); break; - } - - g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); + my.barcode = i_barcode; + break; + default: alert("Please report that this happened."); break; + } + + g.list.append( { 'row' : { 'my' : my }, 'to_top' : true } ); - var x = $('i_barcode'); x.value = ''; x.focus(); + var x = $('i_barcode'); x.value = ''; x.focus(); - } catch(E) { + } catch(E) { - dump(E+'\n'); alert(E); + dump(E+'\n'); alert(E); - } + } } function next_patron(cancel) { - try { - - if (cancel!='cancel') { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - var rows = g.list.dump_with_keys(); - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; row.delta = g.delta; - if (row.patron_barcode == '') { - delete(row.patron_barcode); - } - file.append_object(row); - } - file.close(); - - if ($('print_receipt').checked) { - try { - var params = { - 'patron_barcode' : $('p_barcode').value, - 'template' : 'offline_renew', + try { + + if (cancel!='cancel') { + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + var rows = g.list.dump_with_keys(); + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; row.delta = g.delta; + if (row.patron_barcode == '') { + delete(row.patron_barcode); + } + file.append_object(row); + } + file.close(); + + if ($('print_receipt').checked) { + try { + var params = { + 'patron_barcode' : $('p_barcode').value, + 'template' : 'offline_renew', 'callback' : function() { g.list.clear(); var x = $('i_barcode'); x.value = ''; x = $('p_barcode'); x.value = ''; x.focus(); } - }; - g.list.print( params ); - } catch(E) { - g.error.sdump('D_ERROR','print: ' + E); - alert('print: ' + E); - } - } else { + }; + g.list.print( params ); + } catch(E) { + g.error.sdump('D_ERROR','print: ' + E); + alert('print: ' + E); + } + } else { g.list.clear(); var x = $('i_barcode'); x.value = ''; x = $('p_barcode'); x.value = ''; x.focus(); } - } - } catch(E) { - dump(E+'\n'); alert(E); - } + } + } catch(E) { + dump(E+'\n'); alert(E); + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/circ/util.js b/Open-ILS/xul/staff_client/chrome/content/circ/util.js index cd189d9265..e177784c38 100644 --- a/Open-ILS/xul/staff_client/chrome/content/circ/util.js +++ b/Open-ILS/xul/staff_client/chrome/content/circ/util.js @@ -3,279 +3,279 @@ dump('entering circ/util.js\n'); if (typeof circ == 'undefined') var circ = {}; circ.util = {}; -circ.util.EXPORT_OK = [ - 'offline_checkout_columns', - 'offline_checkin_columns', - 'offline_renew_columns', - 'offline_inhouse_use_columns', - 'hold_columns', 'CHECKIN_VIA_BARCODE', 'std_map_row_to_column', 'hold_capture_via_copy_barcode' +circ.util.EXPORT_OK = [ + 'offline_checkout_columns', + 'offline_checkin_columns', + 'offline_renew_columns', + 'offline_inhouse_use_columns', + 'hold_columns', 'CHECKIN_VIA_BARCODE', 'std_map_row_to_column', 'hold_capture_via_copy_barcode' ]; -circ.util.EXPORT_TAGS = { ':all' : circ.util.EXPORT_OK }; +circ.util.EXPORT_TAGS = { ':all' : circ.util.EXPORT_OK }; circ.util.offline_checkout_columns = function(modify,params) { - - var c = [ - { - 'id' : 'timestamp', - 'label' : 'Timestamp', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.timestamp' - }, - { - 'id' : 'checkout_time', - 'label' : 'Check Out Time', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.checkout_time' - }, - { - 'id' : 'type', - 'label' : 'Transaction Type', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.type' - }, - { - 'id' : 'noncat', - 'label' : 'Non-Cataloged?', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.noncat' - }, - { - 'id' : 'noncat_type', - 'label' : 'Non-Cat Type ID', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.noncat_type' - }, - { - 'id' : 'noncat_count', - 'label' : 'Count', - 'flex' : 1, 'primary' : false, 'hidden' : false, - 'render' : 'my.noncat_count' - }, - { - 'id' : 'patron_barcode', - 'label' : 'Patron Barcode', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.patron_barcode' - }, - { - 'id' : 'barcode', - 'label' : 'Item Barcode', - 'flex' : 2, 'primary' : true, 'hidden' : false, - 'render' : 'my.barcode' - }, - { - 'id' : 'due_date', - 'label' : 'Due Date', - 'flex' : 1, 'primary' : false, 'hidden' : false, - 'render' : 'my.due_date' - }, - ]; - if (modify) for (var i = 0; i < c.length; i++) { - if (modify[ c[i].id ]) { - for (var j in modify[ c[i].id ]) { - c[i][j] = modify[ c[i].id ][j]; - } - } - } - if (params) { - if (params.just_these) { - JSAN.use('util.functional'); - var new_c = []; - for (var i = 0; i < params.just_these.length; i++) { - var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); - new_c.push( function(y){ return y; }( x ) ); - } - return new_c; - } - } - return c; + + var c = [ + { + 'id' : 'timestamp', + 'label' : 'Timestamp', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.timestamp' + }, + { + 'id' : 'checkout_time', + 'label' : 'Check Out Time', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.checkout_time' + }, + { + 'id' : 'type', + 'label' : 'Transaction Type', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.type' + }, + { + 'id' : 'noncat', + 'label' : 'Non-Cataloged?', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.noncat' + }, + { + 'id' : 'noncat_type', + 'label' : 'Non-Cat Type ID', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.noncat_type' + }, + { + 'id' : 'noncat_count', + 'label' : 'Count', + 'flex' : 1, 'primary' : false, 'hidden' : false, + 'render' : 'my.noncat_count' + }, + { + 'id' : 'patron_barcode', + 'label' : 'Patron Barcode', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.patron_barcode' + }, + { + 'id' : 'barcode', + 'label' : 'Item Barcode', + 'flex' : 2, 'primary' : true, 'hidden' : false, + 'render' : 'my.barcode' + }, + { + 'id' : 'due_date', + 'label' : 'Due Date', + 'flex' : 1, 'primary' : false, 'hidden' : false, + 'render' : 'my.due_date' + }, + ]; + if (modify) for (var i = 0; i < c.length; i++) { + if (modify[ c[i].id ]) { + for (var j in modify[ c[i].id ]) { + c[i][j] = modify[ c[i].id ][j]; + } + } + } + if (params) { + if (params.just_these) { + JSAN.use('util.functional'); + var new_c = []; + for (var i = 0; i < params.just_these.length; i++) { + var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); + new_c.push( function(y){ return y; }( x ) ); + } + return new_c; + } + } + return c; } circ.util.offline_checkin_columns = function(modify,params) { - - var c = [ - { - 'id' : 'timestamp', - 'label' : 'Timestamp', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.timestamp' - }, - { - 'id' : 'backdate', - 'label' : 'Back Date', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.backdate' - }, - { - 'id' : 'type', - 'label' : 'Transaction Type', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.type' - }, - { - 'id' : 'barcode', - 'label' : 'Item Barcode', - 'flex' : 2, 'primary' : true, 'hidden' : false, - 'render' : 'my.barcode' - }, - ]; - if (modify) for (var i = 0; i < c.length; i++) { - if (modify[ c[i].id ]) { - for (var j in modify[ c[i].id ]) { - c[i][j] = modify[ c[i].id ][j]; - } - } - } - if (params) { - if (params.just_these) { - JSAN.use('util.functional'); - var new_c = []; - for (var i = 0; i < params.just_these.length; i++) { - var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); - new_c.push( function(y){ return y; }( x ) ); - } - return new_c; - } - } - return c; + + var c = [ + { + 'id' : 'timestamp', + 'label' : 'Timestamp', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.timestamp' + }, + { + 'id' : 'backdate', + 'label' : 'Back Date', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.backdate' + }, + { + 'id' : 'type', + 'label' : 'Transaction Type', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.type' + }, + { + 'id' : 'barcode', + 'label' : 'Item Barcode', + 'flex' : 2, 'primary' : true, 'hidden' : false, + 'render' : 'my.barcode' + }, + ]; + if (modify) for (var i = 0; i < c.length; i++) { + if (modify[ c[i].id ]) { + for (var j in modify[ c[i].id ]) { + c[i][j] = modify[ c[i].id ][j]; + } + } + } + if (params) { + if (params.just_these) { + JSAN.use('util.functional'); + var new_c = []; + for (var i = 0; i < params.just_these.length; i++) { + var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); + new_c.push( function(y){ return y; }( x ) ); + } + return new_c; + } + } + return c; } circ.util.offline_renew_columns = function(modify,params) { - - var c = [ - { - 'id' : 'timestamp', - 'label' : 'Timestamp', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.timestamp' - }, - { - 'id' : 'checkout_time', - 'label' : 'Check Out Time', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.checkout_time' - }, - { - 'id' : 'type', - 'label' : 'Transaction Type', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.type' - }, - { - 'id' : 'patron_barcode', - 'label' : 'Patron Barcode', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.patron_barcode' - }, - { - 'id' : 'barcode', - 'label' : 'Item Barcode', - 'flex' : 2, 'primary' : true, 'hidden' : false, - 'render' : 'my.barcode' - }, - { - 'id' : 'due_date', - 'label' : 'Due Date', - 'flex' : 1, 'primary' : false, 'hidden' : false, - 'render' : 'my.due_date' - }, - ]; - if (modify) for (var i = 0; i < c.length; i++) { - if (modify[ c[i].id ]) { - for (var j in modify[ c[i].id ]) { - c[i][j] = modify[ c[i].id ][j]; - } - } - } - if (params) { - if (params.just_these) { - JSAN.use('util.functional'); - var new_c = []; - for (var i = 0; i < params.just_these.length; i++) { - var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); - new_c.push( function(y){ return y; }( x ) ); - } - return new_c; - } - } - return c; + + var c = [ + { + 'id' : 'timestamp', + 'label' : 'Timestamp', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.timestamp' + }, + { + 'id' : 'checkout_time', + 'label' : 'Check Out Time', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.checkout_time' + }, + { + 'id' : 'type', + 'label' : 'Transaction Type', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.type' + }, + { + 'id' : 'patron_barcode', + 'label' : 'Patron Barcode', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.patron_barcode' + }, + { + 'id' : 'barcode', + 'label' : 'Item Barcode', + 'flex' : 2, 'primary' : true, 'hidden' : false, + 'render' : 'my.barcode' + }, + { + 'id' : 'due_date', + 'label' : 'Due Date', + 'flex' : 1, 'primary' : false, 'hidden' : false, + 'render' : 'my.due_date' + }, + ]; + if (modify) for (var i = 0; i < c.length; i++) { + if (modify[ c[i].id ]) { + for (var j in modify[ c[i].id ]) { + c[i][j] = modify[ c[i].id ][j]; + } + } + } + if (params) { + if (params.just_these) { + JSAN.use('util.functional'); + var new_c = []; + for (var i = 0; i < params.just_these.length; i++) { + var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); + new_c.push( function(y){ return y; }( x ) ); + } + return new_c; + } + } + return c; } circ.util.offline_inhouse_use_columns = function(modify,params) { - - var c = [ - { - 'id' : 'timestamp', - 'label' : 'Timestamp', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.timestamp' - }, - { - 'id' : 'use_time', - 'label' : 'Use Time', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.use_time' - }, - { - 'id' : 'type', - 'label' : 'Transaction Type', - 'flex' : 1, 'primary' : false, 'hidden' : true, - 'render' : 'my.type' - }, - { - 'id' : 'count', - 'label' : 'Count', - 'flex' : 1, 'primary' : false, 'hidden' : false, - 'render' : 'my.count' - }, - { - 'id' : 'barcode', - 'label' : 'Item Barcode', - 'flex' : 2, 'primary' : true, 'hidden' : false, - 'render' : 'my.barcode' - }, - ]; - if (modify) for (var i = 0; i < c.length; i++) { - if (modify[ c[i].id ]) { - for (var j in modify[ c[i].id ]) { - c[i][j] = modify[ c[i].id ][j]; - } - } - } - if (params) { - if (params.just_these) { - JSAN.use('util.functional'); - var new_c = []; - for (var i = 0; i < params.just_these.length; i++) { - var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); - new_c.push( function(y){ return y; }( x ) ); - } - return new_c; - } - } - return c; + + var c = [ + { + 'id' : 'timestamp', + 'label' : 'Timestamp', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.timestamp' + }, + { + 'id' : 'use_time', + 'label' : 'Use Time', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.use_time' + }, + { + 'id' : 'type', + 'label' : 'Transaction Type', + 'flex' : 1, 'primary' : false, 'hidden' : true, + 'render' : 'my.type' + }, + { + 'id' : 'count', + 'label' : 'Count', + 'flex' : 1, 'primary' : false, 'hidden' : false, + 'render' : 'my.count' + }, + { + 'id' : 'barcode', + 'label' : 'Item Barcode', + 'flex' : 2, 'primary' : true, 'hidden' : false, + 'render' : 'my.barcode' + }, + ]; + if (modify) for (var i = 0; i < c.length; i++) { + if (modify[ c[i].id ]) { + for (var j in modify[ c[i].id ]) { + c[i][j] = modify[ c[i].id ][j]; + } + } + } + if (params) { + if (params.just_these) { + JSAN.use('util.functional'); + var new_c = []; + for (var i = 0; i < params.just_these.length; i++) { + var x = util.functional.find_list(c,function(d){return(d.id==params.just_these[i]);}); + new_c.push( function(y){ return y; }( x ) ); + } + return new_c; + } + } + return c; } circ.util.std_map_row_to_column = function(error_value) { - return function(row,col) { - // row contains { 'my' : { 'barcode' : xxx, 'duedate' : xxx } } - // col contains one of the objects listed above in columns + return function(row,col) { + // row contains { 'my' : { 'barcode' : xxx, 'duedate' : xxx } } + // col contains one of the objects listed above in columns - var my = row.my; - var value; - try { - value = eval( col.render ); - if (typeof value == 'undefined') value = ''; + var my = row.my; + var value; + try { + value = eval( col.render ); + if (typeof value == 'undefined') value = ''; - } catch(E) { - JSAN.use('util.error'); var error = new util.error(); - error.sdump('D_WARN','map_row_to_column: ' + E); - if (error_value) value = error_value; else value = '???'; - } - return value; - } + } catch(E) { + JSAN.use('util.error'); var error = new util.error(); + error.sdump('D_WARN','map_row_to_column: ' + E); + if (error_value) value = error_value; else value = '???'; + } + return value; + } } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index aa34d76ef6..b2fcb6f238 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -3,16 +3,16 @@ dump('Loading constants.js\n'); /* Get locale from preferences */ var LOCALE = ''; try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); - LOCALE = pref.getCharPref('general.useragent.locale'); + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); + LOCALE = pref.getCharPref('general.useragent.locale'); } catch (E) { - dump("Failed to fetch a locale from preferences: " + E + "\n"); + dump("Failed to fetch a locale from preferences: " + E + "\n"); } /* Fall back to en-US if we didn't get a locale from the preferences */ if (!LOCALE) { - LOCALE = 'en-US'; + LOCALE = 'en-US'; } const MODE_RDONLY = 0x01; @@ -26,238 +26,238 @@ const PERMS_FILE = 0644; const PERMS_DIR = 0755; const my_constants = { - 'magical_statuses' : { - '1' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Checked out | t */ - '3' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Lost | f */ - '6' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | In transit | t */ - '8' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : false } /* | On holds shelf | t */ - } + 'magical_statuses' : { + '1' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Checked out | t */ + '3' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Lost | f */ + '6' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | In transit | t */ + '8' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : false } /* | On holds shelf | t */ + } } const api = { 'PCRUD_XACT_BEGIN' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.transaction.begin' }, 'PCRUD_XACT_COMMIT' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.transaction.commit' }, 'PCRUD_XACT_ROLLBACK' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.transaction.rollback' }, - 'TEST_SECURE' : { 'app' : 'open-ils.actor', 'method' : 'opensrf.system.time' }, - 'TEST_UNSECURE' : { 'app' : 'open-ils.actor', 'method' : 'opensrf.system.time', 'secure' : false }, - 'AUTH_INIT' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.authenticate.init' }, - 'AUTH_COMPLETE' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.authenticate.complete' }, - 'AUTH_DELETE' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.session.delete' }, - 'AUTH_WORKSTATION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.workstation.register' }, - 'AUTH_VERIFY_CREDENTIALS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.verify_user_password' }, - 'BILL_PAY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment' }, - 'BLOB_AU_PARTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.parts', 'cacheable' : true, 'ttl' : 120000 }, - 'BLOB_MARC_CALLNUMBERS_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc_cn.retrieve', 'secure' : false }, + 'TEST_SECURE' : { 'app' : 'open-ils.actor', 'method' : 'opensrf.system.time' }, + 'TEST_UNSECURE' : { 'app' : 'open-ils.actor', 'method' : 'opensrf.system.time', 'secure' : false }, + 'AUTH_INIT' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.authenticate.init' }, + 'AUTH_COMPLETE' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.authenticate.complete' }, + 'AUTH_DELETE' : { 'app' : 'open-ils.auth', 'method' : 'open-ils.auth.session.delete' }, + 'AUTH_WORKSTATION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.workstation.register' }, + 'AUTH_VERIFY_CREDENTIALS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.verify_user_password' }, + 'BILL_PAY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment' }, + 'BLOB_AU_PARTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.parts', 'cacheable' : true, 'ttl' : 120000 }, + 'BLOB_MARC_CALLNUMBERS_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc_cn.retrieve', 'secure' : false }, 'BLOB_MBTS_DETAILS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transaction.fleshed.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' }, - 'BUCKET_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.create' }, - 'BUCKET_FLESH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.flesh' }, - 'BUCKET_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.full_delete' }, - 'BUCKET_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.all.retrieve_by_user' }, - 'BUCKET_ITEM_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.item.create' }, - 'BUCKET_ITEM_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.item.delete' }, - 'CAPTURE_COPY_FOR_HOLD_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.capture_copy.barcode' }, - 'CHECKIN_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkin' }, - 'CHECKOUT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout' }, - 'CHECKOUT_FULL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout.full' }, - 'CHECKOUT_PERMIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout.permit' }, - 'CHECKOUT_RENEW' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.renew' }, - 'CIRC_MODIFIER_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circ_modifier.retrieve.all' }, - 'FM_ACN_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve', 'secure' : false }, - 'FM_ACN_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve.authoritative', 'secure' : false }, - 'FM_ACN_TREE_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.fleshed.batch.update' }, - 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve', 'secure' : false }, - 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve.authoritative', 'secure' : false }, - 'FM_ACN_TRANSFER' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.batch.transfer' }, - 'FM_ACN_FIND_OR_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.call_number.find_or_create', 'secure' : false }, - 'FM_ACP_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve' }, - 'FM_ACP_DETAILS_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode' }, - 'FM_ACP_DETAILS_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode.authoritative' }, - //'FM_ACP_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.retrieve' }, - 'FM_ACP_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.retrieve', 'secure' : false }, - //'FM_ACP_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.find_by_barcode' }, - 'FM_ACP_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.find_by_barcode', 'secure' : false }, - 'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.find_by_barcode.authoritative', 'secure' : false }, - 'FM_ACP_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve', 'secure' : false }, - 'FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve.authoritative', 'secure' : false }, - 'FM_ACP_FLESHED_BATCH_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy.fleshed.batch.update' }, - 'FM_ACP_COUNT' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff', 'secure' : false }, - 'FM_ACP_COUNT.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff.authoritative', 'secure' : false }, - 'FM_ACPL_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve.all', 'secure' : false }, - 'FM_ACPL_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve', 'secure' : false }, - 'FM_ACPL_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve.authoritative', 'secure' : false }, - 'FM_ACPN_RETRIEVE_ALL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.retrieve.all', 'secure' : false }, - 'FM_ACPN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.create' }, - 'FM_ACPN_DELETE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.delete', 'secure' : false }, - 'FM_ACTSC_RETRIEVE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.batch', 'secure' : false }, - 'FM_ACTSC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.all', 'secure' : false }, - 'FM_AHRN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_note.create' }, - 'FM_AHN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.create' }, - 'FM_AHN_RETRIEVE_VIA_AHR' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold' }, - 'FM_AHN_RETRIEVE_VIA_AHR.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold.authoritative' }, - 'FM_AHR_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_by_id' }, - 'FM_AHR_BLOB_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.details.retrieve' }, - 'FM_AHR_BLOB_RETRIEVE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.details.retrieve.authoritative' }, - 'FM_AHR_RETRIEVE_VIA_AU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve' }, - 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve' }, - 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve.authoritative' }, - 'FM_AHR_RETRIEVE_VIA_BRE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_holds.retrieve' }, - 'FM_AHR_RETRIEVE_ALL_VIA_BRE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_all_from_title' }, - 'FM_AHR_RETRIEVE_VIA_PICKUP_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_by_pickup_lib' }, - 'FM_AHR_ID_LIST_RETRIEVE_VIA_PICKUP_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve_by_pickup_lib' }, - 'FM_AHR_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.retrieve' }, - 'FM_AHR_ID_LIST_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.id_list.retrieve', 'secure' : false }, - 'FM_AHR_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.on_shelf.retrieve' }, - 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve', 'secure' : false }, - 'FM_AHR_COUNT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count', 'cacheable' : true, 'ttl' : 60000 }, - 'FM_AHR_COUNT_RETRIEVE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, - 'FM_AHR_CANCEL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.cancel' }, - 'FM_AHR_UNCANCEL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.uncancel' }, - 'FM_AHR_UPDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.update' }, - 'FM_AHR_RESET' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.reset' }, - 'FM_AHR_STATUS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.status.retrieve' }, + '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' }, + 'BUCKET_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.create' }, + 'BUCKET_FLESH' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.flesh' }, + 'BUCKET_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.full_delete' }, + 'BUCKET_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.all.retrieve_by_user' }, + 'BUCKET_ITEM_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.item.create' }, + 'BUCKET_ITEM_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.container.item.delete' }, + 'CAPTURE_COPY_FOR_HOLD_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.capture_copy.barcode' }, + 'CHECKIN_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkin' }, + 'CHECKOUT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout' }, + 'CHECKOUT_FULL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout.full' }, + 'CHECKOUT_PERMIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.checkout.permit' }, + 'CHECKOUT_RENEW' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.renew' }, + 'CIRC_MODIFIER_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circ_modifier.retrieve.all' }, + 'FM_ACN_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve', 'secure' : false }, + 'FM_ACN_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve.authoritative', 'secure' : false }, + 'FM_ACN_TREE_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.fleshed.batch.update' }, + 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve', 'secure' : false }, + 'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve.authoritative', 'secure' : false }, + 'FM_ACN_TRANSFER' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.batch.transfer' }, + 'FM_ACN_FIND_OR_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.call_number.find_or_create', 'secure' : false }, + 'FM_ACP_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve' }, + 'FM_ACP_DETAILS_VIA_BARCODE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode' }, + 'FM_ACP_DETAILS_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_details.retrieve.barcode.authoritative' }, + //'FM_ACP_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.retrieve' }, + 'FM_ACP_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.retrieve', 'secure' : false }, + //'FM_ACP_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.find_by_barcode' }, + 'FM_ACP_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.find_by_barcode', 'secure' : false }, + 'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.find_by_barcode.authoritative', 'secure' : false }, + 'FM_ACP_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve', 'secure' : false }, + 'FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve.authoritative', 'secure' : false }, + 'FM_ACP_FLESHED_BATCH_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy.fleshed.batch.update' }, + 'FM_ACP_COUNT' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff', 'secure' : false }, + 'FM_ACP_COUNT.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.copy_count.staff.authoritative', 'secure' : false }, + 'FM_ACPL_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve.all', 'secure' : false }, + 'FM_ACPL_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve', 'secure' : false }, + 'FM_ACPL_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_location.retrieve.authoritative', 'secure' : false }, + 'FM_ACPN_RETRIEVE_ALL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.retrieve.all', 'secure' : false }, + 'FM_ACPN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.create' }, + 'FM_ACPN_DELETE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.copy_note.delete', 'secure' : false }, + 'FM_ACTSC_RETRIEVE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.batch', 'secure' : false }, + 'FM_ACTSC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.actor.retrieve.all', 'secure' : false }, + 'FM_AHRN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_note.create' }, + 'FM_AHN_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.create' }, + 'FM_AHN_RETRIEVE_VIA_AHR' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold' }, + 'FM_AHN_RETRIEVE_VIA_AHR.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_notification.retrieve_by_hold.authoritative' }, + 'FM_AHR_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_by_id' }, + 'FM_AHR_BLOB_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.details.retrieve' }, + 'FM_AHR_BLOB_RETRIEVE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.details.retrieve.authoritative' }, + 'FM_AHR_RETRIEVE_VIA_AU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve' }, + 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve' }, + 'FM_AHR_ID_LIST_RETRIEVE_VIA_AU.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve.authoritative' }, + 'FM_AHR_RETRIEVE_VIA_BRE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_holds.retrieve' }, + 'FM_AHR_RETRIEVE_ALL_VIA_BRE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_all_from_title' }, + 'FM_AHR_RETRIEVE_VIA_PICKUP_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.retrieve_by_pickup_lib' }, + 'FM_AHR_ID_LIST_RETRIEVE_VIA_PICKUP_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.holds.id_list.retrieve_by_pickup_lib' }, + 'FM_AHR_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.retrieve' }, + 'FM_AHR_ID_LIST_PULL_LIST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold_pull_list.id_list.retrieve', 'secure' : false }, + 'FM_AHR_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.on_shelf.retrieve' }, + 'FM_AHR_ID_LIST_ONSHELF_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve', 'secure' : false }, + 'FM_AHR_COUNT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count', 'cacheable' : true, 'ttl' : 60000 }, + 'FM_AHR_COUNT_RETRIEVE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.hold_requests.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, + 'FM_AHR_CANCEL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.cancel' }, + 'FM_AHR_UNCANCEL' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.uncancel' }, + 'FM_AHR_UPDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.update' }, + 'FM_AHR_RESET' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.reset' }, + 'FM_AHR_STATUS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.status.retrieve' }, 'FM_AHRCC_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.ahrcc.atomic', 'secure' : false }, - 'FM_AIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.in_house_use.create' }, - 'FM_ANCC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cataloged_circulation.retrieve' }, - 'FM_ANCC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user' }, - 'FM_ANCC_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user.authoritative' }, - 'FM_ANCIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_in_house_use.create' }, - 'FM_AOA_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.address.retrieve', 'secure' : false }, - 'FM_AOU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.retrieve', 'secure' : false }, - 'FM_AOU_DESCENDANTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.descendants.retrieve', 'secure' : false }, - 'FM_AOU_RETRIEVE_RELATED_VIA_SESSION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.full_path.retrieve' }, - 'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title', 'secure' : false }, - 'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title.authoritative', 'secure' : false }, + 'FM_AIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.in_house_use.create' }, + 'FM_ANCC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cataloged_circulation.retrieve' }, + 'FM_ANCC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user' }, + 'FM_ANCC_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user.authoritative' }, + 'FM_ANCIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_in_house_use.create' }, + 'FM_AOA_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.address.retrieve', 'secure' : false }, + 'FM_AOU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.retrieve', 'secure' : false }, + 'FM_AOU_DESCENDANTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.descendants.retrieve', 'secure' : false }, + 'FM_AOU_RETRIEVE_RELATED_VIA_SESSION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.full_path.retrieve' }, + 'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title', 'secure' : false }, + 'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title.authoritative', 'secure' : false }, 'FM_AOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit_setting.values.ranged.retrieve' }, - 'FM_AOUT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_types.retrieve', 'secure' : false }, - 'FM_ASC_BATCH_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.batch', 'secure' : false }, - 'FM_ASC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.all', 'secure' : false }, - 'FM_ASV_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.create' }, - 'FM_ASV_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.retrieve.all', 'secure' : false }, - 'FM_ASV_RETRIEVE_REQUIRED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.retrieve.required' }, - 'FM_ASVR_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.response.retrieve' }, - 'FM_ATC_VOID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.abort' }, - 'FM_ATC_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve', 'secure' : false }, - 'FM_ATC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve_by_lib', 'secure' : false }, + 'FM_AOUT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_types.retrieve', 'secure' : false }, + 'FM_ASC_BATCH_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.batch', 'secure' : false }, + 'FM_ASC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.all', 'secure' : false }, + 'FM_ASV_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.create' }, + 'FM_ASV_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.retrieve.all', 'secure' : false }, + 'FM_ASV_RETRIEVE_REQUIRED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.retrieve.required' }, + 'FM_ASVR_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.survey.response.retrieve' }, + 'FM_ATC_VOID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.abort' }, + 'FM_ATC_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve', 'secure' : false }, + 'FM_ATC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.transit.retrieve_by_lib', 'secure' : false }, 'FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve_id_by_barcode_or_username' }, - '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_LIST_RETRIEVE_VIA_GROUP.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve.authoritative' }, - '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_BARCODE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative', '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_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.authoritative', '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_FLESHED_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve.authoritative', 'cacheable' : true, 'ttl' : 60000 }, + '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_LIST_RETRIEVE_VIA_GROUP.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.retrieve.authoritative' }, + '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_BARCODE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve_by_barcode.authoritative', '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_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.authoritative', '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_FLESHED_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fleshed.retrieve.authoritative', 'cacheable' : true, 'ttl' : 60000 }, 'FM_AU_MERGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.merge' }, - '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_AU_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.delete' }, - 'FM_AUN_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all', 'cacheable' : false, 'ttl' : 60000 }, - 'FM_AUN_RETRIEVE_ALL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all.authoritative', 'cacheable' : false, 'ttl' : 60000 }, - '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_AUS_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.settings.update' }, - 'FM_AUSP_APPLY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.apply' }, - 'FM_AUSP_REMOVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.remove' }, + '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_AU_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.delete' }, + 'FM_AUN_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all', 'cacheable' : false, 'ttl' : 60000 }, + 'FM_AUN_RETRIEVE_ALL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.note.retrieve.all.authoritative', 'cacheable' : false, 'ttl' : 60000 }, + '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_AUS_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.settings.update' }, + 'FM_AUSP_APPLY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.apply' }, + 'FM_AUSP_REMOVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.remove' }, 'FM_AUSP_PCRUD_UPDATE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.update.ausp', 'secure' : false }, - 'FM_AUSP_UPDATE_NOTE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.note.update' }, - 'FM_BRE_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve', 'secure' : false }, - 'FM_BRE_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve.authoritative', 'secure' : false }, - 'FM_BRE_ID_SEARCH_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.find_by_barcode', 'secure' : false }, + 'FM_AUSP_UPDATE_NOTE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.note.update' }, + 'FM_BRE_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve', 'secure' : false }, + 'FM_BRE_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve.authoritative', 'secure' : false }, + 'FM_BRE_ID_SEARCH_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.find_by_barcode', 'secure' : false }, 'FM_BRE_ID_SEARCH_VIA_MULTICLASS_QUERY' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.multiclass.query.staff' }, - 'FM_BRE_ID_SEARCH_VIA_TCN' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.tcn', 'secure' : false }, - 'FM_BRE_DELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.delete', 'secure' : false }, - 'FM_BRE_UNDELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.undelete', 'secure' : false }, - 'FM_BRN_FROM_MARCXML' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.marcxml_to_brn', 'secure' : false }, - 'FM_CBT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.billing_type.ranged.retrieve.all', 'secure' : false }, - 'FM_CCS_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.config.copy_status.retrieve.all', 'secure' : false }, - 'FM_CIRC_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve' }, - 'FM_CIRC_DETAILS.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve.authoritative' }, - 'FM_CIRC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.retrieve' }, - /*'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.actor.user.checked_out.slim' },*/ - 'FM_CIRC_IN_WITH_FINES_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_in_with_fines' }, - 'FM_CIRC_IN_WITH_FINES_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_in_with_fines.authoritative' }, - 'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out' }, - 'FM_CIRC_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.authoritative' }, - '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.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, - 'FM_CIRC_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.count' }, + 'FM_BRE_ID_SEARCH_VIA_TCN' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.tcn', 'secure' : false }, + 'FM_BRE_DELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.delete', 'secure' : false }, + 'FM_BRE_UNDELETE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record_entry.undelete', 'secure' : false }, + 'FM_BRN_FROM_MARCXML' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.marcxml_to_brn', 'secure' : false }, + 'FM_CBT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.billing_type.ranged.retrieve.all', 'secure' : false }, + 'FM_CCS_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.config.copy_status.retrieve.all', 'secure' : false }, + 'FM_CIRC_DETAILS' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve' }, + 'FM_CIRC_DETAILS.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.fleshed.retrieve.authoritative' }, + 'FM_CIRC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.retrieve' }, + /*'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.actor.user.checked_out.slim' },*/ + 'FM_CIRC_IN_WITH_FINES_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_in_with_fines' }, + 'FM_CIRC_IN_WITH_FINES_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_in_with_fines.authoritative' }, + 'FM_CIRC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out' }, + 'FM_CIRC_RETRIEVE_VIA_USER.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.authoritative' }, + '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.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.checked_out.count.authoritative', 'cacheable' : true, 'ttl' : 60000 }, + 'FM_CIRC_COUNT_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.count' }, 'FM_CIRC_IMPROVED_COUNT_VIA_COPY' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.circbyyr.atomic' }, - 'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' }, + 'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' }, 'FM_CIRC_BACKDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate' }, 'FM_CIRC_BACKDATE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate.batch' }, - 'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false }, - 'FM_CITM_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.item_type_map.retrieve.all', 'secure' : false }, - 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, - 'FM_CNCT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_types.retrieve.all', 'secure' : false }, - 'FM_CRAHP_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.config.rules.age_hold_protect.retrieve.all', 'secure' : false }, + 'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false }, + 'FM_CITM_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.item_type_map.retrieve.all', 'secure' : false }, + 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, + 'FM_CNCT_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cat_types.retrieve.all', 'secure' : false }, + 'FM_CRAHP_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.config.rules.age_hold_protect.retrieve.all', 'secure' : false }, 'FM_CSP_PCRUD_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.csp.atomic', 'secure' : false }, - 'FM_CST_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.standings.retrieve', 'secure' : false }, - 'FM_MB_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.create' }, - 'FM_MB_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.retrieve.all' }, - 'FM_MB_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.retrieve.all.authoritative' }, - 'FM_MB_VOID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.void' }, - 'FM_MB_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.note.edit' }, - 'FM_MBTS_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve' }, - 'FM_MBTS_RETRIEVE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve.authoritative' }, - 'FM_MBTS_IDS_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.ids' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_charge.ids' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids.authoritative' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.still_open.ids' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' }, - 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' }, - 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' }, - 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' }, - 'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' }, - 'FM_MP_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all.authoritative' }, - 'FM_MP_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.note.edit' }, - 'FM_MG_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.create' }, - 'FM_MG_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.retrieve' }, - 'FM_MOBTS_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance' }, - 'FM_MOBTS_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.authoritative' }, - 'FM_MOBTS_TOTAL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.total' }, - 'FM_MOBTS_COUNT_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.count' }, - '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.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary.authoritative', 'cacheable' : true, 'ttl' : 60000 }, - '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' }, - 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' }, - 'RETRIEVE_Z3950_SERVICES' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.retrieve_services', 'secure' : false }, - 'MARK_ITEM_DAMAGED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_damaged' }, - 'MARK_ITEM_MISSING' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_missing' }, - 'MARK_ITEM_LOST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.set_lost' }, - 'MARK_ITEM_CLAIM_RETURNED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.set_claims_returned' }, - 'MODS_SLIM_METARECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.metarecord.mods_slim.retrieve', 'secure' : false }, - 'MODS_SLIM_RECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.mods_slim.retrieve', 'secure' : false }, - 'MODS_SLIM_RECORD_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.mods_slim.retrieve.authoritative', 'secure' : false }, - 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.mods_from_copy', 'secure' : false }, - 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.mods_from_copy', 'secure' : false }, - 'PERM_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check' }, - 'PERM_MULTI_ORG_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check.multi_org' }, - 'PERM_RETRIEVE_HIGHEST_ORG' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.highest_org' }, - 'PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at' }, - 'BATCH_PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at.batch' }, - 'MARC_XML_RECORD_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.create' }, - 'MARC_XML_RECORD_IMPORT' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.import' }, - 'MARC_XML_RECORD_REPLACE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc.replace' }, - 'MARC_XML_RECORD_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.update' }, - 'MARC_XML_TEMPLATE_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.marc_template.retrieve', 'secure' : false }, - 'MARC_XML_TEMPLATE_LIST' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.marc_template.types.retrieve', 'secure' : false }, - 'MERGE_RECORDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.records.merge' }, - 'PATRON_BARCODE_EXISTS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists' }, - 'PATRON_BARCODE_EXISTS.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists.authoritative' }, - 'RECALCULATE_STANDING_PENALTIES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalties.update' }, + 'FM_CST_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.standings.retrieve', 'secure' : false }, + 'FM_MB_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.create' }, + 'FM_MB_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.retrieve.all' }, + 'FM_MB_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.retrieve.all.authoritative' }, + 'FM_MB_VOID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.void' }, + 'FM_MB_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.note.edit' }, + 'FM_MBTS_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve' }, + 'FM_MBTS_RETRIEVE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve.authoritative' }, + 'FM_MBTS_IDS_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.ids' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_charge.ids' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids.authoritative' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.still_open.ids' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' }, + 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' }, + 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' }, + 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' }, + 'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' }, + 'FM_MP_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all.authoritative' }, + 'FM_MP_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.note.edit' }, + 'FM_MG_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.create' }, + 'FM_MG_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.retrieve' }, + 'FM_MOBTS_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance' }, + 'FM_MOBTS_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.authoritative' }, + 'FM_MOBTS_TOTAL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.total' }, + 'FM_MOBTS_COUNT_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.count' }, + '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.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.fines.summary.authoritative', 'cacheable' : true, 'ttl' : 60000 }, + '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' }, + 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' }, + 'RETRIEVE_Z3950_SERVICES' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.retrieve_services', 'secure' : false }, + 'MARK_ITEM_DAMAGED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_damaged' }, + 'MARK_ITEM_MISSING' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_missing' }, + 'MARK_ITEM_LOST' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.set_lost' }, + 'MARK_ITEM_CLAIM_RETURNED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.set_claims_returned' }, + 'MODS_SLIM_METARECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.metarecord.mods_slim.retrieve', 'secure' : false }, + 'MODS_SLIM_RECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.mods_slim.retrieve', 'secure' : false }, + 'MODS_SLIM_RECORD_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.mods_slim.retrieve.authoritative', 'secure' : false }, + 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.mods_from_copy', 'secure' : false }, + 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.mods_from_copy', 'secure' : false }, + 'PERM_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check' }, + 'PERM_MULTI_ORG_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check.multi_org' }, + 'PERM_RETRIEVE_HIGHEST_ORG' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.highest_org' }, + 'PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at' }, + 'BATCH_PERM_RETRIEVE_WORK_OU' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.has_work_perm_at.batch' }, + 'MARC_XML_RECORD_CREATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.create' }, + 'MARC_XML_RECORD_IMPORT' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.import' }, + 'MARC_XML_RECORD_REPLACE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc.replace' }, + 'MARC_XML_RECORD_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.xml.update' }, + 'MARC_XML_TEMPLATE_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.marc_template.retrieve', 'secure' : false }, + 'MARC_XML_TEMPLATE_LIST' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.marc_template.types.retrieve', 'secure' : false }, + 'MERGE_RECORDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.records.merge' }, + 'PATRON_BARCODE_EXISTS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists' }, + 'PATRON_BARCODE_EXISTS.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists.authoritative' }, + 'RECALCULATE_STANDING_PENALTIES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalties.update' }, 'USER_ORG_UNIT_OPT_IN_FEATURE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.enabled' }, 'USER_ORG_UNIT_OPT_IN_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.check' }, 'USER_ORG_UNIT_OPT_IN_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.create' } @@ -265,108 +265,108 @@ const api = { const urls = { - 'opac' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', - 'opac_rdetail' : '/opac/' + LOCALE + '/skin/default/xml/rdetail.xml', - 'opac_rresult' : '/opac/' + LOCALE + '/skin/default/xml/rresult.xml', - 'org_tree' : '/opac/common/js/' + LOCALE + '/OrgTree.js', - 'browser' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', - 'fieldmapper' : '/opac/common/js/fmall.js', - 'isodate_lib_remote' : '/opac/common/js/DP_DateExtensions.js', - 'isodate_lib_local' : 'chrome://open_ils_staff_client/content/OpenILS/util/DP_DateExtensions.js', - 'xsl_marc2html' : '/opac/extras/xsl/oilsMARC21slim2HTML.xsl', + 'opac' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', + 'opac_rdetail' : '/opac/' + LOCALE + '/skin/default/xml/rdetail.xml', + 'opac_rresult' : '/opac/' + LOCALE + '/skin/default/xml/rresult.xml', + 'org_tree' : '/opac/common/js/' + LOCALE + '/OrgTree.js', + 'browser' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1', + 'fieldmapper' : '/opac/common/js/fmall.js', + 'isodate_lib_remote' : '/opac/common/js/DP_DateExtensions.js', + 'isodate_lib_local' : 'chrome://open_ils_staff_client/content/OpenILS/util/DP_DateExtensions.js', + 'xsl_marc2html' : '/opac/extras/xsl/oilsMARC21slim2HTML.xsl', - 'AUDIO_GOOD_SOUND' : '/xul/server/skin/media/audio/bonus.wav', - 'AUDIO_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav', - 'AUDIO_HORRIBLE_SOUND' : '/xul/server/skin/media/audio/redalert.wav', - 'AUDIO_CIRC_GOOD_SOUND' : '/xul/server/skin/media/audio/toggled.wav', - 'AUDIO_CIRC_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav', + 'AUDIO_GOOD_SOUND' : '/xul/server/skin/media/audio/bonus.wav', + 'AUDIO_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav', + 'AUDIO_HORRIBLE_SOUND' : '/xul/server/skin/media/audio/redalert.wav', + 'AUDIO_CIRC_GOOD_SOUND' : '/xul/server/skin/media/audio/toggled.wav', + 'AUDIO_CIRC_BAD_SOUND' : '/xul/server/skin/media/audio/question.wav', - 'XUL_AUTH_SIMPLE' : '/xul/server/main/simple_auth.xul', - 'XUL_BIB_BRIEF' : '/xul/server/cat/bib_brief.xul', - 'XUL_BROWSER' : 'chrome://open_ils_staff_client/content/util/browser.xul', - 'XUL_CHECKIN' : '/xul/server/circ/checkin.xul', - 'XUL_BACKDATE' : '/xul/server/circ/backdate_post_checkin.xul', - 'XUL_RENEW' : '/xul/server/circ/renew.xul', - 'XUL_CHECKOUT' : '/xul/server/circ/checkout.xul', - 'XUL_CIRC_BRIEF' : '/xul/server/circ/circ_brief.xul', - 'XUL_CIRC_SUMMARY' : '/xul/server/circ/circ_summary.xul', - 'XUL_COPY_BUCKETS_QUICK' : '/xul/server/cat/copy_buckets_quick.xul', - 'XUL_COPY_BUCKETS' : '/xul/server/cat/copy_buckets.xul', - 'XUL_COPY_DETAILS' : '/xul/server/circ/copy_details.xul', - 'XUL_COPY_EDITOR' : '/xul/server/cat/copy_editor.xul', - 'XUL_COPY_LOCATION_EDIT' : '/xul/server/admin/copy_locations.xhtml', - 'XUL_COPY_NOTES' : '/xul/server/cat/copy_notes.xul', - 'XUL_COPY_STATUS' : '/xul/server/circ/copy_status.xul', - 'XUL_COPY_SUMMARY' : '/xul/server/cat/copy_summary.xul', - 'XUL_COPY_VOLUME_BROWSE' : '/xul/server/cat/copy_browser.xul', - 'XUL_DEBUG_CONSOLE' : 'chrome://global/content/console.xul', - 'XUL_DEBUG_FIELDMAPPER' : '/xul/server/util/fm_view.xul', - 'XUL_DEBUG_FILTER_CONSOLE' : '/xul/server/util/filter_console.xul', - 'XUL_DEBUG_SHELL' : '/xul/server/util/shell.html', - 'XUL_DEBUG_XULEDITOR' : '/xul/server/util/xuledit.xul', - 'XUL_FANCY_PROMPT' : '/xul/server/util/fancy_prompt.xul', - 'XUL_HOLD_CAPTURE' : '/xul/server/circ/hold_capture.xul', - 'XUL_HOLD_PULL_LIST' : '/xul/server/admin/hold_pull_list.xhtml', - 'XUL_HOLDS_BROWSER' : '/xul/server/patron/holds.xul', - 'XUL_HOLD_DETAILS' : '/xul/server/patron/hold_details.xul', - 'XUL_HOLD_CANCEL' : '/xul/server/patron/hold_cancel.xul', - 'XUL_IN_HOUSE_USE' : '/xul/server/circ/in_house_use.xul', - 'XUL_LIST_CLIPBOARD' : '/xul/server/util/list_clipboard.xul', - 'XUL_LOCAL_ADMIN' : '/xul/server/admin/index.xhtml', - 'XUL_MARC_NEW' : '/xul/server/cat/marc_new.xul', - 'XUL_MARC_EDIT' : '/xul/server/cat/marcedit.xul', - 'XUL_MARC_VIEW' : '/xul/server/cat/marc_view.xul', - 'XUL_MENU_FRAME' : 'chrome://open_ils_staff_client/content/main/menu_frame.xul', - 'XUL_NON_CAT_LABEL_EDIT' : '/xul/server/admin/non_cat_types.xhtml', - 'XUL_OFFLINE_UPLOAD_XACTS' : '/xul/server/admin/upload_xacts.xhtml', - 'XUL_OFFLINE_MANAGE_XACTS' : '/xul/server/admin/offline_manage_xacts.xul', - 'XUL_OFFLINE_MANAGE_XACTS_CGI' : '/cgi-bin/offline/offline.pl', - 'XUL_OFFLINE_GENERATE_WIDGETS' : '/xul/server/main/gen_offline_widgets.xul', - 'XUL_REMOTE_OPAC_WRAPPER' : '/xul/server/cat/opac.xul', - 'XUL_OPAC_WRAPPER' : 'chrome://open_ils_staff_client/content/cat/opac.xul', - 'XUL_PATRON_BARCODE_ENTRY' : '/xul/server/patron/barcode_entry.xul', - 'XUL_PATRON_BILLS' : '/xul/server/patron/bills.xul', - 'XUL_PATRON_BILL_CC_INFO' : '/xul/server/patron/bill_cc_info.xul', - 'XUL_PATRON_BILL_CHECK_INFO' : '/xul/server/patron/bill_check_info.xul', - 'XUL_PATRON_BILL_DETAILS' : '/xul/server/patron/bill_details.xul', - 'XUL_PATRON_BILL_HISTORY' : '/xul/server/patron/bill_history.xul', - 'XUL_PATRON_BILL_WIZARD' : '/xul/server/patron/bill_wizard.xul', + 'XUL_AUTH_SIMPLE' : '/xul/server/main/simple_auth.xul', + 'XUL_BIB_BRIEF' : '/xul/server/cat/bib_brief.xul', + 'XUL_BROWSER' : 'chrome://open_ils_staff_client/content/util/browser.xul', + 'XUL_CHECKIN' : '/xul/server/circ/checkin.xul', + 'XUL_BACKDATE' : '/xul/server/circ/backdate_post_checkin.xul', + 'XUL_RENEW' : '/xul/server/circ/renew.xul', + 'XUL_CHECKOUT' : '/xul/server/circ/checkout.xul', + 'XUL_CIRC_BRIEF' : '/xul/server/circ/circ_brief.xul', + 'XUL_CIRC_SUMMARY' : '/xul/server/circ/circ_summary.xul', + 'XUL_COPY_BUCKETS_QUICK' : '/xul/server/cat/copy_buckets_quick.xul', + 'XUL_COPY_BUCKETS' : '/xul/server/cat/copy_buckets.xul', + 'XUL_COPY_DETAILS' : '/xul/server/circ/copy_details.xul', + 'XUL_COPY_EDITOR' : '/xul/server/cat/copy_editor.xul', + 'XUL_COPY_LOCATION_EDIT' : '/xul/server/admin/copy_locations.xhtml', + 'XUL_COPY_NOTES' : '/xul/server/cat/copy_notes.xul', + 'XUL_COPY_STATUS' : '/xul/server/circ/copy_status.xul', + 'XUL_COPY_SUMMARY' : '/xul/server/cat/copy_summary.xul', + 'XUL_COPY_VOLUME_BROWSE' : '/xul/server/cat/copy_browser.xul', + 'XUL_DEBUG_CONSOLE' : 'chrome://global/content/console.xul', + 'XUL_DEBUG_FIELDMAPPER' : '/xul/server/util/fm_view.xul', + 'XUL_DEBUG_FILTER_CONSOLE' : '/xul/server/util/filter_console.xul', + 'XUL_DEBUG_SHELL' : '/xul/server/util/shell.html', + 'XUL_DEBUG_XULEDITOR' : '/xul/server/util/xuledit.xul', + 'XUL_FANCY_PROMPT' : '/xul/server/util/fancy_prompt.xul', + 'XUL_HOLD_CAPTURE' : '/xul/server/circ/hold_capture.xul', + 'XUL_HOLD_PULL_LIST' : '/xul/server/admin/hold_pull_list.xhtml', + 'XUL_HOLDS_BROWSER' : '/xul/server/patron/holds.xul', + 'XUL_HOLD_DETAILS' : '/xul/server/patron/hold_details.xul', + 'XUL_HOLD_CANCEL' : '/xul/server/patron/hold_cancel.xul', + 'XUL_IN_HOUSE_USE' : '/xul/server/circ/in_house_use.xul', + 'XUL_LIST_CLIPBOARD' : '/xul/server/util/list_clipboard.xul', + 'XUL_LOCAL_ADMIN' : '/xul/server/admin/index.xhtml', + 'XUL_MARC_NEW' : '/xul/server/cat/marc_new.xul', + 'XUL_MARC_EDIT' : '/xul/server/cat/marcedit.xul', + 'XUL_MARC_VIEW' : '/xul/server/cat/marc_view.xul', + 'XUL_MENU_FRAME' : 'chrome://open_ils_staff_client/content/main/menu_frame.xul', + 'XUL_NON_CAT_LABEL_EDIT' : '/xul/server/admin/non_cat_types.xhtml', + 'XUL_OFFLINE_UPLOAD_XACTS' : '/xul/server/admin/upload_xacts.xhtml', + 'XUL_OFFLINE_MANAGE_XACTS' : '/xul/server/admin/offline_manage_xacts.xul', + 'XUL_OFFLINE_MANAGE_XACTS_CGI' : '/cgi-bin/offline/offline.pl', + 'XUL_OFFLINE_GENERATE_WIDGETS' : '/xul/server/main/gen_offline_widgets.xul', + 'XUL_REMOTE_OPAC_WRAPPER' : '/xul/server/cat/opac.xul', + 'XUL_OPAC_WRAPPER' : 'chrome://open_ils_staff_client/content/cat/opac.xul', + 'XUL_PATRON_BARCODE_ENTRY' : '/xul/server/patron/barcode_entry.xul', + 'XUL_PATRON_BILLS' : '/xul/server/patron/bills.xul', + 'XUL_PATRON_BILL_CC_INFO' : '/xul/server/patron/bill_cc_info.xul', + 'XUL_PATRON_BILL_CHECK_INFO' : '/xul/server/patron/bill_check_info.xul', + 'XUL_PATRON_BILL_DETAILS' : '/xul/server/patron/bill_details.xul', + 'XUL_PATRON_BILL_HISTORY' : '/xul/server/patron/bill_history.xul', + 'XUL_PATRON_BILL_WIZARD' : '/xul/server/patron/bill_wizard.xul', 'XUL_PATRON_BILL_ALTERNATE_VIEW' : '/xul/server/patron/bill2.xul', - 'XUL_PATRON_DISPLAY' : '/xul/server/patron/display.xul', - 'XUL_PATRON_HORIZ_DISPLAY' : '/xul/server/patron/display_horiz.xul', - 'XUL_PATRON_EDIT' : '/eg/actor/user/register', - 'XUL_USER_PERM_EDITOR' : '/xul/server/patron/user_edit.xhtml', - 'XUL_PATRON_HOLDS' : '/xul/server/patron/holds.xul', - 'XUL_PATRON_INFO_NOTES' : '/xul/server/patron/info_notes.xul', - 'XUL_PATRON_INFO_STAT_CATS' : '/xul/server/patron/info_stat_cats.xul', - 'XUL_PATRON_INFO_SURVEYS' : '/xul/server/patron/info_surveys.xul', - 'XUL_PATRON_INFO_GROUP' : '/xul/server/patron/info_group.xul', - 'XUL_PATRON_ITEMS' : '/xul/server/patron/items.xul', - 'XUL_PATRON_SEARCH_FORM' : '/xul/server/patron/search_form.xul', - 'XUL_PATRON_HORIZONTAL_SEARCH_FORM' : '/xul/server/patron/search_form_horiz.xul', - 'XUL_PATRON_SEARCH_RESULT' : '/xul/server/patron/search_result.xul', - 'XUL_PATRON_SUMMARY' : '/xul/server/patron/summary.xul', - 'XUL_PRE_CAT' : '/xul/server/circ/pre_cat_fields.xul', - 'XUL_PRINT_LIST_TEMPLATE_EDITOR' : '/xul/server/circ/print_list_template_editor.xul', - 'XUL_RECORD_BUCKETS' : '/xul/server/cat/record_buckets.xul', - 'XUL_RECORD_BUCKETS_QUICK' : '/xul/server/cat/record_buckets_quick.xul', - 'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul', - 'XUL_SPINE_LABEL' : '/xul/server/cat/spine_labels.xul', - 'XUL_STANDALONE' : 'chrome://open_ils_staff_client/content/circ/offline.xul', - 'XUL_STANDING_PENALTIES' : '/xul/server/patron/standing_penalties.xul', - 'XUL_NEW_STANDING_PENALTY' : '/xul/server/patron/new_standing_penalty.xul', - 'XUL_EDIT_STANDING_PENALTY' : '/xul/server/patron/edit_standing_penalty.xul', - 'XUL_STAT_CAT_EDIT' : '/xul/server/admin/stat_cat_editor.xhtml', - 'XUL_SURVEY_WIZARD' : 'chrome://open_ils_staff_client/content/admin/survey_wizard.xul', - 'XUL_USER_BUCKETS' : '/xul/server/patron/user_buckets.xul', - 'XUL_VERIFY_CREDENTIALS' : '/xul/server/main/verify_credentials.xul', - 'XUL_VOLUME_BUCKETS' : '/xul/server/cat/volume_buckets.xul', - 'XUL_VOLUME_COPY_CREATOR' : '/xul/server/cat/volume_copy_creator.xul', - 'XUL_VOLUME_EDITOR' : '/xul/server/cat/volume_editor.xul', + 'XUL_PATRON_DISPLAY' : '/xul/server/patron/display.xul', + 'XUL_PATRON_HORIZ_DISPLAY' : '/xul/server/patron/display_horiz.xul', + 'XUL_PATRON_EDIT' : '/eg/actor/user/register', + 'XUL_USER_PERM_EDITOR' : '/xul/server/patron/user_edit.xhtml', + 'XUL_PATRON_HOLDS' : '/xul/server/patron/holds.xul', + 'XUL_PATRON_INFO_NOTES' : '/xul/server/patron/info_notes.xul', + 'XUL_PATRON_INFO_STAT_CATS' : '/xul/server/patron/info_stat_cats.xul', + 'XUL_PATRON_INFO_SURVEYS' : '/xul/server/patron/info_surveys.xul', + 'XUL_PATRON_INFO_GROUP' : '/xul/server/patron/info_group.xul', + 'XUL_PATRON_ITEMS' : '/xul/server/patron/items.xul', + 'XUL_PATRON_SEARCH_FORM' : '/xul/server/patron/search_form.xul', + 'XUL_PATRON_HORIZONTAL_SEARCH_FORM' : '/xul/server/patron/search_form_horiz.xul', + 'XUL_PATRON_SEARCH_RESULT' : '/xul/server/patron/search_result.xul', + 'XUL_PATRON_SUMMARY' : '/xul/server/patron/summary.xul', + 'XUL_PRE_CAT' : '/xul/server/circ/pre_cat_fields.xul', + 'XUL_PRINT_LIST_TEMPLATE_EDITOR' : '/xul/server/circ/print_list_template_editor.xul', + 'XUL_RECORD_BUCKETS' : '/xul/server/cat/record_buckets.xul', + 'XUL_RECORD_BUCKETS_QUICK' : '/xul/server/cat/record_buckets_quick.xul', + 'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul', + 'XUL_SPINE_LABEL' : '/xul/server/cat/spine_labels.xul', + 'XUL_STANDALONE' : 'chrome://open_ils_staff_client/content/circ/offline.xul', + 'XUL_STANDING_PENALTIES' : '/xul/server/patron/standing_penalties.xul', + 'XUL_NEW_STANDING_PENALTY' : '/xul/server/patron/new_standing_penalty.xul', + 'XUL_EDIT_STANDING_PENALTY' : '/xul/server/patron/edit_standing_penalty.xul', + 'XUL_STAT_CAT_EDIT' : '/xul/server/admin/stat_cat_editor.xhtml', + 'XUL_SURVEY_WIZARD' : 'chrome://open_ils_staff_client/content/admin/survey_wizard.xul', + 'XUL_USER_BUCKETS' : '/xul/server/patron/user_buckets.xul', + 'XUL_VERIFY_CREDENTIALS' : '/xul/server/main/verify_credentials.xul', + 'XUL_VOLUME_BUCKETS' : '/xul/server/cat/volume_buckets.xul', + 'XUL_VOLUME_COPY_CREATOR' : '/xul/server/cat/volume_copy_creator.xul', + 'XUL_VOLUME_EDITOR' : '/xul/server/cat/volume_editor.xul', 'XUL_WORK_LOG' : '/xul/server/admin/work_log.xul', - 'XUL_Z3950_IMPORT' : '/xul/server/cat/z3950.xul', - 'TEST_HTML' : '/xul/server/main/test.html', - 'TEST_XUL' : '/xul/server/main/test.xul', + 'XUL_Z3950_IMPORT' : '/xul/server/cat/z3950.xul', + 'TEST_HTML' : '/xul/server/main/test.html', + 'TEST_XUL' : '/xul/server/main/test.xul', 'CONIFY' : '/conify/' + LOCALE + '/global', 'EG_WEB_BASE' : '/eg', 'XUL_LOCAL_ADMIN_BASE' : '/xul/server/admin', diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.js b/Open-ILS/xul/staff_client/chrome/content/main/main.js index cb992f4bba..27ef91dedd 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/main.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js @@ -6,34 +6,34 @@ var offlineStrings; var authStrings; function grant_perms(url) { - var perms = "UniversalXPConnect UniversalPreferencesWrite UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead UniversalFileRead"; - dump('Granting ' + perms + ' to ' + url + '\n'); - if (G.pref) { - G.pref.setCharPref("capability.principal.codebase.p0.granted", perms); - G.pref.setCharPref("capability.principal.codebase.p0.id", url); - G.pref.setCharPref("capability.principal.codebase.p1.granted", perms); - G.pref.setCharPref("capability.principal.codebase.p1.id", url.replace('http:','https:')); - G.pref.setBoolPref("dom.disable_open_during_load",false); - G.pref.setBoolPref("browser.popups.showPopupBlocker",false); - } + var perms = "UniversalXPConnect UniversalPreferencesWrite UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead UniversalFileRead"; + dump('Granting ' + perms + ' to ' + url + '\n'); + if (G.pref) { + G.pref.setCharPref("capability.principal.codebase.p0.granted", perms); + G.pref.setCharPref("capability.principal.codebase.p0.id", url); + G.pref.setCharPref("capability.principal.codebase.p1.granted", perms); + G.pref.setCharPref("capability.principal.codebase.p1.id", url.replace('http:','https:')); + G.pref.setBoolPref("dom.disable_open_during_load",false); + G.pref.setBoolPref("browser.popups.showPopupBlocker",false); + } } function clear_the_cache() { - try { - var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; - var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); - } catch(E) { - dump(E+'\n');alert(E); - } + try { + var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; + var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); + } catch(E) { + dump(E+'\n');alert(E); + } } function toOpenWindowByType(inType, uri) { /* for Venkman */ try { - var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"; - window.open(uri, "_blank", winopts); + var winopts = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"; + window.open(uri, "_blank", winopts); } catch(E) { alert(E); throw(E); } @@ -72,66 +72,66 @@ function start_js_shell() { }; function main_init() { - dump('entering main_init()\n'); - try { - clear_the_cache(); + dump('entering main_init()\n'); + try { + clear_the_cache(); - // Now we can safely load the strings without the cache getting wiped - offlineStrings = document.getElementById('offlineStrings'); - authStrings = document.getElementById('authStrings'); + // Now we can safely load the strings without the cache getting wiped + offlineStrings = document.getElementById('offlineStrings'); + authStrings = document.getElementById('authStrings'); - if (typeof JSAN == 'undefined') { - throw( - offlineStrings.getString('common.jsan.missing') - ); - } - ///////////////////////////////////////////////////////////////////////////// + if (typeof JSAN == 'undefined') { + throw( + offlineStrings.getString('common.jsan.missing') + ); + } + ///////////////////////////////////////////////////////////////////////////// - JSAN.errorLevel = "die"; // none, warn, or die - JSAN.addRepository('..'); + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); - //JSAN.use('test.test'); test.test.hello_world(); + //JSAN.use('test.test'); test.test.hello_world(); - var mw = self; - G = {}; + var mw = self; + G = {}; - G.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); + G.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); - JSAN.use('util.error'); - G.error = new util.error(); - G.error.sdump('D_ERROR', offlineStrings.getString('main.testing')); + JSAN.use('util.error'); + G.error = new util.error(); + G.error.sdump('D_ERROR', offlineStrings.getString('main.testing')); - JSAN.use('util.window'); - G.window = new util.window(); + JSAN.use('util.window'); + G.window = new util.window(); - JSAN.use('auth.controller'); - G.auth = new auth.controller( { 'window' : mw } ); + JSAN.use('auth.controller'); + G.auth = new auth.controller( { 'window' : mw } ); - JSAN.use('OpenILS.data'); - G.data = new OpenILS.data(); - G.data.on_error = G.auth.logoff; + JSAN.use('OpenILS.data'); + G.data = new OpenILS.data(); + G.data.on_error = G.auth.logoff; - JSAN.use('util.file'); - G.file = new util.file(); - try { - G.file.get('ws_info'); - G.ws_info = G.file.get_object(); G.file.close(); - } catch(E) { - G.ws_info = {}; - } - G.data.ws_info = G.ws_info; G.data.stash('ws_info'); + JSAN.use('util.file'); + G.file = new util.file(); + try { + G.file.get('ws_info'); + G.ws_info = G.file.get_object(); G.file.close(); + } catch(E) { + G.ws_info = {}; + } + G.data.ws_info = G.ws_info; G.data.stash('ws_info'); - G.auth.on_login = function() { + G.auth.on_login = function() { - var url = G.auth.controller.view.server_prompt.value || urls.remote; + var url = G.auth.controller.view.server_prompt.value || urls.remote; - G.data.server_unadorned = url; G.data.stash('server_unadorned'); G.data.stash_retrieve(); + G.data.server_unadorned = url; G.data.stash('server_unadorned'); G.data.stash_retrieve(); - if (! url.match( '^http://' ) ) { url = 'http://' + url; } + if (! url.match( '^http://' ) ) { url = 'http://' + url; } - G.data.server = url; G.data.stash('server'); - G.data.session = { 'key' : G.auth.session.key, 'auth' : G.auth.session.authtime }; G.data.stash('session'); - G.data.stash_retrieve(); + G.data.server = url; G.data.stash('server'); + G.data.session = { 'key' : G.auth.session.key, 'auth' : G.auth.session.authtime }; G.data.stash('session'); + G.data.stash_retrieve(); try { var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var cookieUri = ios.newURI("http://" + G.data.server_unadorned, null, null); @@ -147,199 +147,199 @@ function main_init() { alert(offlineStrings.getFormattedString(main.session_cookie.error, [E])); } - grant_perms(url); + grant_perms(url); - xulG = { - 'auth' : G.auth, - 'url' : url, - 'window' : G.window, + xulG = { + 'auth' : G.auth, + 'url' : url, + 'window' : G.window, 'data' : G.data, - 'pref' : G.pref - }; - - if (G.data.ws_info && G.data.ws_info[G.auth.controller.view.server_prompt.value]) { - JSAN.use('util.widgets'); - var deck = document.getElementById('progress_space'); - util.widgets.remove_children( deck ); - var iframe = document.createElement('iframe'); deck.appendChild(iframe); - iframe.setAttribute( 'src', url + '/xul/server/main/data.xul' ); - iframe.contentWindow.xulG = xulG; + 'pref' : G.pref + }; + + if (G.data.ws_info && G.data.ws_info[G.auth.controller.view.server_prompt.value]) { + JSAN.use('util.widgets'); + var deck = document.getElementById('progress_space'); + util.widgets.remove_children( deck ); + var iframe = document.createElement('iframe'); deck.appendChild(iframe); + iframe.setAttribute( 'src', url + '/xul/server/main/data.xul' ); + iframe.contentWindow.xulG = xulG; G.data_xul = iframe.contentWindow; - } else { - xulG.file = G.file; - var deck = G.auth.controller.view.ws_deck; - JSAN.use('util.widgets'); util.widgets.remove_children('ws_deck'); - var iframe = document.createElement('iframe'); deck.appendChild(iframe); - iframe.setAttribute( 'src', url + '/xul/server/main/ws_info.xul' ); - iframe.contentWindow.xulG = xulG; - deck.selectedIndex = deck.childNodes.length - 1; - } - }; - - G.auth.on_standalone = function() { - try { - G.window.open(urls.XUL_STANDALONE,'Offline','chrome,resizable'); - } catch(E) { - alert(E); - } - }; - - G.auth.on_standalone_export = function() { - try { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - if (file._file.exists()) { + } else { + xulG.file = G.file; + var deck = G.auth.controller.view.ws_deck; + JSAN.use('util.widgets'); util.widgets.remove_children('ws_deck'); + var iframe = document.createElement('iframe'); deck.appendChild(iframe); + iframe.setAttribute( 'src', url + '/xul/server/main/ws_info.xul' ); + iframe.contentWindow.xulG = xulG; + deck.selectedIndex = deck.childNodes.length - 1; + } + }; + + G.auth.on_standalone = function() { + try { + G.window.open(urls.XUL_STANDALONE,'Offline','chrome,resizable'); + } catch(E) { + alert(E); + } + }; + + G.auth.on_standalone_export = function() { + try { + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + if (file._file.exists()) { var file2 = new util.file(''); - var f = file2.pick_file( { 'mode' : 'save', 'title' : offlineStrings.getString('main.transaction_export.title') } ); - if (f) { - if (f.exists()) { - var r = G.error.yns_alert( - offlineStrings.getFormattedString('main.transaction_export.prompt', [f.leafName]), - offlineStrings.getString('main.transaction_export.prompt.title'), - offlineStrings.getString('common.yes'), - offlineStrings.getString('common.no'), - null, - offlineStrings.getString('common.confirm') - ); - if (r != 0) { file.close(); return; } - } - var e_file = new util.file(''); e_file._file = f; - e_file.write_content( 'truncate', file.get_content() ); - e_file.close(); - var r = G.error.yns_alert( - offlineStrings.getFormattedString('main.transaction_export.success.prompt', [f.leafName]), - offlineStrings.getString('main.transaction_export.success.title'), - offlineStrings.getString('common.yes'), - offlineStrings.getString('common.no'), - null, - offlineStrings.getString('common.confirm') - ); - if (r == 0) { - var count = 0; - var filename = 'pending_xacts_exported_' + new Date().getTime(); - var t_file = new util.file(filename); - while (t_file._file.exists()) { - filename = 'pending_xacts_' + new Date().getTime() + '.exported'; - t_file = new util.file(filename); - if (count++ > 100) { - throw(offlineStrings.getString('main.transaction_export.filename.error')); - } - } - file._file.moveTo(null,filename); - } else { - alert(offlineStrings.getString('main.transaction_export.duplicate.warning')); - } - } else { - alert(offlineStrings.getString('main.transaction_export.no_filename.error')); - } - } else { - alert(offlineStrings.getString('main.transaction_export.no_transactions.error')); - } - file.close(); - } catch(E) { - alert(E); - } - }; - - G.auth.on_standalone_import = function() { - try { - JSAN.use('util.file'); var file = new util.file('pending_xacts'); - if (file._file.exists()) { - alert(offlineStrings.getString('main.transaction_import.outstanding.error')); - } else { + var f = file2.pick_file( { 'mode' : 'save', 'title' : offlineStrings.getString('main.transaction_export.title') } ); + if (f) { + if (f.exists()) { + var r = G.error.yns_alert( + offlineStrings.getFormattedString('main.transaction_export.prompt', [f.leafName]), + offlineStrings.getString('main.transaction_export.prompt.title'), + offlineStrings.getString('common.yes'), + offlineStrings.getString('common.no'), + null, + offlineStrings.getString('common.confirm') + ); + if (r != 0) { file.close(); return; } + } + var e_file = new util.file(''); e_file._file = f; + e_file.write_content( 'truncate', file.get_content() ); + e_file.close(); + var r = G.error.yns_alert( + offlineStrings.getFormattedString('main.transaction_export.success.prompt', [f.leafName]), + offlineStrings.getString('main.transaction_export.success.title'), + offlineStrings.getString('common.yes'), + offlineStrings.getString('common.no'), + null, + offlineStrings.getString('common.confirm') + ); + if (r == 0) { + var count = 0; + var filename = 'pending_xacts_exported_' + new Date().getTime(); + var t_file = new util.file(filename); + while (t_file._file.exists()) { + filename = 'pending_xacts_' + new Date().getTime() + '.exported'; + t_file = new util.file(filename); + if (count++ > 100) { + throw(offlineStrings.getString('main.transaction_export.filename.error')); + } + } + file._file.moveTo(null,filename); + } else { + alert(offlineStrings.getString('main.transaction_export.duplicate.warning')); + } + } else { + alert(offlineStrings.getString('main.transaction_export.no_filename.error')); + } + } else { + alert(offlineStrings.getString('main.transaction_export.no_transactions.error')); + } + file.close(); + } catch(E) { + alert(E); + } + }; + + G.auth.on_standalone_import = function() { + try { + JSAN.use('util.file'); var file = new util.file('pending_xacts'); + if (file._file.exists()) { + alert(offlineStrings.getString('main.transaction_import.outstanding.error')); + } else { var file2 = new util.file(''); - var f = file2.pick_file( { 'mode' : 'open', 'title' : offlineStrings.getString('main.transaction_import.title')} ); - if (f && f.exists()) { - var i_file = new util.file(''); i_file._file = f; - file.write_content( 'truncate', i_file.get_content() ); - i_file.close(); - var r = G.error.yns_alert( - offlineStrings.getFormattedString('main.transaction_import.delete.prompt', [f.leafName]), - offlineStrings.getString('main.transaction_import.success'), - offlineStrings.getString('common.yes'), - offlineStrings.getString('common.no'), - null, - offlineStrings.getString('common.confirm') - ); - if (r == 0) { - f.remove(false); - } - } - } - file.close(); - } catch(E) { - alert(E); - } - }; - - G.auth.on_debug = function(action) { - switch(action) { - case 'js_console' : - G.window.open(urls.XUL_DEBUG_CONSOLE,'testconsole','chrome,resizable'); - break; - case 'clear_cache' : - clear_the_cache(); - alert(offlineStrings.getString('main.on_debug.clear_cache')); - break; - default: - alert(offlineStrings.getString('main.on_debug.debug')); - break; - } - }; - - G.auth.init(); - // XML_HTTP_SERVER will get reset to G.auth.controller.view.server_prompt.value - - ///////////////////////////////////////////////////////////////////////////// - - var version = '/xul/server/'.split(/\//)[2]; - if (version == 'server') { - version = 'versionless debug build'; - document.getElementById('debug_gb').hidden = false; - } + var f = file2.pick_file( { 'mode' : 'open', 'title' : offlineStrings.getString('main.transaction_import.title')} ); + if (f && f.exists()) { + var i_file = new util.file(''); i_file._file = f; + file.write_content( 'truncate', i_file.get_content() ); + i_file.close(); + var r = G.error.yns_alert( + offlineStrings.getFormattedString('main.transaction_import.delete.prompt', [f.leafName]), + offlineStrings.getString('main.transaction_import.success'), + offlineStrings.getString('common.yes'), + offlineStrings.getString('common.no'), + null, + offlineStrings.getString('common.confirm') + ); + if (r == 0) { + f.remove(false); + } + } + } + file.close(); + } catch(E) { + alert(E); + } + }; + + G.auth.on_debug = function(action) { + switch(action) { + case 'js_console' : + G.window.open(urls.XUL_DEBUG_CONSOLE,'testconsole','chrome,resizable'); + break; + case 'clear_cache' : + clear_the_cache(); + alert(offlineStrings.getString('main.on_debug.clear_cache')); + break; + default: + alert(offlineStrings.getString('main.on_debug.debug')); + break; + } + }; + + G.auth.init(); + // XML_HTTP_SERVER will get reset to G.auth.controller.view.server_prompt.value + + ///////////////////////////////////////////////////////////////////////////// + + var version = '/xul/server/'.split(/\//)[2]; + if (version == 'server') { + version = 'versionless debug build'; + document.getElementById('debug_gb').hidden = false; + } if (G.pref && G.pref.getBoolPref('open-ils.debug_options')) { - document.getElementById('debug_gb').hidden = false; + document.getElementById('debug_gb').hidden = false; } window.title = authStrings.getFormattedString('staff.auth.titlebar.label', version); - var x = document.getElementById('about_btn'); - x.addEventListener( - 'command', - function() { - try { - G.window.open('about.html','about','chrome,resizable,width=800,height=600'); - } catch(E) { alert(E); } - }, - false - ); - - var y = document.getElementById('new_window_btn'); - y.addEventListener( - 'command', - function() { - if (G.data.session) { - try { - //G.data_xul.g.open_menu(); + var x = document.getElementById('about_btn'); + x.addEventListener( + 'command', + function() { + try { + G.window.open('about.html','about','chrome,resizable,width=800,height=600'); + } catch(E) { alert(E); } + }, + false + ); + + var y = document.getElementById('new_window_btn'); + y.addEventListener( + 'command', + function() { + if (G.data.session) { + try { + //G.data_xul.g.open_menu(); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var mframe = xulG.window.open(( String(urls.XUL_MENU_FRAME).match(/^chrome:/) ? '' : G.data.server ) + urls.XUL_MENU_FRAME + '?server='+window.escape(G.data.server), 'main'+xulG.window.window_name_increment(),'chrome,resizable' ); mframe.xulG = xulG; - } catch(E) { alert(E); } - } else { - alert ( offlineStrings.getString('main.new_window_btn.login_first_warning') ); - } - }, - false - ); - - JSAN.use('util.mozilla'); - var z = document.getElementById('locale_menupopup'); - if (z) { - while (z.lastChild) z.removeChild(z.lastChild); - var locales = util.mozilla.chromeRegistry().getLocalesForPackage( String( location.href ).split(/\//)[2] ); - var current_locale = util.mozilla.prefs().getCharPref('general.useragent.locale'); + } catch(E) { alert(E); } + } else { + alert ( offlineStrings.getString('main.new_window_btn.login_first_warning') ); + } + }, + false + ); + + JSAN.use('util.mozilla'); + var z = document.getElementById('locale_menupopup'); + if (z) { + while (z.lastChild) z.removeChild(z.lastChild); + var locales = util.mozilla.chromeRegistry().getLocalesForPackage( String( location.href ).split(/\//)[2] ); + var current_locale = util.mozilla.prefs().getCharPref('general.useragent.locale'); while (locales.hasMore()) { var locale = locales.getNext(); var parts = locale.split(/-/); @@ -356,9 +356,9 @@ function main_init() { } catch(E) { label = locale; } - var mi = document.createElement('menuitem'); - mi.setAttribute('label',label); - mi.setAttribute('value',locale); + var mi = document.createElement('menuitem'); + mi.setAttribute('label',label); + mi.setAttribute('value',locale); if (locale == current_locale) { if (z.parentNode.tagName == 'menulist') { mi.setAttribute('selected','true'); @@ -368,82 +368,82 @@ function main_init() { } z.appendChild( mi ); } - } - var xx = document.getElementById('apply_locale_btn'); - xx.addEventListener( - 'command', - function() { - util.mozilla.change_locale(z.parentNode.value); - }, - false - ); - - if ( found_ws_info_in_Achrome() && G.pref && G.pref.getBoolPref("open-ils.write_in_user_chrome_directory") ) { - //var hbox = x.parentNode; var b = document.createElement('button'); - //b.setAttribute('label','Migrate legacy settings'); hbox.appendChild(b); - //b.addEventListener( - // 'command', - // function() { - // try { - // handle_migration(); - // } catch(E) { alert(E); } - // }, - // false - //); - if (window.confirm(offlineStrings.getString('main.settings.migrate'))) { - setTimeout( function() { handle_migration(); }, 0 ); - } - } - - } catch(E) { - var error = offlineStrings.getFormattedString('common.exception', [E, '']); - try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); } - alert(error); - } - dump('exiting main_init()\n'); + } + var xx = document.getElementById('apply_locale_btn'); + xx.addEventListener( + 'command', + function() { + util.mozilla.change_locale(z.parentNode.value); + }, + false + ); + + if ( found_ws_info_in_Achrome() && G.pref && G.pref.getBoolPref("open-ils.write_in_user_chrome_directory") ) { + //var hbox = x.parentNode; var b = document.createElement('button'); + //b.setAttribute('label','Migrate legacy settings'); hbox.appendChild(b); + //b.addEventListener( + // 'command', + // function() { + // try { + // handle_migration(); + // } catch(E) { alert(E); } + // }, + // false + //); + if (window.confirm(offlineStrings.getString('main.settings.migrate'))) { + setTimeout( function() { handle_migration(); }, 0 ); + } + } + + } catch(E) { + var error = offlineStrings.getFormattedString('common.exception', [E, '']); + try { G.error.sdump('D_ERROR',error); } catch(E) { dump(error); } + alert(error); + } + dump('exiting main_init()\n'); } function found_ws_info_in_Achrome() { - JSAN.use('util.file'); - var f = new util.file(); - var f_in_chrome = f.get('ws_info','chrome'); - var path = f_in_chrome.exists() ? f_in_chrome.path : false; - f.close(); - return path; + JSAN.use('util.file'); + var f = new util.file(); + var f_in_chrome = f.get('ws_info','chrome'); + var path = f_in_chrome.exists() ? f_in_chrome.path : false; + f.close(); + return path; } function found_ws_info_in_Uchrome() { - JSAN.use('util.file'); - var f = new util.file(); - var f_in_uchrome = f.get('ws_info','uchrome'); - var path = f_in_uchrome.exists() ? f_in_uchrome.path : false; - f.close(); - return path; + JSAN.use('util.file'); + var f = new util.file(); + var f_in_uchrome = f.get('ws_info','uchrome'); + var path = f_in_uchrome.exists() ? f_in_uchrome.path : false; + f.close(); + return path; } function handle_migration() { - if ( found_ws_info_in_Uchrome() ) { - alert(offlineStrings.getFormattedString('main.settings.migrate.failed', [found_ws_info_in_Uchrome(), found_ws_info_in_Achrome()]) - ); - } else { - var dirService = Components.classes["@mozilla.org/file/directory_service;1"].getService( Components.interfaces.nsIProperties ); - var f_new = dirService.get( "UChrm", Components.interfaces.nsIFile ); - var f_old = dirService.get( "AChrom", Components.interfaces.nsIFile ); - f_old.append(myPackageDir); f_old.append("content"); f_old.append("conf"); - if (window.confirm(offlineStrings.getFormattedString("main.settings.migrate.confirm", [f_old.path, f_new.path]))) { - var files = f_old.directoryEntries; - while (files.hasMoreElements()) { - var file = files.getNext(); - var file2 = file.QueryInterface( Components.interfaces.nsILocalFile ); - try { - file2.moveTo( f_new, '' ); - } catch(E) { - alert(offlineStrings.getFormattedString('main.settings.migrate.error', [file2.path, f_new.path]) + '\n'); - } - } - location.href = location.href; // huh? - } - } + if ( found_ws_info_in_Uchrome() ) { + alert(offlineStrings.getFormattedString('main.settings.migrate.failed', [found_ws_info_in_Uchrome(), found_ws_info_in_Achrome()]) + ); + } else { + var dirService = Components.classes["@mozilla.org/file/directory_service;1"].getService( Components.interfaces.nsIProperties ); + var f_new = dirService.get( "UChrm", Components.interfaces.nsIFile ); + var f_old = dirService.get( "AChrom", Components.interfaces.nsIFile ); + f_old.append(myPackageDir); f_old.append("content"); f_old.append("conf"); + if (window.confirm(offlineStrings.getFormattedString("main.settings.migrate.confirm", [f_old.path, f_new.path]))) { + var files = f_old.directoryEntries; + while (files.hasMoreElements()) { + var file = files.getNext(); + var file2 = file.QueryInterface( Components.interfaces.nsILocalFile ); + try { + file2.moveTo( f_new, '' ); + } catch(E) { + alert(offlineStrings.getFormattedString('main.settings.migrate.error', [file2.path, f_new.path]) + '\n'); + } + } + location.href = location.href; // huh? + } + } } dump('exiting main/main.js\n'); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 297c64ae62..56b64547df 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -8,10 +8,10 @@ main.menu = function () { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); offlineStrings = document.getElementById('offlineStrings'); - JSAN.use('util.error'); this.error = new util.error(); - JSAN.use('util.window'); this.window = new util.window(); + JSAN.use('util.error'); this.error = new util.error(); + JSAN.use('util.window'); this.window = new util.window(); - this.w = window; + this.w = window; var x = document.getElementById('network_progress'); x.setAttribute('count','0'); x.addEventListener( @@ -27,32 +27,32 @@ main.menu = function () { false ); - if (xulG.pref.getBoolPref('open-ils.disable_accesskeys_on_tabs')) { - var tabs = document.getElementById('main_tabs'); - for (var i = 0; i < tabs.childNodes.length; i++) { - tabs.childNodes[i].setAttribute('accesskey',''); - } - } + if (xulG.pref.getBoolPref('open-ils.disable_accesskeys_on_tabs')) { + var tabs = document.getElementById('main_tabs'); + for (var i = 0; i < tabs.childNodes.length; i++) { + tabs.childNodes[i].setAttribute('accesskey',''); + } + } } main.menu.prototype = { - 'id_incr' : 0, + 'id_incr' : 0, - 'url_prefix' : function(url) { - if (url.match(/^\//)) url = urls.remote + url; - if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url; - dump('url_prefix = ' + url + '\n'); - return url; - }, + 'url_prefix' : function(url) { + if (url.match(/^\//)) url = urls.remote + url; + if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url; + dump('url_prefix = ' + url + '\n'); + return url; + }, - 'init' : function( params ) { + 'init' : function( params ) { - urls.remote = params['server']; + urls.remote = params['server']; - var obj = this; + var obj = this; - JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'}); + JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'}); var button_bar = String( obj.data.hash.aous['ui.general.button_bar'] ) == 'true'; if (button_bar) { @@ -117,126 +117,126 @@ main.menu.prototype = { } - var cmd_map = { - 'cmd_broken' : [ - ['oncommand'], - function() { alert(offlineStrings.getString('common.unimplemented')); } - ], - - /* File Menu */ - 'cmd_close_window' : [ - ['oncommand'], - function() { window.close(); } - ], - 'cmd_new_window' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - var mframe = obj.window.open( - obj.url_prefix(urls.XUL_MENU_FRAME) - + '?server='+window.escape(urls.remote), - 'main' + obj.window.window_name_increment(), - 'chrome,resizable'); + var cmd_map = { + 'cmd_broken' : [ + ['oncommand'], + function() { alert(offlineStrings.getString('common.unimplemented')); } + ], + + /* File Menu */ + 'cmd_close_window' : [ + ['oncommand'], + function() { window.close(); } + ], + 'cmd_new_window' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + var mframe = obj.window.open( + obj.url_prefix(urls.XUL_MENU_FRAME) + + '?server='+window.escape(urls.remote), + 'main' + obj.window.window_name_increment(), + 'chrome,resizable'); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); mframe.xulG = xulG; - } - ], - 'cmd_new_tab' : [ - ['oncommand'], - function() { obj.new_tab(null,{'focus':true},null); } - ], - 'cmd_close_tab' : [ - ['oncommand'], - function() { obj.close_tab(); } - ], - 'cmd_close_all_tabs' : [ - ['oncommand'], - function() { obj.close_all_tabs(); } - ], - - /* Edit Menu */ - 'cmd_edit_copy_buckets' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_COPY_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_copy_buckets.tab')},{}); - } - ], - 'cmd_edit_volume_buckets' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_VOLUME_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_volume_buckets.tab')},{}); - } - ], - 'cmd_edit_record_buckets' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_RECORD_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_record_buckets.tab')},{}); - } - ], - 'cmd_edit_user_buckets' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_USER_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_user_buckets.tab')},{}); - } - ], - - - 'cmd_replace_barcode' : [ - ['oncommand'], - function() { - try { - JSAN.use('util.network'); - var network = new util.network(); - - var old_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.label')); - if (!old_bc) return; - - var copy; + } + ], + 'cmd_new_tab' : [ + ['oncommand'], + function() { obj.new_tab(null,{'focus':true},null); } + ], + 'cmd_close_tab' : [ + ['oncommand'], + function() { obj.close_tab(); } + ], + 'cmd_close_all_tabs' : [ + ['oncommand'], + function() { obj.close_all_tabs(); } + ], + + /* Edit Menu */ + 'cmd_edit_copy_buckets' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_COPY_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_copy_buckets.tab')},{}); + } + ], + 'cmd_edit_volume_buckets' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_VOLUME_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_volume_buckets.tab')},{}); + } + ], + 'cmd_edit_record_buckets' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_RECORD_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_record_buckets.tab')},{}); + } + ], + 'cmd_edit_user_buckets' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_USER_BUCKETS),{'tab_name':offlineStrings.getString('menu.cmd_edit_user_buckets.tab')},{}); + } + ], + + + 'cmd_replace_barcode' : [ + ['oncommand'], + function() { + try { + JSAN.use('util.network'); + var network = new util.network(); + + var old_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.label')); + if (!old_bc) return; + + var copy; try { copy = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ old_bc ]); - if (typeof copy.ilsevent != 'undefined') throw(copy); - if (!copy) throw(copy); + if (typeof copy.ilsevent != 'undefined') throw(copy); + if (!copy) throw(copy); } catch(E) { alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n'); return; } - - // Why did I want to do this twice? Because this copy is more fleshed? + + // Why did I want to do this twice? Because this copy is more fleshed? try { - copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]); - if (typeof copy.ilsevent != 'undefined') throw(copy); - if (!copy) throw(copy); + copy = network.simple_request('FM_ACP_RETRIEVE',[ copy.id() ]); + if (typeof copy.ilsevent != 'undefined') throw(copy); + if (!copy) throw(copy); } catch(E) { try { alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.retrieval.error', [old_bc]) + '\n' + (typeof E.ilsevent == 'undefined' ? '' : E.textcode + ' : ' + E.desc)); } catch(F) { alert(E + '\n' + F); } return; } - - var new_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.replacement.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.replacement.label')); - new_bc = String( new_bc ).replace(/\s/g,''); - /* Casting a possibly null input value to a String turns it into "null" */ - if (!new_bc || new_bc == 'null') { - alert(offlineStrings.getString('menu.cmd_replace_barcode.blank.error')); - return; - } - - var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]); - if (typeof test.ilsevent == 'undefined') { - alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.duplicate.error', [new_bc])); - return; - } else { - if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) { - obj.error.standard_unexpected_error_alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.testing.error', [new_bc]),test); - return; - } - } - - copy.barcode(new_bc); copy.ischanged('1'); - var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]); - if (typeof r.ilsevent != 'undefined') { + + var new_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.replacement.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.replacement.label')); + new_bc = String( new_bc ).replace(/\s/g,''); + /* Casting a possibly null input value to a String turns it into "null" */ + if (!new_bc || new_bc == 'null') { + alert(offlineStrings.getString('menu.cmd_replace_barcode.blank.error')); + return; + } + + var test = network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ new_bc ]); + if (typeof test.ilsevent == 'undefined') { + alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.duplicate.error', [new_bc])); + return; + } else { + if (test.ilsevent != 1502 /* ASSET_COPY_NOT_FOUND */) { + obj.error.standard_unexpected_error_alert(offlineStrings.getFormattedString('menu.cmd_replace_barcode.testing.error', [new_bc]),test); + return; + } + } + + copy.barcode(new_bc); copy.ischanged('1'); + var r = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), [ copy ] ]); + if (typeof r.ilsevent != 'undefined') { if (r.ilsevent != 0) { if (r.ilsevent == 5000 /* PERM_FAILURE */) { alert(offlineStrings.getString('menu.cmd_replace_barcode.permission.error')); @@ -245,231 +245,231 @@ main.menu.prototype = { } } } - } catch(E) { - obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.failure'),copy); - } - } - ], - - /* Search Menu */ - 'cmd_patron_search' : [ - ['oncommand'], - function() { + } catch(E) { + obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.cmd_replace_barcode.renaming.failure'),copy); + } + } + ], + + /* Search Menu */ + 'cmd_patron_search' : [ + ['oncommand'], + function() { obj.set_patron_tab(); - } - ], - 'cmd_search_opac' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - var content_params = { 'session' : ses(), 'authtime' : ses('authtime') }; - obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {'tab_name':offlineStrings.getString('menu.cmd_search_opac.tab')}, content_params); - } - ], - 'cmd_search_tcn' : [ - ['oncommand'], - function() { - var tcn = prompt(offlineStrings.getString('menu.cmd_search_tcn.tab'),'',offlineStrings.getString('menu.cmd_search_tcn.prompt')); - - function spawn_tcn(r) { - for (var i = 0; i < r.count; i++) { - var id = r.ids[i]; - var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + id; - obj.data.stash_retrieve(); - var content_params = { - 'session' : ses(), - 'authtime' : ses('authtime'), - 'opac_url' : opac_url, - }; - if (i == 0) { - obj.set_tab( - obj.url_prefix(urls.XUL_OPAC_WRAPPER), - {'tab_name':tcn}, - content_params - ); - } else { - obj.new_tab( - obj.url_prefix(urls.XUL_OPAC_WRAPPER), - {'tab_name':tcn}, - content_params - ); - } - } - } - - if (tcn) { - JSAN.use('util.network'); - var network = new util.network(); - var robj = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn]); - if (robj.count != robj.ids.length) throw('FIXME -- FM_BRE_ID_SEARCH_VIA_TCN = ' + js2JSON(robj)); - if (robj.count == 0) { - var robj2 = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn,1]); - if (robj2.count == 0) { - alert(offlineStrings.getFormattedString('menu.cmd_search_tcn.not_found.error', [tcn])); - } else { - if ( window.confirm(offlineStrings.getFormattedString('menu.cmd_search_tcn.deleted.error', [tcn])) ) { - spawn_tcn(robj2); - } - } - } else { - spawn_tcn(robj); - } - } - } - ], - 'cmd_search_bib_id' : [ - ['oncommand'], - function() { - var bib_id = prompt(offlineStrings.getString('menu.cmd_search_bib_id.tab'),'',offlineStrings.getString('menu.cmd_search_bib_id.prompt')); + } + ], + 'cmd_search_opac' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + var content_params = { 'session' : ses(), 'authtime' : ses('authtime') }; + obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {'tab_name':offlineStrings.getString('menu.cmd_search_opac.tab')}, content_params); + } + ], + 'cmd_search_tcn' : [ + ['oncommand'], + function() { + var tcn = prompt(offlineStrings.getString('menu.cmd_search_tcn.tab'),'',offlineStrings.getString('menu.cmd_search_tcn.prompt')); + + function spawn_tcn(r) { + for (var i = 0; i < r.count; i++) { + var id = r.ids[i]; + var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + id; + obj.data.stash_retrieve(); + var content_params = { + 'session' : ses(), + 'authtime' : ses('authtime'), + 'opac_url' : opac_url, + }; + if (i == 0) { + obj.set_tab( + obj.url_prefix(urls.XUL_OPAC_WRAPPER), + {'tab_name':tcn}, + content_params + ); + } else { + obj.new_tab( + obj.url_prefix(urls.XUL_OPAC_WRAPPER), + {'tab_name':tcn}, + content_params + ); + } + } + } + + if (tcn) { + JSAN.use('util.network'); + var network = new util.network(); + var robj = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn]); + if (robj.count != robj.ids.length) throw('FIXME -- FM_BRE_ID_SEARCH_VIA_TCN = ' + js2JSON(robj)); + if (robj.count == 0) { + var robj2 = network.simple_request('FM_BRE_ID_SEARCH_VIA_TCN',[tcn,1]); + if (robj2.count == 0) { + alert(offlineStrings.getFormattedString('menu.cmd_search_tcn.not_found.error', [tcn])); + } else { + if ( window.confirm(offlineStrings.getFormattedString('menu.cmd_search_tcn.deleted.error', [tcn])) ) { + spawn_tcn(robj2); + } + } + } else { + spawn_tcn(robj); + } + } + } + ], + 'cmd_search_bib_id' : [ + ['oncommand'], + function() { + var bib_id = prompt(offlineStrings.getString('menu.cmd_search_bib_id.tab'),'',offlineStrings.getString('menu.cmd_search_bib_id.prompt')); if (!bib_id) return; - var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + bib_id; - var content_params = { - 'session' : ses(), - 'authtime' : ses('authtime'), - 'opac_url' : opac_url, - }; - obj.set_tab( - obj.url_prefix(urls.XUL_OPAC_WRAPPER), - {'tab_name':'#' + bib_id}, - content_params - ); - } - ], - 'cmd_copy_status' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_COPY_STATUS),{},{}); - } - ], - - /* Circulation Menu */ - 'cmd_patron_register' : [ - ['oncommand'], - function() { - 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 = obj.url_prefix( urls.XUL_BROWSER ) + '?url=' + window.escape( obj.url_prefix(url) ); - obj.new_tab( - loc, - {}, - { - 'show_print_button' : true , - 'tab_name' : offline.getString('menu.cmd_patron_register.related.tab'), - 'passthru_content_params' : { - 'spawn_search' : function(s) { obj.spawn_search(s); }, - 'spawn_editor' : spawn_editor, - } - } - ); - } - - obj.data.stash_retrieve(); - var loc = obj.url_prefix( urls.XUL_BROWSER ) - + '?url=' + window.escape( obj.url_prefix(urls.XUL_PATRON_EDIT) + '?ses=' + window.escape( ses() ) ); - obj.set_tab( - loc, - {}, - { - 'show_print_button' : true , - 'tab_name' : offlineStrings.getString('menu.cmd_patron_register.tab'), - 'passthru_content_params' : { - 'spawn_search' : function(s) { obj.spawn_search(s); }, - 'spawn_editor' : spawn_editor, - } - } - ); - } - ], - 'cmd_circ_checkin' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN),{},{}); - } - ], - 'cmd_circ_renew' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_RENEW),{},{}); - } - ], - 'cmd_circ_checkout' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY),{},{}); - } - ], - 'cmd_circ_hold_capture' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN)+'?hold_capture=1',{},{}); - } - ], - 'cmd_browse_holds' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER),{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds.tab') },{}); - } - ], - 'cmd_browse_holds_shelf' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER)+'?shelf=1',{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds_shelf.tab') },{}); - } - ], - 'cmd_circ_hold_pull_list' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - var loc = urls.XUL_BROWSER + '?url=' + window.escape( - obj.url_prefix(urls.XUL_HOLD_PULL_LIST) + '?ses='+window.escape(ses()) - ); - obj.set_tab( loc, {'tab_name' : offlineStrings.getString('menu.cmd_browse_hold_pull_list.tab')}, { 'show_print_button' : true } ); - } - ], - - 'cmd_in_house_use' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_IN_HOUSE_USE),{},{}); - } - ], - - 'cmd_standalone' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_STANDALONE),{},{}); - } - ], - - 'cmd_local_admin' : [ - ['oncommand'], - function() { - //obj.set_tab(obj.url_prefix(urls.XUL_LOCAL_ADMIN)+'?ses='+window.escape(ses())+'&session='+window.escape(ses()),{},{}); - var loc = urls.XUL_BROWSER + '?url=' + window.escape( + var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + bib_id; + var content_params = { + 'session' : ses(), + 'authtime' : ses('authtime'), + 'opac_url' : opac_url, + }; + obj.set_tab( + obj.url_prefix(urls.XUL_OPAC_WRAPPER), + {'tab_name':'#' + bib_id}, + content_params + ); + } + ], + 'cmd_copy_status' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_COPY_STATUS),{},{}); + } + ], + + /* Circulation Menu */ + 'cmd_patron_register' : [ + ['oncommand'], + function() { + 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 = obj.url_prefix( urls.XUL_BROWSER ) + '?url=' + window.escape( obj.url_prefix(url) ); + obj.new_tab( + loc, + {}, + { + 'show_print_button' : true , + 'tab_name' : offline.getString('menu.cmd_patron_register.related.tab'), + 'passthru_content_params' : { + 'spawn_search' : function(s) { obj.spawn_search(s); }, + 'spawn_editor' : spawn_editor, + } + } + ); + } + + obj.data.stash_retrieve(); + var loc = obj.url_prefix( urls.XUL_BROWSER ) + + '?url=' + window.escape( obj.url_prefix(urls.XUL_PATRON_EDIT) + '?ses=' + window.escape( ses() ) ); + obj.set_tab( + loc, + {}, + { + 'show_print_button' : true , + 'tab_name' : offlineStrings.getString('menu.cmd_patron_register.tab'), + 'passthru_content_params' : { + 'spawn_search' : function(s) { obj.spawn_search(s); }, + 'spawn_editor' : spawn_editor, + } + } + ); + } + ], + 'cmd_circ_checkin' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN),{},{}); + } + ], + 'cmd_circ_renew' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_RENEW),{},{}); + } + ], + 'cmd_circ_checkout' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY),{},{}); + } + ], + 'cmd_circ_hold_capture' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN)+'?hold_capture=1',{},{}); + } + ], + 'cmd_browse_holds' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER),{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds.tab') },{}); + } + ], + 'cmd_browse_holds_shelf' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_HOLDS_BROWSER)+'?shelf=1',{ 'tab_name' : offlineStrings.getString('menu.cmd_browse_holds_shelf.tab') },{}); + } + ], + 'cmd_circ_hold_pull_list' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + var loc = urls.XUL_BROWSER + '?url=' + window.escape( + obj.url_prefix(urls.XUL_HOLD_PULL_LIST) + '?ses='+window.escape(ses()) + ); + obj.set_tab( loc, {'tab_name' : offlineStrings.getString('menu.cmd_browse_hold_pull_list.tab')}, { 'show_print_button' : true } ); + } + ], + + 'cmd_in_house_use' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_IN_HOUSE_USE),{},{}); + } + ], + + 'cmd_standalone' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_STANDALONE),{},{}); + } + ], + + 'cmd_local_admin' : [ + ['oncommand'], + function() { + //obj.set_tab(obj.url_prefix(urls.XUL_LOCAL_ADMIN)+'?ses='+window.escape(ses())+'&session='+window.escape(ses()),{},{}); + var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix( urls.XUL_LOCAL_ADMIN+'?ses='+window.escape(ses())+'&session='+window.escape(ses()) ) - ); - obj.set_tab( - loc, - {'tab_name' : offlineStrings.getString('menu.cmd_local_admin.tab'), 'browser' : false }, - { 'no_xulG' : false, 'show_nav_buttons' : true, 'show_print_button' : true } - ); + ); + obj.set_tab( + loc, + {'tab_name' : offlineStrings.getString('menu.cmd_local_admin.tab'), 'browser' : false }, + { 'no_xulG' : false, 'show_nav_buttons' : true, 'show_print_button' : true } + ); - } - ], + } + ], 'cmd_toggle_buttonbar' : [ ['oncommand'], @@ -479,21 +479,21 @@ main.menu.prototype = { } ], - 'cmd_local_admin_reports' : [ - ['oncommand'], - function() { - var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.XUL_REPORTS) + '?ses=' + ses()); - obj.set_tab( - loc, - {'tab_name' : offlineStrings.getString('menu.cmd_local_admin_reports.tab'), 'browser' : false }, - {'no_xulG' : false, 'show_print_button' : false, show_nav_buttons : true } - ); - } - ], - 'cmd_open_vandelay' : [ - ['oncommand'], + 'cmd_local_admin_reports' : [ + ['oncommand'], + function() { + var loc = urls.XUL_BROWSER + '?url=' + window.escape( obj.url_prefix(urls.XUL_REPORTS) + '?ses=' + ses()); + obj.set_tab( + loc, + {'tab_name' : offlineStrings.getString('menu.cmd_local_admin_reports.tab'), 'browser' : false }, + {'no_xulG' : false, 'show_print_button' : false, show_nav_buttons : true } + ); + } + ], + 'cmd_open_vandelay' : [ + ['oncommand'], function() { open_eg_web_page('vandelay/vandelay'); } - ], + ], 'cmd_local_admin_transit_list' : [ ['oncommand'], function() { open_admin_page('transit_list.xul', 'menu.cmd_local_admin_transit_list.tab'); } @@ -610,526 +610,526 @@ main.menu.prototype = { ['oncommand'], function() { open_eg_web_page('conify/global/config/org_unit_setting_type'); } ], - 'cmd_acq_view_picklist' : [ - ['oncommand'], - function() { open_eg_web_page('acq/picklist/list', 'menu.cmd_acq_view_picklist.tab'); } - ], - 'cmd_acq_view_po' : [ - ['oncommand'], - function() { open_eg_web_page('acq/po/search', 'menu.cmd_acq_view_po.tab'); } - ], - 'cmd_acq_upload' : [ - ['oncommand'], - function() { open_eg_web_page('acq/picklist/upload', 'menu.cmd_acq_upload.tab'); } - ], - 'cmd_acq_bib_search' : [ - ['oncommand'], - function() { open_eg_web_page('acq/picklist/bib_search', 'menu.cmd_acq_bib_search.tab'); } - ], - 'cmd_acq_new_brief_record' : [ - ['oncommand'], - function() { open_eg_web_page('acq/picklist/brief_record', 'menu.cmd_acq_new_brief_record.tab'); } - ], + 'cmd_acq_view_picklist' : [ + ['oncommand'], + function() { open_eg_web_page('acq/picklist/list', 'menu.cmd_acq_view_picklist.tab'); } + ], + 'cmd_acq_view_po' : [ + ['oncommand'], + function() { open_eg_web_page('acq/po/search', 'menu.cmd_acq_view_po.tab'); } + ], + 'cmd_acq_upload' : [ + ['oncommand'], + function() { open_eg_web_page('acq/picklist/upload', 'menu.cmd_acq_upload.tab'); } + ], + 'cmd_acq_bib_search' : [ + ['oncommand'], + function() { open_eg_web_page('acq/picklist/bib_search', 'menu.cmd_acq_bib_search.tab'); } + ], + 'cmd_acq_new_brief_record' : [ + ['oncommand'], + function() { open_eg_web_page('acq/picklist/brief_record', 'menu.cmd_acq_new_brief_record.tab'); } + ], 'cmd_acq_view_fund' : [ - ['oncommand'], - function() { open_eg_web_page('acq/fund/list', 'menu.cmd_acq_view_fund.tab'); } - ], + ['oncommand'], + function() { open_eg_web_page('acq/fund/list', 'menu.cmd_acq_view_fund.tab'); } + ], 'cmd_acq_view_funding_source' : [ - ['oncommand'], - function() { open_eg_web_page('acq/funding_source/list', 'menu.cmd_acq_view_funding_source.tab'); } - ], + ['oncommand'], + function() { open_eg_web_page('acq/funding_source/list', 'menu.cmd_acq_view_funding_source.tab'); } + ], 'cmd_acq_view_provider' : [ - ['oncommand'], - function() { open_eg_web_page('conify/global/acq/provider', 'menu.cmd_acq_view_provider.tab'); } - ], + ['oncommand'], + function() { open_eg_web_page('conify/global/acq/provider', 'menu.cmd_acq_view_provider.tab'); } + ], 'cmd_acq_view_currency_type' : [ - ['oncommand'], - function() { open_eg_web_page('acq/currency_type/list', 'menu.cmd_acq_view_currency_type.tab'); } - ], + ['oncommand'], + function() { open_eg_web_page('acq/currency_type/list', 'menu.cmd_acq_view_currency_type.tab'); } + ], 'cmd_acq_view_exchange_rate' : [ - ['oncommand'], - function() { open_eg_web_page('conify/global/acq/exchange_rate', 'menu.cmd_acq_view_exchange_rate.tab'); } - ], + ['oncommand'], + function() { open_eg_web_page('conify/global/acq/exchange_rate', 'menu.cmd_acq_view_exchange_rate.tab'); } + ], 'cmd_acq_view_distrib_formula' : [ - ['oncommand'], - function() { open_eg_web_page('conify/global/acq/distribution_formula', 'menu.cmd_acq_view_distrib_formula.tab'); } - ], - - 'cmd_reprint' : [ - ['oncommand'], - function() { - try { - JSAN.use('util.print'); var print = new util.print(); - print.reprint_last(); - } catch(E) { - alert(E); - } - } - ], - - 'cmd_retrieve_last_patron' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - if (!obj.data.last_patron) { - alert(offlineStrings.getString('menu.cmd_retrieve_last_patron.session.error')); - return; - } + ['oncommand'], + function() { open_eg_web_page('conify/global/acq/distribution_formula', 'menu.cmd_acq_view_distrib_formula.tab'); } + ], + + 'cmd_reprint' : [ + ['oncommand'], + function() { + try { + JSAN.use('util.print'); var print = new util.print(); + print.reprint_last(); + } catch(E) { + alert(E); + } + } + ], + + 'cmd_retrieve_last_patron' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + if (!obj.data.last_patron) { + alert(offlineStrings.getString('menu.cmd_retrieve_last_patron.session.error')); + return; + } var horizontal_interface = String( obj.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true'; var url = obj.url_prefix( horizontal_interface ? urls.XUL_PATRON_HORIZ_DISPLAY : urls.XUL_PATRON_DISPLAY ); - obj.set_tab( url, {}, { 'id' : obj.data.last_patron } ); - } - ], - - 'cmd_retrieve_last_record' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - if (!obj.data.last_record) { - alert(offlineStrings.getString('menu.cmd_retrieve_last_record.session.error')); - return; - } - var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + obj.data.last_record; - var content_params = { - 'session' : ses(), - 'authtime' : ses('authtime'), - 'opac_url' : opac_url, - }; - obj.set_tab( - obj.url_prefix(urls.XUL_OPAC_WRAPPER), - {'tab_name' : offlineStrings.getString('menu.cmd_retrieve_last_record.status')}, - content_params - ); - } - ], + obj.set_tab( url, {}, { 'id' : obj.data.last_patron } ); + } + ], + + 'cmd_retrieve_last_record' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + if (!obj.data.last_record) { + alert(offlineStrings.getString('menu.cmd_retrieve_last_record.session.error')); + return; + } + var opac_url = obj.url_prefix( urls.opac_rdetail ) + '?r=' + obj.data.last_record; + var content_params = { + 'session' : ses(), + 'authtime' : ses('authtime'), + 'opac_url' : opac_url, + }; + obj.set_tab( + obj.url_prefix(urls.XUL_OPAC_WRAPPER), + {'tab_name' : offlineStrings.getString('menu.cmd_retrieve_last_record.status')}, + content_params + ); + } + ], 'cmd_verify_credentials' : [ ['oncommand'], function() { - obj.set_tab( - obj.url_prefix(urls.XUL_VERIFY_CREDENTIALS), - { 'tab_name' : offlineStrings.getString('menu.cmd_verify_credentials.tabname') }, - {} - ); + obj.set_tab( + obj.url_prefix(urls.XUL_VERIFY_CREDENTIALS), + { 'tab_name' : offlineStrings.getString('menu.cmd_verify_credentials.tabname') }, + {} + ); + } + ], + + /* Cataloging Menu */ + 'cmd_z39_50_import' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_Z3950_IMPORT),{},{}); + } + ], + 'cmd_create_marc' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_MARC_NEW),{},{}); } ], - /* Cataloging Menu */ - 'cmd_z39_50_import' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_Z3950_IMPORT),{},{}); - } - ], - 'cmd_create_marc' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_MARC_NEW),{},{}); - } - ], - - /* Admin menu */ - 'cmd_change_session' : [ - ['oncommand'], - function() { - try { - obj.data.stash_retrieve(); - JSAN.use('util.network'); var network = new util.network(); - var x = document.getElementById('oc_menuitem'); - var x_label = x.getAttribute('label_orig'); - var temp_au = js2JSON( obj.data.list.au[0] ); - var temp_ses = js2JSON( obj.data.session ); - if (obj.data.list.au.length > 1) { - obj.data.list.au = [ obj.data.list.au[1] ]; - obj.data.stash('list'); - network.reset_titlebars( obj.data ); - x.setAttribute('label', x_label ); - network.simple_request('AUTH_DELETE', [ obj.data.session.key ] ); - obj.data.session = obj.data.previous_session; - obj.data.stash('session'); - try { + /* Admin menu */ + 'cmd_change_session' : [ + ['oncommand'], + function() { + try { + obj.data.stash_retrieve(); + JSAN.use('util.network'); var network = new util.network(); + var x = document.getElementById('oc_menuitem'); + var x_label = x.getAttribute('label_orig'); + var temp_au = js2JSON( obj.data.list.au[0] ); + var temp_ses = js2JSON( obj.data.session ); + if (obj.data.list.au.length > 1) { + obj.data.list.au = [ obj.data.list.au[1] ]; + obj.data.stash('list'); + network.reset_titlebars( obj.data ); + x.setAttribute('label', x_label ); + network.simple_request('AUTH_DELETE', [ obj.data.session.key ] ); + obj.data.session = obj.data.previous_session; + obj.data.stash('session'); + try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); - var cookieUri = ios.newURI("http://" + obj.data.server_unadorned, null, null); - var cookieUriSSL = ios.newURI("https://" + obj.data.server_unadorned, null, null); - var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService); - - cookieSvc.setCookieString(cookieUri, null, "ses="+obj.data.session.key, null); - cookieSvc.setCookieString(cookieUriSSL, null, "ses="+obj.data.session.key, null); - - } catch(E) { - alert(offlineStrings.getFormattedString(main.session_cookie.error, [E])); - } - - removeCSSClass(document.getElementById('main_tabbox'),'operator_change'); - } else { - if (network.get_new_session(offlineStrings.getString('menu.cmd_chg_session.label'),{'url_prefix':obj.url_prefix})) { - obj.data.stash_retrieve(); - obj.data.list.au[1] = JSON2js( temp_au ); - obj.data.stash('list'); - obj.data.previous_session = JSON2js( temp_ses ); - obj.data.stash('previous_session'); - x.setAttribute('label', offlineStrings.getFormattedString('menu.cmd_chg_session.operator.label', [obj.data.list.au[1].usrname()]) ); - addCSSClass(document.getElementById('main_tabbox'),'operator_change'); - } - } - } catch(E) { - obj.error.standard_unexpected_error_alert('cmd_change_session',E); - } - } - ], - 'cmd_manage_offline_xacts' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS), {'tab_name' : offlineStrings.getString('menu.cmd_manage_offline_xacts.tab')}, {}); - } - ], - 'cmd_download_patrons' : [ - ['oncommand'], - function() { - try { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var x = new XMLHttpRequest(); - var url = 'http://' + XML_HTTP_SERVER + '/standalone/list.txt'; - x.open("GET",url,false); - x.send(null); - if (x.status == 200) { - JSAN.use('util.file'); var file = new util.file('offline_patron_list'); - file.write_content('truncate',x.responseText); - file.close(); - file = new util.file('offline_patron_list.date'); - file.write_content('truncate',new Date()); - file.close(); - alert(offlineStrings.getString('menu.cmd_download_patrons.complete.status')); - } else { - alert(offlineStrings.getFormattedString('menu.cmd_download_patrons.error', [x.status, x.statusText])); - } - } catch(E) { - obj.error.standard_unexpected_error_alert('cmd_download_patrons',E); - } - } - ], - 'cmd_adv_user_edit' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY), {}, { 'perm_editor' : true }); - } - ], - 'cmd_print_list_template_edit' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_PRINT_LIST_TEMPLATE_EDITOR), {}, {}); - } - ], - 'cmd_stat_cat_edit' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_STAT_CAT_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_stat_cat_edit.tab')},{}); - } - ], - 'cmd_non_cat_type_edit' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_NON_CAT_LABEL_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_non_cat_type_edit.tab')},{}); - } - ], - 'cmd_copy_location_edit' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.XUL_COPY_LOCATION_EDIT) + '?ses='+window.escape(ses()),{'tab_name' : offlineStrings.getString('menu.cmd_copy_location_edit.tab')},{}); - } - ], - 'cmd_test' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - var content_params = { 'session' : ses(), 'authtime' : ses('authtime') }; - obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params); - } - ], - 'cmd_test_html' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.TEST_HTML) + '?ses='+window.escape(ses()),{ 'browser' : true },{}); - } - ], - 'cmd_test_xul' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - obj.set_tab(obj.url_prefix(urls.TEST_XUL) + '?ses='+window.escape(ses()),{ 'browser' : false },{}); - } - ], - 'cmd_console' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_CONSOLE),{'tab_name' : offlineStrings.getString('menu.cmd_console.tab')},{}); - } - ], - 'cmd_shell' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_SHELL),{'tab_name' : offlineStrings.getString('menu.cmd_shell.tab')},{}); - } - ], - 'cmd_xuleditor' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_XULEDITOR),{'tab_name' : offlineStrings.getString('menu.cmd_xuleditor.tab')},{}); - } - ], - 'cmd_fieldmapper' : [ - ['oncommand'], - function() { - obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{'tab_name' : offlineStrings.getString('menu.cmd_fieldmapper.tab')},{}); - } - ], - 'cmd_survey_wizard' : [ - ['oncommand'], - function() { - obj.data.stash_retrieve(); - xulG.window.open(obj.url_prefix(urls.XUL_SURVEY_WIZARD),'survey_wizard','chrome'); - } - ], - 'cmd_public_opac' : [ - ['oncommand'], - function() { - var loc = urls.XUL_BROWSER + '?url=' + window.escape( - obj.url_prefix(urls.remote) - ); - obj.set_tab( - loc, - {'tab_name' : offlineStrings.getString('menu.cmd_public_opac.tab'), 'browser' : false}, - { 'no_xulG' : true, 'show_nav_buttons' : true, 'show_print_button' : true } - ); - } - ], - 'cmd_clear_cache' : [ - ['oncommand'], - function clear_the_cache() { - try { + var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); + var cookieUri = ios.newURI("http://" + obj.data.server_unadorned, null, null); + var cookieUriSSL = ios.newURI("https://" + obj.data.server_unadorned, null, null); + var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService); + + cookieSvc.setCookieString(cookieUri, null, "ses="+obj.data.session.key, null); + cookieSvc.setCookieString(cookieUriSSL, null, "ses="+obj.data.session.key, null); + + } catch(E) { + alert(offlineStrings.getFormattedString(main.session_cookie.error, [E])); + } + + removeCSSClass(document.getElementById('main_tabbox'),'operator_change'); + } else { + if (network.get_new_session(offlineStrings.getString('menu.cmd_chg_session.label'),{'url_prefix':obj.url_prefix})) { + obj.data.stash_retrieve(); + obj.data.list.au[1] = JSON2js( temp_au ); + obj.data.stash('list'); + obj.data.previous_session = JSON2js( temp_ses ); + obj.data.stash('previous_session'); + x.setAttribute('label', offlineStrings.getFormattedString('menu.cmd_chg_session.operator.label', [obj.data.list.au[1].usrname()]) ); + addCSSClass(document.getElementById('main_tabbox'),'operator_change'); + } + } + } catch(E) { + obj.error.standard_unexpected_error_alert('cmd_change_session',E); + } + } + ], + 'cmd_manage_offline_xacts' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS), {'tab_name' : offlineStrings.getString('menu.cmd_manage_offline_xacts.tab')}, {}); + } + ], + 'cmd_download_patrons' : [ + ['oncommand'], + function() { + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var x = new XMLHttpRequest(); + var url = 'http://' + XML_HTTP_SERVER + '/standalone/list.txt'; + x.open("GET",url,false); + x.send(null); + if (x.status == 200) { + JSAN.use('util.file'); var file = new util.file('offline_patron_list'); + file.write_content('truncate',x.responseText); + file.close(); + file = new util.file('offline_patron_list.date'); + file.write_content('truncate',new Date()); + file.close(); + alert(offlineStrings.getString('menu.cmd_download_patrons.complete.status')); + } else { + alert(offlineStrings.getFormattedString('menu.cmd_download_patrons.error', [x.status, x.statusText])); + } + } catch(E) { + obj.error.standard_unexpected_error_alert('cmd_download_patrons',E); + } + } + ], + 'cmd_adv_user_edit' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY), {}, { 'perm_editor' : true }); + } + ], + 'cmd_print_list_template_edit' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_PRINT_LIST_TEMPLATE_EDITOR), {}, {}); + } + ], + 'cmd_stat_cat_edit' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_STAT_CAT_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_stat_cat_edit.tab')},{}); + } + ], + 'cmd_non_cat_type_edit' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_NON_CAT_LABEL_EDIT) + '?ses='+window.escape(ses()), {'tab_name' : offlineStrings.getString('menu.cmd_non_cat_type_edit.tab')},{}); + } + ], + 'cmd_copy_location_edit' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_COPY_LOCATION_EDIT) + '?ses='+window.escape(ses()),{'tab_name' : offlineStrings.getString('menu.cmd_copy_location_edit.tab')},{}); + } + ], + 'cmd_test' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + var content_params = { 'session' : ses(), 'authtime' : ses('authtime') }; + obj.set_tab(obj.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params); + } + ], + 'cmd_test_html' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.TEST_HTML) + '?ses='+window.escape(ses()),{ 'browser' : true },{}); + } + ], + 'cmd_test_xul' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.TEST_XUL) + '?ses='+window.escape(ses()),{ 'browser' : false },{}); + } + ], + 'cmd_console' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_CONSOLE),{'tab_name' : offlineStrings.getString('menu.cmd_console.tab')},{}); + } + ], + 'cmd_shell' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_SHELL),{'tab_name' : offlineStrings.getString('menu.cmd_shell.tab')},{}); + } + ], + 'cmd_xuleditor' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_XULEDITOR),{'tab_name' : offlineStrings.getString('menu.cmd_xuleditor.tab')},{}); + } + ], + 'cmd_fieldmapper' : [ + ['oncommand'], + function() { + obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{'tab_name' : offlineStrings.getString('menu.cmd_fieldmapper.tab')},{}); + } + ], + 'cmd_survey_wizard' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + xulG.window.open(obj.url_prefix(urls.XUL_SURVEY_WIZARD),'survey_wizard','chrome'); + } + ], + 'cmd_public_opac' : [ + ['oncommand'], + function() { + var loc = urls.XUL_BROWSER + '?url=' + window.escape( + obj.url_prefix(urls.remote) + ); + obj.set_tab( + loc, + {'tab_name' : offlineStrings.getString('menu.cmd_public_opac.tab'), 'browser' : false}, + { 'no_xulG' : true, 'show_nav_buttons' : true, 'show_print_button' : true } + ); + } + ], + 'cmd_clear_cache' : [ + ['oncommand'], + function clear_the_cache() { + try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; - var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); - cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); - } catch(E) { - dump(E+'\n');alert(E); - } - } - ], - 'cmd_restore_all_tabs' : [ - ['oncommand'], - function() { - var tabs = obj.controller.view.tabs; - for (var i = 0; i < tabs.childNodes.length; i++) { - tabs.childNodes[i].hidden = false; - } - } - ], - 'cmd_extension_manager' : [ - ['oncommand'], - function() { - obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=extensions',{'tab_name' : offlineStrings.getString('menu.cmd_extension_manager.tab')},{}); - } - ], - 'cmd_theme_manager' : [ - ['oncommand'], - function() { - obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=themes',{'tab_name' : offlineStrings.getString('menu.cmd_theme_manager.tab')},{}); - } - ], - 'cmd_about_config' : [ - ['oncommand'], - function() { - obj.set_tab('chrome://global/content/config.xul',{'tab_name' : 'about:config'},{}); - } - ], - 'cmd_shutdown' : [ - ['oncommand'], - function() { - if (window.confirm(offlineStrings.getString('menu.cmd_shutdown.prompt'))) { + var cacheClass = Components.classes["@mozilla.org/network/cache-service;1"]; + var cacheService = cacheClass.getService(Components.interfaces.nsICacheService); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_ON_DISK); + cacheService.evictEntries(Components.interfaces.nsICache.STORE_IN_MEMORY); + } catch(E) { + dump(E+'\n');alert(E); + } + } + ], + 'cmd_restore_all_tabs' : [ + ['oncommand'], + function() { + var tabs = obj.controller.view.tabs; + for (var i = 0; i < tabs.childNodes.length; i++) { + tabs.childNodes[i].hidden = false; + } + } + ], + 'cmd_extension_manager' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=extensions',{'tab_name' : offlineStrings.getString('menu.cmd_extension_manager.tab')},{}); + } + ], + 'cmd_theme_manager' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://mozapps/content/extensions/extensions.xul?type=themes',{'tab_name' : offlineStrings.getString('menu.cmd_theme_manager.tab')},{}); + } + ], + 'cmd_about_config' : [ + ['oncommand'], + function() { + obj.set_tab('chrome://global/content/config.xul',{'tab_name' : 'about:config'},{}); + } + ], + 'cmd_shutdown' : [ + ['oncommand'], + function() { + if (window.confirm(offlineStrings.getString('menu.cmd_shutdown.prompt'))) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(); - var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); - var enumerator = windowManagerInterface.getEnumerator(null); - var w; // close all other windows - while ( w = enumerator.getNext() ) { - if (w != window) w.close(); - } - window.close(); - } - } - ], - - }; - - JSAN.use('util.controller'); - var cmd; - obj.controller = new util.controller(); - obj.controller.init( { 'window_knows_me_by' : 'g.menu.controller', 'control_map' : cmd_map } ); - - obj.controller.view.tabbox = window.document.getElementById('main_tabbox'); - obj.controller.view.tabs = obj.controller.view.tabbox.firstChild; - obj.controller.view.panels = obj.controller.view.tabbox.lastChild; - - obj.new_tab(null,{'focus':true},null); - - obj.init_tab_focus_handlers(); - }, - - 'spawn_search' : function(s) { - var obj = this; - obj.error.sdump('D_TRACE', offlineStrings.getFormattedString('menu.spawn_search.msg', [js2JSON(s)]) ); - obj.data.stash_retrieve(); - var loc = obj.url_prefix(urls.XUL_PATRON_DISPLAY); - loc += '?doit=1&query=' + window.escape(js2JSON(s)); - obj.new_tab( loc, {}, {} ); - }, - - 'init_tab_focus_handlers' : function() { - var obj = this; - for (var i = 0; i < obj.controller.view.tabs.childNodes.length; i++) { - var tab = obj.controller.view.tabs.childNodes[i]; - var panel = obj.controller.view.panels.childNodes[i]; - tab.addEventListener( - 'command', - function(p) { - return function() { - try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - if (p - && p.firstChild - && ( p.firstChild.nodeName == 'iframe' || p.firstChild.nodeName == 'browser' ) - && p.firstChild.contentWindow - ) { - if (typeof p.firstChild.contentWindow.default_focus == 'function') { - p.firstChild.contentWindow.default_focus(); - } else { - //p.firstChild.contentWindow.firstChild.focus(); - } - } - } catch(E) { - obj.error.sdump('D_ERROR','init_tab_focus_handler: ' + js2JSON(E)); - } - } - }(panel), - false - ); - } - }, - - 'close_all_tabs' : function() { - var obj = this; - try { - var count = obj.controller.view.tabs.childNodes.length; - for (var i = 0; i < count; i++) obj.close_tab(); - setTimeout( function(){ obj.controller.view.tabs.firstChild.focus(); }, 0); - } catch(E) { - obj.error.standard_unexpected_error_alert(offlineStrings.getString('menu.close_all_tabs.error'),E); - } - }, - - 'close_tab' : function () { - var idx = this.controller.view.tabs.selectedIndex; - var tab = this.controller.view.tabs.childNodes[idx]; - var panel = this.controller.view.panels.childNodes[ idx ]; - while ( panel.lastChild ) panel.removeChild( panel.lastChild ); - if (idx == 0) { - try { - this.controller.view.tabs.advanceSelectedTab(+1); - } catch(E) { - this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(+1):'+js2JSON(E) + '\n'); - try { - this.controller.view.tabs.advanceSelectedTab(-1); - } catch(E) { - this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(-1):'+ - js2JSON(E) + '\n'); - } - } - } else { - try { - this.controller.view.tabs.advanceSelectedTab(-1); - } catch(E) { - this.error.sdump('D_TAB','failed tabs.advanceSelectedTab(-1):'+js2JSON(E) + '\n'); - try { - this.controller.view.tabs.advanceSelectedTab(+1); - } catch(E) { - this.error.sdump('D_TAB','failed again tabs.advanceSelectedTab(+1):'+ - js2JSON(E) + '\n'); - } - } - - } - - this.error.sdump('D_TAB','\tnew tabbox.selectedIndex = ' + this.controller.view.tabbox.selectedIndex + '\n'); - - this.controller.view.tabs.childNodes[ idx ].hidden = true; - this.error.sdump('D_TAB','tabs.childNodes[ ' + idx + ' ].hidden = true;\n'); - - // Make sure we keep at least one tab open. - var tab_flag = true; - for (var i = 0; i < this.controller.view.tabs.childNodes.length; i++) { - var tab = this.controller.view.tabs.childNodes[i]; - if (!tab.hidden) - tab_flag = false; - } - if (tab_flag) { - this.controller.view.tabs.selectedIndex = 0; - this.new_tab(); - } - }, - - 'find_free_tab' : function() { - var last_not_hidden = -1; - for (var i = 0; i