<@_model id=id>
    <#assign a=object/>
    <#if (object.parentId)??><#assign parentId=object.parentId/></#if>
</@_model>
<form method="post" autocomplete="off" action="cmsModel/save?callbackType=closeCurrent&navTabId=cmsModel/list" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
    <input name="modelId" type="hidden" value="${id!}" />
    <input name="parentId" type="hidden" value="${parentId!}" />
    <input type="hidden" name="_csrf" value="<@_csrfToken admin=true/>"/>
    <div class="formBar">
        <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"><@t.page 'button.save'/></button></li>
        </#if>
            <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
    <div class="pageFormContent" layoutH>
        <fieldset>
            <legend><@t.page 'base_info'/></legend>
            <dl class="nowrap">
                <dt><@t.page 'id'/>:</dt>
                <dd>
                    <input class="required" name="id" type="text" maxlength="20" size="20" value="${(a.id)!}"/>
                    <label><input name="onlyUrl" type="checkbox"/><@t.page 'url'/></label>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt><@t.page 'name'/>:</dt>
                <dd>
                    <input class="required" name="name" type="text" maxlength="20" size="20" value="${(a.name)!}"/>
                </dd>
            </dl>
        <#if site.useStatic>
            <dl class="onlyUrl nowrap">
                <dt><@t.page 'template_path'/>:</dt>
                <dd>
                    <input name="templatePath" type="text" autocomplete="on" maxlength="200" size="30" value="${(a.templatePath)!}"/>
                    <a class="btnLook" href="cmsTemplate/lookup.html?field=templatePath" lookupGroup=""><@t.page 'template.select'/></a>
                    <span class="info"><@t.page 'model.template_path.description'/></span>
                </dd>
            </dl>
        </#if>
        </fieldset>
        <fieldset class="systemField">
            <legend><@t.page 'content.system_field'/></legend>
            <div class="unit">
                <p><label><input name="hasChild" type="checkbox"/><@t.page 'model.has_child'/></label></p>
                <p><label><input name="hasImages" type="checkbox"/><@t.page 'model.has_images'/></label></p>
                <p><label><input name="hasFiles" type="checkbox"/><@t.page 'model.has_attachs'/></label></p>
                <p><label><input name="hasProducts" type="checkbox"/><@t.page 'model.has_products'/></label></p>
            </div>
            <div class="divider"></div>
            <dl class="nowrap">
                <dt>
                    <label><@t.page 'field.title'/>(title):</label>
                </dt>
                <dd>
                    <input name="fieldTextMap[title]" class="required" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['title'])!t.pageMessage('title')}"/>
                </dd>
            </dl>
            <dl class="nowrap urlText hide">
                <dt>
                    <label><@t.page 'field.url_text'/>(url):</label>
                </dt>
                <dd>
                    <input name="fieldTextMap[url]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['url'])!t.pageMessage('url')}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="copied"/><@t.page 'copied'/>(copied)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[copied]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['copied'])!t.pageMessage('copied')}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="tag"/><@t.page 'tag'/>(tag)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[tag]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['tag'])!t.pageMessage('tag')}"/>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="author"/><@t.page 'content.author'/>(author)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[author]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['author'])!t.pageMessage('content.author')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="author"/><@t.page 'required'/></label>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="editor"/><@t.page 'editor'/>(editor)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[editor]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['editor'])!t.pageMessage('editor')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="editor"/><@t.page 'required'/></label>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="description"/><@t.page 'description'/>(description)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[description]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['description'])!t.pageMessage('description')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="description"/><@t.page 'required'/></label>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="cover"/><@t.page 'cover'/>(cover)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label>
                    <input name="fieldTextMap[cover]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['cover'])!t.pageMessage('cover')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="cover"/><@t.page 'required'/></label>
                </dd>
            </dl>
        </fieldset>
        <fieldset class="systemField">
            <legend><@t.page 'extend_field'/></legend>
            <dl class="nowrap copied">
                <dt>
                    <label><@t.page 'content.source'/></label>
                </dt>
                <dd>
                    <label><@t.page 'field.source'/>(source):</label>
                    <input name="fieldTextMap[source]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['source'])!t.pageMessage('content.source')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="source"/><@t.page 'required'/></label>
                    <label><@t.page 'field.source_url'/>(sourceUrl):</label>
                    <input name="fieldTextMap[sourceUrl]" type="text" maxlength="20" size="10" value="${(a.fieldTextMap['sourceUrl'])!t.pageMessage('content.source_url')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="sourceUrl"/><@t.page 'required'/></label>
                </dd>
            </dl>
            <dl class="nowrap">
                <dt>
                    <label><input name="fieldList" type="checkbox" value="content"/><@t.page 'content.text'/>(text)</label>
                </dt>
                <dd>
                    <label><@t.page 'text'/>:</label><input name="fieldTextMap[content]" type="text" autocomplete="on" maxlength="20" size="10" value="${(a.fieldTextMap['content'])!t.pageMessage('content.text')}"/>
                    <label><input name="requiredFieldList" type="checkbox" value="content"/><@t.page 'required'/></label>
                    <label><input name="searchable" type="checkbox" ${(!a?has_content||a.searchable)?then(' checked="true"','')?no_esc}/><@t.page 'searchable'/></label>
                    <label><@t.page 'editor_type'/>:</label>
                    <#assign editorTypes={'ueditor':t.pageMessage('ueditor'),'ckeditor':t.pageMessage('ckeditor'),'kindeditor':t.pageMessage('kindeditor')}/>
                    <select class="combox" name="editorType">
                        <#list editorTypes as k,v>
                        <option value="${k}"${(k=(a.editorType)!)?then(' selected="true"','')?no_esc}>${v}</option>
                        </#list>
                    </select>
                </dd>
            </dl>
        </fieldset>
        <script>
            $('.systemField dt [type=checkbox]',navTab.getCurrentPanel()).each(function(){
                var box = $(this).parent().parent().parent();
                box.find('dd').hide();
                $('.copied',navTab.getCurrentPanel()).hide();
                $(this).click(function(){
                    if( $(this).is(':checked') ) {
                        box.find('dd').show().find('input[type=text]').addClass('required');
                        if("copied"==$(this).val()){
                            $('.copied',navTab.getCurrentPanel()).show().find('input[type=text]').addClass('required');
                        }
                    } else {
                        box.find('dd').hide().find('input[type=text]').removeClass('required').val('');
                        if("copied"==$(this).val()){
                            $('.copied',navTab.getCurrentPanel()).hide().find('input[type=text]').removeClass('required');
                        }
                    }
                });
            });
            $('input[name=onlyUrl]',navTab.getCurrentPanel()).click(function(){
                if($(this).is(':checked')) {
                    $('.onlyUrl',navTab.getCurrentPanel()).hide();
                    $('.onlyUrl input[type=text]',navTab.getCurrentPanel()).val('');
                    $('.urlText',navTab.getCurrentPanel()).show();
                    $('.urlText input[type=text]',navTab.getCurrentPanel()).addClass('required');
                } else {
                    $('.onlyUrl',navTab.getCurrentPanel()).show();
                    $('.urlText',navTab.getCurrentPanel()).hide();
                    $('.urlText input[type=text]',navTab.getCurrentPanel()).removeClass('required').val('');
                }
            });
            <#if a?has_content>
                <#if a.onlyUrl>
                $('input[name=onlyUrl]',navTab.getCurrentPanel()).click();
                </#if>
                <#if a.hasChild>
                    $('input[name=hasChild]',navTab.getCurrentPanel()).click();
                </#if>
                <#if a.hasImages>
                    $('input[name=hasImages]',navTab.getCurrentPanel()).click();
                </#if>
                <#if a.hasFiles>
                    $('input[name=hasFiles]',navTab.getCurrentPanel()).click();
                </#if>
                <#if a.hasProducts>
                    $('input[name=hasProducts]',navTab.getCurrentPanel()).click();
                </#if>

                <#if a.fieldList?has_content>
                    <#list a.fieldList as field>
                        $('input[name=fieldList][value=${field}]',navTab.getCurrentPanel()).click();
                    </#list>
                </#if>
                <#if a.requiredFieldList?has_content>
                    <#list a.requiredFieldList as field>
                        $('input[name=requiredFieldList][value=${field}]',navTab.getCurrentPanel()).click();
                    </#list>
                </#if>
            </#if>
        </script>
<#assign contentExtendList=(a.extendList)![]>
        <fieldset>
            <legend><@t.page 'content.extend_field'/>(<@t.page 'extend_field.invalid'/>:source,sourceUrl,text)(<@t.page 'metadata.default_value_description'/>)</legend>
            <#include "../include_page/extends.html"/>
            <@extends 'extendList' contentExtendList true/>
        </fieldset>
    </div>
</form>