From 555225fcbe94f02b7a2ed1020a10082c6b8945e8 Mon Sep 17 00:00:00 2001 From: Dan Reuther Date: Wed, 28 Oct 2015 16:07:30 -0400 Subject: [PATCH] KMAIN-1828 Full Patron Messages Add new action on messages: "View Penalty/Message." Add new xul window to display full note of message in larger font than displayed on main messages page. Add localization for new content. Signed-off-by: Kyle Huckins modified: Open-ILS/web/opac/locale/en-US/lang.dtd modified: Open-ILS/xul/staff_client/chrome/content/main/constants.js modified: Open-ILS/xul/staff_client/server/patron/standing_penalties.js modified: Open-ILS/xul/staff_client/server/patron/standing_penalties.xul new file: Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js new file: Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul --- Open-ILS/web/opac/locale/en-US/lang.dtd | 5 +++ .../staff_client/chrome/content/main/constants.js | 1 + .../server/patron/standing_penalties.js | 31 +++++++++++++ .../server/patron/standing_penalties.xul | 3 ++ .../server/patron/view_standing_penalty.js | 51 ++++++++++++++++++++++ .../server/patron/view_standing_penalty.xul | 46 +++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js create mode 100644 Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 166dc44684..032339efea 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1594,6 +1594,7 @@ + @@ -1615,6 +1616,10 @@ + + + + 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 eb0b9b303b..b2e0864ca8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -498,6 +498,7 @@ var urls = { 'XUL_STANDING_PENALTIES' : 'oils://remote/xul/server/patron/standing_penalties.xul', 'XUL_NEW_STANDING_PENALTY' : 'oils://remote/xul/server/patron/new_standing_penalty.xul', 'XUL_EDIT_STANDING_PENALTY' : 'oils://remote/xul/server/patron/edit_standing_penalty.xul', + 'XUL_VIEW_STANDING_PENALTY' : 'oils://remote/xul/server/patron/view_standing_penalty.xul', 'XUL_SCAN_ITEM_AS_MISSING_PIECES' : 'oils://remote/xul/server/circ/missing_pieces.xul', 'XUL_STAT_CAT_EDIT' : 'oils://remote/xul/server/admin/stat_cat_editor.xhtml', 'XUL_SURVEY_WIZARD' : 'chrome://open_ils_staff_client/content/admin/survey_wizard.xul', diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js index 15100f9aa8..de2f3a0b6b 100644 --- a/Open-ILS/xul/staff_client/server/patron/standing_penalties.js +++ b/Open-ILS/xul/staff_client/server/patron/standing_penalties.js @@ -30,6 +30,7 @@ function penalty_init() { init_archived_list(); window.standing_penalties_event_listeners = new EventListenerList(); document.getElementById('date1').year = document.getElementById('date1').year - 1; + window.standing_penalties_event_listeners.add(document.getElementById('cmd_view_message'), 'command', handle_view_message, false); window.standing_penalties_event_listeners.add(document.getElementById('cmd_apply_penalty'), 'command', handle_apply_penalty, false); window.standing_penalties_event_listeners.add(document.getElementById('cmd_remove_penalty'), 'command', handle_remove_penalty, false); window.standing_penalties_event_listeners.add(document.getElementById('cmd_edit_penalty'), 'command', handle_edit_penalty, false); @@ -106,10 +107,12 @@ function generate_handle_selection(which_list) { var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } ); if (which_list == list) { // top list if (ids.length > 0) { + document.getElementById('cmd_view_message').setAttribute('disabled','false'); document.getElementById('cmd_remove_penalty').setAttribute('disabled','false'); document.getElementById('cmd_edit_penalty').setAttribute('disabled','false'); document.getElementById('cmd_archive_penalty').setAttribute('disabled','false'); } else { + document.getElementById('cmd_view_message').setAttribute('disabled','true'); document.getElementById('cmd_remove_penalty').setAttribute('disabled','true'); document.getElementById('cmd_edit_penalty').setAttribute('disabled','true'); document.getElementById('cmd_archive_penalty').setAttribute('disabled','true'); @@ -146,6 +149,34 @@ function populate_list() { } } +function handle_view_message(ev) { + try { + JSAN.use('util.window'); + var win = new util.window(); + + var sel = list.retrieve_selection(); + var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } ); + if (ids.length > 0) { + for (var i = 0; i < ids.length; i++) { + var penalty = util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.id() == ids[i]; } ); + var my_xulG = win.open( + urls.XUL_VIEW_STANDING_PENALTY, + 'new_standing_penalty', + 'chrome,resizable,modal', + { + 'id' : typeof penalty.standing_penalty() == 'object' ? penalty.standing_penalty().id() : penalty.standing_penalty(), + 'note' : penalty.note() + } + ); + } + } + + } catch(E) { + var err_prefix = 'standing_penalties.js -> handle_view_penalty() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } +} + function handle_apply_penalty(ev) { try { JSAN.use('util.window'); diff --git a/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul b/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul index 5571298a1d..9476116178 100644 --- a/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul +++ b/Open-ILS/xul/staff_client/server/patron/standing_penalties.xul @@ -32,6 +32,7 @@ + @@ -74,6 +75,7 @@ type="menu" style="-moz-user-focus: normal" oncommand="this.focus(); this.firstChild.showPopup()"> + @@ -114,6 +116,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js new file mode 100644 index 0000000000..381cde266a --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js @@ -0,0 +1,51 @@ +var data; var error; + +function default_focus() { document.getElementById('note_tb').focus(); } // parent interfaces often call this + +function view_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'); + + /* set widget values */ + document.getElementById('note_tb').value = xul_param('note'); + + /* set widget behavior */ + window.view_standing_penalty_event_listeners = new EventListenerList(); + + + window.view_standing_penalty_event_listeners.add(document.getElementById('close_btn'), + 'command', function() { window.close(); }, false + ); + + } 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 view_penalty_cleanup() { + try { + window.view_standing_penalty_event_listeners.removeAll(); + } catch(E) { + var err_prefix = 'standing_penalties.js -> penalty_cleanup() : '; + if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E); + } + +} \ No newline at end of file diff --git a/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul new file mode 100644 index 0000000000..be0a4fea0b --- /dev/null +++ b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul @@ -0,0 +1,46 @@ + + + + + + + + + + + + +]> + + + + + + + + + + + + +