can update (and remove, though untested) group perm maps
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Apr 2008 20:27:57 +0000 (20:27 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Apr 2008 20:27:57 +0000 (20:27 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/dojo-admin@9211 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/conify/global/permission/grp_tree.html
Open-ILS/web/conify/global/permission/grp_tree.js

index c76dbcb..2d7ed97 100644 (file)
@@ -1,4 +1,4 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w2.org/1999/xhtml">
        <head>
                <title>Confiy :: Global :: Permission :: Group Tree</title>
 
@@ -66,7 +66,6 @@
                        <div dojoType="dijit.layout.ContentPane" sizeShare="100">
                                <script type="dojo/method">
                                        window.dirtyStore = [];
-                                       window.dirtyMapStore = [];
 
                     server.pCRUD.request({
                         method : 'open-ils.permacrud.search.pgt.atomic',
@@ -77,7 +76,7 @@
                             window._group_list = r.recv().content();
                             window._group_data = pgt.toStoreData( window._group_list );
                             window.group_store = new dojo.data.ItemFileWriteStore({ data : window._group_data });
-                            window.group_store.onSet = function (item, attr, n, o) {
+                            window.group_store.onSet = function (item, attr, o, n) {
                                 if (attr == 'ischanged') return;
                                 if (n == o) return;
                                 this.setValue( item, 'ischanged', 1);
                                                        window.perm_map_store.onSet = function (item, attr, o, n) {
                                                                if (attr == 'ischanged') return;
                                                                if (n == o) return;
+
                                                                this.setValue( item, 'ischanged', 1);
-                                                               alert('changed ' + attr + ' to ' + o);
+
+                                                               if (attr == 'grantable' && typeof n != 'string')
+                                                                       this.setValue(item, 'grantable', n ? 't' : 'f');
                                                        }
 
                             dojo.addOnUnload( function (event) { save_them_all(); });
index 3a11b96..eb12e8b 100644 (file)
@@ -68,15 +68,11 @@ function save_group () {
        }).send();
 }
 
-function save_perm_map () {
+function save_perm_map (storeItem) {
 
-       var modified_pgpm = new pgpm().fromStoreItem( current_perm );
+       var modified_pgpm = new pgpm().fromStoreItem( storeItem );
        modified_pgpm.ischanged( 1 );
 
-       new_kid_button.disabled = false;
-       save_out_button.disabled = false;
-       delete_out_button.disabled = false;
-
        server.pCRUD.request({
                method : 'open-ils.permacrud.update.pgpm',
                timeout : 10,
@@ -88,7 +84,7 @@ function save_perm_map () {
                oncomplete : function (r) {
                        var res = r.recv();
                        if ( res && res.content() ) {
-                               group_store.setValue( current_perm, 'ischanged', 0 );
+                               perm_map_store.setValue( storeItem, 'ischanged', 0 );
                                highlighter.editor_pane.green.play();
                                status_update( 'Saved permission changes to ' + group_store.getValue( current_group, 'name' ) );
                        } else {
@@ -101,16 +97,18 @@ function save_perm_map () {
 
 function save_them_all (event) {
 
+       var dirtyMaps = [];
+
     perm_map_store.fetch({
         query : { ischanged : 1 },
-        onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyMapStore.push( item ); } catch (e) { /* meh */ } },
+        onItem : function (item, req) { try { if (this.isItem( item )) dirtyMaps.push( item ); } catch (e) { /* meh */ } },
         scope : perm_map_store
     });
 
     var confirmation = true;
 
 
-    if (event && dirtyMapStore.length > 0) {
+    if (event && dirtyMaps.length > 0) {
         confirmation = confirm(
             'There are unsaved modified Permission Maps!  '+
             'OK to save these changes, Cancel to abandon them.'
@@ -118,12 +116,9 @@ function save_them_all (event) {
     }
 
     if (confirmation) {
-        for (var i in window.dirtyMapStore) {
-            window.current_perm = window.dirtyMapStore[i];
-            save_perm_map(true);
+        for (var i in dirtyMaps) {
+            save_perm_map(dirtyMaps[i]);
         }
-
-        window.dirtyMapStore = [];
     }
 }