backporting from staff-client-experiment: refactor standard list actions (the ones...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 00:50:31 +0000 (00:50 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 22 Feb 2009 00:50:31 +0000 (00:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12245 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/list.js
Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Open-ILS/xul/staff_client/server/cat/copy_buckets.js
Open-ILS/xul/staff_client/server/cat/copy_buckets.xul
Open-ILS/xul/staff_client/server/cat/copy_buckets_overlay.xul
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/copy_status.xul
Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul

index a1a1453..7629368 100644 (file)
@@ -74,7 +74,7 @@ util.list.prototype = {
                                                }
 
                                                if (obj.row_count.total != obj.row_count.fleshed && (obj.row_count.total - obj.row_count.fleshed) > 50) {
-                                                       var r = window.confirm('WARNING: Only ' + obj.row_count.fleshed + ' out of ' + obj.row_count.total + ' rows in this list have been retrieved for immediate viewing.  Sorting this list requires that all these rows be retrieved, and this may take some time and lag the staff client.  Would you like to proceed?');
+                                                       var r = window.confirm(document.getElementById('offlineStrings').getFormattedString('list.row_fetch_warning',[obj.row_count.fleshed,obj.row_count.total]));
 
                                                        if (r) {
                                                                setTimeout( do_it, 0 );
@@ -94,13 +94,20 @@ util.list.prototype = {
                        this.node.appendChild(treechildren);
                        this.treechildren = treechildren;
                }
-               if (typeof params.on_select == 'function') {
-                       this.node.addEventListener(
-                               'select',
-                               params.on_select,
-                               false
-                       );
-               }
+        this.node.addEventListener(
+            'select',
+            function(ev) {
+                if (typeof params.on_select == 'function') {
+                    params.on_select(ev);
+                }
+                var x = document.getElementById(obj.node.id + '_clipfield');
+                if (x) {
+                    var sel = obj.retrieve_selection();
+                    x.setAttribute('disabled', sel.length == 0);
+                }
+            },
+            false
+        );
                if (typeof params.on_click == 'function') {
                        this.node.addEventListener(
                                'click',
@@ -203,7 +210,7 @@ util.list.prototype = {
                        JSAN.use('util.file'); var file = new util.file('tree_columns_for_'+window.escape(id));
                        file.set_object(my_cols);
                        file.close();
-                       alert('Columns saved.');
+                       alert(document.getElementById('offlineStrings').getString('list.columns_saved'));
                } catch(E) {
                        obj.error.standard_unexpected_error_alert('_save_columns_tree',E);
                }
@@ -658,7 +665,7 @@ util.list.prototype = {
                        }
                        */
                        for (var i = 0; i < obj.columns.length; i++) {
-                       var treecell = document.createElement('treecell'); treecell.setAttribute('label','Retrieving...');
+                       var treecell = document.createElement('treecell'); treecell.setAttribute('label',document.getElementById('offlineStrings').getString('list.row_retrieving'));
                        treerow.appendChild(treecell);
                        }
                        /*
@@ -1105,14 +1112,14 @@ util.list.prototype = {
         if (params.no_full_retrieve) {
             params.data = obj.dump_csv( params );
             params.not_json = true;
-            if (!params.title) params.title = 'Save List CSV As';
+            if (!params.title) params.title = document.getElementById('offlineStrings').getString('list.save_csv_as');
             f.export_file( params );
         } else {
             obj.wrap_in_full_retrieve( 
                 function() { 
                     params.data = obj.dump_csv( params );
                     params.not_json = true;
-                    if (!params.title) params.title = 'Save List CSV As';
+                    if (!params.title) params.title = document.getElementById('offlineStrings').getString('list.save_csv_as');
                     f.export_file( params );
                 }
             );
@@ -1188,7 +1195,7 @@ util.list.prototype = {
                return dump;
        },
 
-       'clipboard' : function() {
+       'clipboard' : function(params) {
                try {
                        var obj = this;
                        var dump = obj.dump_selected_with_keys({'skip_hidden_columns':true,'labels_instead_of_ids':true});
@@ -1296,7 +1303,142 @@ util.list.prototype = {
                } catch(E) {
                        obj.error.standard_unexpected_error_alert('pre sorting', E);
                }
-       }
+       },
+
+       'render_list_actions' : function(params) {
+               var obj = this;
+               switch(this.node.nodeName) {
+                       case 'tree' : return this._render_list_actions_for_tree(params); break;
+                       default: throw('NYI: Need ._render_list_actions() for ' + this.node.nodeName); break;
+               }
+       },
+
+    '_render_list_actions_for_tree' : function(params) {
+        var obj = this;
+        try {
+            var btn = document.createElement('button');
+            btn.setAttribute('id',obj.node.id + '_list_actions');
+            btn.setAttribute('type','menu');
+            btn.setAttribute('allowevents','true');
+            //btn.setAttribute('oncommand','this.firstChild.showPopup();');
+            btn.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.menu.label'));
+            btn.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.menu.accesskey'));
+            var mp = document.createElement('menupopup');
+            btn.appendChild(mp);
+            var mi = document.createElement('menuitem');
+            mi.setAttribute('id',obj.node.id + '_clipfield');
+            mi.setAttribute('disabled','true');
+            mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.field_to_clipboard.label'));
+            mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.field_to_clipboard.accesskey'));
+            mp.appendChild(mi);
+            mi = document.createElement('menuitem');
+            mi.setAttribute('id',obj.node.id + '_csv_to_clipboard');
+            mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.csv_to_clipboard.label'));
+            mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.csv_to_clipboard.accesskey'));
+            mp.appendChild(mi);
+            mi = document.createElement('menuitem');
+            mi.setAttribute('id',obj.node.id + '_csv_to_printer');
+            mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.csv_to_printer.label'));
+            mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.csv_to_printer.accesskey'));
+            mp.appendChild(mi);
+            mi = document.createElement('menuitem');
+            mi.setAttribute('id',obj.node.id + '_csv_to_file');
+            mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.csv_to_file.label'));
+            mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.csv_to_file.accesskey'));
+            mp.appendChild(mi);
+            mi = document.createElement('menuitem');
+            mi.setAttribute('id',obj.node.id + '_save_columns');
+            mi.setAttribute('label',document.getElementById('offlineStrings').getString('list.actions.save_column_configuration.label'));
+            mi.setAttribute('accesskey',document.getElementById('offlineStrings').getString('list.actions.save_column_configuration.accesskey'));
+            mp.appendChild(mi);
+            return btn;
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert('rendering list actions',E);
+        }
+    },
+
+       'set_list_actions' : function(params) {
+               var obj = this;
+               switch(this.node.nodeName) {
+                       case 'tree' : return this._set_list_actions_for_tree(params); break;
+                       default: throw('NYI: Need ._set_list_actions() for ' + this.node.nodeName); break;
+               }
+       },
+
+    '_set_list_actions_for_tree' : function(params) {
+        // This should be called after the button element from render_list_actions has been appended to the DOM
+        var obj = this;
+        try {
+            var x = document.getElementById(obj.node.id + '_clipfield');
+            if (x) {
+                x.addEventListener(
+                    'command',
+                    function() {
+                        obj.clipboard(params);
+                        if (params && typeof params.on_complete == 'function') {
+                            params.on_complete(params);
+                        }
+                    },
+                    false
+                );
+            }
+            x = document.getElementById(obj.node.id + '_csv_to_clipboard');
+            if (x) {
+                x.addEventListener(
+                    'command',
+                    function() {
+                        obj.dump_csv_to_clipboard(params);
+                        if (params && typeof params.on_complete == 'function') {
+                            params.on_complete(params);
+                        }
+                    },
+                    false
+                );
+            }
+            x = document.getElementById(obj.node.id + '_csv_to_printer');
+            if (x) {
+                x.addEventListener(
+                    'command',
+                    function() {
+                        obj.dump_csv_to_printer(params);
+                        if (params && typeof params.on_complete == 'function') {
+                            params.on_complete(params);
+                        }
+                    },
+                    false
+                );
+            }
+            x = document.getElementById(obj.node.id + '_csv_to_file');
+            if (x) {
+                x.addEventListener(
+                    'command',
+                    function() {
+                        obj.dump_csv_to_file(params);
+                        if (params && typeof params.on_complete == 'function') {
+                            params.on_complete(params);
+                        }
+                    },
+                    false
+                );
+            }
+            x = document.getElementById(obj.node.id + '_save_columns');
+            if (x) {
+                x.addEventListener(
+                    'command',
+                    function() {
+                        obj.save_columns(params);
+                        if (params && typeof params.on_complete == 'function') {
+                            params.on_complete(params);
+                        }
+                    },
+                    false
+                );
+            }
+
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert('setting list actions',E);
+        }
+    }
 
 }
 dump('exiting util.list.js\n');
index 3fc2aad..f72b3fb 100644 (file)
@@ -137,6 +137,7 @@ menu.close_all_tabs.error=Error closing all tabs
 menu.new_tab.tab=Tab
 main.session_cookie.error=Error setting session cookie: %1$s
 menu.set_tab.error=pause for error
+menu.reset_network_stats=Reset network activity summary?
 main.testing=Testing
 main.transaction_export.title=Save Transaction File As
 main.transaction_export.prompt=Would you like to overwrite the existing file %1$s?
@@ -187,4 +188,19 @@ openils.global_util.clipboard=Copied "%1$s" to clipboard.
 openils.global_util.content_window_jsobject.error=Error with get_contentWindow(%1$s) and wrappedJSObject: %2$s
 openils.global_util.content_window.error=Error with get_contentWindow(%1$s): %2$s
 openils.global_util.font_size.error=Error adjusting the font size: %1$s
-
+list.row_fetch_warning=WARNING: Only %1$s out of %2$s rows in this list have been retrieved for immediate viewing.  Sorting this list requires that all these rows be retrieved, and this may take some time and lag the staff client.  Would you like to proceed?
+list.columns_saved=Column configuration saved.
+list.row_retrieving=Retrieving...
+list.save_csv_as=Save List CSV As...
+list.actions.menu.label=List Actions
+list.actions.menu.accesskey=L
+list.actions.field_to_clipboard.label=Copy Field from Selected Row to Clipboard
+list.actions.field_to_clipboard.accesskey=C
+list.actions.csv_to_clipboard.label=Copy List CSV to Clipboard
+list.actions.csv_to_clipboard.accesskey=L
+list.actions.csv_to_printer.label=Print List CSV
+list.actions.csv_to_printer.accesskey=P
+list.actions.csv_to_file.label=Save List CSV to File
+list.actions.csv_to_file.accesskey=F
+list.actions.save_column_configuration.label=Save Column Configuration
+list.actions.save_column_configuration.accesskey=S
index 373c840..df99a44 100644 (file)
@@ -14,6 +14,7 @@ cat.copy_buckets.prototype = {
        'selection_list1' : [],
        'selection_list2' : [],
        'bucket_id_name_map' : {},
+    'copy_hash' : {},
 
        'render_pending_copies' : function() {
                var obj = this;
@@ -47,24 +48,27 @@ cat.copy_buckets.prototype = {
         function retrieve_row(params) {
             var row = params.row;
             try {
-                obj.network.simple_request('FM_ACP_DETAILS', [ ses(), row.my.copy_id ],
-                    function(blob_req) {
-                        try {
-                            var blob = blob_req.getResultObject();
-                            if (typeof blob.ilsevent != 'undefined') throw(blob);
-                            row.my.acp = blob.copy;
-                            row.my.mvr = blob.mvr;
-                            row.my.acn = blob.volume;
-                            row.my.ahr = blob.hold;
-                            row.my.circ = blob.circ;
-                            params.row_node.setAttribute('retrieve_id', js2JSON( [ blob.copy.id(), blob.copy.barcode(), row.my.bucket_item_id ] ));
-                            if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); }
-
-                        } catch(E) {
-                            obj.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_buckets.retrieve_row.error', [row.my.acp_id]), E);
-                        }
+                function handle_details(blob_req) {
+                    try {
+                        var blob = blob_req.getResultObject();
+                        if (typeof blob.ilsevent != 'undefined') throw(blob);
+                        row.my.acp = blob.copy;
+                        row.my.mvr = blob.mvr;
+                        row.my.acn = blob.volume;
+                        row.my.ahr = blob.hold;
+                        row.my.circ = blob.circ;
+                        params.row_node.setAttribute('retrieve_id', js2JSON( [ blob.copy.id(), blob.copy.barcode(), row.my.bucket_item_id ] ));
+                        if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); }
+
+                    } catch(E) {
+                        obj.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_buckets.retrieve_row.error', [row.my.acp_id]), E);
                     }
-                );
+                }
+                if (obj.copy_hash[ row.my.copy_id ]) {
+                    handle_details( { 'getResultObject' : function() { var copy_obj = obj.copy_hash[ row.my.copy_id ]; delete obj.copy_hash[ row.my.copy_id ]; return copy_obj; } } );
+                } else {
+                    obj.network.simple_request( 'FM_ACP_DETAILS', [ ses(), row.my.copy_id ], handle_details );
+                }
             } catch(E) {
                 obj.error.sdump('D_ERROR','retrieve_row: ' + E );
             }
@@ -81,7 +85,6 @@ cat.copy_buckets.prototype = {
                                        try {
                                                JSAN.use('util.functional');
                                                var sel = obj.list1.retrieve_selection();
-                                               document.getElementById('clip_button1').disabled = sel.length < 1;
                                                obj.selection_list1 = util.functional.map_list(
                                                        sel,
                                                        function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
@@ -112,7 +115,6 @@ cat.copy_buckets.prototype = {
                                        try {
                                                JSAN.use('util.functional');
                                                var sel = obj.list2.retrieve_selection();
-                                               document.getElementById('clip_button2').disabled = sel.length < 1;
                                                obj.selection_list2 = util.functional.map_list(
                                                        sel,
                                                        function(o) { return JSON2js(o.getAttribute('retrieve_id')); }
@@ -140,22 +142,46 @@ cat.copy_buckets.prototype = {
                obj.controller.init(
                        {
                                'control_map' : {
-                                       'save_columns2' : [
-                                               ['command'],
-                                               function() { obj.list2.save_columns(); }
-                                       ],
-                                       'save_columns1' : [
-                                               ['command'],
-                                               function() { obj.list1.save_columns(); }
-                                       ],
-                                       'sel_clip2' : [
-                                               ['command'],
-                                               function() { obj.list2.clipboard(); }
-                                       ],
-                                       'sel_clip1' : [
-                                               ['command'],
-                                               function() { obj.list1.clipboard(); }
+                    'list_actions1' : [
+                        ['render'],
+                        function(e) {
+                            return function() {
+                                e.appendChild( obj.list1.render_list_actions() );
+                                obj.list1.set_list_actions(
+                                    {
+                                        'on_complete' : function() { }
+                                    }
+                                );
+                            };
+                        }
+                    ],
+                    'list_actions2' : [
+                        ['render'],
+                        function(e) {
+                            return function() {
+                                e.appendChild( obj.list2.render_list_actions() );
+                                obj.list2.set_list_actions(
+                                    {
+                                        'on_complete' : function() { }
+                                    }
+                                );
+                            };
+                        }
+                    ],
+                                       'copy_bucket_barcode_entry_textbox' : [
+                                               ['keypress'],
+                                               function(ev) {
+                                                       if (ev.keyCode && ev.keyCode == 13) {
+                                                               obj.scan_barcode();
+                                                       }
+                                               }
                                        ],
+                    'cmd_copy_bucket_submit_barcode' : [
+                        ['command'],
+                        function() {
+                            obj.scan_barcode();
+                        }
+                    ],
                                        'copy_buckets_menulist_placeholder' : [
                                                ['render'],
                                                function(e) {
@@ -253,27 +279,31 @@ cat.copy_buckets.prototype = {
                                        'copy_buckets_add' : [
                                                ['command'],
                                                function() {
-                                                       var bucket_id = obj.controller.view.bucket_menulist.value;
-                                                       if (!bucket_id) return;
-                                                       for (var i = 0; i < obj.copy_ids.length; i++) {
-                                                               var bucket_item = new ccbi();
-                                                               bucket_item.isnew('1');
-                                                               bucket_item.bucket(bucket_id);
-                                                               bucket_item.target_copy( obj.copy_ids[i] );
-                                                               try {
-                                                                       var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
-                                                                               [ ses(), 'copy', bucket_item ]);
-
-                                                                       if (typeof robj == 'object') throw robj;
-
-                                                                       var item = obj.prep_item_for_list( obj.copy_ids[i], robj );
-                                                                       if (!item) continue;
-
-                                                                       obj.list2.append( item );
-                                                               } catch(E) {
-                                                                       obj.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_buckets.copy_buckets_add.error'), E);
-                                                               }
-                                                       }
+                            try {
+                                var bucket_id = obj.controller.view.bucket_menulist.value;
+                                if (!bucket_id) return;
+                                for (var i = 0; i < obj.copy_ids.length; i++) {
+                                    var bucket_item = new ccbi();
+                                    bucket_item.isnew('1');
+                                    bucket_item.bucket(bucket_id);
+                                    bucket_item.target_copy( obj.copy_ids[i] );
+                                    try {
+                                        var robj = obj.network.simple_request('BUCKET_ITEM_CREATE',
+                                            [ ses(), 'copy', bucket_item ]);
+
+                                        if (typeof robj == 'object') throw robj;
+
+                                        var item = obj.prep_item_for_list( obj.copy_ids[i], robj );
+                                        if (!item) continue;
+
+                                        obj.list2.append( item );
+                                    } catch(E) {
+                                        obj.error.standard_unexpected_error_alert($('catStrings').getString('staff.cat.copy_buckets.copy_buckets_add.error'), E);
+                                    }
+                                }
+                            } catch(E) {
+                                alert(E);
+                            }
                                                }
                                        ],
                                        'copy_buckets_sel_add' : [
@@ -580,71 +610,11 @@ cat.copy_buckets.prototype = {
                                                        obj.list2.dump_csv_to_clipboard();
                                                }
                                        ],
-                                       'cmd_export1' : [
-                                               ['command'],
-                                               function() {
-                                                       obj.list1.dump_csv_to_clipboard();
-                                               }
-                                       ],
-
-                    'cmd_print_export1' : [
-                        ['command'],
-                        function() {
-                            try {
-                                obj.list1.on_all_fleshed =
-                                    function() {
-                                        try {
-                                            dump( obj.list1.dump_csv() + '\n' );
-                                            //copy_to_clipboard(obj.list.dump_csv());
-                                            JSAN.use('util.print'); var print = new util.print();
-                                            print.simple(obj.list1.dump_csv(),{'content_type':'text/plain'});
-                                            setTimeout(function(){ obj.list1.on_all_fleshed = null; },0);
-                                        } catch(E) {
-                                            obj.error.standard_unexpected_error_alert('print export',E);
-                                        }
-                                    }
-                                obj.list1.full_retrieve();
-                            } catch(E) {
-                                obj.error.standard_unexpected_error_alert('print export',E);
-                            }
-                        }
-                    ],
-
-
-                    'cmd_print_export2' : [
-                        ['command'],
-                        function() {
-                            try {
-                                obj.list2.on_all_fleshed =
-                                    function() {
-                                        try {
-                                            dump( obj.list2.dump_csv() + '\n' );
-                                            //copy_to_clipboard(obj.list.dump_csv());
-                                            JSAN.use('util.print'); var print = new util.print();
-                                            print.simple(obj.list2.dump_csv(),{'content_type':'text/plain'});
-                                            setTimeout(function(){ obj.list2.on_all_fleshed = null; },0);
-                                        } catch(E) {
-                                            obj.error.standard_unexpected_error_alert('print export',E);
-                                        }
-                                    }
-                                obj.list2.full_retrieve();
-                            } catch(E) {
-                                obj.error.standard_unexpected_error_alert('print export',E);
-                            }
-                        }
-                    ],
-
                                        'cmd_copy_buckets_reprint' : [
                                                ['command'],
                                                function() {
                                                }
                                        ],
-                                       'cmd_copy_buckets_done' : [
-                                               ['command'],
-                                               function() {
-                                                       window.close();
-                                               }
-                                       ],
                                        'cmd_export_to_copy_status' : [
                                                ['command'],
                                                function() {
@@ -678,9 +648,6 @@ cat.copy_buckets.prototype = {
                if (typeof xulG == 'undefined') {
                        obj.controller.view.cmd_export_to_copy_status.disabled = true;
                        obj.controller.view.cmd_export_to_copy_status.setAttribute('disabled',true);
-               } else {
-                       obj.controller.view.cmd_copy_buckets_done.disabled = true;
-                       obj.controller.view.cmd_copy_buckets_done.setAttribute('disabled',true);
                }
        
        },
@@ -705,7 +672,54 @@ cat.copy_buckets.prototype = {
                }
 
        },
-       
+
+    'scan_barcode' : function() {
+        var obj = this;
+        try {
+            var barcode = obj.controller.view.copy_bucket_barcode_entry_textbox.value;
+            var copy_obj = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE',[ses(),barcode]);
+            if (copy_obj == null) {
+                throw(document.getElementById('circStrings').getString('staff.circ.copy_status.status.null_result'));
+            } else if (copy_obj.ilsevent) {
+                switch(Number(copy_obj.ilsevent)) {
+                    case -1: 
+                        obj.error.standard_network_error_alert(); 
+                        obj.controller.view.copy_bucket_barcode_entry_textbox.select();
+                        obj.controller.view.copy_bucket_barcode_entry_textbox.focus();
+                        return;
+                    break;
+                    case 1502 /* ASSET_COPY_NOT_FOUND */ :
+                        obj.error.yns_alert(
+                            document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [barcode]),
+                            document.getElementById('circStrings').getString('staff.circ.copy_status.status.not_cataloged'),
+                            document.getElementById('circStrings').getString('staff.circ.copy_status.ok'),
+                            null,
+                            null,
+                            document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+                        );
+                        obj.controller.view.copy_bucket_barcode_entry_textbox.select();
+                        obj.controller.view.copy_bucket_barcode_entry_textbox.focus();
+                        return;
+                    break;
+                    default: 
+                        throw(details); 
+                    break;
+                }
+            }
+            var item = obj.prep_item_for_list( copy_obj.copy.id() );
+            if (item) {
+                obj.copy_ids.push( copy_obj.copy.id() );
+                obj.copy_hash[ copy_obj.copy.id() ] = copy_obj;
+                obj.list1.append( item );
+            }
+            obj.controller.view.copy_bucket_barcode_entry_textbox.value = '';
+            obj.controller.view.copy_bucket_barcode_entry_textbox.focus();
+        } catch(E) {
+            obj.controller.view.copy_bucket_barcode_entry_textbox.select();
+            obj.controller.view.copy_bucket_barcode_entry_textbox.focus();
+            alert(E);
+        }
+    }  
 }
 
 dump('exiting cat.copy_buckets.js\n');
index a5c3cb0..a73453d 100644 (file)
@@ -70,6 +70,7 @@
                        }
                }
 
