コード例 #1
0
ファイル: Bulk.py プロジェクト: calston/tums
    def form_addForm(self, data):
        form = formal.Form(self.submitForm)

        form.addField('upload',
                      formal.File(),
                      formal.FileUploadWidget,
                      label="Upload file")

        form.addAction(self.submitForm)

        return form
コード例 #2
0
ファイル: Squid.py プロジェクト: calston/tums
 def form_addDomain(self, data):
     form = formal.Form()
     form.addField(
         'domain',
         formal.String(required=True),
         label="Domain name",
         description=
         "Domain name to allow. Preceede the domain with a full stop to include all subdomains"
     )
     form.addAction(self.submitDomain)
     return form
コード例 #3
0
    def form_example(self, ctx):
        form = formal.Form()
        form.addField('required', formal.String(required=True))
        form.addField(
            'oneString', formal.String(),
            formal.widgetFactory(formal.SelectChoice, options=strings))
        form.addField(
            'anotherString', formal.String(),
            formal.widgetFactory(formal.SelectChoice, options=data_strings))
        form.addField(
            'oneMoreString', formal.String(required=True),
            formal.widgetFactory(formal.RadioChoice, options=data_strings))
        form.addField('oneDate', formal.Date(),
                      formal.widgetFactory(formal.SelectChoice, options=dates))
        form.addField(
            'multipleStrings', formal.Sequence(formal.String()),
            formal.widgetFactory(formal.CheckboxMultiChoice,
                                 options=data_strings))
        form.addField(
            'multipleDates', formal.Sequence(formal.Date()),
            formal.widgetFactory(formal.CheckboxMultiChoice, options=dates))

        form.addField(
            'multipleTuples', formal.Sequence(formal.Sequence()),
            formal.widgetFactory(formal.CheckboxMultiChoice, options=tuples))

        form.addField(
            'differentNoneSelect', formal.String(),
            formal.widgetFactory(formal.SelectChoice,
                                 options=strings,
                                 noneOption=differentNone))
        form.addField(
            'differentNoneRadios', formal.String(),
            formal.widgetFactory(formal.RadioChoice,
                                 options=data_strings,
                                 noneOption=differentNone))
        form.addField(
            'selectOther', formal.String(),
            formal.widgetFactory(formal.SelectOtherChoice,
                                 options=['Mr', 'Mrs']))
        form.addField(
            'selectOtherCustomOther', formal.String(),
            formal.widgetFactory(formal.SelectOtherChoice,
                                 options=['Mr', 'Mrs'],
                                 otherOption=('...', 'Other (Please Enter)')))
        form.addField(
            'selectOtherRequired', formal.String(required=True),
            formal.widgetFactory(formal.SelectOtherChoice,
                                 options=['Mr', 'Mrs']))
        form.addField(
            'multiselect', formal.String(),
            formal.widgetFactory(formal.MultiselectChoice, options=strings))
        form.addAction(self.submitted)
        return form
コード例 #4
0
    def form_addUser(self, data):
        """ Form for adding a user"""
        form = formal.Form()
        
        form.addField('name', formal.String(), label = self.text.vpnName)
        form.addField('mail', formal.String(), label = self.text.vpnMail) 
        form.addField('ip', formal.String(), label = self.text.vpnStaticIP)
        form.addField('mailKey', formal.Boolean(), label = self.text.vpnMailQuestion)

        form.addAction(self.newCert)
        return form
コード例 #5
0
 def form_addZone(self, data):
     form = formal.Form()
     
     form.addField('zone', formal.String(required=True), label = "Domain")
     form.addField('master', formal.Boolean(), label = "Master")
     form.addField('update', formal.String(), label = "Update", description ="If this server is not the master, enter the master servers IP here")
     form.addField('forward', formal.String(), label = "Forward", description ="Forward requests for this zone to another server")
     
     form.data['master'] = True
     
     form.addAction(self.submitZone)
     return form
