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

Juan David Ibáñez Palomar jdavid@nuxeo.com
Thu, 14 Feb 2002 16:27:50 +0100


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