+               function default_focus() { try { setTimeout( function() { document.getElementById('copy_bucket_barcode_entry_textbox').focus(); }, 0); } catch(E) {} }
        ]]>
        </script>
 
        <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale' -->/circ.properties"/>
 
        <commandset id="copy_buckets_cmds">
-               <command id="sel_clip1" />
-               <command id="save_columns1" />
-               <command id="sel_clip2" />
-               <command id="save_columns2" />
-               <command id="cmd_print_export1" />
-               <command id="cmd_export1" />
-               <command id="cmd_print_export2" />
-               <command id="cmd_copy_buckets_submit_barcode" />
-               <command id="cmd_copy_buckets_print" />
-               <command id="cmd_copy_buckets_export" />
-               <command id="cmd_copy_buckets_reprint" />
-               <command id="cmd_copy_buckets_done" />
+               <command id="cmd_copy_bucket_submit_barcode" />
                <command id="cmd_export_to_copy_status" />
                <command id="copy_buckets_new_bucket" />
                <command id="copy_buckets_delete_bucket" />
index 6c3e062..1c357d0 100644 (file)
        </groupbox>
 </vbox>
 
+<hbox id="pending_buckets_top_ui">
+       <label id="copy_bucket_scan_barcode_label" 
+               value="&staff.circ.copy_status_overlay.copy_status_scan_barcode.label;"
+               accesskey="&staff.circ.copy_status_overlay.copy_status_scan_barcode.accesskey;"
+               control="copy_bucket_barcode_entry_textbox"/>
+       <textbox id="copy_bucket_barcode_entry_textbox" context="clipboard"/>
+       <button id="copy_bucket_submit_barcode_button" 
+               label="&staff.circ.copy_status_overlay.copy_status_submit_barcode.label;"
+               accesskey="&staff.circ.copy_status_overlay.copy_status_submit_barcode.accesskey;"
+               command="cmd_copy_bucket_submit_barcode"/>
+</hbox>
+
 <hbox id="pending_buckets_bottom_ui">
