<%
  import org.exoplatform.services.jcr.RepositoryService;
  
  RepositoryService rService = uicomponent.getApplicationComponent(RepositoryService.class);
  def repository = rService.getCurrentRepository().getConfiguration().getName();  
	String[] repositoryField = ["jcrPath=/node/exo:repository", "visible=false", repository] ;
	uicomponent.addHiddenField("repository", repositoryField) ;
%>
<div class="UIFormWithTitle">
  <div class="TitleBar"><%=_ctx.appRes(uicomponent.getId() + ".title")%></div>
	<% uiform.begin() %>
  <div class="HorizontalLayout">	  
		<table class="UIFormGrid">	
  		<tr>
	      <td class="FieldLabel" style="display:none"><label for="id"><%=_ctx.appRes("ScriptAction.dialog.label.id")%></label></td>
	      <td class="FieldComponent" style="display:none">
		      <%
		        String[] fieldId = ["jcrPath=/node", "mixintype=mix:affectedNodeTypes", "editable=false", "visible=if-not-null"];
		        uicomponent.addMixinField("id", fieldId) ;  
		      %>
		    </td>
		  </tr>
			<tr>
			  <td class="FieldLabel"><label for="actionName"><%=_ctx.appRes("ScriptAction.dialog.label.name")%></label></td>
			  <td class="FieldComponent">
				  <% 
						String[] fieldName = ["jcrPath=/node/exo:name", "validate=empty,XSSValidator"];
						uicomponent.addTextField("actionName", _ctx.appRes("ScriptAction.dialog.label.name"), fieldName);
				  %>
				</td>
			</tr>		          					
			<tr>
			  <td class="FieldLabel"><label for="lifecycle"><%=_ctx.appRes("ScriptAction.dialog.label.lifecycle")%></label></td>
			  <td class="FieldComponent">
			  <% 
          String[] fieldLifecycle = ["jcrPath=/node/exo:lifecyclePhase", 
                                     "options=read,node_added,node_removed,property_added,property_removed,property_changed",
                                     "multiValues=true", "onchange=true","size=5","validate=empty"] ;
          uicomponent.addSelectBoxField("lifecycle", fieldLifecycle) ;
        %>  
				</td>
			</tr>
			<tr>                        
        <td class="FieldLabel"><label for="isDeep"><%=_ctx.appRes("ScriptAction.dialog.label.isDeep")%></label></td>
        <td class="FieldComponent"> 
        <% 
          String[] fieldDeep = ["jcrPath=/node/exo:isDeep", "defaultValues=true"];         
          uicomponent.addCheckBoxField("isDeep", fieldDeep);
        %>
        </td>
      </tr>
      <tr>                        
        <td class="FieldLabel"><label for="nodetypes"><%=_ctx.appRes("ScriptAction.dialog.label.nodetypes")%></label></td>
        <td class="FieldComponent"> 
        <% 
          String[] fieldnodetypes = ["jcrPath=/node/exo:nodeTypeName", "selectorAction=selectNodeTypes", "multiValues=true", "selectorClass=org.exoplatform.ecm.webui.nodetype.selector.UINodeTypeSelector", "selectorIcon=SelectPath24x24Icon", "validate=empty", "editable=false"];         
          uicomponent.addActionField("nodetypes", fieldnodetypes);
        %>
        </td>
      </tr>
      <tr>
			  <td class="FieldLabel"><label for="homePath"><%=_ctx.appRes("ScriptAction.dialog.label.homePath")%></label></td>
			  <td class="FieldComponent">
				  <% 
						String[] fieldHomePath = ["jcrPath=/node/exo:storeHomePath", "validate=empty", "editable=false"];
						uicomponent.addTextField("homePath", fieldHomePath);
				  %>
				</td>
			</tr>			
		  <tr>
	      <td class="FieldLabel"><label for="targetWorkspace"><%=_ctx.appRes("ScriptAction.dialog.label.targetWorkspace")%></label></td>
	      <td class="FieldComponent">
		      <% 
		        String[] fieldWorkspace = ["jcrPath=/node/exo:targetWorkspace", "script=ecm-explorer/widget/FillSelectBoxWithWorkspaces.groovy", "scriptParams=repository", "onchange=true"] ;
		        uicomponent.addSelectBoxField("targetWorkspace", fieldWorkspace) ;
		      %>
		    </td>
		  </tr>
		  <tr>
	      <td class="FieldLabel"><label for="targetPath"><%=_ctx.appRes("ScriptAction.dialog.label.targetPath")%></label></td>
	      <td class="FieldComponent">
		      <% 
		        String[] fieldPath = ["jcrPath=/node/exo:targetPath", "selectorAction=selectDestPath", "selectorClass=org.exoplatform.ecm.webui.tree.selectone.UIOneNodePathSelector", "workspaceField=targetWorkspace", "selectorIcon=SelectPath24x24Icon", "validate=empty", "editable=false"];
		        uicomponent.addActionField("targetPath", fieldPath);
		      %>
		    </td>
		  </tr>
		  <tr>
  		  <td class="FieldLabel"><label for="affectedNodetypes"><%=_ctx.appRes("ScriptAction.dialog.label.affectedNodeTypeNames")%></td>
  		  <td class="FieldComponent">
  		  <% 
    		  String[] fieldAffectedNodetypes = ["jcrPath=/node/exo:affectedNodeTypeNames", "selectorAction=selectAffectedNodeTypes", "multiValues=true", "selectorClass=org.exoplatform.ecm.webui.nodetype.selector.UINodeTypeSelector", "selectorIcon=SelectPath24x24Icon", "validate=empty", "editable=false", "defaultValues=nt:file,exo:article,exo:podcast,exo:sample,rma:filePlan,kfx:document"];
  		  		uicomponent.addActionField("affectedNodetypes", fieldAffectedNodetypes);
  		  %>
  		  </td>
		  </tr>
 		</table>
		<%/* start render action*/%>
		<%uiform.processRenderAction()%>
		<%/* end render action*/%>
  </div>
  <%uiform.end()%>
</div>