looks like I was worried about name collisions, and fixing up the copy add shortcut...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 27 Feb 2006 17:25:30 +0000 (17:25 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 27 Feb 2006 17:25:30 +0000 (17:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3199 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/legacy/_browse.xul
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.xul

index 385dc60..6636d0f 100644 (file)
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'copy';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'copy';
                                }
                        );
 
                                                g.data.list.au[0].id(), 
                                                util.functional.map_list(
                                                        list,
-                                                       function (obj) {
-                                                               return obj.getAttribute('ou_id');
+                                                       function (o) {
+                                                               return o.getAttribute('ou_id');
                                                        }
                                                ),
                                                [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ]
 
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('copy_id');
+                               function (o) {
+                                       return o.getAttribute('copy_id');
                                }
                        );
 
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'volume';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'volume';
                                }
                        );
                        
                                                g.data.list.au[0].id(), 
                                                util.functional.map_list(
                                                        list,
-                                                       function (obj) {
-                                                               return obj.getAttribute('ou_id');
+                                                       function (o) {
+                                                               return o.getAttribute('ou_id');
                                                        }
                                                ),
                                                [ 'UPDATE_VOLUME' ]
 
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       return [ obj.getAttribute('ou_id'), obj.getAttribute('volume_id'), obj.getAttribute('callnumber') ];
+                               function (o) {
+                                       return [ o.getAttribute('ou_id'), o.getAttribute('volume_id'), o.getAttribute('callnumber') ];
                                }
                        );
 
                
                        volumes = util.functional.filter_list(
                                volumes,
-                               function (obj) {
-                                       return obj.ischanged() == '1';
+                               function (o) {
+                                       return o.ischanged() == '1';
                                }
                        );
 
                        volumes = util.functional.map_list(
                                volumes,
-                               function (obj) {
-                                       obj.record( find_this_id ); // staff client 2 didn't do this.  Does it matter?
-                                       return obj;
+                               function (o) {
+                                       o.record( find_this_id ); // staff client 2 didn't do this.  Does it matter?
+                                       return o;
                                }
                        );
 
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'org_unit';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'org_unit';
                                }
                        );
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('ou_id');
+                               function (o) {
+                                       return o.getAttribute('ou_id');
                                }
                        )               
                        var edit = 0;
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'volume';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'volume';
                                }
                        );
                        var copy_shortcut = {};
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       var cn =  obj.network.simple_request(
+                               function (o) {
+                                       var cn =  g.network.simple_request(
                                                'FM_ACN_RETRIEVE',
-                                               obj.getAttribute('volume_id')
+                                               o.getAttribute('volume_id')
                                        );
                                        var ou_id = cn.owning_lib();
                                        var label = cn.label();
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'volume';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'volume';
                                }
                        );
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('volume_id');
+                               function (o) {
+                                       return o.getAttribute('volume_id');
                                }
                        );
 
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('object_type') == 'copy';
+                               function (o) {
+                                       return o.getAttribute('object_type') == 'copy';
                                }
                        );
 
                        list = util.functional.map_list(
                                list,
-                               function (obj) {
-                                       return obj.getAttribute('copy_id');
+                               function (o) {
+                                       return o.getAttribute('copy_id');
                                }
                        );
                        
index 8be2685..df4e9d5 100644 (file)
@@ -49,6 +49,9 @@
 
                                g.session = g.cgi.param('session') || g.cgi.param('ses');
                                g.doc_id = g.cgi.param('doc_id');
+                               g.copy_shortcut = g.cgi.param('copy_shortcut');
+                               g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + g.cgi.param('ou_ids'));
+                               if (g.copy_shortcut) g.copy_shortcut = JSON2js( g.copy_shortcut );
 
                                var ou_ids = [];
                                if (g.cgi.param('ou_ids')) 
                        }
                        util.widgets.apply_vertical_tab_on_enter_handler( tb, render_copy_count_entry);
                        tb.addEventListener( 'change', render_copy_count_entry, false);
-                       if (g.copy_shortcut) {
-                               tb.value = g.copy_shortcut[ou_id].length;
-                               render_copy_count_entry(tb);
-                       }
+                       setTimeout(
+                               function() {
+                                       try {
+                                       if (g.copy_shortcut) {
+                                               JSAN.use('util.functional');
+                                               tb.value = util.functional.map_object_to_list(
+                                                       g.copy_shortcut[ou_id],
+                                                       function(o,i) {
+                                                               return g.copy_shortcut[ou_id][i];
+                                                       }
+                                               ).length
+                                               render_copy_count_entry({'target':tb});
+                                       }
+                                       } catch(E) {
+                                               alert(E);
+                                       }
+                               }, 0
+                       );
                }
 
                g.render_callnumber_copy_count_entry = function(row,ou_id,count) {
                                tb1.addEventListener( 'change', handle_change_tb1, false);
                                tb2.addEventListener( 'change', handle_change_tb2, false);
 
-                               if (g.copy_shortcut) {
-                                       var label = g.copy_shortcut[ou_id][i];
-                                       tb1.value = label; handle_change_tb1(tb1);
-                               }
+                               setTimeout(
+                                       function(idx,tb){
+                                               return function() {
+                                                       try {
+                                                       JSAN.use('util.functional');
+                                                       if (g.copy_shortcut) {
+                                                               var label = util.functional.map_object_to_list(
+                                                                       g.copy_shortcut[ou_id],
+                                                                       function(o,i) {
+                                                                               return i;
+                                                                       }
+                                                               )[idx];
+                                                               tb.value = label; handle_change_tb1({'target':tb});
+                                                       }
+                                                       } catch(E) {
+                                                               alert(E);
+                                                       }
+                                               }
+                                       }(i,tb1),0
+                               );
                        }
                }
 
                                for (var ou_id in volumes_hash) {
                                        for (var cn in volumes_hash[ou_id]) {
                                                var volume = new acn();
-                                               var acn_id = g.new_node_id--;
+                                               var acn_id;
+                                               if (!g.copy_shortcut) {
+                                                       acn_id = g.new_node_id--;
+                                                       volume.isnew('1');
+                                               } else {
+                                                       acn_id = g.copy_shortcut[ou_id][cn];
+                                               }
                                                volume.id( acn_id );
-                                               volume.isnew('1');
                                                volume.record(g.doc_id);
                                                volume.label(cn);
                                                volume.owning_lib(ou_id);