<#macro placeTree filepath=''>
    <@tools.fileList path='/include'+filepath orderField='createDate'>
        <#list list as a>
            <@t.merge 'pages' '/include'+filepath+'/'+a.fileName/>
        </#list>
        <@sys.deptItem itemType='page' deptId=admin.deptId!'' itemIds=t.pages!><#assign deptPageMap=map!/></@sys.deptItem>
        <#list list as a>
            <#local path=filepath+'/'+a.fileName>
            <#if (deptPageMap['/include'+path])?has_content&&deptPageMap['/include'+path]>
                <@tools.placeMetadata path=path>
                    <#if a.directory>
                        <li>
                            <a href="javascript:;" onclick="return false;">${a.fileName}</a>
                            <ul><@placeTree path/></ul>
                        </li>
                    <#elseif (object.size)?has_content&&0!=object.size&&(!(object.acceptItemTypes)?has_content||object.acceptItemTypes?seq_contains(itemType))>
                        <li>
                            <a href="cmsPlace/add.html?path=${path?url}&itemType=${itemType}&itemId=${itemId!}" target="navTab" rel="cmsPlace/add">${(object.alias)!a.fileName}</a>
                        </li>
                    </#if>
                </@tools.placeMetadata>
            </#if>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@tools.fileList>
</#macro>
<script>
$('ul li a',$.pdialog.getCurrent()).on("click", function(){
    if($(this).attr('href')!='javascript:;'){
        $.pdialog.closeCurrent();
    }
});
</script>
<div class="pageFormContent" layoutH>
    <ul class="tree treeFolder">
        <@placeTree/>
    </ul>
</div>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>