-       <button id="save_button1" command="save_columns1" label="&staff.cat.copy_buckets_overlay.pending_buckets.save_columns1;" />
-       <button id="clip_button1" command="sel_clip1" label="&staff.cat.copy_buckets_overlay.pending_buckets.sel_clip1;" disabled="true" />
-       <button id="cmd_print_export_btn1" command="cmd_print_export1" label="&staff.cat.copy_buckets_overlay.pending_buckets.cmd_print_export1;" />
-       <button id="cmd_export_btn1" command="cmd_export1" label="&staff.cat.copy_buckets_overlay.pending_buckets.cmd_export1;" />
+    <hbox id="list_actions1"/>
        <spacer flex="1"/>
        <button label="&staff.cat.copy_buckets_overlay.pending_buckets.copy_buckets_add.label;" command="copy_buckets_add" accesskey="&staff.cat.copy_buckets_overlay.pending_buckets.copy_buckets_add.accesskey;" image="/xul/server/skin/media/images/down_arrow.gif"/>
        <button label="&staff.cat.copy_buckets_overlay.pending_buckets.copy_buckets_sel_add.label;" command="copy_buckets_sel_add" accesskey="" image="/xul/server/skin/media/images/down_arrow.gif"/>
@@ -46,8 +55,6 @@
        <button command="copy_buckets_delete_bucket" label="&staff.cat.copy_buckets_overlay.copy_buckets.copy_buckets_delete_bucket.label;"/>
        <button id="refresh" label="&staff.cat.copy_buckets_overlay.copy_buckets.refresh.label;"/>
        <spacer flex="1"/>
