From 5efd1f986560666cf62dd52fa2408f400eae192f Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Fri, 13 May 2011 16:37:43 +0000 Subject: [PATCH] --- BIRT_Reports/src/reportParamForm.py | 53 +++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/BIRT_Reports/src/reportParamForm.py b/BIRT_Reports/src/reportParamForm.py index d91590b..7a1d6a0 100644 --- a/BIRT_Reports/src/reportParamForm.py +++ b/BIRT_Reports/src/reportParamForm.py @@ -8,24 +8,65 @@ import os import sys import xml.dom.minidom as minidom -fileName = "../listaCasas.rptdesign" +fileName = "../teste_parametros.rptdesign" doc = minidom.parse(fileName) parameterTags = doc.getElementsByTagName("parameters") +formFields = {} + for parameterTag in parameterTags: - formFields = {} for parameter in parameterTag.childNodes: if parameter.nodeName != '#text': +# print "Processando campo ", parameter.getAttribute('name').encode('ascii') formField = {} for property in parameter.childNodes: - if property.nodeName != '#text': - formField[property.getAttribute('name').encode('ascii')] = property.childNodes[0].nodeValue + if property.nodeName != '#text' and property.hasChildNodes(): +# 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 -print formFields +#print formFields +#exit(0) + +for field in formFields: + print "field '" + field + "':" + for param in formFields[field]: + print ' ', param, ' = "', formFields[field][param], '"' +'''form = '
' for fieldName in formFields: - print fieldName, ':', formFields[fieldName]['valueType'] \ No newline at end of file + htmlField = '''' \ No newline at end of file