[Product-Developers] Integrating collective.carousel and collective.contentleadimage

Maurits van Rees m.van.rees at zestsoftware.nl
Tue Feb 16 13:55:58 UTC 2010


Hi,

For http://www.milieudefensie.nl (Friends of the Earth Netherlands) I
am looking into integrating collective.carousel (show items of a
collection in a viewlet or portlet, and show the next after a while,
using javascript) and collective.contentleadimage (add a leading image
to all content types, with archetypes.schemaextender).

In essence it is easy enough (once you throw away your initial idea
after getting some strange Unauthorized errors...) and I did that on a
branch of collective.carousel:

http://svn.plone.org/svn/collective/collective.carousel/branches/maurits-collective-contentleadimage

Relevant changeset:
http://dev.plone.org/collective/changeset/111068

Since it is so small I can just paste the few lines I added:

=============================================================
  <a href="#" 
     tal:define="field python:context.getField('leadImage')" 
     tal:condition="python:field and field.get_size(context) != 0" 
     tal:attributes="href python:(item_type in use_view_action) and item_url+'/view' or item_url;"> 
      <img src="" alt="" 
           tal:replace="structure python:field.tag(context, scale='thumb', css_class='tileImage')" /> 
  </a>
=============================================================


I wonder if it is better to add this in one of these two packages or
to create a new very small package to integrate this; seems overkill
for just these few lines that do not hurt when
collective.contentleadimage is not available (except the time needed
to check for the existence of the field, which should hardly be noticeble).


Any objections from the Jarn folks (mostly Denys Mishunov) to merge
this to trunk?  Tests pass with and without contentleadimage on Plone
3.3 and 4.

And any plans to create an actual release of this? :-)

BTW, an alternative solution in collective.carousel would be to keep
the current tile unchanged and register a different one when
collective.contentleadimage is installed:

=============================================================
   <browser:page
     name="carousel-view"                  
+    zcml:condition="not-installed collective.contentleadimage"
     for="Products.ATContentTypes.interface.IATContentType"
     template="templates/default_tile.pt"
     permission="zope2.View"
     layer="..interfaces.ICollectiveCarouselLayer"      
     />
+
+  <browser:page
+    zcml:condition="installed collective.contentleadimage"
+    name="carousel-view"                  
+    for="Products.ATContentTypes.interface.IATContentType"
+    template="templates/lead_image_tile.pt"
+    permission="zope2.View"
+    layer="..interfaces.ICollectiveCarouselLayer"      
+    />
=============================================================


-- 
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
What are you going to create today?





More information about the Product-Developers mailing list