<#macro placeList filepath=''>
    <@tools.fileList path='/include'+filepath orderField='createDate'>
        <#list list as a>
            <#if !a.directory><@t.merge 'paths' filepath+'/'+a.fileName/></#if>
        </#list>
        <@sys.lock userId=admin.id itemType='placeTemplate' 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.user ids=t.userIds><#assign userMap=map!/></@sys.user>
        <#list list as a>
            <#local currentPath=filepath+'/'+a.fileName>
            <li<#if a.directory><#if (path?has_content && path?starts_with(currentPath+'/'))> class="expand"<#else> _src="placeTemplate/list.html?parent=${currentPath?url}"</#if><#elseif path?has_content && path=currentPath> class="selected"</#if>>
                <#if a.directory>
                    <a href="placeTemplate/directory.html?path=${(currentPath?url)!}" target="ajax" rel="cmsTemplatePlace">${a.fileName}</a>
                    <#if path?has_content && path?starts_with(currentPath+'/')>
                        <ul>
                             <@placeList currentPath/>
                        </ul> 
                    </#if>
                <#else>
                    <a href="placeTemplate/content.html?path=${(currentPath?url)!}" target="ajax" rel="cmsTemplatePlace">
                        <@tools.placeMetadata 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)!a.fileName}<#if 0 lt ((object.size)!0)> <@t.page 'place_data'/>(${object.size})</#if>
                        </@tools.placeMetadata>
                    </a>
                </#if>
            </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@tools.fileList>
</#macro>
<#if parent?has_content>
     <ul>
         <@placeList parent/>
     </ul>
<#else>
    <div class="pageContent">
        <div class="leftPageContent">
            <div class="card">
                <h2 class="contentTitle">
                    <a class="button" href="placeTemplate/metadata.html" target="ajax" rel="cmsTemplatePlace"><@t.page 'place.create'/></a>
                </h2>
                <ul class="tree treeFolder" layoutH>
                    <@placeList/>
                </ul>
            </div>
        </div>
        <div id="cmsTemplatePlace" class="unitBox rightPageContent">
            <#if path?has_content>
                <#if editType?has_content&&'metadata'=editType>
                    <#include "metadata.html"/>
                <#else>
                    <#include "content.html"/>
                </#if>
            <#else>
                <#include "directory.html"/>
            </#if>
        </div>
    </div>
</#if>