<%
		/*	
  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"><%=_ctx.appRes("Rss.dialog.label.id")%></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"><%=_ctx.appRes("Rss.dialog.label.feed-action-name")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldName = ["jcrPath=/node/exo:name", "validate=empty"];
		        uicomponent.addTextField("actionName", fieldName) ;  
		      %>
		    </td>
		  </tr>
		  <tr>
	      <td class="FieldLabel"><%=_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"><%=_ctx.appRes("Rss.dialog.label.schedule-type")%></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"><%=_ctx.appRes("Rss.dialog.label.start-time")%></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"><%=_ctx.appRes("Rss.dialog.label.end-time")%></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"><%=_ctx.appRes("Rss.dialog.label.repeat-count")%></td>
					  <td class="FieldComponent">
						  <% 
							String[] fieldRepeatCount= ["jcrPath=/node/exo:repeatCount", "-1", "validate=repeatCountValidator"] ;
							uicomponent.addTextField("repeatCount", fieldRepeatCount) ;
						  %>
						</td>
					</tr>
					<tr>		          					
					  <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.time-inteval")%></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"><%=_ctx.appRes("Rss.dialog.label.cron-expression")%></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"><%=_ctx.appRes("Rss.dialog.label.feed-node-name")%></td>
	      <td class="FieldComponent">
		      <%
		         String[] fieldFeedName = ["jcrPath=/node/exo:feedName"] ;
		         uicomponent.addTextField("feed-name", fieldFeedName) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.feed-store-path")%></td>
	      <td class="FieldComponent">
		      <% 
		         String[] fieldFeedStorePath = ["jcrPath=/node/exo:storePath", "/Feeds"] ;
		         uicomponent.addTextField("store-path", fieldFeedStorePath) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.feed-type")%></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"><%=_ctx.appRes("Rss.dialog.label.title")%></td>
	      <td class="FieldComponent">
		      <% 
		         String[] title = ["jcrPath=/node/exo:title", "validate=empty", "exo:title"] ;
		         uicomponent.addTextField("title", title) ;
		      %>
		    </td>
	    </tr>
	    
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.summary")%></td>
	      <td class="FieldComponent">
		      <% 
		         if(feedTypeValue.equals("rss")) {
			         String[] summary = ["jcrPath=/node/exo:summary", "exo:summary"] ;
			         uicomponent.addTextField("entrySummary", summary) ;
			         uicomponent.removeComponent("entryDescription") ;
		         } else {
			         String[] description = ["jcrPath=/node/exo:summary", "exo:description"] ;
			         uicomponent.addTextField("entryDescription", description) ;
			         uicomponent.removeComponent("entrySummary") ;
		         }
		      %>
		    </td>
	    </tr>
	    
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.query-items")%></td>
	      <td class="FieldComponent">
		      <%
		        if(feedTypeValue.equals("rss")) {
		          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 {
              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"><%=_ctx.appRes("Rss.dialog.label.feed-title")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldTitle = ["jcrPath=/node/exo:feedTitle"] ;
		        uicomponent.addTextField("rss-title", fieldTitle) ;
		      %>
		    </td>
	    </td>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.rss-version")%></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"><%=_ctx.appRes("Rss.dialog.label.link")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldLink = ["jcrPath=/node/exo:link", "validate=empty"] ;
		        uicomponent.addTextField("link", fieldLink) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
        <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.isDeep")%></td>
        <td class="FieldComponent"> 
        <% 
          String[] fieldDeep = ["jcrPath=/node/exo:isDeep", "defaultValues=true"];         
          uicomponent.addCheckBoxField("isDeep", fieldDeep);
        %>
        </td>
      </tr>
      <tr>                        
        <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.nodetypes")%></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"><%=_ctx.appRes("Rss.dialog.label.description")%></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"><%=_ctx.appRes("Rss.dialog.label.language")%></td>
	     	<td class="FieldComponent">
		      <%
		        String[] fieldLanguage = ["jcrPath=/node/exo:language", "English", "options=English,French"] ; 
		        uicomponent.addSelectBoxField("language", fieldLanguage) ; 
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.copyright")%></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"><%=_ctx.appRes("Rss.dialog.label.publish-date")%></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"><%=_ctx.appRes("Rss.dialog.label.owner-name")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldOwnerName = ["jcrPath=/node/exo:ownerName", "Exoplatform"] ; 
		        uicomponent.addTextField("ownerName", fieldOwnerName) ;   
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.owner-email")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldOwnerEmail = ["jcrPath=/node/exo:ownerEmail", "support@exoplatform.com"] ; 
		        uicomponent.addTextField("ownerEmail", fieldOwnerEmail) ;   
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.image-url")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldImageURL = ["jcrPath=/node/exo:imageURL"] ; 
		        uicomponent.addTextField("imageURL", fieldImageURL) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.category")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldCategory = ["jcrPath=/node/exo:category"] ; 
		        uicomponent.addTextField("category", fieldCategory) ;
		      %>
		    </td>
	    </tr>
	    <tr>                        
	      <td class="FieldLabel"><%=_ctx.appRes("Rss.dialog.label.keywords")%></td>
	      <td class="FieldComponent">
		      <%
		        String[] fieldKeyword = ["jcrPath=/node/exo:keywords"] ; 
		        uicomponent.addTextField("keywords", fieldKeyword) ;  
		      %>
		    </td>
	    </tr>
	    <tr>                       
        <td class="FieldLabel"><%=_ctx.appRes("Rss.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"];
        uicomponent.addActionField("affectedNodetypes", fieldAffectedNodetypes);
        %>
      </tr> 
	  </table>
    <%/* start render action*/%>
		<%uiform.processRenderAction()%>
		<%/* end render action*/%>
  </div>
  <%uiform.end()%>
</div>