
<div class="static_tree" >
    ${assetInstance.encodeAsHTML()}
    <g:link controller="assetSubItemDetailed" params="['asset.id':assetInstance?.id]" action="create">
        <img src="${resource(dir:'images/skin',file:'database_add.png')}" alt="Add" title="Add Sub Item"/>
    </g:link>
    <g:link params="['assetToCopy.id':assetInstance?.id]" action="copy">
        <img src="${resource(dir:'images/skin',file:'page_copy.png')}" alt="Copy" title="Copy Asset"/>
    </g:link>

    <ul>
    <g:each var="assetSubItem1" in="${assetInstance.assetSubItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
        <li>
            <a href='' class="toggle"
                                onclick="showElement('treelevel1');
                                                return false">
            </a>
            <g:link controller="assetSubItemDetailed" action="edit" id="${assetSubItem1.id}">${assetSubItem1?.encodeAsHTML()}</g:link>
            <g:link controller="assetSubItemDetailed" params="['parentItem.id':assetSubItem1?.id]" action="create">
                <img src="${resource(dir:'images/skin',file:'database_add.png')}" alt="Add" title="Add Sub Item" />
            </g:link>
        </li>

        <div id="treelevel1">

            <ul>
            <g:each var="assetSubItem2" in="${assetSubItem1.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
                <li>
                    <a href='' class="toggle">
                    </a>
                    <g:link controller="assetSubItemDetailed" action="edit" id="${assetSubItem2.id}">${assetSubItem2?.encodeAsHTML()}</g:link>
                    <g:link controller="assetSubItemDetailed" params="['parentItem.id':assetSubItem2?.id]" action="create">
                        <img src="${resource(dir:'images/skin',file:'database_add.png')}" alt="Add" title="Add Sub Item" />
                    </g:link>
                </li>
                <ul>
                <g:each var="assetSubItem3" in="${assetSubItem2.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
                    <li>
                        <g:link controller="assetSubItemDetailed" action="edit" id="${assetSubItem3.id}">${assetSubItem3?.encodeAsHTML()}</g:link>
                        <g:link controller="assetSubItemDetailed" params="['parentItem.id':assetSubItem3?.id]" action="create">
                            <img src="${resource(dir:'images/skin',file:'database_add.png')}" alt="Add" title="Add Sub Item" />
                        </g:link>
                    </li>
                    <ul>
                    <g:each var="assetSubItem4" in="${assetSubItem3.subItems.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }">
                        <li><g:link controller="assetSubItemDetailed" action="edit" id="${assetSubItem4.id}">${assetSubItem4?.encodeAsHTML()}</g:link></li>
                    </g:each> <!--assetSubItem4-->
                    </ul>
                </g:each> <!--assetSubItem3-->
                </ul>
            </g:each> <!--assetSubItem2-->
            </ul>

        </div>

    </g:each> <!--assetSubItem1-->
    </ul>
</div>