commit-gnue
[Top][All Lists]
Advanced

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

gnue/reports filters/SimpleTabulation/html.xsl ...


From: Jason Cater
Subject: gnue/reports filters/SimpleTabulation/html.xsl ...
Date: Fri, 12 Apr 2002 16:56:54 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/04/12 16:56:53

Modified files:
        reports/filters/SimpleTabulation: html.xsl text.xsl 
        reports/samples/foobulations: monthly.grd 
        reports/src    : GRLayout.py GRParameters.py GRReport.py 
                         GRSortOptions.py 

Log message:
        more support of namespaces in reports output stream; misc bug fixes & 
enhancements

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/filters/SimpleTabulation/html.xsl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/filters/SimpleTabulation/text.xsl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/samples/foobulations/monthly.grd.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRLayout.py.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParameters.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReport.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRSortOptions.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gnue/reports/filters/SimpleTabulation/html.xsl
diff -c gnue/reports/filters/SimpleTabulation/html.xsl:1.3 
gnue/reports/filters/SimpleTabulation/html.xsl:1.4
*** gnue/reports/filters/SimpleTabulation/html.xsl:1.3  Tue Apr  9 03:37:53 2002
--- gnue/reports/filters/SimpleTabulation/html.xsl      Fri Apr 12 16:56:53 2002
***************
*** 1,20 ****
  <?xml version="1.0"?>
  <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0">
! 
  <xsl:output method="html"/>
  <xsl:template match="/">
    <html>
      <head>
        <title>
!         <xsl:value-of select="GNUe-report-output/reportTitle" />
        </title>
        <style>
          body {
            font-face: sans-serif;
          }
