<%
/**
 * 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.wcm.webui.reader.ContentReader;
%>
<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 nodeTitle = ContentReader.getUnescapeIllegalJcrContent(Utils.getTitle(node));
                  String nodeTypeIcon = Utils.getNodeTypeIcon(node,"16x16Icon");
				          def clazz = "Text"
						  						
				          if(Utils.isSymLink(node)) clazz = "TextSymLink";
				        %>
				          
				          <div class="$clazz <%=nodeTypeIcon%>">
				          <%if(Utils.isSymLink(node)) {%>
	                  <img class="LinkSmall" alt="<%=nodeTitle%>" />
	                <%}%>
				          $nodeTitle</div>
				        </td>
				        <td>
		              <a href="<%=uicomponent.event("Select", Utils.formatNodeName(node.getPath()))%>" title="<%=_ctx.appRes("UITreeList.action.title.select")%>">
		                <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>
