determine whether batch copy viewer becomes a batch copy editor based on permissions
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Jan 2006 21:30:02 +0000 (21:30 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Jan 2006 21:30:02 +0000 (21:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2749 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/legacy/_browse.xul
Open-ILS/xul/staff_client/chrome/content/evergreen/main/constants.js

index 9de9700..d5059a0 100644 (file)
                }
 
                function spawn_copy_editor() {
-                       /* <command id="cmd_copy_edit" oncommand="spawn_batch_copy_editor(window.parent_window.document, 'replace_iframe', 'copy_editor', { 'tree' : document.getElementById('browse_list_tree') , 'refresh_func' : refresh_browse_list }); window.parent_window.document.getElementById('copy_editor_tab').disabled = false;"/> */
+
                        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(
                                list,
                                        return obj.getAttribute('object_type') == 'copy';
                                }
                        );
+
+                       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(), 
+                                               util.functional.map_list(
+                                                       list,
+                                                       function (obj) {
+                                                               return obj.getAttribute('ou_id');
+                                                       }
+                                               ),
+                                               [ 'UPDATE_COPY', 'UPDATE_BATCH_COPY' ]
+                                       ]
+                               ).length == 0 ? 1 : 0;
+                       } catch(E) {
+                               g.error.sdump('batch permission check: ' + E);
+                       }
+
                        list = util.functional.map_list(
                                list,
                                function (obj) {
                        );
 
                        JSAN.use('util.window'); var win = new util.window();
-                       win.open(
+                       var w = win.open(
                                window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
                                        +'?session='+window.escape(g.session)
                                        +'&copy_ids='+window.escape(js2JSON(list))
-                                       +'&edit=1',
+                                       +'&edit='+edit,
                                'Copies',
                                'chrome,modal,resizable'
-                       ); 
+                       );
+                       /* FIXME -- need to unique the temp space, and not rely on modalness of window */
+                       g.data.stash_retrieve();
+                       var copies = JSON2js( g.data.temp );
+                       alert('copies = ' + js2JSON(copies));
                }
 
                function spawn_volume_editor() {
index c6e8896..0cf449e 100644 (file)
@@ -39,6 +39,8 @@ var api = {
        'MODS_SLIM_METARECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.metarecord.mods_slim.retrieve' },
        'MODS_SLIM_RECORD_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.mods_slim.retrieve' },
        'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.mods_from_copy' },
+       'PERM_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check' },
+       'PERM_MULTI_ORG_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.perm.check2' },
 }
 
 var urls = {