<#macro dictionaryTree dictionaryId inputName parentValue depth values>
<#if depth gt 0>
    <@cms.dictionaryDataList dictionaryId=dictionaryId parentValue=parentValue>
        <#if list?has_content>
        <ul>
            <#list list as d>
                <li>
                    <a tname="${inputName}" tvalue="${d.id.value}"${(values?has_content&&values?seq_contains(d.id.value))?then(' checked="true"','')?no_esc}>${d.text}</a>
                    <@dictionaryTree dictionaryId=dictionaryId inputName=inputName parentValue=d.id.value depth=depth-1 values=values/>
                </li>
            </#list>
        </ul>
        </#if>
    </@cms.dictionaryDataList>
</#if>
</#macro>
<@cms.dictionaryExcludeValue dictionaryId=id excludeDictionaryId=excludeDictionaryId value=value><#assign a=object/></@cms.dictionaryExcludeValue>
<#if !a?has_content><@cms.dictionaryExcludeValue dictionaryId=id excludeDictionaryId=excludeDictionaryId value=parentValue><#assign a=object/></@cms.dictionaryExcludeValue></#if>
<form method="post" autocomplete="off" action="cmsDictionaryExcludeValue/save?callbackType=closeCurrent&navTabId=cmsDictionary/excludeTree" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <div class="formBar card">
        <ul>
            <li><button type="submit" class="buttonActive" title="ctrl+s"><@t.page 'button.save'/></button></li>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
    <div class="card">
        <div class="pageFormContent" layoutH>
            <dl class="nowrap">
                <dt><@t.page 'dictionary'/>:</dt>
                <dd>
                    <@cms.dictionary id=id;dictionary>${dictionary.name!}</@cms.dictionary>
                    <input name="id.dictionaryId" type="hidden" value="${id!}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt><@t.page 'value'/>:</dt>
                <dd>
                    ${value!}:<@cms.dictionaryData dictionaryId=id value=value>${object.text}</@cms.dictionaryData>
                    <input name="id.value" type="hidden" value="${value!}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt><@t.page 'dictionary.exclude'/>:</dt>
                <dd>
                    <@cms.dictionary id=excludeDictionaryId;exclude>${exclude.name!}</@cms.dictionary>
                    <input name="id.excludeDictionaryId" type="hidden" value="${excludeDictionaryId!}"/>
                </dd>
            </dl>
            <fieldset>
                <legend><@t.page 'dictionary.exclude_value'/></legend>
                <ul class="tree treeFolder treeCheck excludeParent expand">
                <#assign values=((a.excludeValues)!'')?split(',')/>
                <@cms.dictionary id=id;dictionary>
                    <li>
                        <a tname="excludeValues" tvalue="">${dictionary.name}</a>
                        <ul>
                    <@cms.dictionaryDataList dictionaryId=excludeDictionaryId>
                        <#list list as d>
                            <li>
                                <a tname="excludeValues" tvalue="${d.id.value}" ${(values?has_content&&values?seq_contains(d.id.value))?then(' checked="true"','')?no_esc}>${d.text}</a>
                                <@dictionaryTree dictionaryId=excludeDictionaryId inputName='excludeValues' parentValue=d.id.value depth=dictionary.childDepth values=values/>
                            </li>
                        </#list>
                    </@cms.dictionaryDataList>
                        </ul>
                    </li>
                </@cms.dictionary>
                </ul>
            </fieldset>
        </div>
    </div>
</form>