-       <button id="save_button2" command="save_columns2" label="&staff.cat.copy_buckets_overlay.copy_buckets.save_columns2.label;" />
-       <button id="clip_button2" command="sel_clip2" label="&staff.cat.copy_buckets_overlay.copy_buckets.sel_clip2.label;" disabled="true" />
        <button command="copy_buckets_delete_item" label="&staff.cat.copy_buckets_overlay.copy_buckets.delete_item.label;" disabled="true" image="/xul/server/skin/media/images/icon_delete.gif"/>
        <button command="copy_buckets_export" label="&staff.cat.copy_buckets_overlay.copy_buckets.export.label;" disabled="true" image="/xul/server/skin/media/images/up_arrow.gif"/>
 </hbox>
 </hbox>
 
 <hbox id="copy_buckets_bottom_ui">
-       <button id="copy_buckets_print" label="&staff.cat.copy_buckets_overlay.copy_buckets.print.label;" command="cmd_copy_buckets_print" accesskey="&staff.cat.copy_buckets_overlay.copy_buckets.print.accesskey;"/>
-       <button id="cmd_print_export_btn2" command="cmd_print_export2" label="&staff.cat.copy_buckets_overlay.copy_buckets.print_export.label;" />
-       <button id="copy_buckets_export" 
-               label="&staff.cat.copy_buckets_overlay.copy_buckets.cmd_copy_buckets_export.label;"
-               command="cmd_copy_buckets_export"
-               accesskey=""/>
+    <hbox id="list_actions2"/>
        <spacer flex="1"/>
        <hbox style="background: grey">
                <vbox><spacer flex="1"/><label value="&staff.cat.copy_buckets_overlay.copy_buckets.batch.label;" style="font-weight: bold"/><spacer flex="1"/></vbox>
