[Zope] TAL in tables
Myroslav Opyr
myroslav@zope.net.ua
Sat, 17 Aug 2002 00:39:54 +0300
--------------090104000807050401050901
Content-Type: text/plain; charset=KOI8-U; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by l1.lviv.net id g7GN9bkV019156
Hi,
I have a problem with rendering complex table. I want to get=20
callendar-like view with style per quarter of hour:
<table>
<tbody>
<tr class=3D"row0in15"><td align=3D"center" valign=3D"center" rowspan=
=3D"4">0</td><td> </td></tr>
<tr class=3D"row15in15"><td> </td></tr>
<tr class=3D"row30in15"><td> </td></tr>
<tr class=3D"row45in15"><td> </td></tr>
<tr class=3D"row0in15"><td align=3D"center" valign=3D"center" rowspan=
=3D"4">1</td><td> </td></tr>
<tr class=3D"row15in15"><td> </td></tr>
<tr class=3D"row30in15"><td> </td></tr>
<tr class=3D"row45in15"><td> </td></tr>
<tr class=3D"row0in15"><td align=3D"center" valign=3D"center" rowspan=
=3D"4">2</td><td> </td></tr>
<tr class=3D"row15in15"><td> </td></tr>
<tr class=3D"row30in15"><td> </td></tr>
<tr class=3D"row45in15"><td> </td></tr>
etc...
And I am not able to produce PageTemplate to achieve that:
<table>
<tbody tal:define=3D"step python:15">
<tr tal:repeat=3D"minutes python:range(0,24*60,step)"
class=3D"row45in15"
tal:attributes=3D"class string:row${minutes}in${step}">
<td tal:define=3D"hour python:minutes/60"
tal:condition=3D"python:((minutes%60)=3D=3D0)"
tal:attributes=3D"rowspan python:60/step"
align=3D"center" valign=3D"center" rowspan=3D"12"
tal:content=3D"hour">10</td>
<td> </td>
</tr>
</tbody>
</table>
The above produces wrong class attribute for <tr>. The=20
tal:attributes should look like=20
tal:attributes=3D"class string:row${python:minutes%60}in${step}".=20
But TALES string: "${}" substitute can contain only global-name or=20
path only. I am not able to use global-name because I have no place
to define it due to TAL execution order: define-repeat-attributes.
Note that I am unable to use <tbody tal:repeat=3D...><tr tal:define=3D...=
=20
tal:attributes=3D...> trick due to other limitations. I want to get=20
precisely the above view. Any hints appreciated.
Thank you,
m.
--=20
Myroslav Opyr
zope.net.ua <http://zope.net.ua/> =9C Ukrainian Zope Hosting
e-mail: myroslav@zope.net.ua <mailto:myroslav@zope.net.ua>
cell: +380 50.3174578
--------------090104000807050401050901
Content-Type: text/html; charset=KOI8-U
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by l1.lviv.net id g7GN9bkV019156
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html;charset=3DKOI8-U=
">
<title></title>
</head>
<body>
Hi,<br>
<br>
I have a problem with rendering complex table. I want to get callendar-li=
ke
view with style per quarter of hour:<br>
<br>
<pre><samp><table>
<<span class=3D"start-tag">tbody</span>>
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row0in15</b></font=
>"</span>><<span
class=3D"start-tag">td</span><span class=3D"attribute-name"> align</span=
>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>valign</span>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>rowspan</span>=3D<span
class=3D"attribute-value">"4"</span>>0</<span class=3D"end-tag">td=
</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row15in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row30in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row45in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row0in15</b></font=
>"</span>><<span
class=3D"start-tag">td</span><span class=3D"attribute-name"> align</span=
>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>valign</span>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>rowspan</span>=3D<span
class=3D"attribute-value">"4"</span>>1</<span class=3D"end-tag">td=
</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row15in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row30in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row45in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row0in15</b></font=
>"</span>><<span
class=3D"start-tag">td</span><span class=3D"attribute-name"> align</span=
>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>valign</span>=3D<span
class=3D"attribute-value">"center" </span><span class=3D"attribute-name"=
>rowspan</span>=3D<span
class=3D"attribute-value">"4"</span>>2</<span class=3D"end-tag">td=
</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row15in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row30in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
<<span class=3D"start-tag">tr</span><span class=3D"attribute-name"=
> class</span>=3D<span
class=3D"attribute-value">"<font color=3D"#660000"><b>row45in15</b></fon=
t>"</span>><<span
class=3D"start-tag">td</span>>&<span class=3D"entity">nbsp;</span=
></<span
class=3D"end-tag">td</span>></<span class=3D"end-tag">tr</span>>=
;
</samp></pre>
<pre>etc...
</pre>
And I am not able to produce PageTemplate to achieve that:<br>
<tt><br>
<table><br>
=9A <tbody tal:define=3D"step python:15"><br>
=9A=9A=9A <tr tal:repeat=3D"minutes python:range(0,24*60,step)"<br>
=9A=9A=9A=9A=9A=9A=9A class=3D"row45in15"<br>
=9A=9A=9A=9A=9A=9A=9A tal:attributes=3D"class <b><font color=3D"#660000">=
string:row${minutes}in${step}</font></b>"><br>
=9A=9A=9A=9A=9A <td tal:define=3D"hour python:minutes/60"<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A tal:condition=3D"python:((minutes%60)=3D=3D0)=
"<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A tal:attributes=3D"rowspan python:60/step"<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A align=3D"center" valign=3D"center" rowspan=3D=
"12"<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A tal:content=3D"hour">10</td><br>
=9A=9A=9A=9A=9A <td>&nbsp;</td><br>
=9A=9A=9A </tr><br>
=9A </tbody><br>
</table><br>
</tt><br>
The above produces wrong <tt><b>class</b></tt> attribute for <tt><b><t=
r></b></tt>.
The tal:attributes should look like <tt>attributes=3D"class string:row${p=
ython:minutes%60}in${step}"</tt>.
But TALES <tt>string:</tt> "<tt>${}</tt>" substitute can contain only glo=
bal-name
or path only. I am not able to use global-name because I have no place to
define it due to TAL execution order: define-repeat-attributes. <br>
<br>
Note that I am unable to use <tt><tbody tal:repeat=3D...><tr tal=
:define=3D...
tal:attributes=3D...></tt> trick due to other limitations. I want to g=
et
precisely the above view. Any hints appreciated.<br>
<br>
Thank you,<br>
<br>
m.<br>
<div class=3D"moz-signature">-- <br>
<small> Myroslav Opyr<br>
<a href=3D"http://zope.net.ua/">zope.net.ua</a> =9C Ukrainian Zope Hosti=
ng<br>
=20
<table border=3D"0" cellspacing=3D"2" cellpadding=3D"2"
style=3D"font-size: 1em;">
<tbody>
<tr>
<td>e-mail:</td>
<td><a href=3D"mailto:myroslav@zope.net.ua">myroslav@zope.net.ua</a=
></td>
</tr>
<tr>
<td>cell:</td>
<td>+380 50.3174578</td>
</tr>
=20
</tbody>
</table>
</small> </div>
</body>
</html>
--------------090104000807050401050901--