diff --git a/resources/js/jsonlookup.js b/resources/js/jsonlookup.js index a9db226..dc88a25 100644 --- a/resources/js/jsonlookup.js +++ b/resources/js/jsonlookup.js @@ -45,7 +45,8 @@ JSONLookupWidget.prototype = { this.triggers['remove'] = null; this.initialValuesLoaded = false; - this.getValues(); + var d = this.getValues(); + d.addCallback(this.postInitialize); }, 'addTrigger' : function(event, func) { @@ -70,6 +71,7 @@ JSONLookupWidget.prototype = { d.addCallback(checkKTError); d.addCallback(this.saveValues); d.addCallback(this.renderValues); + return d; }, 'errGetValues' : function(res) { @@ -126,6 +128,13 @@ JSONLookupWidget.prototype = { } }, + 'postInitialize' : function(res) { + if(!isUndefinedOrNull(this.triggers['postInitialize'])) { + this.triggers['postInitialize'](); + } + }, + + 'modItems' : function(type, value) { var aTarget = (type == 'add') ? 'aItemsAdded' : 'aItemsRemoved'; var aOtherTarget = (type == 'remove') ? 'aItemsAdded' : 'aItemsRemoved'; @@ -203,6 +212,7 @@ JSONLookupWidget.prototype = { forEach(this.oSelectAvail.options, bind( function(o) { try { + if(o.value == 'off') continue; var a = o.selected; if(a == 'selected' || a === true) { this.modItems('add', o.value); diff --git a/resources/js/permissions.js b/resources/js/permissions.js index c1d40bc..ded4264 100644 --- a/resources/js/permissions.js +++ b/resources/js/permissions.js @@ -13,6 +13,7 @@ PermissionsTable.prototype = { this.oLookup.sAction += '&' + queryString({'permissions':map(function(a){return a['id'];}, aPermissions)}); this.oLookup.addTrigger('add', this.addRow); this.oLookup.addTrigger('remove', this.removeRow); + this.oLookup.addTrigger('postInitialize', this.enableForm); this.aRows = {}; @@ -25,6 +26,9 @@ PermissionsTable.prototype = { }, aPermissions))); this.dTBody = TBODY(null); this.dTable = TABLE({'class':'kt_collection'}, this.dTHead, this.dTBody); + + this.dSubmit = $('submitButtons'); + hideElement(this.dSubmit); replaceChildNodes(this.dContainer, this.dTable); }, @@ -52,6 +56,11 @@ PermissionsTable.prototype = { this.aRows = aNewRows; }, + 'enableForm' : function() { + showElement(this.dSubmit); + }, + + 'addRow' : function(oRow) { if(this._getARow(oRow)) { return; diff --git a/templates/ktcore/folder/permissions.smarty b/templates/ktcore/folder/permissions.smarty index aff18cd..54e3370 100644 --- a/templates/ktcore/folder/permissions.smarty +++ b/templates/ktcore/folder/permissions.smarty @@ -83,7 +83,7 @@ -