def get_reset_password_form(key): reset_password_form = Form( f.TextField('New Password', v.required), f.CheckboxField('Email Password', value=True), f.ButtonField('Save Password', cancel='/admin/users/' + key), ) return reset_password_form
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
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
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 get_reset_password_form(key): reset_password_form = Form( f.TextField('New Password', v.required), f.ButtonField('Save Password', cancel='/admin/users/' + key)) return reset_password_form
from zoom.browse import browse import zoom.fields as f from zoom.forms import Form from zoom.components import success from zoom.tools import home mail_form = Form([ f.TextField('Recipient', size=60, maxlength=60, default=(context.user.email)), f.TextField('Subject', default='a subject ' + uuid.uuid4().hex), f.MemoField('Message', value='this is the message body\n' + uuid.uuid4().hex), # f.FileField('Attachment'), f.ButtonField('Send'), ]) class MyView(View): def index(self): actions = ['Compose'] content = '<h2>Waiting</h2>' + browse(get_mail_store(context.site)) return page(content, title='Mail', actions=actions) def compose(self): # print(context.site) return page(content='Send mail as "{} <{}>"<br><br>{}'.format( context.site.mail_from_name, context.site.mail_from_addr, mail_form.edit(),
import zoom.fields as f from zoom.validators import required import widgets my_form = f.Fields( f.Section('Personal', [ f.TextField( 'Name', required, size=20, value='John Doe', hint='this is a hint'), f.MemoField('Notes', hint='this is a hint'), ]), f.Section('Social', [ f.TextField('Twitter', size=15, value='jdoe', hint='optional'), ]), f.ButtonField('Save'), ) small_form = f.Fields( f.TextField("Name", size=20), f.TextField("Address"), ) class MyView(View): """main application view""" def index(self): site = self.model db = site.db cmd = 'select id, username, email, phone from users limit 10'