<#if parentId?has_content>
    <@cms.content id=parentId>
        <#assign parent=object/>
    </@cms.content>
</#if>
<#macro bread category>
    <#if category.parentId?has_content>
        <@cms.category id=category.parentId>
            <@bread object/>
            ${object.name} &gt;
        </@cms.category>
    </#if>
</#macro>
<@sys.authorized roleIds=admin.roles urls='cmsCategory/add'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageFormContent">
    <ul class="tree treeFolder" layoutH>
<#if categoryId?has_content>
    <@cms.category id=categoryId>
        <#if object.typeId?has_content && authorizedMap['cmsCategory/add']>
            <li><a href="cmsCategory/add.html?id=${categoryId!}" target="navTab" rel="cmsCategory/edit"><i class="icon-edit icon-large"></i><@t.page 'category.edit'/></a></li>
        </#if>
    </@cms.category>
    <#assign size=0/>
    <@cms.modelList parentId=(parent.modelId)!''>
        <#list page.list as a>
            <@cms.categoryModel modelId=a.id categoryId=categoryId>
                <#assign size++/>
        <li><a href="cmsContent/add.html?categoryId=${(parent.categoryId)!categoryId!}&modelId=${a.id}&parentId=${parentId!}" target="navTab" rel="cmsContent/add"><@t.page 'button.add_some_things' a.name/></a></li>
            </@cms.categoryModel>
        </#list>
    </@cms.modelList>
    <#if size=0 && authorizedMap['cmsCategory/add']>
        <li><a href="cmsCategory/add.html?categoryId=${categoryId!}&showTab=model" target="navTab" rel="cmsCategory/edit" title="<@t.page 'category.edit'/>"><i class="icon-edit icon-large"></i><@t.page 'content.no_model'/></a></li>
    </#if>
<#elseif modelId?has_content>
    <@cms.model id=modelId>
        <@cms.categoryModelList modelId=modelId>
            <#list list as a>
                <@t.merge 'categoryIds' a.id.categoryId/>
            </#list>
            <@sys.deptItem itemType='category' deptId=admin.deptId itemIds=t.categoryIds><#assign deptCategoryMap=map/></@sys.deptItem>
            <@cms.category ids=t.categoryIds><#assign categoryMap=map/></@cms.category>
            <#list list as a>
                <#if categoryMap[a.id.categoryId?string]?has_content && deptCategoryMap[a.id.categoryId?string]>
                <li>
                    <a href="cmsContent/add.html?categoryId=${a.id.categoryId}&modelId=${a.id.modelId}" class="exclude-translate" target="navTab" rel="cmsContent/add" title="<@t.page 'button.add_some_things' object.name/>"><@bread categoryMap[a.id.categoryId?string]/> ${categoryMap[a.id.categoryId?string].name}</a>
                </li>
                </#if>
            </#list>
        </@cms.categoryModelList>
    </@cms.model>
<#else>
    <@cms.modelList parentId=(parent.modelId)!''>
        <#list page.list as a>
        <li><a href="cmsContent/addMore.html?modelId=${a.id}" target="dialog" mask="true"><@t.page 'button.add_some_things' a.name/></a></li>
        </#list>
    </@cms.modelList>
</#if>
    </ul>
</div>
<script>
$('ul li a',$.pdialog.getCurrent()).on("click", function(){
    $.pdialog.closeCurrent();
});
</script>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>
