[ZPT] Feature request, "fill-slot" change

Florent Guillaume fg@nuxeo.com
Thu, 21 Feb 2002 17:39:05 +0000 (UTC)


I think Dieter also made that proposition (or a similar one, there were
so many :-) and I also concur that it would be good.

Florent


Juan David Ibáñez Palomar  <jdavid@nuxeo.com> wrote:
> 
> Hi all,
> 
> I'm moving from DTML to ZPT.
> 
> An advantages of DTML are the tags that have been developed
> by the community and that provide quick and easy ways to
> render complex html widgets. An example of this is the
> calendar tag.
> 
> So I released the product "NuxWidgets". Right now it contains
> two widgets, the calendar and the timetable, the ZPT friends
> of the calendar and timetable DTML tags.
> 
> I've inmediately experienced the benefits of ZPT, but also
> have reached some limits.
> 
> 
> An example, this is an snippet of the timetable macro:
> 
>    <td tal:attributes="colspan python:item.colspan;
>                        rowspan python:cell.rowspan"
>        class="event">
>      <div metal:define-slot="event" tal:replace="event/title">
>         Event
>      </div>
>    </td>
> 
> As you notice there's an slot named "event" defined in a div
> block, and within a table cell.
> 
> To change the look and feel I use style sheets, however this
> doesn't works with browsers like Netscape 4.x.
> 
> So the problem is (for example), how to to change the background
> color of the cell? In other words, how to set the "bgcolor"
> attribute of the "td"?
> 
> And the answer is obvious, removing the div block and putting
> the slot in the td, for example:
> 
>    <td tal:attributes="colspan python:item.colspan;
>                        rowspan python:cell.rowspan"
>        tal:content="event/title"
>        metal:define-slot="event"
>        class="event">
>      Event
>    </td>
> 
> But there's a problem. The timetable calculates the colspan and
> rowspan of the cell, if the user fills the slot this information
> is lost and the timetable will be wrongly rendered.
> 
> I guess there're work arounds for this, but I don't want a
> workaround.
> 
> 
> The problem would be solved if the behaviour of "fill-slot" changed.
> 
> The idea is, when the user fills an slot, the attributes of the
> xml element defined in the macro are preserved instead of being
> removed. Then, if the user defines the same attribute it takes
> precedence over the attribute defined in the macro.
> 
> For example, in the timetable case, if the user types:
> 
>    <td metal:fill-slot="event">
>      <em tal:content="event/title">Event with emphasis</em>
>    </td>
> 
> The rendered HTML could be:
> 
>    <td class="event" colspan="2" rowspan="3">
>      <em>Tim Berners-Lee's keynote</em>
>    </td>
> 
> If the user types:
> 
>    <td metal:fill-slot="event" colspan="4">
>      <em tal:content="event/title">Event with emphasis</em>
>    </td>
> 
> The rendered HTML could be:
> 
>    <td class="event" colspan="4" rowspan="3">
>      <em>Tim Berners-Lee's keynote</em>
>    </td>
> 
> If the user types:
> 
>    <td metal:fill-slot="event"
>        tal:attributes="colspan nothing">
>      <em tal:content="event/title">Event with emphasis</em>
>    </td>
> 
> The rendered HTML could be:
> 
>    <td class="event" rowspan="3">
>      <em>Tim Berners-Lee's keynote</em>
>    </td>
> 
> 
> 
> Well, what do you think?
> 
> 
> 
> Cheers,
> jdavid
> 
> 
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
> 


-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com