Commit b44b4bace725036742963680ec420b1bb01bc079

Authored by Bryn Divey
1 parent 097120f5

More permissions JS fixed. Dum de dum.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5853 c91229c3-7414-0410-bfa2-8a42b809f60b
resources/js/jsonlookup.js
... ... @@ -45,7 +45,8 @@ JSONLookupWidget.prototype = {
45 45 this.triggers['remove'] = null;
46 46  
47 47 this.initialValuesLoaded = false;
48   - this.getValues();
  48 + var d = this.getValues();
  49 + d.addCallback(this.postInitialize);
49 50 },
50 51  
51 52 'addTrigger' : function(event, func) {
... ... @@ -70,6 +71,7 @@ JSONLookupWidget.prototype = {
70 71 d.addCallback(checkKTError);
71 72 d.addCallback(this.saveValues);
72 73 d.addCallback(this.renderValues);
  74 + return d;
73 75 },
74 76  
75 77 'errGetValues' : function(res) {
... ... @@ -126,6 +128,13 @@ JSONLookupWidget.prototype = {
126 128 }
127 129 },
128 130  
  131 + 'postInitialize' : function(res) {
  132 + if(!isUndefinedOrNull(this.triggers['postInitialize'])) {
  133 + this.triggers['postInitialize']();
  134 + }
  135 + },
  136 +
  137 +
129 138 'modItems' : function(type, value) {
130 139 var aTarget = (type == 'add') ? 'aItemsAdded' : 'aItemsRemoved';
131 140 var aOtherTarget = (type == 'remove') ? 'aItemsAdded' : 'aItemsRemoved';
... ... @@ -203,6 +212,7 @@ JSONLookupWidget.prototype = {
203 212 forEach(this.oSelectAvail.options, bind(
204 213 function(o) {
205 214 try {
  215 + if(o.value == 'off') continue;
206 216 var a = o.selected;
207 217 if(a == 'selected' || a === true) {
208 218 this.modItems('add', o.value);
... ...
resources/js/permissions.js
... ... @@ -13,6 +13,7 @@ PermissionsTable.prototype = {
13 13 this.oLookup.sAction += '&' + queryString({'permissions':map(function(a){return a['id'];}, aPermissions)});
14 14 this.oLookup.addTrigger('add', this.addRow);
15 15 this.oLookup.addTrigger('remove', this.removeRow);
  16 + this.oLookup.addTrigger('postInitialize', this.enableForm);
16 17  
17 18 this.aRows = {};
18 19  
... ... @@ -25,6 +26,9 @@ PermissionsTable.prototype = {
25 26 }, aPermissions)));
26 27 this.dTBody = TBODY(null);
27 28 this.dTable = TABLE({'class':'kt_collection'}, this.dTHead, this.dTBody);
  29 +
  30 + this.dSubmit = $('submitButtons');
  31 + hideElement(this.dSubmit);
28 32 replaceChildNodes(this.dContainer, this.dTable);
29 33 },
30 34  
... ... @@ -52,6 +56,11 @@ PermissionsTable.prototype = {
52 56 this.aRows = aNewRows;
53 57 },
54 58  
  59 + 'enableForm' : function() {
  60 + showElement(this.dSubmit);
  61 + },
  62 +
  63 +
55 64 'addRow' : function(oRow) {
56 65 if(this._getARow(oRow)) {
57 66 return;
... ...
templates/ktcore/folder/permissions.smarty
... ... @@ -83,7 +83,7 @@
83 83  
84 84 <input type="hidden" name="action" value="update">
85 85 <input type="hidden" name="fFolderId" value="{$iFolderId}">
86   -<div class="form_actions">
  86 +<div id="submitButtons" class="form_actions">
87 87 <input type="submit" value="{i18n}Update Permission Assignments{/i18n}" />
88 88 <input type="submit" name="kt_cancel[{addQS}fFolderId={$iFolderId}{/addQS}]" value="{i18n}Cancel{/i18n}" />
89 89 {/if}
... ...