Hi David,
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: donderdag 6 maart 2008 9:38
> To: Hippo CMS development public mailinglist
> Cc: [EMAIL PROTECTED]
> Subject: [HippoCMS-dev] community apps
>
> Hi folks,
>
> We are using the hcamanager and more specifically the
> newsletter manager into one of our project. The community
> apps is still running in our cms but we are wondering how we
> can use it and customize it:
>
> How can we (un)subscribe the new letter from a front-end site
You'll have to write a custom form for that. Below some flowscript that
handles unsubscribing:
function removeSubscriptions(email){
var newsletterService = getFacade("newsletterService");
var subscriber = newsletterService.getSubscriberByEmail(email);
if(subscriber == null){
return
"newsletterform.status.unsubscribe.fail.nosubscriberfound";
}
else{
var mailgroups =
cocoon.request.getParameter("mailgroup");
if(mailgroups == null || mailgroups ==''){
return "newsletterform.status.fail.nomailgroup";
}
else if(mailgroups instanceof
Packages.java.lang.String){
var mailgroup =
newsletterService.getMailGroup(Packages.java.lang.Integer.parseInt(mailg
roups));
newsletterService.removeSubscription(subscriber,mailgroup);
}
else{
var mailgroupIterator = mailgroups.iterator();
while (mailgroupIterator.hasNext()){
var mailgroup =
newsletterService.getMailGroup(Packages.java.lang.Integer.parseInt(mailg
roupIterator.next()));
newsletterService.removeSubscription(subscriber,mailgroup);
}
}
}
// newsletterService.removeSubscription has silent failure
return "newsletterform.status.unsubscribe.success";
}
function getFacade(beanName) {
var spring =
cocoon.context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_C
ONTEXT_ATTRIBUTE);
return spring.getBean(beanName);
}
> Is it possible to custom the sending action (launch a
> specific pipeline when we send a newsletter)
The sending part is not done from a Cocoon pipeline. What do you want to
achieve?
> Is it possible to create a newsletter merging a
> subset of documents based on a folder.
Yes that's possible. The include transformer is called after the XSL
transformation. The pipeline that renders the content is:
<map:match pattern="repository*body/*/**">
<map:generate src="repository://{3}"/>
<map:transform src="cocoon:/newsletter-{1}-{2}.xsl">
<map:parameter name="self" value="{3}"/>
<map:parameter name="siteUrl" value="{flow-attr:siteUrl}"/>
</map:transform>
<map:transform type="i18n"/>
<map:transform type="include"/>
<map:transform type="stripnamespaces"/>
<map:select type="simple">
<map:parameter name="value" value="{1}"/>
<map:when test="html">
<map:serialize type="html"/>
</map:when>
<map:when test="text">
<map:serialize type="text" mime-type="text/plain"/>
</map:when>
</map:select>
</map:match>
> Unfortunately this part seems to be few documented on the
> website. So if someboby have had an experience with the
> hcamanager, his advices will be useful ;-)
Thank you for the questions, it helps us to improve the documentation.
This reminds me we have to put the API documentation for the community
apps online.
Regards,
Jasha Joachimsthal
---------
Hippo
Oosteinde 11
1017 WT Amsterdam
The Netherlands
+31 (0)20 5224466
[EMAIL PROTECTED]
www.hippo.nl
********************************************
Hippocms-dev: Hippo CMS development public mailinglist