<% 
  import org.exoplatform.ecm.webui.utils.Utils ;
%>
<div id="$uicomponent.id">
	<table class="UIGrid" id="$uicomponent.id">  
		<tbody>
	    <tr>
	      <th><%=_ctx.appRes("UICategoriesAddedList.label.category")%></th>
	      <th><%=_ctx.appRes("UICategoriesAddedList.label.actions") %></th>    
	    </tr>
	    
	    <div class="HomeNode">
	    <%
	      def listCategory = uicomponent.getListCategories();
	      def lstTaxonomyTrees = uicomponent.getAllTaxonomyTrees();
	      if (listCategory != null && listCategory.size() > 0) {
	        def rowClass = null;
  	      boolean even = true;
  		    for (node in listCategory) {
  	 	      if (even) rowClass = "EvenRow";  
	  	      else rowClass = "OddRow"; 
	  	      even = !even;
	  	   /*   
	  	      String path = node.getPath();
						String[] array = path.split("/");
				    String value = "/";
				    if (array.length > 4) {
				      for (int i = 4; i < array.length; i++) {
				        value += array[i]; 
				        if (i < array.length - 1) value += "/";
				      }
				    } else {
				      value = node.getPath();
				    }*/
				    String value = uicomponent.displayCategory(node, lstTaxonomyTrees);
				    if (value.length() > 0) {
	     %>
	          <tr class="$rowClass">
							<td><%=value%></td>	          	
							<td width="10%">
								<div class="ActionContainer">
									<img class="Icon16x16 Remove16x16Icon" src="/eXoResources/skin/sharedImages/Blank.gif" alt="<%=_ctx.appRes("UICategoriesAddedList.label.delete")%>" onclick="<%=uicomponent.event("Delete", Utils.formatNodeName(node.getPath()))%>" title="<%=_ctx.appRes("UICategoriesAddedList.label.delete")%>" />
								</div>
							</td>
	          </tr>
	     <% }
	        }
	      } else { %>
	         <tr class="EvenRow">
	           <td style="font-style:italic; text-align: center; color: #FF5604" colspan="2">
	             <%=_ctx.appRes("UIGrid.msg.empty")%>
	           </td>
	         </tr>
	    <%}%>
	  	</div>
	  </tbody>
	</table>
	
  <% if (uicomponent.getUIPageIterator().getAvailablePage() > 1) { %>
  <div style="margin:1px 0px 5px 0px;">
    <%_ctx.renderUIComponent(uicomponent.getUIPageIterator())%>
  </div>
  <% } %>
</div>