コード例 #6
0
    def form_addTime(self, data):
        acls = []

        for ip, i in self.sysconf.ProxyConfig.get('srcacls', []):
            if (not i in acls):
                acls.append((i, i))

        for n, i in self.sysconf.ProxyConfig.get('aclusers', []):
            if (not i in acls):
                acls.append((i, i))

        for n, i in self.sysconf.ProxyConfig.get('domacls', []):
            if (not i in acls):
                acls.append((i, i))

        for i in self.sysconf.ProxyConfig.get('adacls', []):
            if (not i[2] in acls):
                acls.append((i[2], i[2]))

        form = formal.Form(
            self.submitTime
        )[formal.Field('allow',
                       formal.Boolean(),
                       label="Allow",
                       description="Allow traffic at these times"),
          formal.Field('from',
                       formal.Time(required=True),
                       label="From time",
                       description="Starting time (24 hour format)"),
          formal.Field(
              'to',
              formal.Time(required=True),
              label="To time",
              description=
              "Ending time (24 hour format), must be later than the starting time and must not overlap midnight"
          ),
          formal.Field('domain',
                       formal.String(),
                       label="Domain",
                       description="Apply this rule to a specific domain"),
          formal.Field('exacl',
                       formal.String(),
                       formal.widgetFactory(formal.SelectChoice, options=acls),
                       label="Extra ACL",
                       description="Apply this rule to a specific other ACL"),
          formal.Group('Days')[[
              formal.Field(i, formal.Boolean(), label=i)
              for i in PageHelpers.days
          ]]]
        form.data['from'] = datetime.time(0, 0)
        form.data['to'] = datetime.time(23, 59)
        form.addAction(self.submitTime)
        return form
コード例 #7
0
ファイル: Traffic.py プロジェクト: calston/tums
    def form_createClass(self, data):
        form = formal.Form()

        form.addField('interface',
                      formal.String(required=True),
                      formal.widgetFactory(formal.SelectChoice,
                                           options=[
                                               (i, i)
                                               for i in Utils.getInterfaces()
                                           ]),
                      label="Interface",
                      description="The interface to which this class applies")

        form.addField('name',
                      formal.String(required=True),
                      label="Name",
                      description="A name for this class")

        form.addField(
            'baserate',
            formal.String(),
            label="Base Rate",
            description=[
                "The basic rate for this class,",
                " preceded by the unit mbit or kbit (for example '768kbit')"
            ])

        form.addField(
            'maxrate',
            formal.String(),
            label="Maximum Rate",
            description=[
                "The maximum rate for this class,",
                " preceded by the unit mbit or kbit (for example '2mbit')"
            ])

        form.addField('prio',
                      formal.Integer(),
                      label="Priority",
                      description="Priority of this traffic")

        form.addField(
            'default',
            formal.Boolean(),
            label="Default class",
            description=[
                "Tick if this is the default class to use for all traffic",
                " Every interface must have a default class."
            ])

        form.addAction(self.submitTransProxy)

        return form
コード例 #8
0
    def form_mailLocal(self, data):
        form = formal.Form()
        form.addField('localDomains',
                      formal.String(),
                      formal.TextArea,
                      label=self.text.eximLocalDomains,
                      description=self.text.eximLocalDescription)

        local = self.sysconf.LocalDomains
        form.data['localDomains'] = '\n'.join(local)
        form.addAction(self.submitLocal)
        return form
コード例 #9
0
    def form_mailConfig(self, data):
        form = formal.Form()

        form.addField('maxsize',
                      formal.String(),
                      label=self.text.eximMaxMailSize,
                      description=self.text.eximMaxSizeDescription)

        form.addField('blockedFiles',
                      formal.String(),
                      label=self.text.eximBlockedAttachment,
                      description=self.text.eximBlockedDescription)

        form.addField('blockMovies',
                      formal.Boolean(),
                      label=self.text.eximBlockedMovies,
                      description=self.text.eximBlockedMovieDescription)

        form.addField('blockHarm',
                      formal.Boolean(),
                      label=self.text.eximBlockHarmful,
                      description=self.text.eximBlockHarmfulDescription)

        form.addField('greylisting',
                      formal.Boolean(),
                      label=self.text.eximGreylisting,
                      description=self.text.eximGreylistingDescription)

        form.addField('spamscore',
                      formal.Integer(),
                      label=self.text.eximSpamScore,
                      description=self.text.eximSpamScoreDescription)

        form.addField('smtprelay',
                      formal.String(),
                      label=self.text.eximSMTPRelay,
                      description=self.text.eximSMTPRelayDescription)

        form.addField('copyall',
                      formal.String(),
                      label=self.text.eximMailCopy,
                      description=self.text.eximMailCopyDescription)

        mailConf = self.sysconf.Mail
        form.data['maxsize'] = mailConf['mailsize']
        form.data['blockedFiles'] = ', '.join(mailConf['blockedfiles'])
        form.data['greylisting'] = mailConf.get('greylisting', True)
        form.data['smtprelay'] = self.sysconf.SMTPRelay
        form.data['copyall'] = mailConf.get('copytoall', "")
        form.data['spamscore'] = int(mailConf.get('spamscore', "70"))

        form.addAction(self.submitForm)
        return form
