<#if parentId?has_content>
    <@cms.content id=parentId>
        <#assign parent=object/>
    </@cms.content>
</#if>
<@cms.contentList advanced=true status=status modelId=modelIds parentId=parentId title=title userId=admin.id
            startPublishDate=startPublishDate endPublishDate=endPublishDate
            orderField=orderField orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<@sys.authorized roleIds=admin.roles urls='cmsContent/add,cmsContent/delete,cmsContent/uncheck,cmsContent/push,cmsContent/refresh,cmsContent/publish,cmsContent/export,cmsComment/list,sysWorkflowProcess/view'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageHeader card">
    <form class="pagerForm" action="myself/contentList.html" autocomplete="off" onsubmit="return navTabSearch(this);" method="post">
        <#include "../include_page/parameters.html"/>
        <input name="parentId" type="hidden" value="${(parent.id)!}"/>
        <input name="userId" type="hidden" value="${(admin.id)!}"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'title'/>:</label><input type="text" size="20" name="title" value="${title!}"/>
                </li>
                <li class="width:auto">
                    <#include "../include_page/contentStatus.html"/>
                </li>
                <li>
                    <label><@t.page 'publish_date'/>:</label>
                    <input type="text" name="startPublishDate" class="date" size="10" autocomplete="off" dateFmt="yyyy-MM-dd" value="${startPublishDate!}"/>
                    <a class="inputDateButton" href="javascript:void(0);"></a>
                    <span>-</span>
                    <input type="text" name="endPublishDate" class="date" size="10" autocomplete="off" dateFmt="yyyy-MM-dd" value="${endPublishDate!}"/>
                    <a class="inputDateButton" href="javascript:void(0);"></a>
                </li>
                <li style="width:auto">
                    <label><@t.page 'model'/>:</label>
                    <#include "../include_page/modelId.html"/>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                <#if authorizedMap['cmsContent/export']>
                    <li>
                        <a class="button" href="cmsContent/export.html" target="dialog" mask="true" width="500" height="250"><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 parent?has_content>
                <li><a href="myself/contentList.html?parentId=${(parent.parentId)!}" target="navTab" data-change-title="false" rel="myself/contentList"><i class="icon-circle-arrow-up icon-large"></i><@t.page 'button.return'/></a></li>
                <li class="line">line</li>
            </#if>
            <#if authorizedMap['cmsContent/uncheck']>
                <li><a href="cmsContent/uncheck?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_uncheck'/>" target="selectedTodo" rel="ids"><i class="icon-check icon-large"></i><@t.page 'button.batch_uncheck'/></a></li>
            </#if>
            <#if authorizedMap['cmsContent/publish']>
                <li><a href="cmsContent/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['cmsContent/delete']>
            <li class="line">line</li>
                <li><a href="cmsContent/delete?_csrf=<@tools.csrfToken admin=true/>" 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>
        </ul>
    </div>
    <table class="table" width="100%" layoutH orderField="${orderField!}" orderType="${orderType!}">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="30"><@t.page 'id'/></th>
                <th width="150"><@t.page 'content'/></th>
                <th width="30" orderField="comments"><@t.page 'content.comments'/></th>
                <th width="30" orderField="clicks"><@t.page 'clicks'/></th>
                <th width="70" orderField="publishDate"><@t.page 'publish_date'/></th>
                <th width="50"><@t.page 'status'/>/<@t.page 'inspector'/></th>
                <th width="70"><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'checkUserIds' a.checkUserId!/>
                <@t.merge 'categoryIds' a.categoryId!/>
                <@t.merge 'modelIds' a.modelId!/>
                <@t.merge 'ids' a.id!/>
            </#list>

            <@sys.user ids=t.checkUserIds!><#assign checkUserMap=map!/></@sys.user>
            <@cms.category ids=t.categoryIds!><#assign categoryMap=map!/></@cms.category>
            <@cms.model ids=t.modelIds!><#assign modelMap=map!/></@cms.model>
            <@sys.workflowProcessItem itemType="content" itemIds=t.ids!><#assign processItemMap=map!/></@sys.workflowProcessItem>

            <#list page.list as a>
                <#assign contentId=(a.quoteContentId?has_content)?then(a.quoteContentId,a.id)/>
            <tr>
                <td><input name="ids" value="${contentId}" type="checkbox"></td>
                <td>${a.id}</td>
                <td class="wrap">
                    <#if a.cover?has_content>
                        <div class="thumbnail">
                            <img src="${(a.cover)!}"/>
                        </div>
                    </#if>
                    <div class="box">
                        <h3>
                            [<span class="exclude-translate">${(categoryMap[a.categoryId?string].name)!}</span>]
                            ${(a.copied?then('['+t.pageMessage('copied')+']',''))!}
                            <a href="cmsContent/view.html?id=${contentId}" class="exclude-translate" target="dialog" width="1200" height="600" rel="viewContent${contentId}">${(a.title)!}</a>                            
                            <#if a.quoteContentId?has_content && !a.parentId?has_content><span class="statusText orange"><@t.page "content.quote"/></span></#if>
                        </h3>
                        <p>
                            <label><@t.page 'model'/>:</label><span class="exclude-translate">${(modelMap[a.modelId].name)!}</span>
                            <#if modelMap[a.modelId]?has_content&&modelMap[a.modelId].hasChild>
                                <label><a href="myself/contentList.html?parentId=${contentId}" class="btnText" target="navTab" data-change-title="false" rel="myself/contentList"><@t.page 'content.child_management'/></a></label>
                            </#if>
                            <#if a.expiryDate?has_content><label><@t.page 'expiry_date'/>:</label><span class="exclude-translate">${a.expiryDate!}</span></#if>
                            <#if processItemMap[a.id?string]?has_content && authorizedMap['sysWorkflowProcess/view']><a href="sysWorkflowProcess/view.html?id=${processItemMap[a.id?string].processId}" class="btnText blue" target="dialog" rel="viewProcess${processItemMap[a.id?string].processId}" width="1200" height="500"><@t.page 'workflow.check'/></a></#if>
                        </p>
                    </div>
                </td>
                <td class="center">
                    <#if authorizedMap['cmsComment/list']>
                        <a href="cmsComment/list.html?contentId=${contentId}" target="navTab" rel="cmsComment/list" title="<@t.page 'comment.management'/>">${a.comments!}</a>
                    <#else>
                        ${a.comments!}
                    </#if>
                </td>
                <td class="center">${a.clicks!}</td>
                <td class="center">${a.publishDate!}</td>
                <td>
                    <span class="statusText ${a.status?switch(1,'green',2,'orange',3,'red',4,'orange','')}"><@t.page 'status.content.'+a.status/></span>
                    <#if 1 = a.status>/${(checkUserMap[a.checkUserId?string].nickname)!}</#if>
                </td>
                <td class="wrap">
                    <#if 4 != a.status && authorizedMap['cmsContent/add']>
                        <a href="cmsContent/add.html?id=${a.id}&navTabId=myself/contentList" class="edit btnText blue" target="navTab" rel="myself/contentList/edit"><i class="icon-edit"></i><@t.page 'content.edit'/></a></li>
                    </#if>
                    <#if 1 = a.status && authorizedMap['cmsContent/push']>
                        <a href="cmsContent/push.html?contentId=${contentId}" class="btnText green" width="1200" height="600" target="dialog" mask="true"><@t.page 'button.push'/></a>
                    </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#include "../include_page/page.html"/>
</div>
</@cms.contentList>