commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/designer src/reports/TemplateSupport.py te...


From: Jason Cater
Subject: gnue/designer src/reports/TemplateSupport.py te...
Date: Wed, 13 Nov 2002 23:10:45 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/11/13 23:10:45

Modified files:
        designer/src/reports: TemplateSupport.py 
        designer/templates/reports: SimpleReport.py 

Log message:
        added btami's namespace patch for designer wizards

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/reports/TemplateSupport.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/templates/reports/SimpleReport.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/designer/src/reports/TemplateSupport.py
diff -c gnue/designer/src/reports/TemplateSupport.py:1.2 
gnue/designer/src/reports/TemplateSupport.py:1.3
*** gnue/designer/src/reports/TemplateSupport.py:1.2    Tue Jul 23 13:52:52 2002
--- gnue/designer/src/reports/TemplateSupport.py        Wed Nov 13 23:10:45 2002
***************
*** 28,37 ****
  #
  
  from gnue.designer.TemplateBase import *
! try:
!   import Incubator
! except:
!   print 'Incubator import failed'
  from gnue.reports.GRReport import GRReport
  
  # TODO
--- 28,34 ----
  #
  
  from gnue.designer.TemplateBase import *
! import Incubator
  from gnue.reports.GRReport import GRReport
  
  # TODO
***************
*** 51,54 ****
--- 48,68 ----
    def Start(self, root):
      pass
  
+ 
+   def AddContent(self, parent, content):
+     GParserHelpers.GContent(parent, content)
+ 
+   def AddElement(self, tag, parent, attributes={}, ns=None):
+     if ns:
+       o = GRLayout.GRPassThru(parent)
+       o._xmltag = tag
+       o._xmlnamespace = ns
+       o._listedAttributes = attributes.keys()
+     else:
+       o = self.parser.elements[tag]['BaseClass'](parent)
+       
+     o.__dict__.update(attributes)
+     o._buildObject()
+     self.parser.instance.onCreateObject(o, __name__)
+     return o
  
Index: gnue/designer/templates/reports/SimpleReport.py
diff -c gnue/designer/templates/reports/SimpleReport.py:1.3 
gnue/designer/templates/reports/SimpleReport.py:1.4
*** gnue/designer/templates/reports/SimpleReport.py:1.3 Mon Sep 16 15:30:16 2002
--- gnue/designer/templates/reports/SimpleReport.py     Wed Nov 13 23:10:45 2002
***************
*** 41,47 ****
  
  class SimpleReportTemplate(ReportTemplate):
  
- 
    # The first step in our wizard.
    # The template parser will initially
    # call GetStep(FIRST_STEP).
--- 41,46 ----
***************
*** 165,185 ****
            'type': 'object',
            'name': 'dts%s' %  tableKey })
  
      # TODO: This needs to add namespaces!
      # TODO: When this happens, remove the default namespace
      # TODO: hack in GNUe Reports' GREngine
-     layout = self.AddElement('layout', self.report, {})
  
!     section = self.AddElement('section', layout, {'name': "detailes", 
'source': datasource.name})
  
!     # Add each field
!     for field in self.variables['fields']:
!       # Create the field element
!       self.AddElement('field', section, { 'name': field })
  
      # That's it... we're done.
      return 1
- 
  
  
  ############
--- 164,221 ----
            'type': 'object',
            'name': 'dts%s' %  tableKey })
  
+     schema = self.GetSourceSchema(self.variables['connection'],
+                          self.variables['table'])
+ 
+     # Make a map of all the field schemas we will need
+     # We will not actually create the entries at this point
+     # because we want to keep in the order that the user
+     # specified
+     fields = {}
+     for field in schema.getChildSchema(schema):
+       if field.name in self.variables['fields']:
+         fields[field.name] = field
+ 
      # TODO: This needs to add namespaces!
      # TODO: When this happens, remove the default namespace
      # TODO: hack in GNUe Reports' GREngine
  
!     layout = self.AddElement('layout', self.report, {})
  
!     ns = 'GNUe:Reports:SimpleTabulation'
!     out_report = self.AddElement('report', layout, {}, ns)
!     out_reportTitle = self.AddElement('reportTitle', out_report, {}, ns)
!     self.AddContent(out_reportTitle, self.variables['title'])
!     out_section = self.AddElement('section', out_report, {'break':"page"}, ns)
!     out_table = self.AddElement('table', out_section, {'width':"100%"}, ns)
!     out_tablehead = self.AddElement('tablehead', out_table, {}, ns)
! 
!     for name in self.variables['fields']:
!       field = fields[name]
!       attrs = {'width':field.length}
!       if field.datatype == 'number':
!         attrs['align'] = "right"
!       elif field.datatype == 'date':
!         attrs['align'] = "center"
!       out_colhead = self.AddElement('colhead', out_tablehead, attrs, ns)
!       self.AddContent(out_colhead, field.name)
!     
!     section = self.AddElement('section', out_table, {'name': "detailes", 
'source': datasource.name})
!     out_row = self.AddElement('row', section, {}, ns)
! 
! # Add each field
!     for name in self.variables['fields']:
!       field = fields[name]
!       attrs = {}
!       if field.datatype == 'number':
!         attrs['align'] = "right"
!       elif field.datatype == 'date':
!         attrs['align'] = "center"
!       out_col = self.AddElement('col', out_row, attrs, ns)
!       self.AddElement('field', out_col, {'name':field.name})
  
      # That's it... we're done.
      return 1
  
  
  ############




reply via email to

[Prev in Thread] Current Thread [Next in Thread]