From: phasefx Date: Fri, 24 Jul 2009 17:14:19 +0000 (+0000) Subject: Reworking of the "Messages" interface in the patron display for manipulating standing... X-Git-Tag: sprint4-merge-nov22~9616 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ba3ed9a304c9950a6152e43b6f923a5d6f70b2ff;p=working%2FEvergreen.git Reworking of the "Messages" interface in the patron display for manipulating standing penalties. Not yet complete, but functional. TODO: Need to add a field for staff initials if a specific OU setting is present, and need to add a section and some methods for "archived" messages. Also need to change how penalties are expressed in the summary sidebar. Also need thought on how/whether/when this will replace the existing Notes infrastructure, since it can do the same thing but better. NOTES: Experimenting with xul toolbar/toolbox; there's a beep when you use the hot key for the Actions menu that this might be the cause of. Also, we're actually using the Dojo openils.PermaCrud code for modifying existing penalties. Exciting :) git-svn-id: svn://svn.open-ils.org/ILS/trunk@13728 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 810aece0e7..bd2a2ab261 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1217,15 +1217,41 @@ - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 3a444fc892..d594a5ccbf 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -35,6 +35,9 @@ const my_constants = { } 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' }, @@ -154,6 +157,7 @@ const api = { '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 }, @@ -334,6 +338,8 @@ const urls = { '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', diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 31b3d6c094..2a204e01e9 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -245,14 +245,9 @@ staff.patron.summary.patron_net_access=Internet 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.standing_penalty.note_prompt=Enter note to go with penalties: -staff.patron.standing_penalty.note_title=Apply Penalty 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. staff.patron.standing_penalty.update_error=Error updating block/standing penalty. -staff.patron.standing_penalty.note_prompt.title=Edit Block/Standing Penalty Note -staff.patron.standing_penalty.note_prompt.singular=Enter note for selected block/standing penalty: -staff.patron.standing_penalty.note_prompt.plural=Enter note for selected blocks/standing penalties: staff.patron.ue.uEditInit.session_no_defined=User session is not defined staff.patron.ue.uEditSaveuser.error_creating_note=Error creating patron guardian or parent note staff.patron.ue.uEditShowSearch.search=Search would be:\n%1$s diff --git a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js new file mode 100644 index 0000000000..6215f8b112 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js @@ -0,0 +1,124 @@ +var data; var error; + +function default_focus() { document.getElementById('note_tb').focus(); } // parent interfaces often call this + +function edit_penalty_init() { + try { + + commonStrings = document.getElementById('commonStrings'); + patronStrings = document.getElementById('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(); + + JSAN.use('util.error'); error = new util.error(); + JSAN.use('util.widgets'); + + build_penalty_menu(); + + /* set widget values */ + document.getElementById('csp_menupopup').setAttribute('value',xul_param('id',{'modal_xulG':true})); + if (xul_param('id',{'modal_xulG':true})==21) { // SILENT_NOTE + document.getElementById('note_btn').checked = true; + } else if (xul_param('id',{'modal_xulG':true})==20) { // ALERT_NOTE + document.getElementById('alert_btn').checked = true; + } else if (xul_param('id',{'modal_xulG':true})==25) { // STAFF_CHR + document.getElementById('block_btn').checked = true; + } else { + var nl = document.getElementById('csp_menupopup').getElementsByAttribute('value',xul_param('id',{'modal_xulG':true})); + if (nl.length > 0) { + document.getElementById('csp_menulist').setAttribute('label', nl[0].getAttribute('label')); + } else { + document.getElementById('csp_menulist').setAttribute('label', '???'); + } + } + + /* set widget behavior */ + document.getElementById('csp_menulist').addEventListener( + 'command', + function() { + document.getElementById('note_btn').checked = false; + document.getElementById('alert_btn').checked = false; + document.getElementById('block_btn').checked = false; + }, + false + ); + document.getElementById('note_btn').addEventListener( + 'command', + function() { + document.getElementById('csp_menulist').setAttribute('label',''); + document.getElementById('csp_menupopup').setAttribute('value','21'); // SILENT_NOTE + }, + false + ); + document.getElementById('alert_btn').addEventListener( + 'command', + function() { + document.getElementById('csp_menulist').setAttribute('label',''); + document.getElementById('csp_menupopup').setAttribute('value','20'); // ALERT_NOTE + }, + false + ); + document.getElementById('block_btn').addEventListener( + 'command', + function() { + document.getElementById('csp_menulist').setAttribute('label',''); + document.getElementById('csp_menupopup').setAttribute('value','25'); // STAFF_CHR + }, + false + ); + document.getElementById('cancel_btn').addEventListener( + 'command', function() { window.close(); }, false + ); + document.getElementById('apply_btn').addEventListener( + 'command', + function() { + update_modal_xulG( + { + 'id' : document.getElementById('csp_menupopup').getAttribute('value'), + 'note' : document.getElementById('note_tb').value, + 'modify' : 1 + } + ) + window.close(); + }, + false + ); + default_focus(); + + } catch(E) { + var err_prefix = 'standing_penalties.js -> penalty_init() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } + +} + +function build_penalty_menu() { + try { + + var csp_menupopup = document.getElementById('csp_menupopup'); + util.widgets.remove_children(csp_menupopup); + for (var i = 0; i < data.list.csp.length; i++) { + if (data.list.csp[i].id() > 100) { + var menuitem = document.createElement('menuitem'); csp_menupopup.appendChild(menuitem); + menuitem.setAttribute('label',data.list.csp[i].label()); + menuitem.setAttribute('value',data.list.csp[i].id()); + menuitem.setAttribute('id','csp_'+data.list.csp[i].id()); + menuitem.setAttribute('oncommand',"var p = this.parentNode; p.parentNode.setAttribute('label',this.getAttribute('label')); p.setAttribute('value'," + data.list.csp[i].id() + ")"); + } + } + + } catch(E) { + var err_prefix = 'edit_standing_penalty.js -> build_penalty_menu() : '; + 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/edit_standing_penalty.xul b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul new file mode 100644 index 0000000000..792baaf559 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.xul @@ -0,0 +1,66 @@ + + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + +