CAT-44: Support copy-to-clipboard in Pending Patrons Interface
authorVictoria Lewis <vlewis@catalystitservices.com>
Tue, 2 Feb 2016 22:47:05 +0000 (14:47 -0800)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Add right-click copy-to-clipboard behavior to rows
in the Pending Patron interface.

Signed-off-by: Victoria Lewis <vlewis@catalystitservices.com>
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
Open-ILS/xul/staff_client/server/patron/staged.xul

index 7b48fb1..ff8e751 100644 (file)
@@ -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');
     }
 };
 
index 18b3140..a04a6f7 100644 (file)
@@ -34,6 +34,7 @@
     <commandset id="staged_cmds">
         <command id="cmd_load" disabled="true"/>
         <command id="cmd_cancel" disabled="true"/>
+        <command id="cmd_copy" disabled="true"/>
         <command id="cmd_reload" />
     </commandset>
 
@@ -66,6 +67,7 @@
         <menupopup id="stgu_actions" position="at_pointer">
             <menuitem command="cmd_load" label="&staff.patron_display.staged.menu.actions.load.label;" accesskey="&staff.patron_display.menu.actions.load.accesskey;"/>
             <menuitem command="cmd_cancel" label="&staff.patron_display.staged.menu.actions.cancel.label;" accesskey="&staff.patron_display.menu.actions.cancel.accesskey;"/>
+            <menuitem command="cmd_copy" label="&staff.generic.list_actions.sel_clip.label;" accesskey="&staff.generic.list_actions.sel_clip.accesskey;"/>
         </menupopup>
     </popupset>