Browse Source

diagnosticos
Sesostris Vieira 14 years ago
parent
commit
5efd1f9865
  1. 53
      BIRT_Reports/src/reportParamForm.py

53
BIRT_Reports/src/reportParamForm.py

@ -8,24 +8,65 @@ import os
import sys import sys
import xml.dom.minidom as minidom import xml.dom.minidom as minidom
fileName = "../listaCasas.rptdesign" fileName = "../teste_parametros.rptdesign"
doc = minidom.parse(fileName) doc = minidom.parse(fileName)
parameterTags = doc.getElementsByTagName("parameters") parameterTags = doc.getElementsByTagName("parameters")
for parameterTag in parameterTags:
formFields = {} formFields = {}
for parameterTag in parameterTags:
for parameter in parameterTag.childNodes: for parameter in parameterTag.childNodes:
if parameter.nodeName != '#text': if parameter.nodeName != '#text':
# print "Processando campo ", parameter.getAttribute('name').encode('ascii')
formField = {} formField = {}
for property in parameter.childNodes: for property in parameter.childNodes:
if property.nodeName != '#text': if property.nodeName != '#text' and property.hasChildNodes():
formField[property.getAttribute('name').encode('ascii')] = property.childNodes[0].nodeValue # print " Processando propriedade ", property.getAttribute('name').encode('ascii'), "(", property.__class__, ")"
fieldName = property.getAttribute('name').encode('ascii')
fieldValue = property.childNodes[0].nodeValue
if fieldName == 'selectionList':
fieldValue = ()
for structure in property.getElementsByTagName('structure'):
s = {}
for structProp in structure.getElementsByTagName('property'):
s[structProp.getAttribute('name').encode('ascii')] = structProp.childNodes[0].nodeValue
fieldValue = fieldValue + (s,)
formField[fieldName] = fieldValue
if formField['valueType'] == 'dynamic':
for dataSets in doc.getElementsByTagName("data-sets"):
for dataSet in dataSets.getElementsByTagName("oda-data-set"):
if dataSet.getAttribute('name') == formField['dataSetName']:
for xmlProp in dataSet.getElementsByTagName('xml-property'):
if xmlProp.getAttribute('name') == 'queryText':
formField['queryText'] = xmlProp.childNodes[0].data
formFields[parameter.getAttribute('name').encode('ascii')] = formField formFields[parameter.getAttribute('name').encode('ascii')] = formField
print formFields #print formFields
#exit(0)
for field in formFields:
print "field '" + field + "':"
for param in formFields[field]:
print ' ', param, ' = "', formFields[field][param], '"'
'''form = '<form action="printReport" method="post">'
for fieldName in formFields: for fieldName in formFields:
print fieldName, ':', formFields[fieldName]['valueType'] htmlField = '<input name="' + fieldName + '" '
field = formFields[fieldName]
print fieldName, ':', formFields[fieldName]['controlType'], field
if field['controlType'] == 'text-box':
htmlField += 'type = "text">'
elif field['controlType'] == 'list-box':
htmlField += 'type = "select">'
form += htmlField
print form + '</form>'''
Loading…
Cancel
Save