<%	
	import org.exoplatform.ecm.jcr.model.VersionNode;

	VersionNode rootNode = uicomponent.getRootVersionNode() ;  
  public void writeNodes(List nodes, int level) {
  	boolean even = true ;
  	int n = 0;
  	for (node in nodes) {  		  			  		
			def clazz = "ExpandIcon" ;
			def clazzRow = "EvenRow" ;
			def selectItem = "ItemIcon TrueIcon";
			if(uicomponent.isSelectedVersion(node)) {
			  clazz = "CollapseIcon" ;
			  clazzRow = "SelectRow" ;
			  selectItem = "ItemIcon TrueSelectIcon" ;
			}  
    	println("<tr class=\""+clazzRow+"\"><td><div class=\""+selectItem+"\"><span></span></div></td>");
  	  println("<td><div class=\"Node Text\">");  		      	
		  println("<div class=\"" +clazz+ "\">");
			String show = "Version: " + node.getName();					
			println("<a href=\""+uicomponent.event("Select",   node.getPath()) + "\">");
			println(show);				
			println("</a>")	
			println("</div></div></td><td>");
			if(uicomponent.isPublised(node)) {
				println("<div class=\"ItemIcon Publishedicon\">");					
			} else {
				println("<div class=\"ItemIcon UnPublishedicon\">");					
			}
			println("<span></span></div></td></tr>");							
    	if (node.getChildrenSize() > 0) writeNodes(node.getChildren(), level + 1) ;  		
	  }  	
  }
%>
<%
  if(rootNode != null) {
%>
<div class="UIVersionTreeList">
	<div class="UITrees">
    <table class="UIGrid">
		  <thead>
			  <tr>
					<th width="40"></th>
					<th><%=_ctx.appRes("UIVersionTreeList.header.version")%></th>
					<th width="40"><%=_ctx.appRes("UIVersionTreeList.header.state")%></th>
				</tr>
			 </thead>
			 <tbody>
			 
			 <%
					writeNodes(rootNode.getChildren(), 0 );
				  uicomponent.renderChildren(); 
			 %>
			</tbody>
		</table>
	</div>
</div>
<%}%>