!       table { 
          width: 80%;
          margin-left: 10%;
          margin-right: 10%;
--- 1,22 ----
  <?xml version="1.0"?>
  <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+   xmlns:gnue="GNUe:Reports:Base"
+   xmlns:t="GNUe:Reports:SimpleTabulation"
    version="1.0">
! <!--  exclude-result-prefixes="gnue" -->
  <xsl:output method="html"/>
  <xsl:template match="/">
    <html>
      <head>
        <title>
!         <xsl:value-of select="gnue:report-output/t:report/t:reportTitle" />
        </title>
        <style>
          body {
            font-face: sans-serif;
          }
!       table {
          width: 80%;
          margin-left: 10%;
          margin-right: 10%;
***************
*** 63,85 ****
      </head>
      <body>
        <h1>
!         <xsl:value-of select="GNUe-report-output/reportTitle" />
        </h1>
!       <xsl:for-each select="GNUe-report-output/section">
          <hr/>
          <h2>
!           <xsl:value-of select="sectionTitle"/>
          </h2>
!         <xsl:for-each select="table">
            <table>
!             <xsl:for-each select="tablehead">
                <tr>
!                 <xsl:for-each select="colhead">
                    <th align="address@hidden"><xsl:value-of select="."/></th>
                  </xsl:for-each>
                </tr>
              </xsl:for-each>
!             <xsl:for-each select="row">
                <xsl:variable name="trclass">
                  <xsl:choose>
                    <xsl:when test="@type = 'subtotal'">subtotal</xsl:when>
--- 65,87 ----
      </head>
      <body>
        <h1>
!         <xsl:value-of select="gnue:report-output/t:report/t:reportTitle" />
        </h1>
!       <xsl:for-each select="gnue:report-output/t:report/t:section">
          <hr/>
          <h2>
!           <xsl:value-of select="t:sectionTitle"/>
          </h2>
!         <xsl:for-each select="t:table">
            <table>
!             <xsl:for-each select="t:tablehead">
                <tr>
!                 <xsl:for-each select="t:colhead">
                    <th align="address@hidden"><xsl:value-of select="."/></th>
                  </xsl:for-each>
                </tr>
              </xsl:for-each>
!             <xsl:for-each select="t:row">
                <xsl:variable name="trclass">
                  <xsl:choose>
                    <xsl:when test="@type = 'subtotal'">subtotal</xsl:when>
***************
*** 87,93 ****
                  </xsl:choose>
                </xsl:variable>
                <tr class="{$trclass}">
!                 <xsl:for-each select="col">
  
                      <xsl:choose>
                        <xsl:when test="@align">
--- 89,95 ----
                  </xsl:choose>
                </xsl:variable>
                <tr class="{$trclass}">
!                 <xsl:for-each select="t:col">
  
                      <xsl:choose>
                        <xsl:when test="@align">
***************
*** 108,112 ****
        </xsl:for-each>
      </body>
    </html>
! </xsl:template>     
! </xsl:stylesheet>
\ No newline at end of file
--- 110,114 ----
        </xsl:for-each>
      </body>
    </html>
! </xsl:template>
! </xsl:stylesheet>
Index: gnue/reports/filters/SimpleTabulation/text.xsl
diff -c gnue/reports/filters/SimpleTabulation/text.xsl:1.1 
gnue/reports/filters/SimpleTabulation/text.xsl:1.2
*** gnue/reports/filters/SimpleTabulation/text.xsl:1.1  Tue Apr  9 03:37:53 2002
--- gnue/reports/filters/SimpleTabulation/text.xsl      Fri Apr 12 16:56:53 2002
***************
*** 1,6 ****
--- 1,8 ----
  <?xml version="1.0"?>
  <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+   xmlns:gnue="GNUe:Reports:Base"
+   xmlns:t="GNUe:Reports:SimpleTabulation"
    version="1.0">
  
  <xsl:output method="text" indent="no"/>
***************
*** 18,46 ****
    <xsl:text>=====================================================</xsl:text>
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$tab"/><xsl:value-of select="$tab"/>
!   <xsl:value-of select="GNUe-report-output/reportTitle" />
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$tab"/>
    <xsl:text>=====================================================</xsl:text>
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$newline"/>
!   <xsl:for-each select="GNUe-report-output/section">
!     <xsl:value-of select="sectionTitle"/>
  
!     <xsl:for-each select="table">
!       <xsl:for-each select="tablehead">
!         <xsl:for-each select="colhead">
            <xsl:value-of select="."/><xsl:value-of select="$tab"/>
          </xsl:for-each>
          <xsl:value-of select="$newline"/>
        </xsl:for-each>
!       <xsl:for-each select="row">
!         <xsl:for-each select="col">
            <xsl:value-of select="."/><xsl:value-of select="$tab"/>
          </xsl:for-each>
          <xsl:value-of select="$newline"/>
        </xsl:for-each>
      </xsl:for-each>
    </xsl:for-each>
! </xsl:template>     
! </xsl:stylesheet>
\ No newline at end of file
--- 20,48 ----
    <xsl:text>=====================================================</xsl:text>
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$tab"/><xsl:value-of select="$tab"/>
!   <xsl:value-of select="gnue:report-output/t:report/t:reportTitle" />
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$tab"/>
    <xsl:text>=====================================================</xsl:text>
    <xsl:value-of select="$newline"/>
    <xsl:value-of select="$newline"/>
!   <xsl:for-each select="gnue:report-output/t:report/t:section">
!     <xsl:value-of select="t:sectionTitle"/>
  
!     <xsl:for-each select="t:table">
!       <xsl:for-each select="t:tablehead">
!         <xsl:for-each select="t:colhead">
            <xsl:value-of select="."/><xsl:value-of select="$tab"/>
          </xsl:for-each>
          <xsl:value-of select="$newline"/>
        </xsl:for-each>
!       <xsl:for-each select="t:row">
!         <xsl:for-each select="t:col">
            <xsl:value-of select="."/><xsl:value-of select="$tab"/>
          </xsl:for-each>
          <xsl:value-of select="$newline"/>
        </xsl:for-each>
      </xsl:for-each>
    </xsl:for-each>
! </xsl:template>
! </xsl:stylesheet>
Index: gnue/reports/samples/foobulations/monthly.grd
diff -c gnue/reports/samples/foobulations/monthly.grd:1.14 
gnue/reports/samples/foobulations/monthly.grd:1.15
*** gnue/reports/samples/foobulations/monthly.grd:1.14  Thu Apr 11 00:19:30 2002
--- gnue/reports/samples/foobulations/monthly.grd       Fri Apr 12 16:56:53 2002
***************
*** 14,20 ****
     <datasource database="gnue" name="dtsFoo" table="foobulations"/>
    </sources>
  
!   <layout xmlns:out="GNUe:Reports:UnsupportedSimple:0.0.1">
  
      <out:reportTitle>Monthly Accounting Foobulation Report</out:reportTitle>
  
--- 14,21 ----
     <datasource database="gnue" name="dtsFoo" table="foobulations"/>
    </sources>
  
!   <layout xmlns:out="GNUe:Reports:SimpleTabulation">
!    <out:report>
  
      <out:reportTitle>Monthly Accounting Foobulation Report</out:reportTitle>
  
***************
*** 58,63 ****
--- 59,66 ----
  
        </out:table>
      </out:section>
+ 
+    </out:report>
  
    </layout>
  </report>
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.27 gnue/reports/src/GRLayout.py:1.28
*** gnue/reports/src/GRLayout.py:1.27   Wed Apr 10 15:58:35 2002
--- gnue/reports/src/GRLayout.py        Fri Apr 12 16:56:53 2002
***************
*** 56,61 ****
--- 56,62 ----
  class GRLayout (GObj):
    def __init__(self, parent):
      GObj.__init__(self, parent, type='GRLayout')
+     self._inits = (self.initialize,)
  
  
    def _buildObject(self):
***************
*** 63,69 ****
      # object, then create an unbound section to contain them.
      # This is a convenience for the layout engine code :)
  
!     if len(self._children) > 1:
  
        temp = self._children[:]
        self._children = []
--- 64,72 ----
      # object, then create an unbound section to contain them.
      # This is a convenience for the layout engine code :)
  
!     if  len(self._children) > 1 or \
!        ( len(self._children) and \
!          self._children[0]._type != 'GRSection' ):
  
        temp = self._children[:]
        self._children = []
***************
*** 75,80 ****
--- 78,101 ----
          "The layout section does not contain any instructions. What do I do?"
  
      return GObj._buildObject(self)
+ 
+   def initialize(self):
+     # Find the xml namespace in use by any child passthru objects
+     self._xmlnamespace = self._findNamespace(self)
+ 
+ 
+   # Find the xml namespace in use by any child passthru objects
+   def _findNamespace(self, object):
+     for child in object._children:
+       try:
+         if child._xmlnamespace:
+           namespace =  child._xmlnamespace
+         else:
+           namespace = self._findNamespace(child)
+         if namespace:
+           return namespace
+       except AttributeError:
+         pass
  
  
    #
Index: gnue/reports/src/GRParameters.py
diff -c gnue/reports/src/GRParameters.py:1.7 
gnue/reports/src/GRParameters.py:1.8
*** gnue/reports/src/GRParameters.py:1.7        Thu Apr  4 18:38:20 2002
--- gnue/reports/src/GRParameters.py    Fri Apr 12 16:56:53 2002
***************
*** 86,92 ****
      parameters.update(self._parameters)
  
      for param in parameters.keys():
!       xml += '    <GNUe-request-parameter 
name="%s">%s</GNUe-request-parameter>\n' % \
              (param, saxutils.escape(parameters[param]))
  
      return xml
--- 86,92 ----
      parameters.update(self._parameters)
  
      for param in parameters.keys():
!       xml += '    <gnue:request-parameter 
name="%s">%s</gnue:request-parameter>\n' % \
              (param, saxutils.escape(parameters[param]))
  
      return xml
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.19 gnue/reports/src/GRReport.py:1.20
*** gnue/reports/src/GRReport.py:1.19   Thu Apr  4 18:38:20 2002
--- gnue/reports/src/GRReport.py        Fri Apr 12 16:56:53 2002
***************
*** 22,28 ****
  # GRReport.py
  #
  # DESCRIPTION:
! # Class 
  #
  # NOTES:
  #
--- 22,28 ----
  # GRReport.py
  #
  # DESCRIPTION:
! # Class
  #
  # NOTES:
  #
***************
*** 49,70 ****
      self._parameters = None
  
    def initialize(self):
!     self.walk(self.__initElements)
  
    def postInit(self):
      if not self._parameters:
        self._parameters = GRParameters.GRParameters(self)
  
  
-   # TODO: This is duplicating functionality in GRSources.prepare!!
-   def __initElements(self, object):
-     if object.getObjectType() == "GRDataSource":
-       GDebug.printMesg(3,"Attaching DataSource '%s' to '%s'" \
-                          % (object.name, self._connections) )
-       object.setConnectionManager(self._connections)
-       self._datasourceDictionary[object.name] = object
- 
- 
    def dumpXML(self, treeDump=1, gap="  "):
      return GObj.dumpXML(self,
          GRParser.getXMLelements(), treeDump, gap)
--- 49,61 ----
      self._parameters = None
  
    def initialize(self):
!     pass
  
    def postInit(self):
      if not self._parameters:
        self._parameters = GRParameters.GRParameters(self)
  
  
    def dumpXML(self, treeDump=1, gap="  "):
      return GObj.dumpXML(self,
          GRParser.getXMLelements(), treeDump, gap)
***************
*** 115,137 ****
  
      # Write common header information
      if not omitGNUeXML:
!       dest.write ('<?xml version="1.0"?>\n')
!       dest.write ("<GNUe-report-output>\n")
!       dest.write ("  <GNUe-report-request>\n")
        dest.write ( parameters.getRunOptionsAsXML() )
        dest.write ( sortoptions.getRunOptionsAsXML() )
!       dest.write ("  </GNUe-report-request>\n")
  
      layout.process(dest, includeStructuralComments)
  
      if not omitGNUeXML:
!       dest.write ("\n</GNUe-report-output>\n")
  
  
    def getChildOfType(self, type):
      rv = None
      for child in self._children:
!       if child.getObjectType() == type:
          rv = child
          break
      return rv
--- 106,135 ----
  
      # Write common header information
      if not omitGNUeXML:
! 
!       if layout._xmlnamespace:
!         ns = ' xmlns="%s"' % layout._xmlnamespace
!       else:
!         ns = ""
! 
!       dest.write ('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
!       #dest.write ('<!DOCTYPE ... >\n')
!       dest.write ('<gnue:report-output xmlns:gnue="GNUe:Reports:Base"%s>\n' % 
ns)
!       dest.write ("  <gnue:report-request>\n")
        dest.write ( parameters.getRunOptionsAsXML() )
        dest.write ( sortoptions.getRunOptionsAsXML() )
!       dest.write ("  </gnue:report-request>\n")
  
      layout.process(dest, includeStructuralComments)
  
      if not omitGNUeXML:
!       dest.write ("\n</gnue:report-output>\n")
  
  
    def getChildOfType(self, type):
      rv = None
      for child in self._children:
!       if child._type == type:
          rv = child
          break
      return rv
Index: gnue/reports/src/GRSortOptions.py
diff -c gnue/reports/src/GRSortOptions.py:1.5 
gnue/reports/src/GRSortOptions.py:1.6
*** gnue/reports/src/GRSortOptions.py:1.5       Mon Mar 25 23:34:07 2002
--- gnue/reports/src/GRSortOptions.py   Fri Apr 12 16:56:53 2002
***************
*** 51,57 ****
      if self.getSortOption() == None:
        return ""
      else:
!       return '    <GNUe-request-sortoption id="%s"/>\n' % self.getSortOption()
  
    #
    # Set the sort option to use
--- 51,57 ----
      if self.getSortOption() == None:
        return ""
      else:
!       return '    <gnue:request-sortoption id="%s"/>\n' % self.getSortOption()
  
    #
    # Set the sort option to use



reply via email to

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