[Zope] Solution: how to pass variables into ZGDChart
Jaroslav Lukesh
lsh at wo.cz
Wed May 17 12:00:15 EDT 2006
Hi all,
I was find simple solution how to pass variables into DTML method of
ZGDChart product. It was discussed few years ago via SESSION - see
http://mail.zope.org/pipermail/zope/2003-April/135196.html
Note, that for my old Zope 2.5.1 is functional version
ZGDChart-0.6.4babel.tgz only
So here are DTML document from where we calling image:
<dtml-if users_id>
<dtml-elif user_id>
<dtml-call "REQUEST.set('users_id', [])">
<dtml-call "users_id.append(user_id)">
<dtml-else>
<dtml-call "REQUEST.set('users_id', [0])">
</dtml-if>
<dtml-call "REQUEST.set('temp_labels', [])">
<dtml-call "REQUEST.set('temp_data1', [])">
<dtml-call "REQUEST.set('temp_data2', [])">
<dtml-in ZSQL_query>
<dtml-call "temp_labels.append(month + ' ' + year)">
<dtml-call "temp_data1.append((time1 or 0.00000) / _.len(users_id) ))">
<dtml-call "temp_data2.append((time2 or 0.00000) / _.len(users_id) ))">
</dtml-in>
<img src="ZGDChart_graph/?data0=<dtml-var "_.string.join(temp_labels, ',')
">&data1=<dtml-var "_.string.join(temp_data1, ',') ">&data2=<dtml-var
"_.string.join(temp_data2, ',') ">">
-----------
And here are DTML method from inside of ZDGChart_graph:
<dtml-call "REQUEST.set('temp_labels', _.string.split(data0, ',' ) )">
<dtml-call "REQUEST.set('x_data1', _.string.split(data1, ',' ) )">
<dtml-call "REQUEST.set('x_data2', _.string.split(data2, ',' ) )">
<dtml-call "REQUEST.set('temp_data1', [] )">
<dtml-call "REQUEST.set('temp_data2', [] )">
<dtml-in x_data1 prefix=cislo>
<dtml-call "temp_data1.append(_.float(cislo_item))">
</dtml-in>
<dtml-in x_data2 prefix=cislo>
<dtml-call "temp_data2.append(_.float(cislo_item))">
</dtml-in>
<dtml-return "(temp_labels, temp_data1, temp_data2)">
Happy using!
Regards, JL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060517/1844de3d/attachment-0001.htm
More information about the Zope
mailing list