From: phasefx Date: Mon, 16 Nov 2009 22:41:54 +0000 (+0000) Subject: First cut at an interface to list "staged" users by org unit. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7bc0aa55f86c6e5f88034476c761169fd6d49323;p=evergreen%2Fmasslnc.git First cut at an interface to list "staged" users by org unit. APROPOS: "Ability to have online card applications entered directly into system, with approval and checking done by staff before account is activated" TODO: * Wire up Load patron to spawn the existing patron editor interface * See if there is a Cancel staged patron method we want to call from here * Add an org unit selector instead of using the workstation ou * Support paging or a Fetch More button or something similar (the list retrieval method has offset/limit parameters) git-svn-id: svn://svn.open-ils.org/ILS/trunk@14929 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 1ce9795a22..252b0ecc47 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -789,6 +789,8 @@ + + @@ -1298,6 +1300,13 @@ + + + + + + + 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 a4a833df04..de3d81ffd9 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -240,6 +240,7 @@ const api = { '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 }, + 'FM_STGU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.stage.retrieve.by_org', 'secure' : true }, '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' }, @@ -362,6 +363,7 @@ const urls = { '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_STAGED_PATRONS' : '/xul/server/patron/staged.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', 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 a42cea7fe9..17f7ef0ad7 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -387,6 +387,13 @@ main.menu.prototype = { ); } ], + 'cmd_staged_patrons' : [ + ['oncommand'], + function() { + obj.data.stash_retrieve(); + obj.set_tab(obj.url_prefix(urls.XUL_STAGED_PATRONS),{'tab_name':offlineStrings.getString('menu.circulation.staged_patrons.tab')},{}); + } + ], 'cmd_circ_checkin' : [ ['oncommand'], function() { diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index bbb3021d41..07f20f3e8d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -37,6 +37,7 @@ + @@ -184,6 +185,7 @@ + diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index da4aa785e6..3950db28b3 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -235,5 +235,6 @@ menu.cmd_acq_view_distrib_formula.tab=Distribution Formulas menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies menu.local_admin.work_log.tab=Work Log +menu.circulation.staged_patrons.tab=Staged Patrons load_printer_settings_error_description=Printer settings did not load cleanly with this version of Evergreen. You should reconfigure your printer under Printer Settings Editor. load_printer_settings_error_title=Printer Settings diff --git a/Open-ILS/xul/staff_client/server/patron/staged.js b/Open-ILS/xul/staff_client/server/patron/staged.js new file mode 100644 index 0000000000..b9f0aae547 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/staged.js @@ -0,0 +1,187 @@ +var list; var error; var net; var rows; + +function $(id) { return document.getElementById(id); } + +//// parent interfaces often call these +function default_focus() { $('stgu_list').focus(); } +function refresh() { populate_list(); } +//// + +function staged_init() { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + commonStrings = $('commonStrings'); + patronStrings = $('patronStrings'); + + if (typeof JSAN == 'undefined') { + throw( + commonStrings.getString('common.jsan.missing') + ); + } + + JSAN.errorLevel = "die"; // none, warn, or die + JSAN.addRepository('..'); + + JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve(); + XML_HTTP_SERVER = data.server_unadorned; + + JSAN.use('util.error'); error = new util.error(); + JSAN.use('util.network'); net = new util.network(); + JSAN.use('patron.util'); + JSAN.use('util.list'); + JSAN.use('util.functional'); + JSAN.use('util.widgets'); + + dojo.require('openils.Util'); + + init_list(); + $('list_actions').appendChild( list.render_list_actions() ); + list.set_list_actions(); + $('cmd_cancel').addEventListener('command', gen_event_handler('cancel'), false); + $('cmd_load').addEventListener('command', gen_event_handler('load'), false); + populate_list(); + default_focus(); + + } catch(E) { + var err_prefix = 'staged.js -> staged_init() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} + +function gen_event_handler(method) { // cancel or load? + return function(ev) { + try { + var sel = list.retrieve_selection(); + var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } ); + + if (method == 'cancel') { + + var pm = $('progress'); pm.value = 0; pm.hidden = false; + var idx = -1; + + fieldmapper.standardRequest( + [ api['FM_STGU_CANCEL'].app, api['FM_STGU_CANCEL'].method ], + { async: true, + params: [ses(), ids], + onresponse: function(r) { + try { + idx++; pm.value = Number( pm.value ) + 100/ids.length; + var result = openils.Util.readResponse(r); + if (typeof result.ilsevent != 'undefined') { throw(result); } + } catch(E) { + error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event onresponse.',E); + } + }, + onerror: function(r) { + try { + var result = openils.Util.readResponse(r); + throw(result); + } catch(E) { + error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event onerror.',E); + } + pm.hidden = true; pm.value = 0; populate_list(); + }, + oncomplete: function(r) { + try { + var result = openils.Util.readResponse(r); + } catch(E) { + error.standard_unexpected_error_alert('In patron/staged.js, handle_'+i+'_event oncomplete.',E); + } + pm.hidden = true; pm.value = 0; populate_list(); + } + } + ); + } else { + // load + } + + } catch(E) { + alert('Error in patron/staged.js, handle_???_event(): ' + E); + } + }; +} + +function init_list() { + try { + + list = new util.list( 'stgu_list' ); + list.init( + { + 'columns' : list.fm_columns( + 'stgu', { + 'stgu_ident_type' : { 'render' : function(my) { return data.hash.cit[ my.stgu.ident_type() ].name(); } }, + 'stgu_home_ou' : { 'render' : function(my) { return data.hash.aou[ my.stgu.home_ou() ].shortname(); } } + } + ), + 'retrieve_row' : retrieve_row, + 'on_select' : handle_selection + } + ); + + } catch(E) { + var err_prefix = 'staged.js -> init_list() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} + +function retrieve_row(params) { // callback function for fleshing rows in a list + try { + params.row_node.setAttribute('retrieve_id',params.row.my.stgu.row_id()); + params.on_retrieve(params.row); + } catch(E) { + alert('Error in staged.js, retrieve_row(): ' + E); + } + return params.row; +} + +function handle_selection(ev) { // handler for list row selection event + var sel = list.retrieve_selection(); + if (sel.length > 0) { + $('cmd_cancel').setAttribute('disabled','false'); + $('cmd_load').setAttribute('disabled','false'); + } else { + $('cmd_cancel').setAttribute('disabled','true'); + $('cmd_load').setAttribute('disabled','true'); + } +}; + +function populate_list() { + try { + + rows = {}; + list.clear(); + + function onResponse(r) { + var blob = openils.Util.readResponse(r); + var row_params = { + 'row' : { + 'my' : { + 'stgu' : blob.user + } + } + }; + rows[ blob.user.row_id() ] = list.append( row_params ); + } + + function onError(r) { + var my_stgu = openils.Util.readResponse(r); + alert('error, my_stgu = ' + js2JSON(my_stgu)); + } + + fieldmapper.standardRequest( + [api['FM_STGU_RETRIEVE'].app, api['FM_STGU_RETRIEVE'].method ], + { async: true, + params: [ses(), ses('ws_ou')], + onresponse : onResponse, + onerror : onError, + oncomplete : function() { + } + } + ); + + } catch(E) { + var err_prefix = 'staged.js -> populate_list() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} diff --git a/Open-ILS/xul/staff_client/server/patron/staged.xul b/Open-ILS/xul/staff_client/server/patron/staged.xul new file mode 100644 index 0000000000..0745c99709 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/staged.xul @@ -0,0 +1,70 @@ + + + + + + + + + + + + +]> + + + + + + + + + + + + +