<@cms.categoryList advanced=true parentId=parentId allowContribute=allowContribute pageIndex=pageNum pageSize=numPerPage>
<@sys.authorized roleIds=admin.roles urls='cmsCategory/add,cmsCategory/delete,cmsCategory/publish,cmsCategory/rebuildChildIds,cmsCategory/batchPublish,cmsCategory/seo,cmsCategory/batchCopy,cmsCategory/export,cmsCategory/import,cmsCategory/contributeForm,cmsCategory/static,cmsCategory/moveParameters,cmsCategory/changeTypeParameters,cmsCategory/publishParameters,cmsPlace/push'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageHeader card">
    <form autocomplete="off" class="pagerForm" action="cmsCategory/category_list.html" onsubmit="return divSearch(this,'categoryBox');" method="post">
        <#include "../include_page/parameters.html"/>
        <input name="parentId" type="hidden" value="${parentId!}"/>
        <input name="lang" type="hidden" value="${lang!}"/>
        <div class="searchBar">
            <ul class="searchContent">
                <#if parentId?has_content>
                <li>
                    <label><@t.page 'category.parent'/>:</label><label><@cms.category id=parentId;parent>${parent.name}</@cms.category></label>
                </li>
                </#if>
                <li>
                    <select class="combox" name="allowContribute">
                        <option value><@t.page 'contribute'/></option>
                        <option value="true"${(allowContribute?has_content&&"true"=allowContribute)?then(' selected="true"','')?no_esc}><@t.page 'allow_contribute'/></option>
                        <option value="false"${(allowContribute?has_content&&"false"=allowContribute)?then(' selected="true"','')?no_esc}><@t.page 'forbid_contribute'/></option>
                    </select>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                    <#if authorizedMap['cmsCategory/export']>
                        <li>
                            <a class="button" href="cmsCategory/export?_csrf=<@tools.csrfToken admin=true/>" target="dwzExport" targetType="navTab"><i class="bi bi-cloud-download"></i><@t.page "button.export"/></a>
                        </li>
                    </#if>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
<#if authorizedMap['cmsCategory/add']>
            <li>
                <a href="cmsCategory/add.html?parentId=${parentId!}" class="addMore" target="navTab" rel="cmsCategory/add"><i class="icon-double-angle-down icon-large"></i><#if parentId?has_content><@t.page 'category.add_child'/><#else><@t.page 'category.add'/></#if></a>
                <ul>
    <@cms.categoryTypeList pageSize=10>
            <li><a href="cmsCategory/add.html?parentId=${parentId!}" target="navTab" rel="cmsCategory/add"><i class="bi bi-plus-circle-dotted"></i><#if parentId?has_content><@t.page 'category.add_child'/><#else><@t.page 'category.add'/></#if></a></li>
        <#list page.list as a>
            <li><a href="cmsCategory/add.html?parentId=${parentId!}&typeId=${a.id}" target="navTab" rel="cmsCategory/add"><i class="bi bi-plus-circle-dotted"></i><@t.page 'button.add_some_things' a.name/></a></li>
        </#list>
        <#if page.totalCount gt 10>
            <li><a href="cmsCategory/addMore.html?parentId=${parentId!}" target="dialog" mask="true"><i class="bi bi-plus-circle-dotted"></i><@t.page 'category.add_more'/></a></li>
        </#if>
    </@cms.categoryTypeList>
                </ul>
            </li>
            <li class="line">line</li>
