Exemplo n.º 1
0
 def form_example(self, ctx):
     form = formal.Form()
     form.addField('required', formal.String(required=True))
     form.addField('file', formal.File(), formal.FileUploadWidget)
     form.addField('removeableFile', formal.File(), formal.widgetFactory(formal.FileUploadWidget, removeable=True ) )
                   
     form.addAction(self.submitted)
     return form
Exemplo n.º 2
0
    def form_addApp(self, data):
        form = formal.Form()

        form.addField('file', formal.File())

        form.addAction(self.submitForm)
        return form
Exemplo n.º 3
0
Arquivo: Bulk.py Projeto: 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
Exemplo n.º 4
0
Arquivo: VPN.py Projeto: calston/tums
    def form_addTun(self, data):
        form = formal.Form()
        
        form.addField('name', formal.String(required=True), label = "Tunnel name")
        form.addField('endpoint', formal.String(strip=True, validators=[PageHelpers.IPValidator()]), label = "Tunnel endpoint", 
            description = "IP address or hostname of the remote computer")

        form.addField('type', formal.String(required=True),  formal.widgetFactory(formal.SelectChoice, options = [
                ('openvpn','OpenVPN'), 
                ('l2tp', 'L2TP'),
                #('pptp', 'PPTP'),
                #('sit', 'SIT'),
                #('gre', 'GRE'),
            ]), label = "Type",
            description = "The type of tunnel to use")
        form.data['type'] = 'openvpn'

        form.addField('default', formal.Boolean(), label = "Default route",
            description = "If set will route all traffic over the link once it is established. If you only need specific routes then add them with the Routing tool.")

        # JS will enable these for pptp or l2tp
        form.addField('username', formal.String(), label = "Username")
        form.addField('password', formal.String(), label = "Password")

        # JS will enable these for OpenVPN
        form.addField('proto', formal.String(required=True),  formal.widgetFactory(formal.SelectChoice, options = [
            ('udp', 'UDP'),
            ('tcp', 'TCP')
        ]), label = "Protocol", description="The layer 3 protocol to use for this connection. Usuauly UDP")

        form.data['proto'] = 'udp'

        form.addField('CA', formal.File(), formal.FileUploadWidget, label = "Remote CA")
        form.addField('crt', formal.File(), formal.FileUploadWidget, label = "Local certificate")
        form.addField('key', formal.File(), formal.FileUploadWidget, label = "Local key")

        form.addAction(self.submitTunnel)
        return form
Exemplo n.º 5
0
    def form_importAliases(self, data):
        """Form presented to the users"""

        form = formal.Form(self.submitForm)
        form.addField('domain',
                      formal.String(required=True, strip=True),
                      label="Domain for Addresses")
        form.addField(
            'createUser',
            formal.Boolean(),
            label="Create User(s)",
            description=
            "You may find that you need to create a holding user account for the forwards to be set up, checking this will create user accounts when they do not exist, mail will not be stored locally and passwords will be randomised"
        )
        form.addField('upload', formal.File(), label="Upload file")
        form.addAction(
            self.submitForm)  #Set the method to handle the submit action
        return form
Exemplo n.º 6
0
    def form_buttons(self, ctx):
        form = formal.Form()

        g = formalutils.CollapsibleGroup('import',
                                         label='Import Configuration')
        g.setCollapsed(False)  # makes no sense to collapse really
        g.add(
            formalutils.Field('importfile',
                              formal.File(required=False),
                              label='File to import'))
        sg = formalutils.SubmitFieldGroup('buttons')
        sg.add(
            formalutils.SubmitField('submitconfigimport',
                                    formal.String(),
                                    label='Import configuration'))
        g.add(sg)
        form.add(g)
        form.addAction(self.submitted_configimport,
                       name='submitconfigimport',
                       validate=False)
        return form
Exemplo n.º 7
0
 def form_upload(self, ctx):
     f = formal.Form()
     f.addField('file', formal.File())
     f.addAction(self.saveFile, name="submit", label="Upload File")
     return f
Exemplo n.º 8
0
 def form_example(self, ctx):
     form = formal.Form()
     form.addField('file', formal.File())
     form.addAction(self.submitted)
     return form