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