</#if>
        <#if authorizedMap['cmsCategory/publish']>
            <li><a href="cmsCategory/publish?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_publish'/>" target="selectedTodo" rel="ids"><i class="icon-file-text-alt icon-large"></i><@t.page 'button.batch_publish'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/moveParameters']>
            <li><a href="cmsCategory/moveParameters.html" target="dialog" mask="true"><i class="icon-move icon-large"></i><@t.page 'button.batch_move'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/batchPublish']>
            <li><a href="cmsCategory/batchPublish?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.do'/>" target="selectedTodo" rel="ids"><i class="icon-file-text-alt icon-large"></i><@t.page 'button.batch_publish_content'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/delete']>
            <li class="line">line</li>
            <li><a href="cmsCategory/delete?_csrf=<@tools.csrfToken admin=true/>&rel=page&navTabId=cmsCategory/list" title="<@t.page 'confirm.batch_delete'/>" target="selectedTodo" rel="ids"><i class="icon-trash icon-large"></i><@t.page 'button.batch_delete'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/rebuildChildIds']>
            <li class="line">line</li>
            <li><a href="cmsCategory/rebuildChildIds?_csrf=<@tools.csrfToken admin=true/>&rel=page&navTabId=cmsCategory/list" title="<@t.page 'confirm.do'/>" target="ajaxTodo"><i class="icon-refresh icon-large"></i><@t.page 'button.rebuild_childs'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/seo']>
            <li><a href="cmsCategory/seo.html" target="navTab" rel="cmsCategory/seo"><i class="bi bi-search-heart"></i><@t.page 'button.batch_seo'/></a></li>
        </#if>
        <#if authorizedMap['cmsCategory/import']>
            <li><a href="cmsCategory/import.html" target="dialog" mask="true" width="500" height="250"><i class="bi bi-cloud-upload"></i><@t.page "import"/></a></li>
        </#if>
        </ul>
    </div>
    <table class="table" width="100%" layoutH targetType="ajax" rel="categoryBox">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="30"><@t.page 'id'/></th>
                <th><@t.page 'code'/></th>
                <th width="130"><@t.page 'name'/></th>
                <th><@t.page 'category_type'/></th>
                <th><@t.page 'category.parent'/></th>
                <th><@t.page 'category.page_size'/></th>
                <th><@t.page 'contribute'/></th>
                <th><@t.page 'display'/></th>
                <th><@t.page 'sort'/></th>
                <th width="250"><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'parentIds' a.parentId!/>
                <@t.merge 'typeIds' a.typeId!/>
                <@t.merge 'ids' a.id/>
            </#list>
            <@sys.lock userId=admin.id itemType='category' itemIds=t.ids><#assign lockMap=map!/></@sys.lock>
            <#if lockMap?has_content>
                <#list lockMap as k,lock>
                    <#if lock.userId?has_content><@t.merge 'userIds' lock.userId/></#if>
                </#list>
            </#if>
            <@sys.user ids=t.userIds><#assign userMap=map!/></@sys.user>
            <@cms.category ids=t.parentIds!><#assign parentMap=map!/></@cms.category>
            <@cms.categoryType ids=t.typeIds!><#assign typeMap=map!/></@cms.categoryType>
            <#list page.list as a>
            <tr>
                <td><input name="ids" value="${a.id}" type="checkbox"></td>
                <td>${a.id!}</td>
                <td>
                    <span class="exclude-translate">${a.code!}</span>
                    <br/>
                    <a href="cmsCategory/category_list.html?parentId=${a.id}&lang=${lang!}" target="ajax" rel="categoryBox"><@t.page 'category.child_management'/></a>
                </td>
                <td>
                    <#if lockMap?has_content && lockMap[a.id?string]?has_content>
                        <#assign lockUser=(userMap[lockMap[a.id?string].userId?string].nickname)!''/>
                        <i class="icon-lock icon-large" title="<@t.page 'lock.message' lockUser/> ${lockMap[a.id?string].createDate}"></i>
                    </#if>
                    <a class="exclude-translate" href="cmsDiy/preview.html?url=${((a.url)?url)!}" target="navTab" rel="cmsDiy/preview" title="<@t.page 'diy.preview'/>">${(a.name)!}</a>
                    <a href="${a.url!}" target="_blank"><i class="icon-external-link"></i></a>
                    ${(a.onlyUrl?then('['+t.pageMessage('url')+']',''))!}
                </td>
                <td>
                    <span class="exclude-translate">${(typeMap[a.typeId?string].name)!}</span>
                    <#if authorizedMap['cmsCategory/changeTypeParameters']>
                        <#if a.typeId?has_content><br/></#if>
                        <a href="cmsCategory/changeTypeParameters.html?id=${a.id}" class="btnText blue" target="dialog" mask="true"><@t.page 'category.change_type'/></a>
                    </#if>
                </td>
                <td class="exclude-translate">${(parentMap[a.parentId?string].name)!}</td>
                <td><#if !a.onlyUrl>${a.pageSize!}${(a.containChild?then('['+t.pageMessage('category.contain_child')+']',''))!}</#if></td>
                <td>
                    <#if a.allowContribute>
                        <#if authorizedMap['cmsCategory/contributeForm']>
                    <a href="cmsCategory/contributeForm.html?categoryId=${a.id}" target="dialog" mask="true" width="1200" height="580" title="<@t.page 'help.contribute_form'/>"><@t.page 'allow_contribute'/></a>
                        <#else>
                    <@t.page 'allow_contribute'/>
                        </#if>
                    </#if>
                </td>
                <td><span class="statusText ${a.hidden?then('red','green')}">${t.pageMessage(a.hidden?then('hidden','show'))}</span></td>
                <td>${a.sort!}</td>
                <td class="wrap">
                <#if authorizedMap['cmsCategory/add']>
                    <a href="<#if lang?has_content && lang != siteAttribute.default_language!>cmsCategory/addLang.html?id=${a.id}&showTab=${lang!}<#else>cmsCategory/add.html?id=${a.id}</#if>" class="edit btnText blue" target="navTab" rel="cmsCategory/edit"><i class="icon-edit"></i><@t.page 'category.edit'/></a>
                    <a href="cmsCategory/add.html?copyId=${a.id}" class="btnText blue" target="navTab" rel="cmsCategory/add" title="<@t.page 'category.add'/>"><i class="icon-copy"></i><@t.page 'button.copy'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/publishParameters']&&site.useStatic&&!a.onlyUrl>
                    <a href="cmsCategory/publishParameters.html?id=${a.id}&pageSize=${a.pageSize}&containChild=${a.containChild?then('true','false')}" class="btnText blue" target="dialog" width="450" height="180" mask="true"><@t.page 'button.publish'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/batchCopy']>
                    <a href="cmsCategory/batchCopy.html?id=${a.id}" class="btnText blue" target="navTab" rel="cmsCategory/batchCopy"><i class="bi bi-files"></i><@t.page 'button.batch_copy'/></a>
                </#if>
                <#if authorizedMap['cmsCategory/export']>
                    <a href="cmsCategory/export?id=${a.id}&_csrf=<@tools.csrfToken admin=true/>" class="btnText" target="_blank"><i class="bi bi-cloud-download"></i><@t.page "button.export"/></a>
                </#if>
                <#if authorizedMap['cmsPlace/push']>
                    <a href="cmsPlace/push.html?itemType=category&itemId=${a.id}&lang=${lang!}" class="btnText blue" target="dialog" mask="true"><@t.page 'button.push'/></a>
                </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='categoryBox'/>
    <#include "../include_page/page.html"/>
</div>
</@cms.categoryList>