<%
	/**
 * Created by The eXo Platform SARL
 * Author : Dang Van Minh
 *          minhdv@exoplatform.com
 * Sep 19, 2006
 * 11:57:24 AM 
 */
%>
<% 
  int totalPages = uicomponent.getUIPageIterator().getAvailablePage();
  def metaDatas = uicomponent.getListMetadata() ; 
  int totalItems = uicomponent.getAllMetadatas().size();
  if(metaDatas == null) return ;
%>
<div class="UIMetadataList" id="UIMetadataList">
  <% if (totalItems > 5) { %>
  <div style="margin:3px 0px 5px 0px;">
    <%
      uicomponent.getUIPageIterator().setUseMaxSizeSetting(true);
      _ctx.renderUIComponent(uicomponent.getUIPageIterator());
    %>
  </div>
  <% } %>
  <table class="UIGrid">
	  <thead>
	    <tr>
	      <th><%=_ctx.appRes("UIMetadataList.header.icon")%></th>
		    <th><%=_ctx.appRes("UIMetadataList.header.name")%></th>
		    <th><%=_ctx.appRes("UIMetadataList.header.internalUse")%></th>
		    <th><%=_ctx.appRes("UIMetadataList.header.type")%></th>
		    <th><%=_ctx.appRes("UIMetadataList.header.action")%></th>
	    </tr>
	  </thead>
	  <tbody>
      <%
        def rowClass = null ;
		    boolean even = true ;
		    boolean found = false ;
		    for (meta in metaDatas) {
		      found = true  ;
		      if(even) rowClass = "EvenRow" ;  
		      else rowClass =  "OddRow" ; 
		      even = !even ;
      %>
          <tr class="$rowClass">
            <%
              String nodeType = meta.getName() ;
              nodeType = nodeType.replace(":", "_") ;
            %>
            <td>
              <div style="margin: auto" class="default16x16Icon  ${nodeType}16x16Icon"><span></span></div>
            </td>
            <td>$meta.name</td>
            <td>
            	<div class="ActionContainer">
	              <%
	                String internalText = _ctx.appRes("UIMetadataList.label." + meta.getInternalUse()) ;
	                String internalIconType = meta.getInternalUse() ;                
	              %>
				          <img class="Icon16x16 ${internalIconType}16x16Icon" alt="" src="/eXoResources/skin/sharedImages/Blank.gif"/>
		              <span>$internalText</span>
		           </div>
            </td>
            <td>
            	<div class="ActionContainer">
			          <img class="Icon16x16 True16x16Icon" alt="" src="/eXoResources/skin/sharedImages/Blank.gif"/>
	              <span>true</span>
	            </div>
            </td>
            <td>
            	<div class="ActionContainer">
	                <img onclick="<%=uicomponent.event("View", meta.getName())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="MetaView16x16Icon" title="<%=_ctx.appRes("UIMetadataList.title.view")%>"/>
	                <img onclick="<%=uicomponent.event("Edit", meta.getName())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Edit16x16Icon" title="<%=_ctx.appRes("UIMetadataList.title.edit")%>"/>
	              <%
	              	if(meta.hasTemplate()) {
	              	%>
			              <img onclick="<%=uicomponent.event("Delete", meta.getName())%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="Delete16x16Icon" title="<%=_ctx.appRes("UIMetadataList.title.delete")%>"/>
	              	<%
	              	}
	              %>
	            </div>
            </td>
          </tr>
      <%}%>  
	  </tbody>
  </table>
  <% if (totalItems > 5) { %>
  <div style="margin:3px 0px 5px 0px;">
    <%
      uicomponent.getUIPageIterator().setUseMaxSizeSetting(false);
      _ctx.renderUIComponent(uicomponent.getUIPageIterator());
    %>
  </div>
  <% } %>
</div>
