<#macro categoryTree parentId=''>
    <@cms.categoryList advanced=true parentId=parentId pageSize=500>
        <#list page.list as a>
            <li>
                <a href="cmsPlace/lookup_content_list.html?categoryId=${a.id}" class="exclude-translate" target="ajax" rel="lookup_content_list">${a.name!}</a>
            <#if a.childIds?has_content>
                <ul>
                    <@categoryTree a.id/>
                </ul>
            </#if>
            </li>
        </#list>
    </@cms.categoryList>
</#macro>
<#macro lookupTree parentId=''>
    <@cms.categoryList advanced=true parentId=parentId>
        <#list page.list as a>
            <li>
                <a href="javascript:;" class="exclude-translate" onclick="$.bringBack({itemType:'category',itemId:'${a.id}',title:'${(a.name?js_string)!}',url:'${a.url!}'});return false;">${a.name!}</a>
            <#if a.childIds?has_content>
                <ul>
                    <@lookupTree a.id/>
                </ul>
            </#if>
            </li>
        </#list>
    </@cms.categoryList>
</#macro>
<#macro pageTree filepath=''>
    <@tools.fileList path=filepath orderField='createDate'>
        <#list list as a>
            <#local path=filepath+'/'+a.fileName>
            <li>
            <@tools.metadata path=path>
                <#if a.directory>
                    <a href="javascript:;" onclick="return false;">
                        ${(object.alias)?has_content?then(object.alias+' '+a.fileName,a.fileName)}
                    </a>
                    <ul>
                        <@pageTree path/>
                    </ul>
                <#else>
                    <#if site.useStatic&&(object.publishPath)?has_content>
                        <a href="javascript:;" onclick="$.bringBack({itemType:'custom',title:'${(object.alias)!}',url:'${site.sitePath+object.publishPath}'});return false;">
                            [<@t.page 'static_page'/>] ${(object.alias)?has_content?then(object.alias+' '+a.fileName,a.fileName)}
                        </a>
                    </#if>
                    <#if (object.useDynamic)?has_content&&object.useDynamic>
                        <a href="javascript:;" onclick="$.bringBack({itemType:'custom',title:'${(object.alias)!}',url:'${site.dynamicPath+path}<#if (object.acceptParameters)?has_content>?<#list object.acceptParameters?split(',') as a>${a}=<#if 'content'=(object.parameterTypeMap[a].type)!><@cms.contentList pageSize=1><#list page.list as a>${a.id}</#list></@cms.contentList><#elseif 'category'=(object.parameterTypeMap[a].type)!><@cms.categoryList pageSize=1><#list page.list as a>${a.id}</#list></@cms.categoryList></#if><#sep>&</#list></#if>'});return false;">
                            [<@t.page 'dynamic_page'/>] ${(object.alias)?has_content?then(object.alias+' '+a.fileName,a.fileName)}
                        </a>
                    </#if>
                </#if>
            </@tools.metadata>
            </li>
        <#else>
            <li><a><@t.page 'empty_directory'/></a></li>
        </#list>
    </@tools.fileList>
</#macro>
<#assign itemTypes=acceptItemTypes?has_content?then(acceptItemTypes?split(','),['page','content','category'])/>
<div class="pageContent">
    <div class="leftPageContent">
        <ul class="tree treeFolder" layoutH>
            <li>
                <#if itemTypes?seq_contains('content')>
                    <a href="cmsPlace/lookup_content_list.html" target="ajax" rel="lookup_content_list"><@t.page 'content'/></a>
                    <ul>
                        <@categoryTree/>
                    </ul>
                </#if>
                <#if itemTypes?seq_contains('category')>
                    <li>
                        <a href="javascript:;" onclick="return false;"><@t.page 'category'/></a>
                        <ul>
                            <@lookupTree/>
                        </ul>
                    </li>
                </#if>
                <#if itemTypes?seq_contains('page')>
                    <li>
                        <a href="javascript:;" onclick="return false;"><@t.page 'page'/></a>
                        <ul>
                            <@pageTree/>
                        </ul>
                    </li>
                </#if>

            </li>
         </ul>
    </div>
    <div id="lookup_content_list" class="rightPageContent">
        <#if itemTypes?seq_contains('content')><#include "lookup_content_list.html"/></#if>
    </div>
</div>
</div>
    <div class="formBar">
        <ul>
            <li><button class="button" type="button" onclick="$.bringBack({itemType:'',itemId:''});return false;"><@t.page 'button.clear_select'/></button></li>
            <li><button class="close button" type="button"><@t.page 'button.close'/></button></li>
        </ul>
    </div>
</div>