<@cms.dictionary id=id><#assign a=object/></@cms.dictionary>
<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/>"/>
    <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 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>
                            <th type="text" name="dataList[#index#].text" size="50" fieldAttrs='{"maxlength":100}'><@t.page 'text'/></th>
                            <th type="text" name="dataList[#index#].sort" fieldClass="required digits" defaultval="#index#" size="5"><@t.page 'sort'/></th>
                            <th type="del" 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>
                                <td>
                                    <input type="text" name="dataList[${d?index}].text" value="${d.text}" size="50" maxlength="100"/>
                                </td>
                                <td>
                                    <input type="number" name="dataList[${d?index}].sort" class="required digits" value="${d.sort!}" size="5" maxlength="5"/>
                                </td>
                                <td>
                                    <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>