<@cms.dictionary id=id><#assign a=object/></@cms.dictionary>
<#if 'true'=(siteAttribute.enable_multilingual)!><@cms.languageList><#assign languageList=list/></@cms.languageList></#if>
<form method="post" autocomplete="off" action="cmsDictionary/save?callbackType=closeCurrent&navTabId=cmsDictionary/list" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <#if languageList?has_content>
        <#list languageList as lang>
            <input type="hidden" name="languageList" value="${lang.id.code}"/>
        </#list>
    </#if>
    <div class="formBar card">
        <ul>
        <#if site.parentId?has_content>
            <li><button type="button" class="buttonDisabled"><@t.page 'site.parent_maintain'/></button></li>
        <#else>
            <li><button type="submit" class="buttonActive" title="ctrl+s"><@t.page 'button.save'/></button></li>
        </#if>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
    <div class="card">
        <div class="pageFormContent" layoutH>
        <#if a?has_content && parentValue?has_content>
            <dl class="nowrap">
                <dt><@t.page 'dictionary'/>:</dt>
                <dd>
                    ${a.name!}
                    <input name="id.id" type="hidden" value="${(a.id.id)!}"/>
                </dd>
            </dl>
            <dl>
                <dt><@t.page 'value'/>:</dt>
                <dd>
                    <input name="parentValue" type="hidden" value="${(parentValue)!}"/>${(parentValue)!}
                </dd>
            </dl>
            <dl>
                <dt><@t.page 'text'/>:</dt>
                <dd>
                    <@cms.dictionaryData dictionaryId=id value=parentValue>${(object.text)!}</@cms.dictionaryData>
                </dd>
            </dl>
        <#else>
            <dl class="nowrap">
                <dt><@t.page 'id'/>:</dt>
                <dd>
                    <input name="oldId" type="hidden" value="${(a.id.id)!}"/>
                    <input class="required" name="id.id" remote="cmsDictionary/virify<#if id?has_content>?oldId=${(a.id.id?url)!}</#if>" data-msg-remote="<@t.message 'verify.hasExist.code'/>" type="text" size="20" maxlength="20" value="${(a.id.id)!}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt><@t.page 'name'/>:</dt>
                <dd>
                    <input class="required" name="name" type="text" size="20" maxlength="100" value="${(a.name)!}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt><@t.page 'dictionary.childDepth'/>:</dt>
                <dd>
                    <input class="required" name="childDepth" type="number" size="20" max="5" value="${(a.childDepth)!0}"/>
                </dd>
            </dl>
        </#if>
            <fieldset>
                <legend><@t.page 'value'/></legend>
                <table class="list nowrap sortDrag itemDetail" addButton="<@t.page 'button.new_line'/>" batchButton="<@t.page 'button.batch_create'/>" batchUrl="common/batchCreate2.html?field1=id.value&fieldName1=value&field2=text&fieldName2=text" width="100%">
                    <thead>
                        <tr>
                            <th type="text" name="dataList[#index#].id.value" size="20" fieldClass="required" fieldAttrs='{"maxlength":50,"batchGroup":"dataList[#index#]"}'><@t.page 'value'/></th>
                            <#if languageList?has_content>
                                <#list languageList as lang>
                                    <th type="text" name="dataList[#index#].langdata" size="50" fieldAttrs='{"maxlength":100}'>${(lang.name)!}</th>
                                </#list>
                            <#else>
                                <th type="text" name="dataList[#index#].text" size="50" fieldAttrs='{"maxlength":100}'><@t.page 'text'/></th>
                            </#if>
                            <th type="delAndSort" width="100"><@t.page 'operate'/></th>
                        </tr>
                    </thead>
                    <tbody>
                <#if a?has_content>
                    <@cms.dictionaryDataList dictionaryId=a.id.id parentValue=parentValue>
                        <#list list as d>
                            <tr>
                                <td>
                                    <input type="text" name="dataList[${d?index}].id.value" value="${d.id.value}" size="20" class="required" maxlength="50"/>
                                </td>
                                <#if languageList?has_content>
                                    <#list languageList as lang>
                                        <td>
                                            <input type="text" name="dataList[${d?index}].langdata" value="${d.attribute[lang.id.code]!d.text}" size="50" maxlength="100"/>
                                        </td>
                                    </#list>
                                <#else>
                                    <td>
                                        <input type="text" name="dataList[${d?index}].text" value="${d.text}" size="50" maxlength="100"/>
                                    </td>
                                </#if>
                                <td>
                                    <a href="javascript:;" class="icon-move"></a>
                                    <a href="javascript:void(0)" class="btnDel "><@t.page 'button.delete'/></a>
                                </td>
                            </tr>
                        </#list>
                    </@cms.dictionaryDataList>
                </#if>
                    </tbody>
                </table>
                <span class="info"><@t.page 'dictionary.text.description'/></span>
            </fieldset>
        </div>
    </div>
</form>