index 4441192..a247949 100644 (file)
@@ -110,14 +110,21 @@ circ.copy_status.prototype = {
                obj.controller.init(
                        {
                                'control_map' : {
-                                       'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
-                                       'sel_clip' : [
-                                               ['command'],
-                                               function() { 
-                                                       obj.list.clipboard(); 
-                                                       obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                               }
-                                       ],
+                    'list_actions' : [
+                        ['render'],
+                        function(e) {
+                            return function() {
+                                e.appendChild( obj.list.render_list_actions() );
+                                obj.list.set_list_actions(
+                                    {
+                                        'on_complete' : function() { obj.controller.view.copy_status_barcode_entry_textbox.focus(); } 
+                                    }
+                                );
+                            };
+                        }
+                    ],
+                    'sel_clip' : [ ['command'], function() { obj.list.clipboard(); obj.controller.view.copy_status_barcode_entry_textbox.focus(); } ],
+                    'save_columns' : [ ['command'], function() { obj.list.save_columns(); obj.controller.view.copy_status_barcode_entry_textbox.focus(); } ],
                                        'sel_checkin' : [
                                                ['command'],
                                                function() {
@@ -327,19 +334,6 @@ circ.copy_status.prototype = {
                                                        }
                                                }
                                        ],
-                                       'cmd_csv_to_clipboard' : [ ['command'], function() { 
-                                               obj.list.dump_csv_to_clipboard(); 
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       } ],
-                                       'cmd_csv_to_printer' : [ ['command'], function() { 
-                                               obj.list.dump_csv_to_printer(); 
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       } ],
-                                       'cmd_csv_to_file' : [ ['command'], function() { 
-                                               obj.list.dump_csv_to_file( { 'defaultFileName' : 'item_status.txt' } ); 
-                                               obj.controller.view.copy_status_barcode_entry_textbox.focus();
-                                       } ],
-
                                        'cmd_add_items' : [
                                                ['command'],
                                                function() {
index fa56d08..5c83e70 100644 (file)
                <command id="cmd_copy_status_submit_barcode" />
                <command id="cmd_copy_status_upload_file" />
                <command id="cmd_copy_status_print" />
-               <command id="cmd_csv_to_clipboard" />
-               <command id="cmd_csv_to_printer" />
-               <command id="cmd_csv_to_file" />
                <command id="save_columns" />
                <command id="sel_copy_details" disabled="true"/>
                <command id="sel_mark_items_damaged" disabled="true"/>
index f6379bd..185674f 100644 (file)
 </hbox>
 
 <hbox id="copy_status_bottom_ui">
-    <button id="list_actions" oncommand="this.firstChild.showPopup();"
-        label="&staff.generic.list_actions.label;" 
-        accesskey="&staff.generic.list_actions.accesskey;" 
-        type="menu" allowevents="true">
-        <menupopup id="list_actions_popup">
-               <menuitem command="sel_clip" label="&staff.generic.list_actions.sel_clip.label;" accesskey="&staff.generic.list_actions.sel_clip.accesskey;" disabled="true" />
-           <menuitem command="cmd_csv_to_printer" label="&staff.generic.list_actions.csv_to_printer.label;" accesskey="&staff.generic.list_actions.csv_to_printer.accesskey;" />
-               <menuitem command="cmd_csv_to_clipboard" label="&staff.generic.list_actions.csv_to_clipboard.label;" accesskey="&staff.generic.list_actions.csv_to_clipboard.accesskey;" />
-               <menuitem command="cmd_csv_to_file" label="&staff.generic.list_actions.csv_to_file.label;" accesskey="&staff.generic.list_actions.csv_to_file.accesskey;" />
-               <menuitem command="save_columns" label="&staff.generic.list_actions.save_columns.label;" accesskey="&staff.generic.list_actions.save_columns.accesskey;" />
-        </menupopup>
-    </button>
+    <hbox id="list_actions"/>
 
        <button id="copy_status_print" label="&staff.circ.copy_status_overlay.copy_status_print.label;" command="cmd_copy_status_print" accesskey="&staff.circ.copy_status_overlay.copy_status_print.accesskey;"/>
     <checkbox id="trim_list" label="&staff.circ.copy_status_overlay.trim_list.label;" checked="true" persist="checked" oncommand="try{this.setAttribute('checked',this.checked);}catch(E){alert(E);}" />