示例#1
0
    def createInformation(self):
        resource_type = self['type']
        options = [
            (tr('Identifier'), self['id']),
        ]
        if self.library.window.debug:
            options.extend((
                (u'allow_child', humanYesNo(self['allow_child'])),
                (u'is_generic', humanYesNo(self['is_generic'])),
            ))
            if 'parent' in self:
                parent = self['parent']()
                options.append((u'parent', parent['id']))
        if 'name' in self:
            options.append((tr('Name'), self['name']))
        if 'hostname' in self:
            options.append((tr('Hostname'), self['hostname']))
        if resource_type == IPSEC_NETWORK_RESTYPE:
            options.append((tr('Remote network'), unicode(self['address'])))
            options.append((tr('Remote gateway'), unicode(self['gateway'])))
        else:
            if 'address' in self:
                options.append((tr('Address'), unicode(self['address'])))
            if 'gateway' in self:
                options.append((tr('Gateway'), unicode(self['gateway'])))
        if 'addresses' in self:
            addresses = self['addresses']
            addresses = tuple(unicode(address) for address in addresses)
            options.append((tr('Addresses'), addresses))
        if resource_type not in (INTERFACE_RESTYPE, GENERIC_INTERFACE_RESTYPE) \
        and ('interface' in self):
            options.append((tr('Interface'), self['interface']))
        options.append((tr('References'), self.createReferencesHTML()))

        title = NETWORK_TYPE_LABELS[resource_type]
        address_types = self['address_types'] - set((INTERFACE_ADDRESS,))
        if address_types:
            title += ' (%s)' % u', '.join(address_types)
        return (title, options)
示例#2
0
文件: acl.py 项目: maximerobin/Ufwi
    def createInformation(self):
        options = []

        title = unicode(self)

        extra = []
        template = self.getTemplate()
        if template:
            extra.append(template)
        if not self['enabled']:
            extra.append(tr('disabled'))
        if not self['mandatory']:
            extra.append(tr('optional'))
        if extra:
            title += ' (%s)' % u', '.join(extra)
        decision = htmlImage(self.getIcon(), align="middle")
        decision += NBSP + Html(self['decision'])
        options.extend((
            (tr('Decision'), decision),
            (tr('Chain'), self['chain']),
            (tr('Sources'), formatObjects(self.getSources())),
            (tr('Destinations'), formatObjects(self.getDestinations())),
            (tr('Protocols'), formatObjects(self['protocols'])),
        ))
        if self['user_groups']:
            options.append((tr('User Groups'), formatObjects(self['user_groups'])))
        if self['applications']:
            options.append((tr('Applications'), formatObjects(self['applications'])))
        if self['operating_systems']:
            options.append((tr('Operating Systems'), formatObjects(self['operating_systems'])))
        if self['periodicities']:
            options.append((tr('Time Criteria'), formatObjects(self['periodicities'])))
        if self['durations']:
            options.append((tr('Durations'), formatObjects(self['durations'])))
        log = htmlBold(humanYesNo(self['log']))
        if 'log_prefix' in self:
            log = tr('%s, prefix="%s"') % (log, htmlBold(self['log_prefix']))
        options.extend((
            (tr('Logging'), Html(log, escape=False)),
            (tr('Input'), self['input'].createHTML()),
            (tr('Output'), self['output'].createHTML()),
        ))
        if 'comment' in self:
            options.append((tr('Comment'), self['comment']))
        return title, options
示例#3
0
 def createDebugOptions(self, options):
     options.append((tr('Editable'), humanYesNo(self['editable'])))
     if 'physical_id' in self:
         options.append((tr('Physical ID'), self['physical_id']))
     if 'from_template' in self:
         options.append((tr('From template'), self['from_template']))