コード例 #10
0
 def form_example(self, ctx):
     form = formal.Form()
     form.addField('aString', formal.String())
     form.addField('aInteger', formal.Integer())
     form.addField('aFloat', formal.Float())
     if haveDecimal:
         form.addField('aDecimal', formal.Decimal())
     form.addField('aBoolean', formal.Boolean())
     form.addField('aDate', formal.Date())
     form.addField('aTime', formal.Time())
     form.addAction(self.submitted)
     return form
コード例 #11
0
    def form_updatebutton(self, ctx):
        form = formal.Form()

        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('submitupdate',
                                    formal.String(),
                                    label='Update product (causes reboot)'))
        form.add(sg)
        form.addAction(self.submitted_update,
                       name='submitupdate',
                       validate=False)
        return form
コード例 #12
0
    def form_xenConf(self, data):
        form = formal.Form()

        form.addField('enable',
                      formal.Boolean(),
                      label="Xen enabled",
                      description="Enable Xen support")

        form.data['enable'] = self.sysconf.General.get('xen',
                                                       {}).get('enabled')

        form.addAction(self.submitXenConf)
        return form
コード例 #13
0
ファイル: HA.py プロジェクト: calston/tums
    def form_genKey(self, ctx):
        form = formal.Form()

        form.addField('key', formal.String(), label = "Access Key",
            description="This key is generated on submit. Paste this key into the section below on the slave server")
        
        try:
            l = open('/root/.ssh/identity.pub')
            form.data['key'] = l.read()
            l.close()

        except Exception, e:
            print "No key found", e
コード例 #14
0
    def form_searchForm(self, d):
        form = formal.Form()

        form.addField('to', formal.String(), label="To Address Contains")
        form.addField('from',
                      formal.String(),
                      label="From Address Contains",
                      description=["Between Dates"])
        form.addField('fromdate', formal.Date(), label="")
        form.addField('todate', formal.Date(), label="")

        form.addAction(self.submitForm)
        return form
コード例 #15
0
 def form_addStatic(self, data):
     form = formal.Form()
     form.addField('hostname',
                   formal.String(required=True),
                   label="Hostname")
     form.addField(
         'mac',
         formal.String(required=True),
         label="Mac address",
         description="Hardware address of host. Must be : delimited")
     form.addField('ip', formal.String(required=True), label="IP Address")
     form.addAction(self.submitForm)
     return form
コード例 #16
0
    def form_buttons(self, ctx):
        form = formal.Form()

        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('submitdiagexport',
                                    formal.String(),
                                    label='Export diagnostics'))
        form.add(sg)
        form.addAction(self.submitted_diagexport,
                       name='submitdiagexport',
                       validate=False)
        return form
コード例 #17
0
    def form_buttons(self, ctx):
        form = formal.Form()

        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('submitshutdown',
                                    formal.String(),
                                    label='Shut down'))
        form.add(sg)
        form.addAction(self.submitted_shutdown,
                       name='submitshutdown',
                       validate=False)
        return form
コード例 #18
0
    def form_mailRewrite(self, data):
        form = formal.Form()
        form.addField('ffrom', formal.String(required=True),label = "Domain",
            description = "Domain to modify")

        form.addField('tto', formal.String(required=True),label = "Rewrite to",
            description = "Domain to rewrite to")

        form.addField('tos', formal.Boolean(),label = "To header",  description = "Rewrite email To header")
        form.addField('froms', formal.Boolean(),label = "From header",  description = "Rewrite email From header")
        form.addField('bcr', formal.Boolean(),label = "BCC, CC and Recipient",  description = "Rewrite all other headers")
        form.addAction(self.submitRewrite)
        return form
コード例 #19
0
    def form_mailHubbed(self, data):
        form = formal.Form()
        form.addField('hubbedHosts',
                      formal.String(),
                      formal.TextArea,
                      label=self.text.eximHubbedHostMappings,
                      description=self.text.eximHubbedHostDescription)

        mailConf = self.sysconf.Mail
        form.data['hubbedHosts'] = '\n'.join(
            ['    '.join(i) for i in mailConf['hubbed']])
        form.addAction(self.submitHubbed)
        return form
コード例 #20
0
    def form_rename(self, data):
        form = formal.Form()

        form.addField('descr', formal.String(), label="Description")
        form.addField('init', formal.String(), label="RC Script")
        form.addField('proc',
                      formal.String(),
                      label="Process ID",
                      description="Leave blank if same as RC script")

        form.addAction(self.submitForm)

        return form
