### Eclipse Workspace Patch 1.0 #P Ametys - Template CMSWEB Index: webapp/cms/skins/demo/stylesheets/content/common.xsl =================================================================== --- webapp/cms/skins/demo/stylesheets/content/common.xsl (revision 15641) +++ webapp/cms/skins/demo/stylesheets/content/common.xsl (working copy) @@ -35,4 +35,10 @@ </xsl:with-param> </xsl:call-template> </xsl:template> + + <xsl:template name="comments-rss"> + <a href="{$site-uri-prefix}/_plugins/web/comments/rss.xml?contentId={@id}&siteName={$site}"> + <img src="{ametys:skinURL('img/rssicon.png')}" title="plugin.web:PLUGINS_WEB_RSS_COMMENTS_LABEL" alt="plugin.web:PLUGINS_WEB_RSS_COMMENTS_LABEL" i18n:attr="alt title" class="invisible floatright"/> + </a> + </xsl:template> </xsl:stylesheet> \ No newline at end of file #P Ametys - 07 CMS Index: main/plugin-cms/pages/comments/helper/comments_3.3.xsl =================================================================== --- main/plugin-cms/pages/comments/helper/comments_3.3.xsl (revision 15641) +++ main/plugin-cms/pages/comments/helper/comments_3.3.xsl (working copy) @@ -43,6 +43,8 @@ <xsl:choose> <xsl:when test="comments/comment or metadata/comment = 'true'"> <div class="comments-wrapper" id="{$uniqueId}"> + <xsl:call-template name="comments-rss"/> + <xsl:choose> <xsl:when test="comments/comment"> <xsl:call-template name="comments-count"/> @@ -477,4 +479,6 @@ <xsl:with-param name="onclick">return comment_form_submit_<xsl:value-of select="$uniqueId"/>();</xsl:with-param> </xsl:call-template> </xsl:template> + + <xsl:template name="comments-rss"/> </xsl:stylesheet> Index: main/plugin-cms/src/org/ametys/cms/content/CommentsGenerator.java =================================================================== --- main/plugin-cms/src/org/ametys/cms/content/CommentsGenerator.java (revision 0) +++ main/plugin-cms/src/org/ametys/cms/content/CommentsGenerator.java (revision 0) @@ -0,0 +1,23 @@ +package org.ametys.cms.content; + +import java.io.IOException; + +import org.apache.cocoon.ProcessingException; +import org.apache.cocoon.xml.AttributesImpl; +import org.apache.cocoon.xml.XMLUtils; +import org.xml.sax.SAXException; + +import org.ametys.cms.repository.Content; + +public class CommentsGenerator extends ContentGenerator +{ + protected void _saxContent (Content content) throws SAXException, IOException, ProcessingException + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addCDATAAttribute("title", content.getTitle()); + attrs.addCDATAAttribute("name", content.getName()); + XMLUtils.startElement(contentHandler, "content", attrs); + _saxCommentsMetadata(content); + XMLUtils.endElement(contentHandler, "content"); + } +} #P Ametys - 08 WEB Index: main/plugin-web/i18n/messages_en.xml =================================================================== --- main/plugin-web/i18n/messages_en.xml (revision 15614) +++ main/plugin-web/i18n/messages_en.xml (working copy) @@ -1952,6 +1983,13 @@ <message key="PLUGINS_WEB_BUILDALL_ERROR_MAIL_BODY">The scheduled rebuilt of live workspace failed. Your sites are potentially in an unstable state. The full stack trace of the error is displayed at the bottom of this email. You can try a manual rebuild on administration screen to the url : </message> <message key="PLUGINS_WEB_SYNCHRONIZE_INFINITE_REDIRECTION_MAIL_SUBJECT">[{0}] Detection of an infinite redirection</message> <message key="PLUGINS_WEB_SYNCHRONIZE_INFINITE_REDIRECTION_MAIL_BODY">An infinite redirection was detected on site "{0}". The problem lies in the site map at page '{1}'. This page and its sub-pages have not been published. A infinite redirection is caused by series of page of redirection and/or node pages, leading to a redirection loop. Example: page redirects to page B which redirects to the page A. To correct this problem, go to the CMS to the url {2} and edit or delete one of theses redirections.</message> + + <!-- Shared folder --> + <message key="PLUGINS_EXPLORER_PROXY_FOLDER">Shared resources</message> + <message key="PLUGINS_WEB_RESOURCES_SHARED_FOLDER_LABEL">Shared resources</message> + <message key="PLUGINS_WEB_RESOURCES_SHARED_FOLDER_DESCRIPTION">Shared resources for all websites, if you disable this option, it won't delete the content of the shared folder but it will be hide for users.</message> + <message key="PLUGINS_WEB_RSS_COMMENTS_DESCRIPTION">Last comments on {content}</message> + <message key="PLUGINS_WEB_RSS_COMMENTS_LABEL">Comments RSS feed</message> </catalogue> \ No newline at end of file Index: main/plugin-web/i18n/messages_fr.xml =================================================================== --- main/plugin-web/i18n/messages_fr.xml (revision 15614) +++ main/plugin-web/i18n/messages_fr.xml (working copy) @@ -1954,5 +1954,7 @@ <message key="PLUGINS_WEB_SYNCHRONIZE_INFINITE_REDIRECTION_MAIL_SUBJECT">[{0}] Détection d'une redirection infinie</message> <message key="PLUGINS_WEB_SYNCHRONIZE_INFINITE_REDIRECTION_MAIL_BODY">Une redirection infinie a été détectée sur le site "{0}". Le problème se situe dans l'arborescence au niveau de la page '{1}'. Cette page et sa sous-arborescence n'ont pas été mises en ligne. Une redirection infinie est provoquée par un enchaînement de pages de redirection et/ou de pages noeuds, menant à une redirection en boucle. Exemple : la page A redirige vers la page B qui elle-même redirige vers la page A. Pour corriger ce problème, rendez vous sur le CMS à l'url {2} et modifiez ou supprimez une des redirections.</message> + <message key="PLUGINS_WEB_RSS_COMMENTS_DESCRIPTION">Derniers commentaires sur {content}</message> + <message key="PLUGINS_WEB_RSS_COMMENTS_LABEL">Flux RSS des commentaires</message> </catalogue> \ No newline at end of file Index: main/plugin-web/sitemap-front.xmap =================================================================== --- main/plugin-web/sitemap-front.xmap (revision 15614) +++ main/plugin-web/sitemap-front.xmap (working copy) @@ -41,6 +41,8 @@ <map:generator name="front-search" src="org.ametys.web.frontoffice.SearchGenerator" label="xml"/> <map:generator name="resources-search" src="org.ametys.web.frontoffice.SearchResourcesGenerator" label="xml"/> <map:generator name="auto-completion" src="org.ametys.web.frontoffice.AutoCompletionGenerator" label="xml"/> + + <map:generator name="comments-generator" src="org.ametys.cms.content.CommentsGenerator"/> </map:generators> <map:transformers> @@ -472,6 +47,25 @@ <map:match pattern="org.ametys.web.default.Content.*.*"> <map:redirect-to uri="cocoon:/content-type.{1}.{2}"/> </map:match> + + <map:match pattern="comments/rss.xml"> + <map:act type="get-content"> + <map:parameter name="id" value="{request-param:contentId}"/> + <map:generate type="comments-generator" label="content"/> + + <map:transform src="pages/comments/comments2rss.xsl"> + <map:parameter name="contextPath" value="{uri-prefix:absolute-uri-prefix:{request-param:siteName}}"></map:parameter> + </map:transform> + <map:transform type="i18n"> + <map:parameter name="locale" value="{locale:locale}"/> + </map:transform> + <map:transform src="pages/rss/rss.xsl"> + <map:parameter name="siteURL" value="{uri-prefix:absolute-uri-prefix:{request-param:siteName}}"></map:parameter> + <map:parameter name="rssPath" value="_plugins/web/comments/rss.xml?contentId={request-param:contentId}"></map:parameter> + </map:transform> + <map:serialize type="xml"/> + </map:act> + </map:match> </map:pipeline> </map:pipelines> </map:sitemap> Index: main/plugin-web/pages/comments/comments2rss.xsl =================================================================== --- main/plugin-web/pages/comments/comments2rss.xsl (revision 0) +++ main/plugin-web/pages/comments/comments2rss.xsl (revision 0) @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2012 Anyware Services + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:docbook="http://docbook.org/ns/docbook" + xmlns:resolver="org.ametys.cms.transformation.xslt.ResolveURIComponent" + xmlns:i18n="http://apache.org/cocoon/i18n/2.1" exclude-result-prefixes="docbook resolver i18n"> + + <xsl:param name="contextPath"/> + + <xsl:template match="/"> + <RssFeed> + <title><xsl:value-of select="content/@title"/></title> + <description> + <i18n:translate> + <i18n:text i18n:key="PLUGINS_WEB_RSS_COMMENTS_DESCRIPTION" i18n:catalogue="plugin.web"/> + <i18n:param name="content"><xsl:value-of select="content/@title"/></i18n:param> + </i18n:translate> + </description> + <pubDate><i18n:date pattern="EEE, d MMM yyyy HH:mm:ss Z" src-pattern="yyyy-MM-dd'T'HH:mm:ss" locale="en_EN"/></pubDate> + <xsl:apply-templates select="//comment"/> + </RssFeed> + </xsl:template> + + <xsl:template match="comment"> + <item> + <author><xsl:value-of select="@author-email"/><xsl:text> (</xsl:text><xsl:value-of select="@author-name"/><xsl:text>)</xsl:text></author> + <guid><xsl:value-of select="$contextPath"/>/_wrapped-content/<xsl:value-of select="//content/@name"/>.html#<xsl:value-of select="@id"/></guid> + <pubDate><i18n:date pattern="EEE, d MMM yyyy HH:mm:ss Z" src-pattern="yyyy-MM-dd'T'HH:mm:ss" locale="en_EN"><xsl:value-of select="@creation-date"/></i18n:date></pubDate> + <rawDate><xsl:value-of select="@creation-date"/></rawDate> + <description> + <xsl:apply-templates select="*" mode="escape"/> + </description> + </item> + </xsl:template> + + <xsl:template match="*" mode="escape"> + <xsl:choose> + <xsl:when test="count(*) >= 0"> + <<xsl:value-of select="local-name()" /> <xsl:apply-templates select="@*" mode="escape"/>> + + <xsl:apply-templates mode="escape"/> + + </<xsl:value-of select="local-name()" />> + </xsl:when> + + <xsl:otherwise> + <<xsl:value-of select="local-name()" /> <xsl:apply-templates select="@*" mode="escape"/> /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="@*" mode="escape"> + <xsl:value-of select="local-name()" />="<xsl:value-of select="." />"<xsl:text> </xsl:text> + </xsl:template> + +</xsl:stylesheet> Index: main/plugin-web/pages/comments/helper/comments_3.3.xsl =================================================================== --- main/plugin-web/pages/comments/helper/comments_3.3.xsl (revision 15614) +++ main/plugin-web/pages/comments/helper/comments_3.3.xsl (working copy) @@ -22,6 +22,9 @@ <xsl:import href="plugin:cms://pages/comments/helper/comments_3.3.xsl"/> + <xsl:variable name="site" select="ametys:site()"/> + <xsl:variable name="site-uri-prefix" select="ametys:siteUriPrefix()"/> + <xsl:template name="get-uri-prefix"> <xsl:value-of select="ametys:uriPrefix()"/> </xsl:template> @@ -33,4 +36,9 @@ <xsl:text>/_plugins/cms/page/comments/add-comment</xsl:text> </xsl:template> + <xsl:template name="comments-rss"> + <a href="{$site-uri-prefix}/_plugins/web/comments/rss.xml?contentId={@id}&siteName={$site}"> + <i18n:text i18n:key="PLUGINS_WEB_RSS_COMMENTS_LABEL" i18n:catalogue="plugin.web"/> + </a> + </xsl:template> </xsl:stylesheet>