<@sys.dept id=admin.deptId>
    <#assign
        dept=object
        containChild=object.ownsAllCategory
    />
</@sys.dept>
<@sys.deptItem itemType='category' deptId=admin.deptId itemId=categoryId><#assign deptCategory=object/></@sys.deptItem>
<#if deptCategory?has_content && deptCategory || dept?has_content && dept.ownsAllCategory>
    <#if parentId?has_content>
        <@cms.content id=parentId><#assign parent=object/></@cms.content>
    </#if>
    <#if 0=admin.contentPermissions><#assign userId=admin.id/></#if>
    <#if 2=admin.contentPermissions><#assign deptId=admin.deptId/></#if>
<@cms.contentList advanced=true status=1 categoryId=categoryId containChild=containChild
            modelId=modelIds parentId=parentId emptyParent=true title=title userId=userId deptId=deptId
            startPublishDate=startPublishDate endPublishDate=endPublishDate absoluteId=false
            orderField=orderField orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<@sys.authorized roleIds=admin.roles urls='cmsContent/add,cmsContent/delete,cmsContent/check,cmsContent/reject,cmsContent/uncheck,cmsContent/uncheck_list,cmsContent/push,cmsCategory/lookupBySiteId,cmsContent/refresh,cmsContent/publish,cmsContent/moveParameters,cmsContent/changeModelParameters,cmsContent/export,cmsContent/import,cmsRecycleContent/list,cmsComment/list,cmsContent/sortParameters,cmsCategory/add'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageHeader card">
    <form class="pagerForm" action="cmsContent/content_list.html" autocomplete="off" onsubmit="return divSearch(this,'contentBox');" method="post">
        <#include "../include_page/parameters.html"/>
        <input name="categoryId" type="hidden" value="${categoryId!}"/>
        <input name="parentId" type="hidden" value="${(parent.id)!}"/>
        <input name="status" type="hidden" value="1"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'title'/>:</label><input type="text" size="20" name="title" value="${title!}"/>
                </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>
            <#if 1=admin.contentPermissions>
                <li>
                    <label><@t.page 'dept'/>:</label>
                    <#include "../include_page/deptId.html"/>
                </li>
            </#if>
            <#if 1=admin.contentPermissions||2=admin.contentPermissions>
                <li>
                    <label><@t.page 'content.promulgator'/>:</label>
                    <#include "../include_page/userId.html"/>
                </li>
            </#if>
                <li>
                    <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="cmsContent/list.html?parentId=${(parent.parentId)!}&categoryId=${categoryId!}" target="navTab" rel="cmsContent/list"><i class="icon-circle-arrow-up icon-large"></i><@t.page 'button.return'/></a></li>
                <li class="line">line</li>
            </#if>
