<%
/**
 * Created by The eXo Platform SARL
 * Author : Hoang Van Hung
 *          hunghvit@gmail.com
 * April 13, 2009
 */
%>
<div class="$uicomponent.id UITreeList" id="$uicomponent.id">
  <table class="UIGrid">
	  <col></col>
	  <col style="width:200px;"></col>
	  <thead>
	    <tr>
	      <th><%=_ctx.appRes("UITreeList.header.name")%></th>
		    <th><%=_ctx.appRes("UITreeList.header.action")%></th>
	    </tr>
	  </thead>
	  <tbody>
      <%
        def nodes = uicomponent.getListNodes() ;
        def rowClass = "OddRow" ;
		    boolean even = true ;
		    if(nodes.size() > 0) {
			    for(node in nodes) {
			      if(even) rowClass = "EvenRow" ;  
			      else rowClass =  "OddRow" ; 
			      even = !even ;
      %>
			      <tr class="$rowClass">
			        <td class="Truncated">
			          <%
			            String path = node.getPath() ;
			            String nodeName = path.substring(path.lastIndexOf("/") + 1, path.length()) ;
			           %>
			          <div class="Text" title="$nodeName">$nodeName</div>
			        </td>
			        <td>
			        	<div class="ActionContainer">
		              <%
		                if(uicomponent.isRootNode()) {
		              %>
		                <img onclick="<%=uicomponent.event("Add", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Add16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" />
		                <img onclick="<%=uicomponent.event("Paste", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Paste16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" />
		              <%} else {%>
			              <img onclick="<%=uicomponent.event("Add", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Add16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" />
		                <img onclick="<%=uicomponent.event("Copy", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.copy")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Copy16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.copy")%>" />
			              <img onclick="<%=uicomponent.event("Cut", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.cut")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Cut16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.cut")%>" />
		                <img onclick="<%=uicomponent.event("Paste", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Paste16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" />
		                <img onclick="<%=uicomponent.event("ViewPermission", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.permission")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Permission16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.permission")%>" />
		                <img onclick="<%=uicomponent.event("Remove", node.getPath())%>" alt="<%=_ctx.appRes("UITaxonomyManager.title.remove")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Remove16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.remove")%>" />
		              <%}%>
		            </div>
			        </td>
			      </tr>
			<%
		    	}
		    } else {
		  %>
		  		<tr class="EvenRow">
		  			<td colspan="2"><div class="Text"><%=_ctx.appRes("UITreeList.info.child-not-found")%></div></td>
		  		</tr>
		  <%  	
		    }
			%>
    </tbody>
  </table>
  
  <% if (uicomponent.getUIPageIterator().getAvailablePage() > 1) { %>
  <div style="margin:1px 0px 5px 0px;">
    <%_ctx.renderUIComponent(uicomponent.getUIPageIterator())%>
  </div>
  <% } %>
</div>
<div class="UIAction">
	<%for(action in uicomponent.getActions()) { 
		String actionLabel = _ctx.appRes(uicomponent.getName() + ".action." + action);
		String link = uicomponent.event(action) ;
	%>
		<a onclick="$link" class="ActionButton LightBlueStyle" href="javascript:void(0);">$actionLabel</a>
	<%}%>
</div>