<@tools.metadata path=path><#assign metadata=object/></@tools.metadata>
<form method="post" autocomplete="off" action="cmsPage/save?rel=${rel!'pageBox'}" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
    <input type="hidden" name="_csrf" value="<@tools.csrfToken admin=true/>"/>
    <input type="hidden" name="type" value="page"/>
    <div class="formBar card">
        <ul>
            <li>
                <@sys.authorized roleIds=admin.roles url='cmsTemplate/list'>
                    <li><a class="button" href="cmsTemplate/list.html?path=${(path?url)!}" target="navTab" rel="cmsTemplate/list"><@t.page 'template.content'/></a></li>
                    <li><a class="button" href="cmsTemplate/list.html?path=${(path?url)!}&editType=metadata" target="navTab" rel="cmsTemplate/list"><@t.page 'metadata'/></a></li>
                </@sys.authorized>
                <#if (metadata.extendList)?has_content><li><button type="submit" class="buttonActive" title="ctrl+s" lock-url="common/lock?itemType=page&itemId=${path}" close-url="common/unlock?itemType=page&itemId=${path}"><@t.page 'button.save'/></button></li></#if>
            </li>
        </ul>
    </div>
    <div class="card">
        <div class="pageFormContent" layoutH>
            <input name="path" type="hidden" value="${path}"/>
            <#if site.useStatic&&(metadata.publishPath)?has_content>
                <dl class="nowrap">
                    <dt><@t.page 'static_page'/>:</dt>
                    <dd>
                        <a class="button" href="cmsTemplate/publish?path=${path}&_csrf=<@tools.csrfToken admin=true/>" target="ajaxTodo"><@t.page 'publish_page'/></a>
                        <a class="button" href="cmsDiy/preview.html?url=${(site.sitePath+metadata.publishPath)?url}" target="navTab" rel="cmsDiy/preview" title="<@t.page 'diy.preview'/>"><@t.page 'button.view_page'/></a>
                        <a class="button" href="${site.sitePath+metadata.publishPath?url_path}" target="_blank"><i class="icon-external-link"></i></a>
                    </dd>
                </dl>
            </#if>
            <#if !metadata?has_content||metadata.useDynamic?has_content&&metadata.useDynamic>
                <dl class="nowrap">
                    <dt><@t.page 'dynamic_page'/>:</dt>
                    <dd>
                        <a class="button" href="cmsDiy/preview.html?url=${(site.dynamicPath+path)?url}<#if metadata.acceptParameters?has_content>%3F<#list metadata.acceptParameters?split(',') as p>${p}=<#if 'content'=(metadata.parameterTypeMap[p].type)!><@cms.contentList pageSize=1><#list page.list as a>${a.id}</#list></@cms.contentList><#elseif 'category'=(metadata.parameterTypeMap[p].type)!><@cms.categoryList pageSize=1><#list page.list as a>${a.id}</#list></@cms.categoryList></#if><#sep>%26</#list></#if>" target="navTab" rel="cmsDiy/preview" title="<@t.page 'diy.preview'/>"><@t.page 'button.view_page'/></a>
                        <a class="button" href="${site.dynamicPath+path?url_path}<#if metadata.acceptParameters?has_content>?<#list metadata.acceptParameters?split(',') as p>${p}=<#if 'content'=(metadata.parameterTypeMap[p].type)!><@cms.contentList pageSize=1><#list page.list as a>${a.id}</#list></@cms.contentList><#elseif 'category'=(metadata.parameterTypeMap[p].type)!><@cms.categoryList pageSize=1><#list page.list as a>${a.id}</#list></@cms.categoryList></#if><#sep>&</#list></#if>" target="_blank"><i class="icon-external-link"></i></a>
                        <#if 0 lte (metadata.cacheTime)!0>
                            <a class="button" href="cmsPage/clearCache?path=${path}&_csrf=<@tools.csrfToken admin=true/>" target="ajaxTodo"><@t.page 'button.clear_cache'/></a>
                        </#if>
                    </dd>
                </dl>
            </#if>
        <@tools.templateRegionList path=path>
            <#if list?has_content>
            <dl class="nowrap">
                <dt><@t.page 'diy'/>:</dt>
                <dd>
                    <#list list as a>
                        <@tools.diyMetadata itemType='region' itemId=a>
                            <a href="cmsPage/diy.html?id=${(object.id?url)!}" target="navTab" class="button" rel="cmsPage/diy" title="<@t.page 'diy'/>"><i class='bi bi-palette'></i>${(object.name)!}</a>
                        </@tools.diyMetadata>
                    </#list>
                </dd>
            </dl>
            </#if>
        </@tools.templateRegionList>
        <@tools.templatePlaceList path=path>
            <#if list?has_content>
            <dl class="nowrap">
                <dt><@t.page 'place'/>:</dt>
                <dd>
                    <#list list as a>
                        <@tools.placeMetadata path=a>
                        <#if (object.metadataExtendList)?has_content || 0 gte ((object.size)!0)>
                            <a href="cmsPlace/metadata.html?path=${a?url}" target="ajax" class="button" rel="${rel!'pageBox'}"><i class="bi bi-layout-sidebar"></i>${(object.alias)!a}</a>
                        </#if>
                        <#if 0 lt ((object.size)!0)>
                            <a href="cmsPlace/dataList.html?path=${a?url}" target="navTab" class="button" rel="cmsPlace/dataList"><i class="bi bi-layout-text-sidebar-reverse"></i><@t.page 'place_data'/>:${(object.alias)!a}(${object.size})</a>
                        </#if>
                        </@tools.placeMetadata>
                    </#list>
                </dd>
            </dl>
            </#if>
        </@tools.templatePlaceList>
            <#include "../include_page/extendData.html"/>
            <@extendData extendList=metadata.extendList extendValues=metadata.extendData historyItemType='metadataExtend' historyItemId=path/>
        </div>
    </div>
</form>