<#if authorizedMap['cmsContent/add']>
        <@cms.modelList parentId=(parent.modelId)!''>
            <#list page.list as a>
                <@t.merge 'tempModelIds' a.id!/>
            </#list>
            <#assign size=0/>
            <li>
                <a href="cmsContent/addMore.html?categoryId=${(parent.categoryId)!categoryId!}&parentId=${parentId!}" target="dialog" mask="true" class="addMore"><i class="icon-double-angle-down icon-large"></i><@t.page 'content.add'/></a>
                <ul>
            <#if categoryId?has_content>
                <@cms.categoryModel modelIds=t.tempModelIds categoryId=categoryId><#assign categoryModelMap=map/></@cms.categoryModel>
                <#list page.list as a>
                    <#if categoryModelMap?has_content&&categoryModelMap[a.id]?has_content>
                        <#assign size++/>
                        <li><a href="cmsContent/add.html?categoryId=${(parent.categoryId)!categoryId!}&modelId=${a.id}&parentId=${parentId!}" target="navTab" rel="cmsContent/add"><i class="bi bi-plus-circle-dotted"></i><@t.page 'button.add_some_things' a.name/></a></li>
                    </#if>
                </#list>
                <@cms.category id=categoryId>
                    <#if authorizedMap['cmsCategory/add']>
                        <li><a href="cmsCategory/add.html?id=${categoryId!}" target="navTab" rel="cmsCategory/edit"><i class="icon-edit icon-large"></i><@t.page 'category.edit'/></a></li>
                   </#if>
                </@cms.category>
                <#if size=0 && authorizedMap['cmsCategory/add']>
                        <li><a href="cmsCategory/add.html?id=${categoryId!}&showTab=model" target="navTab" rel="cmsCategory/edit" title="<@t.page 'category.edit'/>"><i class="icon-edit icon-large"></i><@t.page 'content.no_model'/></a></li>
                </#if>
            <#elseif !parent?has_content>
                <#list page.list as a>
                    <li><a href="cmsContent/addMore.html?modelId=${a.id}" target="dialog" mask="true"><i class="bi bi-plus-circle-dotted"></i><@t.page 'button.add_some_things' a.name/></a></li>
                </#list>
            </#if>
                </ul>
            </li>
        </@cms.modelList>
            <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/refresh'] && !site.useStatic>
            <li><a href="cmsContent/refresh?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_refresh'/>" target="selectedTodo" rel="ids"><i class="icon-refresh icon-large"></i><@t.page 'button.batch_refresh'/></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 !parentId?has_content&&authorizedMap['cmsContent/moveParameters']>
            <li><a href="cmsContent/moveParameters.html" target="dialog" mask="true"><i class="icon-move icon-large"></i><@t.page 'button.batch_move'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/import']>
            <li class="line">line</li>
            <li><a href="cmsContent/import.html" target="dialog" mask="true" width="500" height="250"><i class="bi bi-cloud-upload"></i><@t.page "import"/></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>
        <#if authorizedMap['cmsContent/uncheck_list']>
            <#if 0=admin.contentPermissions><#assign uncheckUserId=admin.id/></#if>
            <#if 2=admin.contentPermissions><#assign uncheckDeptId=admin.deptId/></#if>
            <@cms.contentList advanced=true status=2 categoryId=categoryId userId=uncheckUserId deptId=uncheckDeptId containChild=containChild absoluteId=false pageSize=0>
                <#if page.totalCount gt 0>
                    <li class="line">line</li>
                    <li><a href="cmsContent/uncheck_list.html?categoryId=${categoryId!}&containChild=${containChild!}" target="ajax" rel="contentBox"><i class="icon-check-sign icon-large"></i><@t.page 'status.content.2'/><span class="todoNumber">${page.totalCount}</span></a></li>
                </#if>
            </@cms.contentList>
        </#if>
        <#if authorizedMap['cmsRecycleContent/list']>
            <li><a class="button" href="cmsRecycleContent/list.html" target="navTab" rel="cmsRecycleContent/list"><i class="bi bi-recycle"></i><@t.page 'recycle_bin'/></a></li>
        </#if>
        </ul>
    </div>
    <table class="table" width="100%" layoutH targetType="ajax" orderField="${orderField!}" orderType="${orderType!}" rel="contentBox">
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
                <th width="200"><@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="30" orderField="collections"><@t.page 'collections'/></th>
                <th width="70" orderField="publishDate"><@t.page 'publish_date'/></th>
                <th width="100"><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'userIds' a.userId!/>
                <@t.merge 'userIds' a.checkUserId!/>
                <@t.merge 'categoryIds' a.categoryId!/>
                <@t.merge 'modelId' a.modelId!/>
                <@t.merge 'ids' a.id/>
            </#list>

            <@sys.lock userId=admin.id itemType='content' 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.categoryIds!><#assign categoryMap=map!/></@cms.category>
            <@cms.model ids=t.modelId!><#assign modelMap=map!/></@cms.model>
            <@sys.workflowProcessItem itemType="content" itemIds=t.ids!><#assign processItemMap=map!/></@sys.workflowProcessItem>

            <#list page.list as a>
            <tr>
                <td class="center" title="${a.id}"><input name="ids" value="${a.id}" type="checkbox"></td>
                <td class="wrap">
                    <#if a.cover?has_content>
                        <div class="thumbnail">
                            <img src="${(a.cover)!}" alt="${a.title}"/>
                        </div>
                    </#if>
                    <div class="box">
                        <h3>
                            <#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>
                            [<span class="exclude-translate">${(categoryMap[a.categoryId?string].name)!}</span>]
                            ${(a.copied?then('['+t.pageMessage('copied')+']',''))!}
                            <a href="cmsContent/view.html?id=${a.id}" class="exclude-translate" target="dialog" rel="viewContent${a.id}" width="1200" height="600">${(a.title)!}</a>
                            <#if a.url?has_content><a href="${a.url!}" target="_blank"><i class="icon-external-link"></i></a></#if>
                            <#if a.quoteContentId?has_content && !a.parentId?has_content><span class="statusText orange"><@t.page "content.quote"/></span></#if>
                        </h3>
                        <p>
                            <#if modelMap[a.modelId]?has_content&&modelMap[a.modelId].hasChild>
                                <label><a href="cmsContent/list.html?parentId=${a.id}&categoryId=${a.categoryId!}" class="btnText" target="navTab" rel="cmsContent/list"><@t.page 'content.child_management'/></a></label>
                            </#if>
                            <label><@t.page 'content.promulgator'/>:</label><span class="exclude-translate">${(userMap[a.userId?string].nickname)!}</span>
                            <label><@t.page 'inspector'/>:</label><span class="exclude-translate">${(userMap[a.checkUserId?string].nickname)!}</span>
                            <label><@t.page 'model'/>:</label><span class="exclude-translate">${(modelMap[a.modelId].name)!}</span>
                            <#if processItemMap[a.id?string]?has_content><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>
                        <#if a.expiryDate?has_content><p><label><@t.page 'expiry_date'/>:</label><span class="exclude-translate">${a.expiryDate!}</span></p></#if>
                    </div>
                </td>
                <td class="center">
                    <#if authorizedMap['cmsComment/list']>
                        <a href="cmsComment/list.html?contentId=${a.id}" 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.collections!}</td>
                <td class="center" title="<@t.page 'create_date'/>:${a.createDate!}">${a.publishDate!}</td>
                <td class="wrap">
                    <p>
                    <a href="cmsContent/add.html?id=${a.id}" class="edit btnText blue" target="navTab" rel="cmsContent/edit"><i class="icon-edit"></i><@t.page 'content.edit'/></a>
                    <#if authorizedMap['cmsContent/sortParameters']>
                        <#if dept?has_content>
                            <a href="cmsContent/sortParameters.html?id=${a.id}&sort=${a.sort}" class="btnText <#if a.sort gt 0>warn<#else>blue</#if>" target="dialog" width="450" height="180" mask="true"><@t.page 'top'/><#if a.sort gt 0>(${a.sort})</#if></a>
                        </#if>
                    </#if>
                    <#if authorizedMap['cmsContent/add']>
                        <a href="cmsContent/add.html?copyId=${a.id}" class="btnText blue" target="navTab" rel="cmsContent/add" title="<@t.page 'content.add'/>"><i class="icon-copy"></i><@t.page 'button.copy'/></a>
                    </#if>
                    </p>
                    <p>
                    <#if authorizedMap['cmsContent/push']>
                        <a href="cmsContent/push.html?contentId=${a.id}" class="btnText blue" width="1200" height="600" target="dialog" mask="true"><@t.page 'button.push'/></a>
                    </#if>
                    <#if authorizedMap['cmsCategory/lookupBySiteId']>
                        <a href="cmsCategory/lookupBySiteId.html?id=${a.id}&modelId=${a.modelId!}&currentCategoryId=${a.categoryId!}" class="btnText blue" target="dialog" mask="true"><i class="icon-asterisk"></i><@t.page 'button.distribute'/></a>
                    </#if>
                    <#if authorizedMap['cmsContent/changeModelParameters']>
                        <a href="cmsContent/changeModelParameters.html?id=${a.id}&parentId=${(modelMap[a.modelId].parentId?url)!}" class="btnText red" target="dialog" mask="true"><i class="icon-list-alt"></i><@t.page 'content.change_model'/></a>
                    </#if>
                    </p>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='contentBox'/>
    <#include "../include_page/page.html"/>
</div>
</@cms.contentList>
<#else>
    <div class="pageContent"><#if categoryId?has_content><@t.message 'verify.notEquals.siteId'/></#if></div>
</#if>