예제 #1
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