<%
import org.exoplatform.webui.form.validator.MandatoryValidator; 
String fieldName;
int numberUploadFile = uicomponent.getNumberUploadFile();
%>
<div class="UIForm $uicomponent.id">
  <%uiform.begin()%>
  <div class="HorizontalLayout">
    <div class="FormContainer">
      <table class="UIFormGrid" cellspacing="4px">
	      <%
	        int indexUpload = 0; 
	        for(field in uiform.getChildren()) { 
	          if(field.isRendered()) {
	          if(field.getName().indexOf("name") >= 0) {
	          %>
	          <tr onmouseover="this.style.background='#E7F3FF'" onmouseout="this.style.background='transparent'" 
	          onfocus="this.style.background='#E7F3FF'" onblur="this.style.background='transparent'">
              <td><table>	            
	          <%
	          } 
	      %>
              <tr>
	              <%fieldName = uicomponent.getLabel(field.getName());%>
	              <%
	              	if(fieldName != null && fieldName.length() > 0 && !fieldName.equals(uicomponent.getId())) {
	              %>                        
  	              <td class="FieldLabel">                     
                    <%
                    String fieldLabel = field.getName();
							      if (fieldLabel.indexOf("name") >= 0) {
							        fieldName = "name";
							        indexUpload = indexUpload + 1;
							      } else if(fieldName.indexOf("upload") >= 0){
							        fieldName = "upload";							        
							      } else if(fieldName.indexOf("fieldListTaxonomy") >= 0) {
							        fieldName = "fieldListTaxonomy";
							      }
                    %>
                    <label for="<%=field.getId()%>"><%=uicomponent.getLabel(fieldName)%></label>
                  </td>
                 <% if (uicomponent.getTaxonomyMandatory() && (field.getId().indexOf("fieldListTaxonomy") >= 0)){                 		
                 		if (field.getValidators() != null) field.getValidators().clear();
                 		field.addValidator(MandatoryValidator.class);
                 }%>
  	              <td class="FieldComponent"><% uiform.renderField(field) %></td>
  	              <td class="FieldComponent">
  	              <%
  	                if (field.getName().indexOf("name") >= 0) {
	  	                if (indexUpload == numberUploadFile) {
	  	                  if (indexUpload != 1) {
	  	                  %>
	  	                    <img src="/eXoResources/skin/sharedImages/Blank.gif" class="MultiFieldAction Remove16x16Icon" alt="<%=_ctx.appRes("UIUploadForm.action.RemoveUpload")%>" title="<%=_ctx.appRes("UIUploadForm.action.RemoveUpload")%>" onclick="<%=uicomponent.event("RemoveUpload", field.getId())%>"/>
	  	                  <%}%> 
	  	                    <img src="/eXoResources/skin/sharedImages/Blank.gif" class="MultiFieldAction AddNewNodeIcon" alt="<%=_ctx.appRes("UIUploadForm.action.AddUpload")%>" title="<%=_ctx.appRes("UIUploadForm.action.AddUpload")%>" onclick="<%=uicomponent.event("AddUpload")%>"/>										      									      
										    <%
							        } else {
							          %>
	                        <img src="/eXoResources/skin/sharedImages/Blank.gif" class="MultiFieldAction Remove16x16Icon" alt="<%=_ctx.appRes("UIUploadForm.action.RemoveUpload")%>" title="<%=_ctx.appRes("UIUploadForm.action.RemoveUpload")%>" onclick="<%=uicomponent.event("RemoveUpload", field.getId())%>"/>						          
							          <%
							        }
							      }
							    %>
  	              </td>
	              <%}%>
              </tr>
	      <%
	          if(field.getName().indexOf("fieldListTaxonomy") >= 0) {
	          %>
	          </table></td></tr>
	          <%if((field.getName().indexOf("fieldListTaxonomy") >= 0) && (numberUploadFile > 1) && (indexUpload != numberUploadFile)) {%>
              <tr>
                <td><div class="GroupUploadILine"><span></span></div></td>
              </tr>
            <%}%>
            <%	       
	          }
	          }
	        }
	      %>
      </table>

      <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>

    </div>
  </div>
  <%uiform.end()%>
</div>
