<%
/**
 * Created by The eXo Platform SARL
 * Author : Dang Van Minh
 *          minhdv@exoplatform.com
 * Oct 17, 2006
 * 9:32:56 AM 
 */
%>
<% 
	import org.exoplatform.ecm.webui.utils.Utils;
	import java.net.URLEncoder;
	import org.exoplatform.services.jcr.util.Text;
%>
<div id="$uicomponent.id" class="UITreeList">
  <table class="UIGrid">
	  <col></col>
	  <col style="width:60px;"></col>
	  <thead>
	    <tr>
	      <th><%=_ctx.appRes("UITreeList.header.name")%></th>
		    <th><%=_ctx.appRes("UITreeList.header.action")%></th>
	    </tr>
	  </thead>
	  <tbody>
      <%
        def nodes = uicomponent.getSelectableNodes() ;
        def rowClass = "OddRow" ;
		    boolean even = true ;
		    if(nodes.size() > 0) {
			    for(node in nodes) {
			      if(even) {
			      	rowClass = "EvenRow" ;  
			      } else {
			      	rowClass =  "OddRow" ; 
			      }
			      even = !even ;
	      %>
			      <%if(!uicomponent.isExceptedNodeType(node)) {%>
				      <tr class="$rowClass">
				        <td>
				        <%
				          String nodeName = Text.unescapeIllegalJcrChars(Utils.getIndexName(node));
				          
								  				String nodeTypeIcon = Utils.getNodeTypeIcon(node,"16x16Icon");
				          def clazz = "Text"
						  						
				          if(Utils.isSymLink(node)) clazz = "TextSymLink";
				        %>
				          
				          <div class="$clazz <%=nodeTypeIcon%>">
				          <%if(Utils.isSymLink(node)) {%>
	                  <image class="LinkSmall" />
	                <%}%>
				          $nodeName</div>
				        </td>
				        <td>
		              <a href="<%=uicomponent.event("Select", Utils.formatNodeName(node.getPath()))%>">
		                <div class="Select16x16Icon" style="margin-left:15px;"></div>
		              </a>
				        </td>
				      </tr>
			<%
			      }
					}
		    } else {
		  %>
		  		<tr class="EvenRow">
		  			<td colspan="2" style="align:center;"><%=_ctx.appRes("UITreeList.info.child-not-found")%></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>