コード例 #21
0
    def form_squidConf(self, data):
        form = formal.Form()
        form.addField('contentfilter',
                      formal.Boolean(),
                      label="Content filter")

        form.addField('advanced',
                      formal.Boolean(),
                      label="Update cache",
                      description="Enable update caching support.")

        form.addField(
            'captive',
            formal.Boolean(),
            label="Captive portal",
            description=
            "Enable captive portal (Requires Update Cache to be enabled).")

        form.addField(
            'captiveblock',
            formal.Boolean(),
            label="Captive block",
            description=
            "Check this if you want the default captive portal firewall policy to be blocking. By default all traffic will be accepted from authenticated computers"
        )

        form.addField(
            'bindaddr',
            formal.String(),
            label="Exit address",
            description=
            "The IP address to use for outbound connections. Leave blank for default"
        )

        k = self.sysconf.ProxyConfig
        data = {}
        data['contentfilter'] = k.get('contentfilter', False)
        data['captive'] = k.get('captive', False)
        data['captiveblock'] = k.get('captiveblock', False)

        if k.get('updates'):
            u = k['updates']

            data['advanced'] = u.get('enabled', False)

        data['bindaddr'] = k.get('bindaddr', '')

        form.data = data
        form.addAction(self.submitConfig)

        return form
コード例 #22
0
    def form_addSNAT(self, data):
        form = formal.Form()

        ifs = []
        for i in Utils.getInterfaces():
            if 'eth' in i or 'tap' in i:  # Only allow tap and eth binds...
                ifs.append((i, i))

        form.addField(
            'dstif',
            formal.String(required=True),
            formal.widgetFactory(formal.SelectChoice, options=ifs),
            label="External Interface",
            description=
            "The interface to which this traffic will be NATed. (Generaly the outside/internet interface)"
        )

        form.addField('dstip',
                      formal.String(required=True,
                                    validators=[PageHelpers.IPValidator()]),
                      label="External IP",
                      description="The IP to which this traffic will be NATed")

        form.addField(
            'srcip',
            formal.String(required=True,
                          strip=True,
                          validators=[PageHelpers.IPValidator()]),
            label="Source IP",
            description=["The source IP you would like to NAT to and from."])

        form.addField(
            'all',
            formal.Boolean(),
            label="Any Interface",
            description=
            "Tick this if the rule should apply to all interfaces and not just the External Interface."
        )

        form.addField(
            'local',
            formal.Boolean(),
            label="Use Internal",
            description="Apply this NAT rule to this servers traffic as well.")

        form.data['local'] = False
        form.data['all'] = False

        form.addAction(self.submitSNAT)

        return form
コード例 #23
0
ファイル: HA.py プロジェクト: calston/tums
    def form_masterKey(self, ctx):
        form = formal.Form()

        form.addField(
            'key',
            formal.String(),
            label="Master Key",
            description="If this is a slave node, enter the masters key here")

        form.data['key'] = self.sysconf.General.get('haconf',
                                                    {}).get('masterkey', '')

        form.addAction(self.submitMaster)
        return form
コード例 #24
0
ファイル: formatconfirm.py プロジェクト: zeus911/vpnease-l2tp
    def form_confirm_formatting(self, ctx):
        form = formal.Form()

        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(formalutils.SubmitField('confirm', formal.String(), label='Start formatting'))
        sg.add(formalutils.SubmitField('reselect', formal.String(), label='Back'))
        sg.add(formalutils.SubmitField('cancel', formal.String(), label='Cancel'))
        form.add(sg)
        
        form.addAction(self.submitted_confirm_formatting, name='confirm', label='Start formatting', validate=False)
        form.addAction(self.submitted_reselect, name='reselect', label='Back', validate=False)
        form.addAction(self.submitted_cancel_formatting, name='cancel', label='Cancel', validate=False)

        return form
コード例 #25
0
ファイル: VPN.py プロジェクト: calston/tums
    def form_winForm(self, data):
        """ Windows VPN Form"""
        form = formal.Form()

        form.addField('windows', formal.Boolean(), label = self.text.vpnLabelWindows, description=self.text.vpnDescripWindows)
        form.addField('winip', formal.String(), label = self.text.vpnLabelWinserver)
        form.addField('winextip', formal.String(), label = self.text.vpnLabelExtwinserver,
            description = [self.text.vpnDescripExtwinserver])

        form.data['winip'], form.data['winextip'], form.data['windows'] = VPN.get_windows_vpn(self.sysconf)

        form.addAction(self.submitWinForm)

        return form
