<#macro pageList filepath=''>
    <@tools.fileList path=filepath>
        <#list list as a>
            <@t.merge 'pages' '/'+filepath?has_content?then(filepath+'/','')+a.fileName/>
            <#if !a.directory><@t.merge 'paths' filepath+'/'+a.fileName/></#if>
        </#list>
        <@sys.lock userId=admin.id itemType='page' itemIds=t.paths><#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.deptItem itemType='page' deptId=admin.deptId!'' itemIds=t.pages!><#assign deptPageMap=map!/></@sys.deptItem>
        <@sys.user ids=t.userIds!><#assign userMap=map!/></@sys.user>
        <#list list as a>
            <#local currentPath=filepath?has_content?then(filepath+'/','')+a.fileName>
            <#if (deptPageMap['/'+currentPath])?has_content&&deptPageMap['/'+currentPath]>
                <li<#if a.directory><#if (path?has_content && path?starts_with(currentPath+'/'))> class="expand"<#else> _src="cmsPage/list.html?parent=${currentPath?url}"</#if><#elseif path?has_content && path=currentPath> class="selected"</#if>>
                    <#if a.directory>
                        <a href="javascript:;" onclick="return false;">${a.fileName}</a>
                        <#if path?has_content && path?starts_with(currentPath+'/')>
                            <ul>
                                 <@pageList currentPath/>
                            </ul>
                        </#if>
                    <#else>
                        <a href="cmsPage/metadata.html?path=${(currentPath?url)!}"<#if (object.extendList)?has_content> class="red" title="<@t.page "metadata"/>"</#if> target="ajax" rel="pageBox">
                            <@tools.metadata path=currentPath>
                               <#if lockMap?has_content && lockMap[currentPath]?has_content>
                                  <#assign lockUser=(userMap[lockMap[currentPath].userId?string].nickname)!''/>
                                  <i class="icon-lock icon-large" title="<@t.page 'lock.message' lockUser/> ${lockMap[currentPath].createDate}"></i>
                               </#if>
                               ${(object.alias)?has_content?then(object.alias+' '+a.fileName,a.fileName)}
                            </@tools.metadata>
                        </a>
                    </#if>
                </li>
            </#if>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@tools.fileList>
</#macro>
<#if parent?has_content>
     <ul>
         <@pageList parent/>
     </ul>
<#else>
    <div class="pageContent">
        <div class="leftPageContent">
            <div class="card">
                <ul class="tree treeFolder" layoutH>
                    <@pageList/>
                </ul>
            </div>
        </div>
        <div id="pageBox" class="unitBox rightPageContent">
            <#if path?has_content>
                <#include "metadata.html"/>
            </#if>
        </div>
    </div>
</#if>