Commit | Line | Data |
---|---|---|
97f28da5 MS |
1 | {if $categoryName|isset && $categoryName|substr:-2 == '.*'} |
2 | {assign var='__categoryNameStart' value=$categoryName|substr:0:-1} | |
3 | {/if} | |
9543d9fe | 4 | <script data-relocate="true"> |
092bdf82 AE |
5 | $(function() { |
6 | {if $aclValues[$objectTypeID]|isset} | |
0f0590c2 | 7 | var initialPermissions = { |
092bdf82 AE |
8 | returnValues: { |
9 | options: { | |
97f28da5 MS |
10 | {foreach from=$aclValues[$objectTypeID][options] key='__optionID' item='__optionData'} |
11 | {assign var='__optionCategoryName' value=$__optionData[categoryName]} | |
12 | ||
13 | {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)} | |
14 | {@$__optionID}: { | |
15 | categoryName: '{@$__optionData[categoryName]|encodeJS}', | |
16 | label: '{@$__optionData[label]|encodeJS}', | |
17 | optionName: '{@$__optionData[optionName]|encodeJS}' | |
18 | }, | |
19 | {/if} | |
20 | {/foreach} | |
092bdf82 AE |
21 | }, |
22 | categories: { | |
23 | {implode from=$aclValues[$objectTypeID][categories] key='__category' item='__categoryName'} | |
24 | '{@$__category|encodeJS}': '{@$__categoryName|encodeJS}' | |
25 | {/implode} | |
26 | }, | |
27 | user: { | |
28 | {if $aclValues[$objectTypeID][user]|isset} | |
29 | option: { | |
97f28da5 MS |
30 | {foreach from=$aclValues[$objectTypeID][user][option] key='__userID' item='__optionData'} |
31 | {hascontent} | |
32 | {@$__userID}: { | |
33 | {content} | |
34 | {foreach from=$__optionData key='__optionID' item='__optionValue'} | |
35 | {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]} | |
36 | ||
37 | {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)} | |
38 | {@$__optionID}: {@$__optionValue}, | |
39 | {/if} | |
40 | {/foreach} | |
41 | {/content} | |
42 | }, | |
43 | {/hascontent} | |
44 | {/foreach} | |
092bdf82 | 45 | }, |
97f28da5 | 46 | label: { } |
092bdf82 AE |
47 | {/if} |
48 | }, | |
49 | group: { | |
50 | {if $aclValues[$objectTypeID][group]|isset} | |
51 | option: { | |
97f28da5 MS |
52 | {foreach from=$aclValues[$objectTypeID][group][option] key='__groupID' item='__optionData'} |
53 | {hascontent} | |
54 | {@$__groupID}: { | |
55 | {content} | |
56 | {foreach from=$__optionData key='__optionID' item='__optionValue'} | |
57 | {assign var='__optionCategoryName' value=$aclValues[$objectTypeID][options][$__optionID][categoryName]} | |
58 | ||
59 | {if !$categoryName|isset || ($__categoryNameStart|isset && $__optionCategoryName|strpos:$__categoryNameStart === 0) || (!$__categoryNameStart|isset && $__optionCategoryName == $categoryName)} | |
60 | {@$__optionID}: {@$__optionValue}, | |
61 | {/if} | |
62 | {/foreach} | |
63 | {/content} | |
64 | }, | |
65 | {/hascontent} | |
66 | {/foreach} | |
092bdf82 | 67 | }, |
97f28da5 | 68 | label: { } |
092bdf82 AE |
69 | {/if} |
70 | } | |
71 | } | |
72 | }; | |
97f28da5 MS |
73 | |
74 | {if $aclValues[$objectTypeID][user]|isset} | |
75 | {foreach from=$aclValues[$objectTypeID][user][label] key='__userID' item='__label'} | |
76 | if (initialPermissions.returnValues.user.option[{@$__userID}]) { | |
77 | initialPermissions.returnValues.user.label[{@$__userID}] = '{@$__label|encodeJS}'; | |
78 | } | |
79 | {/foreach} | |
80 | {/if} | |
81 | ||
82 | {if $aclValues[$objectTypeID][group]|isset} | |
83 | {foreach from=$aclValues[$objectTypeID][group][label] key='__groupID' item='__label'} | |
84 | if (initialPermissions.returnValues.group.option[{@$__groupID}]) { | |
85 | initialPermissions.returnValues.group.label[{@$__groupID}] = '{@$__label|encodeJS}'; | |
86 | } | |
87 | {/foreach} | |
88 | {/if} | |
092bdf82 | 89 | {/if} |
6cce1152 | 90 | |
7300dd80 MS |
91 | var aclList = new {if $aclListClassName|isset}{@$aclListClassName}{else}WCF.ACL.List{/if}( |
92 | $('#{@$containerID}'), | |
93 | {@$objectTypeID}, | |
94 | {if $categoryName|isset}'{@$categoryName}'{else}null{/if}, | |
95 | {if $objectID|isset}{@$objectID}{else}0{/if}, | |
96 | {if !$includeUserGroups|isset || $includeUserGroups}true{else}false{/if}, | |
97 | {if $aclValues[$objectTypeID]|isset}initialPermissions{else}undefined{/if}, | |
98 | {if $aclValuesFieldName|isset}'{@$aclValuesFieldName}'{else}undefined{/if} | |
99 | ); | |
6cce1152 MS |
100 | |
101 | {if !$aclFormBuilderMode|empty} | |
102 | require(['WoltLabSuite/Core/Form/Builder/Manager'], function(FormBuilderManager) { | |
103 | FormBuilderManager.getField( | |
104 | '{@$field->getDocument()->getId()}', | |
105 | '{@$field->getPrefixedId()}' | |
106 | ).setAclList(aclList); | |
107 | }); | |
108 | {/if} | |
092bdf82 | 109 | }); |
97f28da5 | 110 | </script> |