<#if 0=admin.contentPermissions><#assign userId=admin.id/></#if>
<#if 2=admin.contentPermissions><#assign deptId=admin.deptId/></#if>
<@cms.contentList advanced=true status=2 modelId=modelIds parentId=parentId categoryId=categoryId containChild=containChild 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/delete,cmsContent/preview,cmsContent/add,cmsContent/check,cmsContent/reject,cmsComment/list'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageHeader card">
    <form class="pagerForm" action="cmsContent/uncheck_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="${parentId!}"/>
        <input name="lang" type="hidden" value="${lang!}"/>
        <div class="searchBar">
            <ul class="searchContent">
            <#if categoryId?has_content>
                <li>
                    <label><@t.page 'category'/>: <@cms.category id=categoryId;category>${category.name}</@cms.category></label>
                </li>
            </#if>
                <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>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
        <#if authorizedMap['cmsContent/check']>
            <li><a href="cmsContent/check?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_check'/>" target="selectedTodo" rel="ids"><i class="icon-check icon-large"></i><@t.page 'button.batch_check'/></a></li>
        </#if>
        <#if authorizedMap['cmsContent/reject']>
            <li><a href="cmsContent/reject?_csrf=<@tools.csrfToken admin=true/>" title="<@t.page 'confirm.batch_reject'/>" target="selectedTodo" rel="ids"><i class="icon-exclamation icon-large"></i><@t.page 'button.batch_reject'/></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 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="70" orderField="publishDate"><@t.page 'publish_date'/></th>
                <th width="50"><@t.page 'status'/></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>

            <#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)!}"/>
                        </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}&lang=${lang!}" class="exclude-translate" target="dialog" width="1200" height="600" rel="viewContent${a.id}">${(a.title)!}</a>
                            <#if !a.onlyUrl && authorizedMap['cmsContent/preview']>
                                <a href="cmsContent/preview?id=${a.id}&lang=${lang!}" class="btnText blue" target="_blank"><@t.page 'button.preview'/></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!}&lang=${lang!}" class="btnText" target="navTab" rel="cmsContent/list" data-change-title="false"><@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 'model'/>:</label><span class="exclude-translate">${(modelMap[a.modelId].name)!}</span>
                        </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" title="<@t.page 'create_date'/>:${a.createDate!}">${a.publishDate!}</td>
                <td>
                    <span class="statusText orange"><@t.page 'status.content.'+a.status/></span>
                </td>
                <td class="wrap">
                    <#if authorizedMap['cmsContent/check']>
                        <a href="cmsContent/check?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>" class="btnText green" title="<@t.page 'confirm.check'/>" target="ajaxTodo"><i class="icon-check"></i><@t.page 'button.check'/></a>
                    </#if>
                    <#if authorizedMap['cmsContent/reject']>
                        <a href="cmsContent/reject?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>" class="btnText red" title="<@t.page 'confirm.reject'/>" target="ajaxTodo"><i class="icon-exclamation"></i><@t.page 'button.reject'/></a>
                    </#if>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#assign rel='contentBox'/>
    <#include "../include_page/page.html"/>
</div>
</@cms.contentList>