[Zope] I can't find a way to give parameters to the getDtmlData of a ZGDChartobjectobject

2000-11-08 Thread Frederic Quin

Hi all,


I can't find a way to give parameters to the getDtmlData of a ZGDChart
object.
Please, help... 'Cause I don't want to duplicate the same chart one
hundred times...


Fred

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] I can't find a way to give parameters to the getDtmlData of a ZGDChartobjectobject

2000-11-08 Thread Steve Spicklemire


Hi Fred,

   I experimented a bit with the ZGDChart product. You can might try the following 
patch:

*** lib/python/Products/ZGDChart/ZGDChart.pyTue Sep 12 21:44:09 2000
--- /usr/local/etc/Zope2Test/pr/ZGDChart/ZGDChart.pyWed Oct  4 10:41:51 2000
***
*** 64,73 
--- 64,74 
  from Globals import HTMLFile, MessageDialog, Persistent
  from Globals import package_home
  from DocumentTemplate.DT_Util import *
  from DocumentTemplate.DT_String import String
  from maybe_lock import allocate_lock
+ import traceback
  
  #
  # In this module, extend gdchart so
  # that it can render itself
  #
***
*** 133,142 
--- 134,144 
manage_options=(
{'label':'Properties' , 'icon':icon, 'action':'manage_main',
'target':'_self'},
{'label':'Colors' , 'icon':icon, 'action':'manage_mainColor',   
'target':'_self'},
{'label':'Scale',   'icon':icon, 'action':'manage_mainScale',   
'target':'_self'},
{'label':'Data Method', 'icon':icon, 'action':'manage_mainGetData', 
'target':'_self'},
+   {'label':'DTML Data',   'icon':icon, 
+'action':'getDtmlData/manage_main', 'target':'_self'},
{'label':'Security'   , 'icon':icon, 'action':'manage_access',  
'target':'_self'},
{'label':'View'   , 'icon':icon, 'action':'manage_mainView',
'target':'_self'},
)
  
__ac_permissions__=(
***
*** 281,291 
self.id = id
self.title  = title
self.height = height
self.width  = width
self.SQL= SQL
!   self.content_type   = 'image/gif'
self.tempfile   = self.home() + '/temp.gif'

# Set the chart options
self.bg_transparent = 'bg_transparent' in option
self.xaxis  = 'xaxis' in option
--- 283,293 
self.id = id
self.title  = title
self.height = height
self.width  = width
self.SQL= SQL
!   self.content_type   = 'image/png'
self.tempfile   = self.home() + '/temp.gif'

# Set the chart options
self.bg_transparent = 'bg_transparent' in option
self.xaxis  = 'xaxis' in option
***
*** 372,386 
self.threed_angle   =   0
self.threed_depth   =   0
  
# Set the data gathering method
self.selected_data_method = 'dtml'
!   f = open(os.path.join(self.home(),'manage', 'getDtmlData.dtml'), 'r')
!   getDtmlData_dtml = f.read()
!   f.close()
!   ob = OFS.DTMLMethod.DTMLMethod(getDtmlData_dtml, 
__name__='getDtmlData')
!   self._setObject('getDtmlData', ob)

def manage_edit(self, title, xtitle, ytitle, width, height, chart_type, 
option=[], REQUEST=None):
"""edit ZGDChart"""
self.title  = title
self.xtitle = xtitle
--- 374,384 
self.threed_angle   =   0
self.threed_depth   =   0
  
# Set the data gathering method
self.selected_data_method = 'dtml'
!   self.manage_addDTMLMethod('getDtmlData', 'DTML Data Method', 
open(HTMLFile('manage/getDtmlData',globals()).raw).read())

def manage_edit(self, title, xtitle, ytitle, width, height, chart_type, 
option=[], REQUEST=None):
"""edit ZGDChart"""
self.title  = title
self.xtitle = xtitle
***
*** 687,704 
#
# requires GDChart 0.4
#
tempfile = cStringIO.StringIO() 
apply(chart, (GDC_TYPE, (self.width, self.height), tempfile) + 
tuple(chartdata))
!   if RESPONSE: RESPONSE['content-type']=self.content_type
output = tempfile.getvalue()
-   #
-   # requires GDChart 0.3
-   # apply(chart, (GDC_TYPE, (self.width, self.height), 
self.tempfile) + tuple(chartdata))
-   # if RESPONSE: RESPONSE['content-type']=self.content_type
-   # output = open(self.tempfile,'rb').read()
-   #
finally:
_chart_lock.release()