<%
	/**
	 * Created by The eXo Platform SARL
	 * Author : pham tuan
	 *          phamtuanchip@yahoo.de
	 * September 14, 2006
	 * 2:10:23 PM
	 */
	 
import org.exoplatform.wcm.webui.reader.ContentReader;
 
%>
<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 = ContentReader.getXSSCompatibilityContent(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="<%=value%>">
				      <%=value%>
				   	</div>
				    <%}%>  
			    </td>
			    <td>
			    	<div class="ActionContainer">
					    <%
					    if(uicomponent.isCanbeEdit(bean)) {%> 			    
					      <img onclick="<%=uicomponent.event("Edit", bean.getName())%>" alt="<%=_ctx.appRes("UIPropertyTab.title.edit")%>" title="<%=_ctx.appRes("UIPropertyTab.title.edit")%>" src="/eXoResources/skin/sharedImages/Blank.gif" class="EditIcon" />
					    <%}%>
					    <%if(uicomponent.isCanbeRemoved(bean.getName())) {%>
					      <img onclick="<%=uicomponent.event("Delete", bean.getName())%>" alt="<%=_ctx.appRes("UIPropertyTab.title.delete")%>" 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>
