<%
		/*	
  String driverName = uicomponent.getDriverName();
  String[] fieldURL = ["jcrPath=/node/exo:url", driverName];
  uicomponent.addHiddenField("url", fieldURL);
  */ 
%>
<%
  String[] fieldURL = ["jcrPath=/node/exo:url", "http://localhost:8080/ecmexplorer/rss"] ;
  uicomponent.addHiddenField("url", fieldURL) ; 
%>
<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("Rss.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("Rss.dialog.label.feed-action-name")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldName = ["jcrPath=/node/exo:name", "validate=empty"];
		        uicomponent.addTextField("actionName", fieldName) ;  
		      %>
		    </td>
		  </tr>
		  <tr>
	      <td class="FieldLabel"><label for="lifecycle"><%=_ctx.appRes("Rss.dialog.label.lifecycle")%></td>
	      <td class="FieldComponent">
  	      <% 
            String[] fieldLifecycle = ["jcrPath=/node/exo:lifecyclePhase", 
                                       "options=read,schedule,node_added,node_removed,property_added,property_removed,property_changed",
                                       "multiValues=true", "onchange=true","size=5","validate=empty"] ;
            uicomponent.addSelectBoxField("lifecycle", fieldLifecycle) ;
          %>
		    </td>
			</tr>
	    <%
				String selectValue = uicomponent.getSelectBoxFieldValue("lifecycle") ;
				if(selectValue != null) {
					if(selectValue.equals("schedule")) {
			%>
		  <tr>
	      <td class="FieldLabel"><label for="scheduleType"><%=_ctx.appRes("Rss.dialog.label.schedule-type")%></label></td>
	      <td class="FieldComponent">
				  <% 
						String[] fieldScheduleType = ["jcrPath=/node/exo:scheduleType", "options=cron,period", "onchange=true"] ;
						uicomponent.addSelectBoxField("scheduleType", fieldScheduleType) 
				  %>
			  </td>
			</tr>
			<%
				String ScheduleType = uicomponent.getSelectBoxFieldValue("scheduleType") ;
				if(ScheduleType.equals("period") ) {%>
					<tr>		          					
					  <td class="FieldLabel"><label for="startTime"><%=_ctx.appRes("Rss.dialog.label.start-time")%></label></td>
					  <td class="FieldComponent">
						  <% 
							String[] fieldStartTime = ["jcrPath=/node/exo:startTime", "options=displaytime", "validate=datetime", "visible=true"] ;
							uicomponent.addCalendarField("startTime", fieldStartTime) ;
						  %>
						</td>
					</tr>
					<tr>		          					
					  <td class="FieldLabel"><label for="endTime"><%=_ctx.appRes("Rss.dialog.label.end-time")%></label></td>
					  <td class="FieldComponent">
						  <% 
						  String[] fieldEndTime = ["jcrPath=/node/exo:endTime", "options=displaytime", "validate=datetime", "visible=true"];
							uicomponent.addCalendarField("endTime", fieldEndTime) ;
						  %>
						</td>
					</tr>
					<tr>		          					
					  <td class="FieldLabel"><label for="repeatCount"><%=_ctx.appRes("Rss.dialog.label.repeat-count")%></label></td>
					  <td class="FieldComponent">
						  <% 
							String[] fieldRepeatCount= ["jcrPath=/node/exo:repeatCount", "-1", "validate=repeatCountValidator"] ;
							uicomponent.addTextField("repeatCount", fieldRepeatCount) ;
						  %>
						</td>
					</tr>
					<tr>		          					
					  <td class="FieldLabel"><label for="timeInterval"><%=_ctx.appRes("Rss.dialog.label.time-inteval")%></label></td>
					  <td class="FieldComponent">
						  <% 
							String[] fieldTimeInterval = ["jcrPath=/node/exo:timeInterval", "1", "validate=repeatIntervalValidator"] ;
							uicomponent.addTextField("timeInterval", fieldTimeInterval) ;
						  %>
						</td>
					</tr>
          <% uicomponent.removeChildById("cronExpression") ; %>					
				<%} else {%>
					<tr>		          					
					  <td class="FieldLabel"><label for="cronExpression"><%=_ctx.appRes("Rss.dialog.label.cron-expression")%></label></td>
					  <td class="FieldComponent">
						  <% 
							String[] fieldCronExpression = ["jcrPath=/node/exo:cronExpression", "validate=cronExpressionValidator"] ;
							uicomponent.addTextField("cronExpression", fieldCronExpression) ;
						  %>
						</td>
					</tr>
					<% 
					  uicomponent.removeChildById("startTime") ; 
					  uicomponent.removeChildById("endTime") ; 
					  uicomponent.removeChildById("repeatCount") ; 
					  uicomponent.removeChildById("timeInterval") ; 
					%>					
				<%}	
			} else {
				uicomponent.removeChildById("startTime") ; 
				uicomponent.removeChildById("endTime") ; 
				uicomponent.removeChildById("repeatCount") ; 
				uicomponent.removeChildById("timeInterval") ; 	
				uicomponent.removeChildById("cronExpression") ;					  			    
			}
		}
		%>	
	    <tr>                        
	      <td class="FieldLabel"><label for="feed-name"><%=_ctx.appRes("Rss.dialog.label.feed-node-name")%></label></td>
	      <td class="FieldComponent">
		      <%
		         String[] fieldFeedName = ["jcrPath=/node/exo:feedName"] ;
		         uicomponent.addTextField("feed-name", fieldFeedName) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="store-path"><%=_ctx.appRes("Rss.dialog.label.feed-store-path")%></label></td>
	      <td class="FieldComponent">
		      <% 
		         String[] fieldFeedStorePath = ["jcrPath=/node/exo:storePath", "/Feeds"] ;
		         uicomponent.addTextField("store-path", fieldFeedStorePath) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="feed-type"><%=_ctx.appRes("Rss.dialog.label.feed-type")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldFeedType = ["jcrPath=/node/exo:feedType", "rss", "options=rss,podcast,video podcast", "onchange=true"] ;
		        uicomponent.addSelectBoxField("feed-type", fieldFeedType) ;
		      %>
		    </td>
	    </tr>
	    <%
	      String feedTypeValue = uicomponent.getSelectBoxFieldValue("feed-type") ;
	    %>
	    <tr>                        
	      <td class="FieldLabel"><label for="title"><%=_ctx.appRes("Rss.dialog.label.title")%></label></td>
	      <td class="FieldComponent">
		      <% 
		         String[] title = ["jcrPath=/node/exo:title", "validate=empty", "exo:title"] ;
		         uicomponent.addTextField("title", title) ;
		      %>
		    </td>
	    </tr>
	    
	    <tr>                        
		      <% 
		         if(feedTypeValue.equals("rss")) {
		      %>
            <td class="FieldLabel"><label for="entrySummary"><%=_ctx.appRes("Rss.dialog.label.summary")%></label></td>
            <td class="FieldComponent">
          <%		      
			         String[] summary = ["jcrPath=/node/exo:summary", "exo:summary"] ;
			         uicomponent.addTextField("entrySummary", summary) ;
			         uicomponent.removeComponent("entryDescription") ;
		         } else {
		      %>
              <td class="FieldLabel"><label for="entryDescription"><%=_ctx.appRes("Rss.dialog.label.summary")%></label></td>
              <td class="FieldComponent">
          <%		      
			         String[] description = ["jcrPath=/node/exo:summary", "exo:description"] ;
			         uicomponent.addTextField("entryDescription", description) ;
			         uicomponent.removeComponent("entrySummary") ;
		         }
		      %>
		    </td>
	    </tr>
	    
	    <tr>                        
		      <%
		        if(feedTypeValue.equals("rss")) {
		      %>
            <td class="FieldLabel"><label for="queryPathRss"><%=_ctx.appRes("Rss.dialog.label.query-items")%></label></td>
            <td class="FieldComponent">
          <%		      
		          String s1 = "SELECT * FROM exo:article WHERE jcr:path LIKE '" + 
		          uicomponent.getCurrentPath() + "/%' AND NOT jcr:path LIKE '" + uicomponent.getCurrentPath() + "/%/%'";
		          String[] fieldQueryPathRss = ["jcrPath=/node/exo:queryPath", s1] ;
		          uicomponent.addTextAreaField("queryPathRss", fieldQueryPathRss) ; 
		          uicomponent.removeComponent("queryPathPodcast") ;
		        } else {
		      %>
	            <td class="FieldLabel"><label for="queryPathPodcast"><%=_ctx.appRes("Rss.dialog.label.query-items")%></label></td>
              <td class="FieldComponent">	      
          <%
              String s2 = "SELECT * FROM exo:podcast WHERE jcr:path LIKE '" + 
              uicomponent.getCurrentPath() + "/%' AND NOT jcr:path LIKE '" + uicomponent.getCurrentPath() + "/%/%'";
		          String[] fieldQueryPathPodcast = ["jcrPath=/node/exo:queryPath", s2] ;
		          uicomponent.addTextAreaField("queryPathPodcast", fieldQueryPathPodcast) ; 
		          uicomponent.removeComponent("queryPathRss") ;
		        }
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="rss-title"><%=_ctx.appRes("Rss.dialog.label.feed-title")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldTitle = ["jcrPath=/node/exo:feedTitle"] ;
		        uicomponent.addTextField("rss-title", fieldTitle) ;
		      %>
		    </td>
	    </td>
	    <tr>                        
	      <td class="FieldLabel"><label for="rss-version"><%=_ctx.appRes("Rss.dialog.label.rss-version")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldRSSVersion = ["jcrPath=/node/exo:rssVersion", "rss_2.0", "options=rss_2.0,rss_1.0,rss_0.94,rss_0.93,rss_0.92,rss_0.91,rss_0.90"] ;
		        uicomponent.addSelectBoxField("rss-version", fieldRSSVersion) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="link"><%=_ctx.appRes("Rss.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="isDeep"><%=_ctx.appRes("Rss.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("Rss.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="description"><%=_ctx.appRes("Rss.dialog.label.description")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldDescription = ["jcrPath=/node/exo:description", "This podcast provided by eXo Platform opensource company"] ; 
		        uicomponent.addTextAreaField("description", fieldDescription) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="language"><%=_ctx.appRes("Rss.dialog.label.language")%></label></td>
	     	<td class="FieldComponent">
		      <%
		        String[] fieldLanguage = ["jcrPath=/node/exo:language", "English", "options=English,French"] ; 
		        uicomponent.addSelectBoxField("language", fieldLanguage) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="copyright"><%=_ctx.appRes("Rss.dialog.label.copyright")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldCopyright = ["jcrPath=/node/exo:copyright", "Copyright ? 2000-2008 eXo Platform SARL"] ; 
		        uicomponent.addTextField("copyright", fieldCopyright) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="pubDate"><%=_ctx.appRes("Rss.dialog.label.publish-date")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldPubDate = ["jcrPath=/node/exo:pubDate", "options=displaytime", "validate=datetime", "visible=true"];
		        uicomponent.addCalendarField("pubDate", fieldPubDate) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="ownerName"><%=_ctx.appRes("Rss.dialog.label.owner-name")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldOwnerName = ["jcrPath=/node/exo:ownerName", "Exoplatform"] ; 
		        uicomponent.addTextField("ownerName", fieldOwnerName) ;   
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="ownerEmail"><%=_ctx.appRes("Rss.dialog.label.owner-email")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldOwnerEmail = ["jcrPath=/node/exo:ownerEmail", "support@exoplatform.com"] ; 
		        uicomponent.addTextField("ownerEmail", fieldOwnerEmail) ;   
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="imageURL"><%=_ctx.appRes("Rss.dialog.label.image-url")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldImageURL = ["jcrPath=/node/exo:imageURL"] ; 
		        uicomponent.addTextField("imageURL", fieldImageURL) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="category"><%=_ctx.appRes("Rss.dialog.label.category")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldCategory = ["jcrPath=/node/exo:category"] ; 
		        uicomponent.addTextField("category", fieldCategory) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><label for="keywords"><%=_ctx.appRes("Rss.dialog.label.keywords")%></label></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldKeyword = ["jcrPath=/node/exo:keywords"] ; 
		        uicomponent.addTextField("keywords", fieldKeyword) ;  
		      %>
		    </td>
	    </tr>
	    <tr>                       
        <td class="FieldLabel"><label for="affectedNodetypes"><%=_ctx.appRes("Rss.dialog.label.affectedNodeTypeNames")%></label></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"];
        uicomponent.addActionField("affectedNodetypes", fieldAffectedNodetypes);
        %>
      </tr> 
	  </table>
    <%/* start render action*/%>
		<%uiform.processRenderAction()%>
		<%/* end render action*/%>
  </div>
  <%uiform.end()%>
</div>