<%
/**
 * Created by The eXo Platform SARL
 * Author : Dang Van Minh
 *          minhdv@exoplatform.com
 * April 10, 2008
 * 4:56:56 PM 
 */
%>
<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>
			          <%
			            String path = node.getPath() ;
			            String nodeName = path.substring(path.lastIndexOf("/") + 1, path.length()) ;
			           %>
			          <div class="Text">$nodeName</div>
			        </td>
			        <td>
			        	<div class="ActionContainer">
		              <%
		                if(uicomponent.isRootNode()) {
		              %>
		                <img onclick="<%=uicomponent.event("Add", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Add16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" />
		                <img onclick="<%=uicomponent.event("Paste", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Paste16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" />
		              <%} else {%>
			              <img onclick="<%=uicomponent.event("Add", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Add16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.add")%>" />
		                <img onclick="<%=uicomponent.event("Copy", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Copy16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.copy")%>" />
			              <img onclick="<%=uicomponent.event("Cut", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Cut16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.cut")%>" />
		                <img onclick="<%=uicomponent.event("Paste", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Paste16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.paste")%>" />
		                <img onclick="<%=uicomponent.event("ViewPermission", node.getPath())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Icon16x16 Permission16x16Icon" title="<%=_ctx.appRes("UITaxonomyManager.title.permission")%>" />
		                <img onclick="<%=uicomponent.event("Remove", node.getPath())%>" alt="" 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="ClearLeft"><span></span></div>