コード例 #26
0
ファイル: Routing.py プロジェクト: calston/tums
    def form_bgp(self, data):
        form = formal.Form()

        form.addField('as', formal.String(required=True), label="AS Number")

        form.addField('id',
                      formal.String(required=True,
                                    strip=True,
                                    validators=[PageHelpers.IPValidator()]),
                      label="Router ID",
                      description="IP that is used to peered with this router")

        form.addAction(self.submitAS)
        return form
コード例 #27
0
ファイル: HA.py プロジェクト: calston/tums
    def form_config(self, ctx):
        form = formal.Form(self.submitForm)[
            formal.Group('topology')[
                tags.div[
                    tags.h3["Topology configuration"]
                ],
                formal.Field('name', formal.String(), label = "Name"),
                formal.Field('topology', formal.String(),  formal.widgetFactory(formal.SelectChoice, options = [
                        ('master', 'Master'),
                        ('slave', 'Slave')
                    ]), label = "Topology"),
                formal.Field('ipoverride', formal.Boolean(), label = "Take over LAN", 
                    description = "Take over the LAN settings of this server on failure."), 
                formal.Field('wanoverride', formal.Boolean(), label = "Take over WAN", 
                    description = "Take over the WAN settings of this server on failure."),
                #formal.Field('key', formal.String(), label = "Access Key", 
                #    description = "On the slave system, configure it to accept HA connections and generate a key which is pasted here")
            ],
            formal.Group('failover')[
                tags.div[
                    tags.h3["Failover services"]
                ],
                formal.Field('dhcp', formal.Boolean(), label = "DHCP", 
                    description = "This server will act as a backup DHCP server"),

                formal.Field('smtp', formal.Boolean(), label = "SMTP", 
                    description = "This server will provide backup SMTP routing - NOT POP3/IMAP DELIVERY."),

                formal.Field('routing', formal.Boolean(), label = "Internet Gateway", 
                    description = "This server may act as a backup internet gateway in the event that the master goes offline"),

                formal.Field('dns', formal.Boolean(), label = "DNS Server", 
                    description = "This server may act as a backup DNS server for all zones"),

                formal.Field('pdc', formal.Boolean(), label = "Domain controller", 
                    description = "This server may act as the primary domain controller")
            ],
            formal.Group('loadbalance')[
                tags.div[
                    tags.h3["Load sharing services"]
                ],
                formal.Field('dhcp', formal.Boolean(), label = "DHCP"),
                formal.Field('smtp', formal.Boolean(), label = "SMTP")
            ],
        ]
        
        form.data = self.populateForm()
        form.addAction(self.submitForm)
        return form
コード例 #28
0
ファイル: ConfWiz.py プロジェクト: calston/tums
    def form_wizard1(self, data):
        form = formal.Form()
        form.addField('company', formal.String(), label="Company Name")
        form.addField('hostname', formal.String(), label="Hostname")
        form.addField('domain', formal.String(), label="Domain name")
        form.addField('bigname',
                      formal.String(),
                      label="Domain/Base",
                      description="Company name in capitals usualy")
        form.addField('external', formal.String(), label="External Hostname")
        form.addAction(self.submitWiz1)

        form.data = self.config

        return form
コード例 #29
0
    def form_reboot_computer(self, ctx):
        form = formal.Form()

        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('reboot',
                                    formal.String(),
                                    label='Reboot computer'))
        form.add(sg)
        form.addAction(self.submitted_reboot_computer,
                       name='reboot',
                       label='Reboot computer',
                       validate=False)

        return form
コード例 #30
0
ファイル: Network.py プロジェクト: calston/tums
    def form_tunnelConf(self, data):
        form = formal.Form()
        form.addField('remoteip', formal.String(), label="Remote IPv4 address")
        form.addField('localip', formal.String(), label="Local IPv4 address")
        form.addField('localv6', formal.String(), label="IPv6 address")
        form.addAction(self.submitTunnel)

        if self.sysconf.Tunnel.get('ipv6', False):
            form.data['remoteip'] = self.sysconf.Tunnel['ipv6'].get(
                'remoteip', '')
            form.data['localip'] = self.sysconf.Tunnel['ipv6'].get(
                'localip', '')
            form.data['localv6'] = self.sysconf.Tunnel['ipv6'].get(
                'localv6', '')
        return form