Пример #1
0
def get_site_settings_form():
    form = zoom.forms.Form(
        f.Section('Site', [
            f.TextField('Name', v.required),
            f.TextField('Owner Name'),
            f.EmailField('Owner Email'),
            f.URLField('Owner URL'),
            f.EmailField('Register Email'),
            f.EmailField('Support Email'),
        ]),
        f.ButtonField('Save')
    )
    form.update(zoom.system.site.settings.site)
    return form
Пример #2
0
def user_fields(request):
    # username_available = Validator('taken', valid_username(db))
    # not_registered = Validator('already registered', email_unknown_test)

    personal_fields = f.Section(
        'Personal',
        [
            f.TextField('First Name', v.required, v.valid_name),
            f.TextField('Last Name', v.required, v.valid_name),
            # f.TextField('Email', v.required, v.valid_email, not_registered(request)),
            f.EmailField('Email', v.required, v.valid_email),
            f.PhoneField('Phone', v.valid_phone, hint='optional'),
        ])

    account_fields = f.Section(
        'Account',
        [
            # f.TextField('Username', v.required, v.valid_username, username_available(request)),
            f.TextField('Username', v.required, v.valid_username),
        ])

    security_fields = f.Section('Security', [
        UserGroupsField('Groups',
                        default=['2'],
                        options=model.get_user_group_options(request.site))
    ])

    return f.Fields(personal_fields, account_fields, security_fields)
Пример #3
0
def user_fields(request):
    """Return user fields"""
    # username_available = Validator('taken', valid_username(db))
    # not_registered = Validator('already registered', email_unknown_test)

    personal_fields = f.Section(
        'Personal',
        [
            f.TextField('First Name', v.required, v.valid_name),
            f.TextField('Last Name', v.required, v.valid_name),
            # f.TextField('Email', v.required, v.valid_email, not_registered(request)),
            f.EmailField('Email', v.required, v.valid_email),
            f.PhoneField('Phone', v.valid_phone, hint='optional'),
        ])

    if request.route[-1] == 'new':
        account_fields = f.Section('Account', [
            f.TextField('Username', v.required, v.valid_username),
            f.CheckboxField('Send invitation'),
        ])
    else:
        account_fields = f.Section('Account', [
            f.TextField('Username', v.required, v.valid_username),
        ])

    security_fields = f.Section('Security', [
        UserGroupsField('Groups',
                        name='memberships',
                        default=[2],
                        options=model.get_user_group_options(request.site))
    ])

    return f.Fields(personal_fields, account_fields, security_fields)
Пример #4
0
def get_fields():
    """Return registration form fields"""
    return f.Fields([
        f.Section('First, the basics', [
            f.TextField(
                'First Name',
                v.required,
                v.valid_name,
                maxlength=40,
                placeholder='First Name'
            ),
            f.TextField(
                'Last Name',
                v.required,
                maxlength=40,
                placeholder="Last Name"
            ),
            f.EmailField(
                'Email',
                v.required,
                v.valid_email,
                maxlength=60,
                placeholder='Email'
            ),
        ]),
        f.Section('Next, choose a username and password', [
            f.TextField(
                'Username',
                v.required,
                v.valid_username,
                # v.name_available,
                maxlength=50,
                size=30
            ),
            f.PasswordField(
                'Password',
                v.required,
                v.valid_password,
                maxlength=16,
                size=20
            ),
            f.PasswordField(
                'Confirm',
                v.required,
                maxlength=16,
                size=20
            ),
        ]),
    ])
Пример #5
0
def get_mail_settings_form():
    """Creates, initializes and returns the mail settings form"""
    form = zoom.forms.Form(
        f.Section('Mail', [
            f.TextField('SMTP Host'),
            f.IntegerField('SMTP Port', size=4, default=3309),
            f.TextField('SMTP User'),
            f.TextField('SMTP Password', name='smtp_password'),
            f.URLField('Logo'),
            f.EmailField('From Address', name='from_addr'),
            f.TextField('From Name', name='from_name'),
            f.PulldownField('Delivery', options=['immediate', 'background'])
        ]),
        f.ButtonField('Save')
    )
    form.update(zoom.system.site.settings.mail)
    return form
Пример #6
0
def profile_fields():
    """Return Profile Fields"""
    return f.Fields([
        f.Section('Basic', [
            f.TextField('First Name', v.required),
            f.TextField('Last Name', v.required),
            f.TextField('Username', v.required, size=15),
            f.EmailField('Email'),
            f.PhoneField('Phone'),
            f.TextField('City', size=20),
            f.BasicImageField('Photo'),
        ]),
        f.Section('Locale', [
            f.TimezoneField('Timezone', default='Canada/Pacific'),
        ]),
        f.Section('Social', [
            f.TextField('Web'),
            f.TextField('Blog'),
            f.TextField('Twitter',size=20),
        ]),
        f.Section('Bio', [
            f.MemoField('About You', cols=40, name="about"),
        ]),
    ])