+{if $categoryName|isset && $categoryName|substr:-2 == '.*'}
+ {assign var='__categoryNameStart' value=$categoryName|substr:0:-1}
+{/if}
<script data-relocate="true">
//<![CDATA[
$(function() {
var initialPermissions = {
returnValues: {
options: {
- {implode from=$aclValues[$objectTypeID][options] key='__optionID' item='__optionData'}
- {@$__optionID}: {
- categoryName: '{@$__optionData[categoryName]|encodeJS}',
- label: '{@$__optionData[label]|encodeJS}',
- optionName: '{@$__optionData[optionName]|encodeJS}'
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][options] key='__optionID' item='__optionData'}
+ {assign var='__optionCategoryName' value=$__optionData[categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {
+ categoryName: '{@$__optionData[categoryName]|encodeJS}',
+ label: '{@$__optionData[label]|encodeJS}',
+ optionName: '{@$__optionData[optionName]|encodeJS}'
+ },
+ {/if}
+ {/foreach}
},
categories: {
{implode from=$aclValues[$objectTypeID][categories] key='__category' item='__categoryName'}
user: {
{if $aclValues[$objectTypeID][user]|isset}
option: {
- {implode from=$aclValues[$objectTypeID][user][option] key='__userID' item='__optionData'}
- {@$__userID}: {
- {implode from=$__optionData key='__optionID' item='__optionValue'}
- {@$__optionID}: {@$__optionValue}
- {/implode}
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][user][option] key='__userID' item='__optionData'}
+ {hascontent}
+ {@$__userID}: {
+ {content}
+ {foreach from=$__optionData key='__optionID' item='__optionValue'}
+ {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {@$__optionValue},
+ {/if}
+ {/foreach}
+ {/content}
+ },
+ {/hascontent}
+ {/foreach}
},
- label: {
- {implode from=$aclValues[$objectTypeID][user][label] key='__userID' item='__label'}
- {@$__userID}: '{@$__label|encodeJS}'
- {/implode}
- }
+ label: { }
{/if}
},
group: {
{if $aclValues[$objectTypeID][group]|isset}
option: {
- {implode from=$aclValues[$objectTypeID][group][option] key='__groupID' item='__optionData'}
- {@$__groupID}: {
- {implode from=$__optionData key='__optionID' item='__optionValue'}
- {@$__optionID}: {@$__optionValue}
- {/implode}
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][group][option] key='__groupID' item='__optionData'}
+ {hascontent}
+ {@$__groupID}: {
+ {content}
+ {foreach from=$__optionData key='__optionID' item='__optionValue'}
+ {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {@$__optionValue},
+ {/if}
+ {/foreach}
+ {/content}
+ },
+ {/hascontent}
+ {/foreach}
},
- label: {
- {implode from=$aclValues[$objectTypeID][group][label] key='__groupID' item='__label'}
- {@$__groupID}: '{@$__label|encodeJS}'
- {/implode}
- }
+ label: { }
{/if}
}
}
};
+
+ {if $aclValues[$objectTypeID][user]|isset}
+ {foreach from=$aclValues[$objectTypeID][user][label] key='__userID' item='__label'}
+ if (initialPermissions.returnValues.user.option[{@$__userID}]) {
+ initialPermissions.returnValues.user.label[{@$__userID}] = '{@$__label|encodeJS}';
+ }
+ {/foreach}
+ {/if}
+
+ {if $aclValues[$objectTypeID][group]|isset}
+ {foreach from=$aclValues[$objectTypeID][group][label] key='__groupID' item='__label'}
+ if (initialPermissions.returnValues.group.option[{@$__groupID}]) {
+ initialPermissions.returnValues.group.label[{@$__groupID}] = '{@$__label|encodeJS}';
+ }
+ {/foreach}
+ {/if}
{/if}
new {if $aclListClassName|isset}{@$aclListClassName}{else}WCF.ACL.List{/if}($('#{@$containerID}'), {@$objectTypeID}, {if $categoryName|isset}'{@$categoryName}'{else}null{/if}, {if $objectID|isset}{@$objectID}{else}0{/if}, {if !$includeUserGroups|isset || $includeUserGroups}true{else}false{/if}{if $aclValues[$objectTypeID]|isset}, initialPermissions{/if});
});
//]]>
-</script>
\ No newline at end of file
+</script>
+{if $categoryName|isset && $categoryName|substr:-2 == '.*'}
+ {assign var='__categoryNameStart' value=$categoryName|substr:0:-1}
+{/if}
<script data-relocate="true">
//<![CDATA[
$(function() {
var initialPermissions = {
returnValues: {
options: {
- {implode from=$aclValues[$objectTypeID][options] key='__optionID' item='__optionData'}
- {@$__optionID}: {
- categoryName: '{@$__optionData[categoryName]|encodeJS}',
- label: '{@$__optionData[label]|encodeJS}',
- optionName: '{@$__optionData[optionName]|encodeJS}'
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][options] key='__optionID' item='__optionData'}
+ {assign var='__optionCategoryName' value=$__optionData[categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {
+ categoryName: '{@$__optionData[categoryName]|encodeJS}',
+ label: '{@$__optionData[label]|encodeJS}',
+ optionName: '{@$__optionData[optionName]|encodeJS}'
+ },
+ {/if}
+ {/foreach}
},
categories: {
{implode from=$aclValues[$objectTypeID][categories] key='__category' item='__categoryName'}
user: {
{if $aclValues[$objectTypeID][user]|isset}
option: {
- {implode from=$aclValues[$objectTypeID][user][option] key='__userID' item='__optionData'}
- {@$__userID}: {
- {implode from=$__optionData key='__optionID' item='__optionValue'}
- {@$__optionID}: {@$__optionValue}
- {/implode}
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][user][option] key='__userID' item='__optionData'}
+ {hascontent}
+ {@$__userID}: {
+ {content}
+ {foreach from=$__optionData key='__optionID' item='__optionValue'}
+ {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {@$__optionValue},
+ {/if}
+ {/foreach}
+ {/content}
+ },
+ {/hascontent}
+ {/foreach}
},
- label: {
- {implode from=$aclValues[$objectTypeID][user][label] key='__userID' item='__label'}
- {@$__userID}: '{@$__label|encodeJS}'
- {/implode}
- }
+ label: { }
{/if}
},
group: {
{if $aclValues[$objectTypeID][group]|isset}
option: {
- {implode from=$aclValues[$objectTypeID][group][option] key='__groupID' item='__optionData'}
- {@$__groupID}: {
- {implode from=$__optionData key='__optionID' item='__optionValue'}
- {@$__optionID}: {@$__optionValue}
- {/implode}
- }
- {/implode}
+ {foreach from=$aclValues[$objectTypeID][group][option] key='__groupID' item='__optionData'}
+ {hascontent}
+ {@$__groupID}: {
+ {content}
+ {foreach from=$__optionData key='__optionID' item='__optionValue'}
+ {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]}
+
+ {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)}
+ {@$__optionID}: {@$__optionValue},
+ {/if}
+ {/foreach}
+ {/content}
+ },
+ {/hascontent}
+ {/foreach}
},
- label: {
- {implode from=$aclValues[$objectTypeID][group][label] key='__groupID' item='__label'}
- {@$__groupID}: '{@$__label|encodeJS}'
- {/implode}
- }
+ label: { }
{/if}
}
}
};
+
+ {if $aclValues[$objectTypeID][user]|isset}
+ {foreach from=$aclValues[$objectTypeID][user][label] key='__userID' item='__label'}
+ if (initialPermissions.returnValues.user.option[{@$__userID}]) {
+ initialPermissions.returnValues.user.label[{@$__userID}] = '{@$__label|encodeJS}';
+ }
+ {/foreach}
+ {/if}
+
+ {if $aclValues[$objectTypeID][group]|isset}
+ {foreach from=$aclValues[$objectTypeID][group][label] key='__groupID' item='__label'}
+ if (initialPermissions.returnValues.group.option[{@$__groupID}]) {
+ initialPermissions.returnValues.group.label[{@$__groupID}] = '{@$__label|encodeJS}';
+ }
+ {/foreach}
+ {/if}
{/if}
new {if $aclListClassName|isset}{@$aclListClassName}{else}WCF.ACL.List{/if}($('#{@$containerID}'), {@$objectTypeID}, {if $categoryName|isset}'{@$categoryName}'{else}null{/if}, {if $objectID|isset}{@$objectID}{else}0{/if}, {if !$includeUserGroups|isset || $includeUserGroups}true{else}false{/if}{if $aclValues[$objectTypeID]|isset}, initialPermissions{/if});
});
//]]>
-</script>
\ No newline at end of file
+</script>
/**
* Namespace for ACL
*/
-WCF.ACL = {};
+WCF.ACL = { };
/**
* ACL support for WCF
if (includeUserGroups === undefined) {
includeUserGroups = true;
}
+ this._values = {
+ group: { },
+ user: { }
+ };
this._proxy = new WCF.Action.Proxy({
showLoadingOverlay: false,
});
if ($type == 'deny') {
if (this._containerElements.denyAll !== null) {
- if ($allChecked) this._containerElements.denyAll.prop('checked', true)
+ if ($allChecked) this._containerElements.denyAll.prop('checked', true);
else this._containerElements.denyAll.prop('checked', false);
}
}
else {
if (this._containerElements.grantAll !== null) {
- if ($allChecked) this._containerElements.grantAll.prop('checked', true)
+ if ($allChecked) this._containerElements.grantAll.prop('checked', true);
else this._containerElements.grantAll.prop('checked', false);
}
}
_savePermissions: function() {
// get active object
var $activeObject = this._containerElements.aclList.find('li.active');
+ if (!$activeObject.length) {
+ return;
+ }
+
var $objectID = $activeObject.data('objectID');
var $type = $activeObject.data('type');
+ // clear old values
+ this._values[$type][$objectID] = { };
+
var self = this;
this._containerElements.permissionList.find("input[type='checkbox']").each(function(index, checkbox) {
var $checkbox = $(checkbox);
var $optionID = $checkbox.data('optionID');
if ($checkbox.is(':checked')) {
- if (!self._values[$type][$objectID]) {
- self._values[$type][$objectID] = { };
- }
-
// store value
self._values[$type][$objectID][$optionID] = $optionValue;