def group_fields(request): user_groups = model.get_user_group_options(request.site) fields = f.Fields([ f.TextField('Name', v.required, v.valid_name), f.TextField('Description', maxlength=60), f.PulldownField( 'Administrators', default='administrators', name='admin_group_id', options=user_groups ), ]) db = request.site.db admin = model.AdminModel(db) if len(request.route) > 2 and request.route[2] not in ['new', 'clear', 'reindex']: group_id = int(request.route[2]) else: group_id = None include_fields = f.Section('Includes',[ SelectionField('Subgroups', options=admin.get_subgroup_options(group_id)), SelectionField('Users', options=admin.get_user_options()), ]) access_fields = f.Section('Accesses',[ SelectionField('Roles', options=admin.get_role_options(group_id)), SelectionField('Apps', options=admin.get_app_options(group_id)), ]) return f.Fields(fields, include_fields, access_fields)
def get_theme_settings_form(): form = zoom.forms.Form( f.Section('Theme',[ f.PulldownField( 'Name', name='theme_name', options=get_theme_options() ), # f.TextField('Template', name='theme_template'), f.PulldownField( 'Comments', name='theme_comments', options=theme_comment_options ) ]), f.ButtonField('Save') ) form.update(zoom.system.site.settings.theme) return form
def group_fields(request): fields = f.Fields([ f.TextField('Name', v.required, v.valid_name), f.MemoField('Description'), f.PulldownField('Administrators', default='administrators', options=request.site.user_groups), ]) personal_fields = f.Section('Includes',[ # f.ChosenMultiselectField('Groups', options=request.site.user_groups), f.ChosenMultiselectField('Users', options=request.site.user_options), ]) return f.Fields(fields, personal_fields)
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