[open-ils-commits] r14950 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/chrome/locale/en-US xul/staff_client/server/locale/en-US xul/staff_client/server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 18 02:25:44 EST 2009
Author: phasefx
Date: 2009-11-18 02:25:39 -0500 (Wed, 18 Nov 2009)
New Revision: 14950
Modified:
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
trunk/Open-ILS/xul/staff_client/server/patron/staged.js
trunk/Open-ILS/xul/staff_client/server/patron/staged.xul
Log:
Change labels such that they refer to Pending patrons instead of Staged patrons, and change Cancel to Delete.
Wire up the Delete action.
Add a sticky number box for how many patrons to retrieve in lieu of paged navigation, and a Refresh button.
Pig-trickery to make the Home Library selector sticky.
Deleting or loading a patron removes the patron from the list.
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-11-18 07:25:39 UTC (rev 14950)
@@ -789,8 +789,8 @@
<!ENTITY staff.main.menu.circ.offline.label "Enter Offline Interface">
<!ENTITY staff.main.menu.circ.patron_registration.accesskey "R">
<!ENTITY staff.main.menu.circ.patron_registration.label "Register Patron">
-<!ENTITY staff.main.menu.circ.staged_patrons.accesskey "t">
-<!ENTITY staff.main.menu.circ.staged_patrons.label "Staged Patrons">
+<!ENTITY staff.main.menu.circ.staged_patrons.accesskey "g">
+<!ENTITY staff.main.menu.circ.staged_patrons.label "Pending Patrons">
<!ENTITY staff.main.menu.circ.patron_retrieve.accesskey "L">
<!ENTITY staff.main.menu.circ.patron_retrieve.label "Retrieve Last Patron">
<!ENTITY staff.main.menu.circ.patron_status.key "P">
@@ -1300,13 +1300,17 @@
<!ENTITY staff.patron_display.archived_penalty.end_date.accesskey "">
<!ENTITY staff.patron_display.archived_penalty.retrieve.label "Retrieve Archived Penalties">
<!ENTITY staff.patron_display.archived_penalty.retrieve.accesskey "R">
-<!ENTITY staff.patron_display.staged.caption "Staged Patrons">
-<!ENTITY staff.patron_display.staged.menu.actions.label "Actions for Selected Events">
-<!ENTITY staff.patron_display.staged.menu.actions.accesskey "A">
-<!ENTITY staff.patron_display.staged.menu.actions.cancel.label "Cancel Patron">
+<!ENTITY staff.patron_display.staged.caption "Pending Patrons">
+<!ENTITY staff.patron_display.staged.menu.actions.cancel.label "Delete Patron">
<!ENTITY staff.patron_display.staged.menu.actions.cancel.accesskey "">
<!ENTITY staff.patron_display.staged.menu.actions.load.label "Load Patron">
<!ENTITY staff.patron_display.staged.menu.actions.load.accesskey "P">
+<!ENTITY staff.patron_display.staged.limit.label "Limit:">
+<!ENTITY staff.patron_display.staged.limit.accesskey "t">
+<!ENTITY staff.patron_display.staged.home_lib.label "Home Library:">
+<!ENTITY staff.patron_display.staged.home_lib.accesskey "H">
+<!ENTITY staff.patron_display.staged.reload.label "Refresh">
+<!ENTITY staff.patron_display.staged.reload.accesskey "R">
<!ENTITY staff.patron_display.trigger_event.caption "Modify Triggered Events">
<!ENTITY staff.patron_display.trigger_event.menu.actions.label "Actions for Selected Events">
<!ENTITY staff.patron_display.trigger_event.menu.actions.accesskey "A">
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-11-18 07:25:39 UTC (rev 14950)
@@ -241,6 +241,7 @@
'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 },
+ 'FM_STGU_DELETE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.stage.delete', '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' },
Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties 2009-11-18 07:25:39 UTC (rev 14950)
@@ -235,6 +235,6 @@
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
+menu.circulation.staged_patrons.tab=Pending 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
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties 2009-11-18 07:25:39 UTC (rev 14950)
@@ -318,7 +318,9 @@
staff.patron.summary.expires_on=Expires on
staff.patron.summary.standing_penalty.remove=Remove
staff.patron.summary.standing_penalty.none=No Blocks/Penalties
-staff.patron.staged.register_patron=Registering Staged Patron: %1$s
+staff.patron.staged.register_patron=Registering Pending Patron: %1$s
+staff.patron.staged.confirm_patron_delete=Delete the selected patrons?
+staff.patron.staged.error_on_delete=Error deleting pending patron with row_id = %1$s
staff.patron.staged.lib_menus.missing_library_list=Missing library list.
staff.patron.standing_penalty.apply_error=Error applying %1$s block/standing penalty.
staff.patron.standing_penalty.remove_error=Error removing %1$s block/standing penalty.
Modified: trunk/Open-ILS/xul/staff_client/server/patron/staged.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/staged.js 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/xul/staff_client/server/patron/staged.js 2009-11-18 07:25:39 UTC (rev 14950)
@@ -1,4 +1,4 @@
-var list; var error; var net; var rows; var menu_lib;
+var list; var error; var net; var rows; var row_id_usrname_map; var menu_lib;
function $(id) { return document.getElementById(id); }
@@ -41,6 +41,7 @@
list.set_list_actions();
$('cmd_cancel').addEventListener('command', gen_event_handler('cancel'), false);
$('cmd_load').addEventListener('command', gen_event_handler('load'), false);
+ $('cmd_reload').addEventListener('command', function() { populate_list(); }, false);
populate_list();
default_focus();
@@ -61,13 +62,15 @@
var file = new util.file('offline_ou_list');
if (file._file.exists()) {
var list_data = file.get_object(); file.close();
- var ml = util.widgets.make_menulist( list_data[0], ses('ws_ou') );
+ menu_lib = x.getAttribute('value') || ses('ws_ou');
+ var ml = util.widgets.make_menulist( list_data[0], menu_lib );
ml.setAttribute('id','lib_menu');
x.appendChild( ml );
ml.addEventListener(
'command',
function(ev) {
menu_lib = ev.target.value;
+ x.setAttribute('value',ev.target.value); oils_persist(x);
populate_list();
},
false
@@ -84,12 +87,13 @@
return function(ev) {
try {
var sel = list.retrieve_selection();
- var ids = util.functional.map_list( sel, function(o) { return o.getAttribute('retrieve_id'); } );
+ var row_ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ).row_id; } );
+ var usrnames = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ).usrname; } );
if (method == 'cancel') {
- cancel( ids );
+ cancel( row_ids );
} else {
- load( ids );
+ load( usrnames );
}
} catch(E) {
@@ -100,41 +104,35 @@
function cancel(ids) {
try {
+
+ if (! window.confirm( $('patronStrings').getString('staff.patron.staged.confirm_patron_delete') ) ) { return; }
var pm = $('progress'); pm.value = 0; pm.hidden = false;
- var idx = -1;
+ var idx = 0;
- 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);
+ function gen_req_handler(id) {
+ return function(req) {
+ try {
+ idx++; pm.value = Number( pm.value ) + 100/ids.length;
+ if (idx == ids.length) { pm.value = 0; pm.hidden = true; }
+ var robj = req.getResultObject();
+ if (robj == '1') {
+ var node = rows[ row_id_usrname_map[ id ] ].my_node;
+ var parentNode = node.parentNode;
+ parentNode.removeChild( node );
+ delete(rows[ row_id_usrname_map[ id ] ]);
+ delete(row_id_usrname_map[ id ]);
+ } else {
+ alert( $('patronStrings').getFormattedString('staff.patron.staged.error_on_delete',[ id ]) );
}
- },
- 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();
+ } catch(E) {
+ alert('Error in staged.js, cancel patron request handler: ' + E);
}
}
- );
+ }
+
+ for (var i = 0; i < ids.length; i++) {
+ net.simple_request('FM_STGU_DELETE', [ ses(), ids[i] ], gen_req_handler( ids[i] ));
+ }
} catch(E) {
alert('Error in staged.js, cancel(): ' + E);
}
@@ -145,7 +143,7 @@
xulG.new_patron_tab( {}, { 'doit' : 1, 'query' : s } );
}
-function spawn_editor(p) {
+function spawn_editor(p,func) {
var url = urls.XUL_PATRON_EDIT;
var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER );
xulG.new_tab(
@@ -161,20 +159,36 @@
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
'new_patron_tab' : xulG.new_patron_tab,
+ 'on_save' : function() { if (typeof func == 'function') { func(); } },
'params' : p
}
}
);
}
-function load( ids ) {
+function load( usrnames ) {
try {
+
+ function gen_on_save_handler(usrname) {
+ return function() {
+ try {
+ var node = rows[ usrname ].my_node;
+ var parentNode = node.parentNode;
+ parentNode.removeChild( node );
+ delete(row_id_usrname_map[ rows[ usrname ].row.my.stgu.row_id() ]);
+ delete(rows[ usrname ]);
+ } catch(E) {
+ alert('Error in staged.js, load on save handler: ' + E);
+ }
+ }
+ }
+
var seen = {};
- for (var i = 0; i < ids.length; i++) {
- if (! seen[ ids[i] ]) {
- seen[ ids[i] ] = true;
- spawn_editor( { 'stage' : ids[i] } );
+ for (var i = 0; i < usrnames.length; i++) {
+ if (! seen[ usrnames[i] ]) {
+ seen[ usrnames[i] ] = true;
+ spawn_editor( { 'stage' : usrnames[i] }, gen_on_save_handler( usrnames[i] ) );
}
}
@@ -208,7 +222,7 @@
function retrieve_row(params) { // callback function for fleshing rows in a list
try {
- params.row_node.setAttribute('retrieve_id',params.row.my.stgu.usrname());
+ params.row_node.setAttribute('retrieve_id',js2JSON( { 'row_id' : params.row.my.stgu.row_id(), 'usrname' : params.row.my.stgu.usrname() } ));
params.on_retrieve(params.row);
} catch(E) {
alert('Error in staged.js, retrieve_row(): ' + E);
@@ -230,7 +244,7 @@
function populate_list() {
try {
- rows = {};
+ rows = {}; row_id_usrname_map = {};
list.clear();
function onResponse(r) {
@@ -243,6 +257,7 @@
}
};
rows[ blob.user.usrname() ] = list.append( row_params );
+ row_id_usrname_map[ blob.user.row_id() ] = blob.user.usrname();
}
function onError(r) {
@@ -253,7 +268,7 @@
fieldmapper.standardRequest(
[api['FM_STGU_RETRIEVE'].app, api['FM_STGU_RETRIEVE'].method ],
{ async: true,
- params: [ses(), menu_lib || ses('ws_ou')],
+ params: [ses(), menu_lib || ses('ws_ou'), $('limit').value || 100],
onresponse : onResponse,
onerror : onError,
oncomplete : function() {
Modified: trunk/Open-ILS/xul/staff_client/server/patron/staged.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/staged.xul 2009-11-18 05:54:00 UTC (rev 14949)
+++ trunk/Open-ILS/xul/staff_client/server/patron/staged.xul 2009-11-18 07:25:39 UTC (rev 14950)
@@ -33,6 +33,7 @@
<commandset id="staged_cmds">
<command id="cmd_load" disabled="true"/>
<command id="cmd_cancel" disabled="true"/>
+ <command id="cmd_reload" />
</commandset>
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -41,21 +42,17 @@
<caption id="staged_caption" label="&staff.patron_display.staged.caption;"/>
<vbox flex="0">
<hbox flex="1">
- <hbox id="lib_menu_placeholder" />
+ <vbox pack="center">
+ <label value="&staff.patron_display.staged.limit.label;" accesskey="&staff.patron_display.staged.limit.accesskey;" control="limit" />
+ </vbox>
+ <textbox id="limit" type="number" value="100" oils_persist="value" />
+ <vbox pack="center">
+ <label value="&staff.patron_display.staged.home_lib.label;" accesskey="&staff.patron_display.staged.home_lib.accesskey;" control="lib_menu" />
+ </vbox>
+ <hbox id="lib_menu_placeholder" oils_persist="value" />
+ <button command="cmd_reload" label="&staff.patron_display.staged.reload.label;" accesskey="&staff.patron_display.staged.reload.accesskey;" />
<spacer flex="1" />
<progressmeter id="progress" flex="1" hidden="true" mode="undetermined"/>
-<!--
- <menubar>
- <menu label="&staff.patron_display.staged.menu.actions.label;"
- accesskey="&staff.patron_display.staged.menu.actions.accesskey;"
- style="-moz-user-focus: normal">
- <menupopup>
- <menuitem command="cmd_load" label="&staff.patron_display.staged.menu.actions.load.label;" accesskey="&staff.patron_display.staged.menu.actions.load.accesskey;"/>
- <menuitem command="cmd_cancel" label="&staff.patron_display.staged.menu.actions.cancel.label;" accesskey="&staff.patron_display.staged.menu.actions.cancel.accesskey;"/>
- </menupopup>
- </menu>
- </menubar>
--->
<button command="cmd_load" label="&staff.patron_display.staged.menu.actions.load.label;" accesskey="&staff.patron_display.staged.menu.actions.load.accesskey;"/>
<button command="cmd_cancel" label="&staff.patron_display.staged.menu.actions.cancel.label;" accesskey="&staff.patron_display.staged.menu.actions.cancel.accesskey;"/>
</hbox>
More information about the open-ils-commits
mailing list