copy shortcut for volume copy creator
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Feb 2006 06:25:10 +0000 (06:25 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Feb 2006 06:25:10 +0000 (06:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3182 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 0e29db7..385dc60 100644 (file)
                }
 
                function spawn_copy_add_wizard() {
-                       /* <command id="cmd_copy_add" oncommand="copy_add(false,{ 'tree' : 'browse_list_tree', 'refresh_func' : refresh_browse_list });"/> */
                        JSAN.use('util.widgets'); JSAN.use('util.functional');
                        var list = util.widgets.get_list_from_tree_selection('browse_list_tree');
                        list = util.functional.filter_list(
                                        return obj.getAttribute('object_type') == 'volume';
                                }
                        );
+                       var copy_shortcut = {};
                        list = util.functional.map_list(
                                list,
                                function (obj) {
-                                       return obj.getAttribute('volume_id');
+                                       var cn =  obj.network.simple_request(
+                                               'FM_ACN_RETRIEVE',
+                                               obj.getAttribute('volume_id')
+                                       );
+                                       var ou_id = cn.owning_lib();
+                                       var label = cn.label();
+                                       if (!copy_shortcut[ou_id]) copy_shortcut[ou_id] = {};
+                                       copy_shortcut[ou_id][label] = 1;
+
+                                       return ou_id;
                                }
                        );
 
+                       var edit = 0;
+                       try {
+                               edit = g.network.request(
+                                       api.PERM_MULTI_ORG_CHECK.app,
+                                       api.PERM_MULTI_ORG_CHECK.method,
+                                       [ 
+                                               g.session, 
+                                               g.data.list.au[0].id(), 
+                                               list,
+                                               [ 'CREATE_COPY' ]
+                                       ]
+                               ).length == 0 ? 1 : 0;
+                       } catch(E) {
+                               g.error.sdump('batch permission check: ' + E);
+                       }
 
-                       alert('spawn copy add wizard with volume_ids = ' + js2JSON(list));
+                       if (edit==0) return; // no read-only view for this interface
+
+                       var title = 'Add Copy';
+
+                       JSAN.use('util.window'); var win = new util.window();
+                       var w = win.open(
+                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
+                                       +'?session='+window.escape(g.session)
+                                       +'&doc_id=' + window.escape(find_this_id)
+                                       +'&ou_ids=' + window.escape( js2JSON(list) ),
+                                       +'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut) )
+                               title,
+                               'chrome,modal,resizable'
+                       );
+
+                       refresh_browse_list();
                }
                
                function mark_volume() {
index 6a3e122..8be2685 100644 (file)
@@ -79,6 +79,7 @@
                                        ); hbox.appendChild(ml);
                                        var btn = document.createElement('button');
                                        btn.setAttribute('label','Apply');
+                                       btn.setAttribute('accesskey','A');
                                        btn.setAttribute('image','/xul/server/skin/media/images/down_arrow.gif');
                                        hbox.appendChild(btn);
                                        btn.addEventListener(
                        }
                        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);
+                       }
                }
 
                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);
+                               }
                        }
                }