From 8331b1c980ded690c9f5ba7a3edfb747ce5b172e Mon Sep 17 00:00:00 2001 From: Victoria Lewis Date: Tue, 2 Feb 2016 14:47:05 -0800 Subject: [PATCH] CAT-44: Support copy-to-clipboard in Pending Patrons Interface Add right-click copy-to-clipboard behavior to rows in the Pending Patron interface. Signed-off-by: Victoria Lewis modified: Open-ILS/xul/staff_client/server/patron/staged.js modified: Open-ILS/xul/staff_client/server/patron/staged.xul --- Open-ILS/xul/staff_client/server/patron/staged.js | 19 +++++++++++++++++++ Open-ILS/xul/staff_client/server/patron/staged.xul | 2 ++ 2 files changed, 21 insertions(+) diff --git a/Open-ILS/xul/staff_client/server/patron/staged.js b/Open-ILS/xul/staff_client/server/patron/staged.js index 7b48fb1f7a..ff8e7513b9 100644 --- a/Open-ILS/xul/staff_client/server/patron/staged.js +++ b/Open-ILS/xul/staff_client/server/patron/staged.js @@ -40,6 +40,7 @@ function staged_init() { list.set_list_actions(); window.staged_event_listeners.add($('cmd_cancel'), 'command', gen_event_handler('cancel'), false); window.staged_event_listeners.add($('cmd_load'), 'command', gen_event_handler('load'), false); + window.staged_event_listeners.add($('cmd_copy'), 'command', gen_event_handler('copy'), false); window.staged_event_listeners.add($('cmd_reload'), 'command', function() { populate_list(); }, false); populate_list(); default_focus(); @@ -102,6 +103,8 @@ function gen_event_handler(method) { // cancel or load? if (method == 'cancel') { cancel( row_ids ); + } else if(method == 'copy') { + copy(row_ids); } else { load( usrnames ); } @@ -112,6 +115,20 @@ function gen_event_handler(method) { // cancel or load? }; } +function copy(ids){ + try { + var dump = list.dump_selected_with_keys({'skip_hidden_columns':true,'labels_instead_of_ids':true}); + list.data.stash_retrieve(); + list.data.list_clipboard = dump; list.data.stash('list_clipboard'); + JSAN.use('util.window'); var win = new util.window(); + win.open(urls.XUL_LIST_CLIPBOARD,'list_clipboard','chrome,resizable,modal'); + window.focus(); // sometimes the main window will lower after a clipboard action + } catch(E) { + this.error.standard_unexpected_error_alert('clipboard',E); + } +} + + function cancel(ids) { try { @@ -299,9 +316,11 @@ function handle_selection(ev) { // handler for list row selection event if (sel.length > 0) { $('cmd_cancel').setAttribute('disabled','false'); $('cmd_load').setAttribute('disabled','false'); + $('cmd_copy').setAttribute('disabled','false'); } else { $('cmd_cancel').setAttribute('disabled','true'); $('cmd_load').setAttribute('disabled','true'); + $('cmd_copy').setAttribute('disabled','true'); } }; diff --git a/Open-ILS/xul/staff_client/server/patron/staged.xul b/Open-ILS/xul/staff_client/server/patron/staged.xul index 18b31408de..a04a6f79cc 100644 --- a/Open-ILS/xul/staff_client/server/patron/staged.xul +++ b/Open-ILS/xul/staff_client/server/patron/staged.xul @@ -34,6 +34,7 @@ + @@ -66,6 +67,7 @@ + -- 2.11.0