def fromXml(self, lxmlNode):

        if lxmlNode.tag != self.matchTagName:
            raise AttributeError, "SimpleForm expected <form> root node; cannot continue parsing"

        # common params
        self.label = lxmlNode.findtext('label')
        self.displayView = lxmlNode.get('displayView')
        self.stylesheet = lxmlNode.get('stylesheet')
        self.refresh = int(lxmlNode.get('refresh', 0))
        self.isVisible = splunk.util.normalizeBoolean(
            lxmlNode.get('isVisible', True))
        self.onunloadCancelJobs = splunk.util.normalizeBoolean(
            lxmlNode.get('onunloadCancelJobs', True))
        self.autoCancelInterval = lxmlNode.get('autoCancelInterval', 90)

        # master search template
        self.searchTemplate = lxmlNode.findtext('./searchTemplate')
        self.searchEarliestTime = lxmlNode.findtext('./earliestTime')
        self.searchLatestTime = lxmlNode.findtext('./latestTime')

        fieldsetNode = lxmlNode.find('./fieldset')
        if fieldsetNode is not None:
            self.autoRun = splunk.util.normalizeBoolean(
                fieldsetNode.get('autoRun', False))
            self.submitButton = splunk.util.normalizeBoolean(
                fieldsetNode.get('submitButton', True))

            for item in fieldsetNode:
                if item.tag == 'html':
                    # no need to pass the flashOk boolean here since we are creating an HTML panel
                    panelInstance = panel.createPanel(item.tag)
                    panelInstance.fromXml(item)
                    panelInstance.layoutPanel = None
                    self.fieldset.append(panelInstance)
                elif item.tag == 'input':
                    inputInstance = forminput.createInput(item.get('type'))
                    inputInstance.fromXml(item)
                    self.fieldset.append(inputInstance)

        for row in lxmlNode.findall('row'):
            if row.get('grouping'):
                self.rowGrouping.append(
                    map(
                        int,
                        row.get('grouping').replace(' ',
                                                    '').strip(',').split(',')))
            else:
                self.rowGrouping.append(None)

            rowList = []
            for item in row:
                if not isinstance(item.tag, basestring):
                    continue
                panelInstance = panel.createPanel(item.tag,
                                                  flashOk=self.flashOk,
                                                  forceFlash=self.forceFlash)
                panelInstance.fromXml(item)
                rowList.append(panelInstance)
            self.rows.append(rowList)
Example #2
0
    def fromXml(self, lxmlNode):
        
        if lxmlNode.tag != self.matchTagName:
            raise AttributeError, "SimpleDashboard expected <dashboard> root node; cannot continue parsing"
            
        self.label = lxmlNode.findtext('label')
        
        # set core view attributes
        for k in self.standardAttributeMap:
            v = lxmlNode.get(k)
            if v != None:
                if k in self.booleanAttributeKeys:
                    v = splunk.util.normalizeBoolean(v)
                elif k in self.integerAttributeKeys:
                    v = int(v)
                setattr(self, k, v)

        for row in lxmlNode.findall('row'):
            if row.get('grouping'):
                self.rowGrouping.append(
                    map(int, row.get('grouping').replace(' ', '').strip(',').split(','))
                )
            else:
                self.rowGrouping.append(None)
                
            rowList = []
            for item in row:
                if not isinstance(item.tag, basestring):
                    continue
                panelInstance = panel.createPanel(item.tag)
                panelInstance.fromXml(item)
                rowList.append(panelInstance)
            self.rows.append(rowList)
Example #3
0
    def fromXml(self, lxmlNode):

        if lxmlNode.tag != self.matchTagName:
            raise AttributeError, "SimpleDashboard expected <dashboard> root node; cannot continue parsing"

        self.label = lxmlNode.findtext('label')

        # set core view attributes
        for k in self.standardAttributeMap:
            v = lxmlNode.get(k)
            if v != None:
                if k in self.booleanAttributeKeys:
                    v = splunk.util.normalizeBoolean(v)
                elif k in self.integerAttributeKeys:
                    v = int(v)
                setattr(self, k, v)

        for row in lxmlNode.findall('row'):
            if row.get('grouping'):
                self.rowGrouping.append(
                    map(
                        int,
                        row.get('grouping').replace(' ',
                                                    '').strip(',').split(',')))
            else:
                self.rowGrouping.append(None)

            rowList = []
            for item in row:
                if not isinstance(item.tag, basestring):
                    continue
                panelInstance = panel.createPanel(item.tag)
                panelInstance.fromXml(item)
                rowList.append(panelInstance)
            self.rows.append(rowList)
Example #4
0
    def fromXml(self, lxmlNode):
        
        if lxmlNode.tag != self.matchTagName:
            raise AttributeError, "SimpleForm expected <form> root node; cannot continue parsing"
        
        # common params
        self.label = lxmlNode.findtext('label')
        self.displayView = lxmlNode.get('displayView')
        self.stylesheet = lxmlNode.get('stylesheet')
        self.refresh = int(lxmlNode.get('refresh', 0))
        self.isVisible = splunk.util.normalizeBoolean(lxmlNode.get('isVisible', True))
        self.onunloadCancelJobs = splunk.util.normalizeBoolean(lxmlNode.get('onunloadCancelJobs', True))
        self.autoCancelInterval = lxmlNode.get('autoCancelInterval', 90)
        
        # master search template
        self.searchTemplate = lxmlNode.findtext('./searchTemplate')
        self.searchEarliestTime = lxmlNode.findtext('./earliestTime')
        self.searchLatestTime = lxmlNode.findtext('./latestTime')
        
        fieldsetNode = lxmlNode.find('./fieldset')
        if fieldsetNode is not None:
            self.autoRun = splunk.util.normalizeBoolean(fieldsetNode.get('autoRun', False))
            self.submitButton = splunk.util.normalizeBoolean(fieldsetNode.get('submitButton', True))
        
        for item in lxmlNode.findall('fieldset/input'):
            inputInstance = forminput.createInput(item.get('type'))
            inputInstance.fromXml(item)
            self.fieldset.append(inputInstance)
            
        for row in lxmlNode.findall('row'):
            if row.get('grouping'):
                self.rowGrouping.append(
                    map(int, row.get('grouping').replace(' ', '').strip(',').split(','))
                )
            else:
                self.rowGrouping.append(None)

            rowList = []
            for item in row:
                if not isinstance(item.tag, basestring):
                    continue
                panelInstance = panel.createPanel(item.tag)
                panelInstance.fromXml(item)
                rowList.append(panelInstance)
            self.rows.append(rowList)
 def buildElement(self, element):
     panelInstance = panel.createPanel(element.tag, flashOk=self.flashOk, forceFlash=self.forceFlash)
     panelInstance.fromXml(element)
     return panelInstance
Example #6
0
 def buildElement(self, element):
     panelInstance = panel.createPanel(element.tag,
                                       flashOk=self.flashOk,
                                       forceFlash=self.forceFlash)
     panelInstance.fromXml(element)
     return panelInstance