<%  
  String[] hiddenField1 = ["jcrPath=/node/jcr:content", "nodetype=nt:resource", "visible=false"] ; 
  String[] hiddenField2 = ["jcrPath=/node/jcr:content/jcr:encoding", "visible=false", "UTF-8"] ;
  String[] hiddenField3 = ["jcrPath=/node/jcr:content/jcr:lastModified", "visible=false"] ;
  uicomponent.addHiddenField("hiddenInput1", hiddenField1) ;
  uicomponent.addHiddenField("hiddenInput2", hiddenField2) ;
  uicomponent.addHiddenField("hiddenInput3", hiddenField3) ;
%>
<div class="UIForm FormLayout FormScrollLayout">
	<% uiform.begin() %>
	
	<%/* start render action*/%>
  <% if (uiform.isShowActionsOnTop()) {
            uiform.processRenderAction()
         }
  %>
	<%/* end render action*/%>
  <div class="HorizontalLayout">	
  	<table class="UIFormGrid">      
	    <tr>		          					
	      <td class="FieldLabel"><label for="name"><%=_ctx.appRes("Podcast.dialog.label.name")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldName = ["jcrPath=/node", "options=noSanitization", "mixintype=mix:votable,mix:commentable,mix:i18n", "editable=if-null", "validate=empty,name"] ;
		        uicomponent.addTextField("name", fieldName) ;   
		      %>
		    </td>
	    </tr>	    
	    <%if(!uicomponent.getId().equals("UILanguageDialogForm")){%>
		    <tr>
		      <td class="FieldLabel"><label for="categories"><%=_ctx.appRes("Podcast.dialog.label.categories")%></label></td>
		      <td class="FieldComponent">
			      <% 
			        String[] fieldCategories = ["jcrPath=/node/exo:category", "multiValues=true", "reference=true", "editable=false"];
			        uicomponent.addTextField("categories", fieldCategories);
			      %>
			    </td>
			  </tr>
      <%}%>
	    <tr>		          					
	      <td class="FieldLabel"><label for="title"><%=_ctx.appRes("Podcast.dialog.label.title")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldTitle = ["jcrPath=/node/exo:title", "options=noSanitization"] ;
		        uicomponent.addTextField("title", fieldTitle) ;  
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="link"><%=_ctx.appRes("Podcast.dialog.label.link")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldLink = ["jcrPath=/node/exo:link", "validate=empty"] ;
		        uicomponent.addTextField("link", fieldLink) ;
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="author"><%=_ctx.appRes("Podcast.dialog.label.author")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldAuthor = ["jcrPath=/node/exo:author"] ;
		        uicomponent.addTextField("author", fieldAuthor) ;
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="explicit"><%=_ctx.appRes("Podcast.dialog.label.explicit")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldExplicit = ["jcrPath=/node/exo:explicit", "no", "options=no,yes"] ;
		        uicomponent.addSelectBoxField("explicit", fieldExplicit) ;
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="category"><%=_ctx.appRes("Podcast.dialog.label.category")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldCategory = ["jcrPath=/node/exo:podcastCategory"] ;
		        uicomponent.addTextField("category", fieldCategory) ;  
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="keywords"><%=_ctx.appRes("Podcast.dialog.label.keywords")%></label></td>
	      <td class="FieldComponent">
		      <%
			      String[] fieldKeywords = ["jcrPath=/node/exo:keywords"] ;
			      uicomponent.addTextField("keywords", fieldKeywords) ;  
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="publishedDate"><%=_ctx.appRes("Podcast.dialog.label.publish-date")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldPublishedDate = ["jcrPath=/node/exo:publishedDate", "options=displaytime", "validate=datetime", "visible=true"] ;
		        uicomponent.addCalendarField("publishedDate", fieldPublishedDate) ;
		      %>
		    </td>
	    </tr>
		<tr>
        	<td class="FieldLabel"><label for="content-lang"><%=_ctx.appRes("ElementSet.dialog.label.language")%></label></td>
			<td class="FieldComponent">
			<%
			  String lang = org.exoplatform.portal.webui.util.Util.getPortalRequestContext().getLocale().toString();
			  String[] fieldLang = ["jcrPath=/node/exo:language", "script=ecm-explorer/widget/FillSelectBoxWithLanguage.groovy", lang] ;
			  uicomponent.addSelectBoxField("content-lang", fieldLang) ;
			%>
			</td>
		</tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="description"><%=_ctx.appRes("Podcast.dialog.label.description")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldDescription = ["jcrPath=/node/exo:description"] ;
		        uicomponent.addTextAreaField("description", fieldDescription) ;
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><%=_ctx.appRes("Podcast.dialog.label.upload-file")%></td>
	      <td class="FieldComponent">
		      <%
		        if (uicomponent.isEditing()) { 
							def curNode = uicomponent.getNode() ;
							if (curNode.hasNode("jcr:content")) {
								def imageNode = curNode.getNode("jcr:content") ;
								if (imageNode.getProperty("jcr:data").getStream().available() > 0) {
									def actionLink = uicomponent.event("RemoveData", "/jcr:content");
						%>		
									<div>
									  <div style="font-size:12px; font-weight: bold; line-height: 17px;">
									    <%=_ctx.appRes("File.dialog.label.re-upload")%>
									  </div>
										<a href="$actionLink">
											<img src="/eXoResources/skin/DefaultSkin/background/Blank.gif" alt="<%=_ctx.appRes("Ecm.dialog.label.remove")%>" class="ActionIcon Remove16x16Icon"/>
										</a>
									</div>
						<%
								} else {
					        String[] fieldMedia = ["jcrPath=/node/jcr:content/jcr:data", "mimetype=audio/mp3,audio/x-m4a,video/mpeg,video/x-m4v,video/quicktime"] ;
				  	      uicomponent.addUploadField("media", fieldMedia) ;				
								}
							}
						} else if (uicomponent.dataRemoved()) {
			        String[] fieldMedia = ["jcrPath=/node/jcr:content/jcr:data", "mimetype=audio/mp3,audio/x-m4a,video/mpeg,video/x-m4v,video/quicktime"] ;
				  	  uicomponent.addUploadField("media", fieldMedia) ;
						}	else {
			        String[] fieldMedia = ["jcrPath=/node/jcr:content/jcr:data", "mimetype=audio/mp3,audio/x-m4a,video/mpeg,video/x-m4v,video/quicktime"] ;
					    uicomponent.addUploadField("media", fieldMedia) ;
						}
		      %>
		    </td>
	    </tr>
	    <tr>	
	    <td class="FieldLabel"><label for="mediamimetype"><%=_ctx.appRes("Podcast.dialog.label.mime-type")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldMediamimetype = ["jcrPath=/node/jcr:content/jcr:mimeType", "audio/mp3", "options=audio/mp3,audio/x-m4a,video/mpeg,video/x-m4v,video/quicktime"] ;
		        uicomponent.addSelectBoxField("mediamimetype", fieldMediamimetype) ;
		      %>
		    </td>
	    </tr>
	    <tr>		          					
	      <td class="FieldLabel"><label for="medialength"><%=_ctx.appRes("Podcast.dialog.label.lenght")%></label></td>
	      <td class="FieldComponent">
		      <%
		       String[] fieldSize = ["jcrPath=/node/exo:length", "validate=number"] ;
		       uicomponent.addTextField("medialength", fieldSize) ; 
		      %>
		    </td>
	    </tr>
	  </table>
  </div>
  <% if (!uiform.isShowActionsOnTop()) {
            uiform.processRenderAction()
         }
  %>
  <%uiform.end()%>
</div>
