[open-ils-commits] r9211 -
branches/dojo-admin/Open-ILS/web/conify/global/permission
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Apr 3 17:04:26 EDT 2008
Author: miker
Date: 2008-04-03 16:27:57 -0400 (Thu, 03 Apr 2008)
New Revision: 9211
Modified:
branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.html
branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.js
Log:
can update (and remove, though untested) group perm maps
Modified: branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.html
===================================================================
--- branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.html 2008-04-03 18:01:36 UTC (rev 9210)
+++ branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.html 2008-04-03 20:27:57 UTC (rev 9211)
@@ -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);
@@ -151,8 +150,11 @@
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(); });
Modified: branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.js
===================================================================
--- branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.js 2008-04-03 18:01:36 UTC (rev 9210)
+++ branches/dojo-admin/Open-ILS/web/conify/global/permission/grp_tree.js 2008-04-03 20:27:57 UTC (rev 9211)
@@ -68,15 +68,11 @@
}).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 @@
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_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 @@
}
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 = [];
}
}
More information about the open-ils-commits
mailing list