plugin provides a XSLT helper for inserting a "Subscribe to this page" link in your pages.
This link can be inserted into the graphic rendering of a content or service, or into the site's graphic charter.
To insert a "Manage my page subscription" link in a page's attachments service:
1) overload the service rendering in your charter: skins/[NON_SKIN]/services/web/pages/services/attach/attachments-tree_3.3.xsl
2) import the helper XSLT plugin:page-subscription://stylesheets/helpers/page-subscribe.xsl
3) call up the XSLT template "page-subscription" in the desired location
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i18n="http://apache.org/cocoon/i18n/2.1" xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper" exclude-result-prefixes="ametys"> <xsl:import href="plugin:web://pages/services/attach/attachments_tree_3.3.xsl"/> <xsl:import href="plugin:page-subscription://stylesheets/helpers/page-subscribe.xsl"/> <!-- Used by common --> <xsl:template name="common-service-head-css"> <link type="text/css" rel="stylesheet" href="{ametys:skinURL('css/services/attach.css')}" media="screen, print, handheld"/> </xsl:template> <xsl:template name="common-service-body-nonempty-content-content"> <xsl:call-template name="attachment-list"/> <xsl:call-template name="page-subscription"/> </xsl:template> </xsl:stylesheet>
Note
The title and action of the link differ depending on whether the user is logged in or not, subscribed or not, and whether the page is cacheable or not. There are several possible scenarios:
- if the user is not connectedthe link is entitled "Manage my subscription on the page" and the user must enter his mail address and what he wants to do: subscribe or unsubscribe.
- if the user is connected and not subscribed to the page, a simple confirmation will be requested. The title of the link is "Subscribe to the page" if the page is not cacheable, or "Manage my subscription on the page" if the page is cacheable.
- if the user is connected and subscribed to the page, a simple confirmation will be requested. The title of the link is "Unsubscribe to the page" if the page is not cacheable, or "Manage my subscription to the page" if the page is cacheable.
The XSLT "page-subscription" template can be configured to modify default texts (link texts, form texts, confirmation or success messages)
For example, "Subscribe to page" can be replaced by "Subscribe to page attachments".
<xsl:template name="page-subscription"> <xsl:with-param name="subscribe-link-content">S'abonner aux pièces jointes de la page</xsl:with-param> <xsl:with-param name="unsubscribe-link-content">Se désabonner aux pièces jointes de la page</xsl:with-param> <xsl:with-param name="subscribe-success-message"><p>Votre abonnement <b>aux pièces jointes</b> a bien été prise en compte</p></xsl:with-param> .... </xsl:template>
Attention
Si du code HTML est utilisé, il doit être échappé : <p>hello</p> => <p>hello</p>
See the helper XSLT for further customization options.
The effect of subscribing to a page is to register the mail address of the user subscribing to the page.
Applications depend on the customization of your Ametys CMS application. By default, it's useful to subscribe to a page only if the page contains an "Attachment" service. In fact, each time an attachment is added, modified or deleted on the page, all subscribers will receive a mail to be notified of the modification.
To date, page attachments is the only application available on Ametys , but you can set up other use cases.