Thursday, September 18, 2008

make SD dance your way

Singing & Dancing is newsletter package for plone3. and a powelfull one. its structure really shows the power of component architecture (CA). only thing missing is some nice documentation, that show customatization technics. did i mentioned that is really well tested (that reminds me that i owe some test for my last project).

when integrating S&D had to do this two customizations:
* include more then just title and description for collector items in newsletter mail
* when content is collected and sent, state of this content should change. so that next time wont get sent.

and before we dive into coding, you know what to do ... PFMO
(Put the Fuc#### Music On) - if your neighbours dont like it, change neighbours



adding image to "Latest News" collector
  • create custom item formatter implementing collective.dancing.IFormatItem



  • register adapter for newsitem content type



  • and thats it. when you collect news items our item formatter will be applied

Change item state after being sent
this is useful so collector does not grab items twice.
  • create newsletter_workflow. (definition.xml) to describe states in short:
    - pending (initial state): content is pending for review to be inlcuded into newletter
    - ready: ready to be collected ny newsletter
    - sent: content already sent

  • create "newsletter_item_already_sent" subscriber method for MessageChanged action



  • subscribe to MessageChanged action



  • now create collector that listens for "ready" state, and your ready to go

well thats about it, S&D is fantastic project relatively young, but is becoming more and more stable and feature reach. i could say its one of those tools in plone i really missed in the past.



resources:
- Daniel Nouri on "Composer templates, IFormat and IFullFormatter"
-
Zope Component Architecture

6 comments:

Unknown said...

thanks for this - this is exactly what I need to do - could you point me in the right direction - where would I add my "custom item formatter" - can this go in my custom skin product?

Rok Garbas said...

well you need some ZCA knowledge, that you can create new adapter which is actually custom item formatter used by SD. you can ofcourse put this in your skin product, but has no direct connection with skinning plone.

Unknown said...

Thanks Rok, i'll go and get me some ZCA knowledge!

Mikko Ohtamaa said...

Hi,

I have been working with pluggable templates for Python (not just Plone). Currently I have collective.easytemplate product 0.2 coming. It gives you ability to use any template language in Kupu pages and email actions.

Please check it out here:

https://dev.plone.org/collective/browser/collective.easytemplate/trunk

I plan to use S&D in one new Plone site for news letter. At least I need to translate it in Finnish, but I believe we have other kind of synenergies as well :)

Mikko Ohtamaa said...

BTW I have Citroen too, Xsara.

It has been under constant repair six months now... those French ladies!

Rok Garbas said...

collective.easytemplate is on my list of "potetialy usefull products"- since i didnt test.

my dyana is also sleeping for know, i just dont have time to fix it. i went on a roat trip this summer and since then she's sick. but i plan complete restauration for spring - to be ready for another summer road trip :)