<@tools.placeMetadata path=path><#assign metadata=object/></@tools.placeMetadata>
<@cms.placeList path=path advanced=true status=status userId=userId startPublishDate=startPublishDate endPublishDate=endPublishDate
    orderField=orderField orderType=orderType pageIndex=pageNum pageSize=numPerPage>
<div class="pageHeader card">
    <form class="pagerForm" autocomplete="off" onsubmit="return navTabSearch(this);" method="post">
        <#include "../include_page/parameters.html"/>
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'place_data.page_size'/>:</label>
                    <label>${(metadata.size)!} ${(metadata.allowContribute?then('['+t.pageMessage('allow_contribute')+']',''))!}</label>
                </li>
                <li class="width:auto">
                    <#list 0..3 as s>
                        <label>
                            <input <@t.compare status!'' s?string 'checked="checked"'/> name="status" value="${s}" type="checkbox" class="form-check-input"/>
                            <@t.page 'status.place.data.'+s/>
                        </label>
                    </#list>
                </li>
                <li>
                    <label><@t.page 'content.promulgator'/>:</label>
                    <#include "../include_page/userId.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>
                <#if 'true'=((siteAttribute.enable_multilingual)!) && ((metadata.enablePlaceMultilingual)!false)>
                <li>
                    <label><@t.page 'language'/></label>
                    <select class="combox" name="lang">
                        <option value><@t.page 'please_select'/></option>
                        <@cms.languageList>
                        <#list list as l>
                            <option value="${l.id.code}"${(l.id.code=lang!)?then(' selected="true"','')?no_esc}>${(l.name)!}</option>
                        </#list>
                        </@cms.languageList>
                    </select>
                </li>
                </#if>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                    <li>
                        <a class="button" href="cmsPlace/export?path=${(path?url)!}&_csrf=<@tools.csrfToken admin=true/>" target="dwzExport" targetType="navTab"><i class="bi bi-cloud-download"></i><@t.page "button.export"/></a>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<@sys.authorized roleIds=admin.roles urls='cmsPlace/add,cmsPlace/refresh,cmsPlace/check,cmsPlace/uncheck,cmsPlace/reject,cmsPlace/import,cmsTemplate/publishPlace,cmsPlace/delete,sysWorkflowProcess/view'><#assign authorizedMap=map/></@sys.authorized>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
            <#if authorizedMap['cmsPlace/add']>
                <li><a href="cmsPlace/add.html?path=${(path?url)!}&lang=${lang!}" target="navTab" rel="cmsPlace/add"><i class="icon-plus-sign-alt icon-large"></i><@t.page 'place_data.add'/></a></li>
            </#if>
            <#if authorizedMap['cmsPlace/check']>
                <li><a href="cmsPlace/check?_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" 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['cmsPlace/uncheck']>
                <li><a href="cmsPlace/uncheck?_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" 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 site.useSsi && authorizedMap['cmsTemplate/publishPlace']>
                <li class="line">line</li>
                <li><a href="cmsTemplate/publishPlace?path=${(path?url)!}&_csrf=<@tools.csrfToken admin=true/>" target="ajaxTodo"><i class="icon-file-text-alt icon-large"></i><@t.page 'button.publish'/></a></li>
            </#if>
            <#if authorizedMap['cmsPlace/refresh']>
                <li><a href="cmsPlace/refresh?_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" 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['cmsPlace/import']>
                <li class="line">line</li>
                <li><a href="cmsPlace/import.html?path=${(path?url)!}" target="dialog" mask="true" width="500" height="250"><i class="bi bi-cloud-upload"></i><@t.page "import"/></a></li>
            </#if>
            <#if authorizedMap['cmsPlace/delete']>
                <li class="line">line</li>
                <li><a href="cmsPlace/delete?_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" 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 'title'/></th>
                <#if 'true'=((siteAttribute.enable_multilingual)!) && ((metadata.enablePlaceMultilingual)!false)>
                    <th width="150"><@t.page 'language'/></th>
                </#if>
                <th width="70" orderField="publishDate"><@t.page 'publish_date'/></th>
                <th width="70"><@t.page 'expiry_date'/></th>
                <th width="60"><@t.page 'content.promulgator'/></th>
                <th width="80" orderField="clicks"><@t.page 'clicks'/></th>
                <th width="50"><@t.page 'status'/>/<@t.page 'inspector'/></th>
                <th width="70" orderField="createDate"><@t.page 'create_date'/></th>
                <th width="150"><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
    <#if (siteAttribute.default_language)?has_content><@t.merge 'languages' siteAttribute.default_language/></#if>
    <#list page.list as a>
        <@t.merge 'userIds' a.userId!/>
        <@t.merge 'userIds' a.checkUserId!/>
        <@t.merge 'ids' a.id/>
        <#if a.lang?has_content>
            <@t.merge 'languages' a.lang/>
        </#if>
        <#if (metadata.workflowId)?has_content><@sys.workflowProcessItem itemType="place" itemIds=t.ids!><#assign processItemMap=map!/></@sys.workflowProcessItem></#if>
    </#list>
    <@sys.lock userId=admin.id itemType='place' 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.language codes=t.languages!><#assign langMap=map!/></@cms.language>
    <#list page.list as a>
            <tr>
                <td><input name="ids" value="${a.id}" type="checkbox"></td>
                <td>${a.id}</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>
                            <a href="cmsPlace/view.html?id=${a.id}" target="dialog" width="1200" height="600" rel="viewContent${a.id}">${a.title}</a>
                        </h3>
                    </div>
                </td>
                <#if 'true'=((siteAttribute.enable_multilingual)!) && ((metadata.enablePlaceMultilingual)!false)>
                    <td class="exclude-translate">${(langMap[a.lang!siteAttribute.default_language].name)!}</td>
                </#if>
                <td>${a.publishDate}</td>
                <td>${a.expiryDate!}</td>
                <td>${(userMap[a.userId?string].nickname)!}</td>
                <td>${a.clicks}</td>
                <td>
                    <span class="statusText ${a.status?switch(1,'green',2,'orange',3,'red','')}"><@t.page 'status.place.data.'+a.status/></span>
                    <#if 1=a.status&&a.checkUserId?has_content>/ ${(userMap[a.checkUserId?string].nickname)!}</#if>
                    <#if (metadata.workflowId)?has_content>
                        <#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>
                    </#if>
                </td>
                <td>${a.createDate}</td>
                <td class="wrap">
                    <#if authorizedMap['cmsPlace/add']>
                        <a href="cmsPlace/add.html?id=${a.id}" class="edit btnText blue" target="navTab" rel="cmsPlace/edit"><i class="icon-edit"></i><@t.page 'button.edit'/></a>
                        <a href="cmsPlace/add.html?copyId=${a.id}" class="btnText blue" target="navTab" rel="cmsPlace/add" title="<@t.page 'place_data.add'/>"><@t.page 'button.copy'/></a>
                    </#if>
                    <#if 2=a.status>
                        <#if authorizedMap['cmsPlace/reject']>
                            <a href="cmsPlace/check?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" class="btnText green" title="<@t.page 'confirm.check'/>" target="ajaxTodo"><i class="icon-check"></i><@t.page 'button.check'/></a>
                        </#if>
                        <#if authorizedMap['cmsPlace/reject']>
                            <a href="cmsPlace/reject?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" class="btnText red" title="<@t.page 'confirm.reject'/>" target="ajaxTodo"><i class="icon-exclamation"></i><@t.page 'button.reject'/></a>
                        </#if>
                    <#elseif 1=a.status && authorizedMap['cmsPlace/uncheck']>
                        <a href="cmsPlace/uncheck?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" class="btnText red" title="<@t.page 'confirm.uncheck'/>" target="ajaxTodo"><i class="icon-eraser"></i><@t.page 'button.uncheck'/></a>
                    </#if>
                    <#if authorizedMap['cmsPlace/delete']>
                        <a href="cmsPlace/delete?ids=${a.id}&_csrf=<@tools.csrfToken admin=true/>&path=${(path?url)!}" class="btnText warn" title="<@t.page 'confirm.delete'/>" target="ajaxTodo"><i class="icon-trash"></i><@t.page 'button.delete'/></a>
                    </#if>
                </td>
            </tr>
    </#list>
        </tbody>
    </table>
    <#include "../include_page/page.html"/>
</div>
</@cms.placeList>