<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="infoglue-content" prefix="content" %>
<%@ taglib uri="infoglue-structure" prefix="structure" %>
<%@ taglib uri="infoglue-page" prefix="page" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<page:deliveryContext id="dc" useFullUrl="true" disableNiceUri="true" trimResponse="true"/>

<structure:componentPropertyValue id="feedTitle" propertyName="FeedTitle"/>
<c:if test="${not empty param.feedTitle}">
	<c:set var="feedTitle" value="${param.feedTitle}"/>
</c:if>
<c:if test="${empty feedTitle}">
	<c:set var="feedTitle" value="RSS from InfoGlue Central"/>
</c:if>

<structure:componentPropertyValue id="feedDescription" propertyName="FeedDescription"/>
<c:if test="${not empty param.feedDescription}">
	<c:set var="feedDescription" value="${param.feedDescription}"/>
</c:if>

<structure:componentPropertyValue id="feedType" propertyName="FeedType"/>
<common:urlBuilder id="currentFullUrl" />
<c:if test="${feedType == null || feedType == ’’ || feedType == ’Undefined’}"><c:set var="feedType" value="rss_2.0"/></c:if>
	
<common:rssFeed id="rss" title="${feedTitle}" link="${currentFullUrl}" description="${feedDescription}" feedType="${feedType}">

	<c:choose>
		<c:when test="${param.matchType == ’childContents’ && not empty param.folderContentId}">
			<content:childContents id="news" contentId="${param.folderContentId}" sortAttribute="publishDateTime" sortOrder="desc"/>
		</c:when>
		<c:otherwise>
			<content:childContents id="news" propertyName="Folder" sortAttribute="publishDateTime" sortOrder="desc"/>
		</c:otherwise>
	</c:choose>
	
	<structure:componentPropertyValue id="titleName" propertyName="TitleAttributeName"/>
	<structure:componentPropertyValue id="descriptionName" propertyName="DescriptionAttributeName"/>
	<c:if test="${titleName == null || titleName == ’’ || titleName == ’Undefined’}">
		<c:set var="titleName" value="NavigationTitle"/>
	</c:if>
	<c:if test="${descriptionName == null || descriptionName == ’’ || descriptionName == ’Undefined’}">
		<c:set var="descriptionName" value="Leadin"/>
	</c:if>
	<c:forEach var="newsItem" items="${news}" varStatus="count">
		<content:contentAttribute id="navigationTitle" contentId="${newsItem.id}" attributeName="${titleName}" disableEditOnSight="true"/>
		<content:contentAttribute id="leadIn" contentId="${newsItem.id}" attributeName="${descriptionName}" disableEditOnSight="true"/>
		<structure:pageUrl id="url" contentId="${newsItem.id}" propertyName="DetailPage"/>
		<common:rssFeedEntry title="${navigationTitle}" link="${url}" description="${leadIn}" publishedDate="${newsItem.publishDateTime}"/>
	</c:forEach>
</common:rssFeed>
<c:out value="${rss}" escapeXml="false"/>