<%
	/**
	 * Created by The eXo Platform SARL
	 * Author : pham tuan
	 *          phamtuanchip@yahoo.de
	 * September 14, 2006
	 * 2:10:23 PM
	 */
	 
import org.apache.commons.lang.StringEscapeUtils;	 
%>
<div class="UIPropertyTab">
  <table class="UIGrid" style="width: 97%">
	  <thead>
			<tr>
			  <%
			    String[] beanFields =  uicomponent.getBeanFields() ;  
			    for(int i = 0; i < beanFields.size(); i++) {%>
			    <th class="Field<%=(i+1)%>"><%=_ctx.appRes("UIPropertyTab.header." + beanFields[i])%></th>
			  <%}%>  
			</tr>
	  </thead>
	  <tbody>
	  <%
	    def value ;
	    String rowClass = null ;
	    String nodeIcon ;
	    boolean even = true ;
	    boolean multiValue = false ;
	    String key ;
	    for (bean in uicomponent.getProperties())  {
	      nodeIcon = bean.name.replace(":", "_");
		    try {
			    multiValue = bean.getDefinition().isMultiple() ;
		    } catch(Exception e) {
		    }
		    value = uicomponent.getPropertyValue(bean) ;
	      if(even) rowClass = "EvenRow" ;  
	      else rowClass =  "OddRow" ; 
	      even = !even ; %>
		    <tr class="$rowClass">
		      <td style="width: 20px;">
		        <div style="margin: auto" class="Icon16x16 default16x16Icon ${nodeIcon}16x16Icon"><span></span></div>					        
		      </td>
			    <td style="overflow: hidden;" title="$bean.name">$bean.name</td>
			    <td>
		        <div class="MultiValue">
		          <%
		            String multiType = "False" ;
		            if(multiValue) multiType = "True" ;
		          %>
					    <div class="Icon16x16 ${multiType}16x16Icon">$multiValue</div>					  	
			      </div>
			    </td>
			    <td>
				    <%if ((value == "binary")||(value == "notavailable")||(value == "cannotget")) {%>
			    	<div class="Text" title="<%=_ctx.appRes("UIPropertyTab.label." + value)%>">
				      <%=_ctx.appRes("UIPropertyTab.label." + value)%>
				    </div>  
				    <%} else {%>
				    <div class="Text" title="<%=StringEscapeUtils.escapeHtml(value)%>">
				      <%=StringEscapeUtils.escapeHtml(value)%>
				   	</div>
				    <%}%>  
			    </td>
			    <td>
			    	<div class="ActionContainer">
					    <%
					    if(uicomponent.isCanbeEdit(bean)) {%> 			    
					      <img onclick="<%=uicomponent.event("Edit", bean.getName())%>" alt="" title="<%=_ctx.appRes("UIPropertyTab.title.edit")%>" alt="" src="/eXoResources/skin/sharedImages/Blank.gif" class="EditIcon" />
					    <%}%>
					    <%if(uicomponent.addedByUser(bean.getName())) {%>
					      <img onclick="<%=uicomponent.event("Delete", bean.getName())%>" alt="" title="<%=_ctx.appRes("UIPropertyTab.title.delete")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="DeleteIcon" />
					    <%}%>  
				    </div>
			    </td>
			  </tr>    
	    <%}%>
	  </tbody>
  </table>

  <%/* start render action*/%>
	<div class="UIAction"> 
		<% for(action in uicomponent.getActions()) {
		String actionLabel = _ctx.appRes(uicomponent.getName() + ".action." + action) 
		String link = uicomponent.event(action) ;
		%>
			<a onclick="$link" class="ActionButton LightBlueStyle" href="javascript:void(0);">$actionLabel</a>
		<%}%>          
	</div>
	<%/* end render action*/%>
</div>
