class fields(ew_core.NameList): startdate = ew.TextField(label='Start date', validator=formencode.All( V.DateValidator(), fev.UnicodeString(not_empty=True))) enddate = ew.TextField(label='End date', validator=formencode.All( V.DateValidator(), fev.UnicodeString(not_empty=True)))
class fields(ew_core.NameList): uppercategory_id = ew.HiddenField(attrs={'value': ''}, show_errors=False) categoryname = ew.TextField( label="Category name", attrs={}, validator=fev.UnicodeString(not_empty=True)) shortname = ew.TextField(label="Short Name", validator=fev.UnicodeString(), attrs={'placeholder': 'optional'})
class fields(ew_core.NameList): name = ew.TextField() redirect = ew.TextField() homepage = ffw.AutoResizeTextarea() allow_browse = ew.Checkbox(label='') show_title = ew.Checkbox(label='') css = ffw.AutoResizeTextarea() project_template = ffw.AutoResizeTextarea(validator=V.JsonValidator( if_empty='')) icon = ew.FileField() tracking_id = ew.TextField() project_list_url = ew.TextField(validator=fev.URL())
class fields(ew_core.NameList): weekday = ew.SingleSelectField( label='Weekday', options=[ew.Option(py_value=wd, label=wd) for wd in weekdays], validator=formencode.All(V.OneOfValidator(weekdays), fev.UnicodeString(not_empty=True))) starttime = ew.TextField(label='Start time', validator=formencode.All( V.TimeValidator(), fev.UnicodeString(not_empty=True))) endtime = ew.TextField(label='End time', validator=formencode.All( V.TimeValidator(), fev.UnicodeString(not_empty=True)))
def fields(self): fields = ew_core.NameList() fields.append(ffw.MarkdownEdit(name='text')) fields.append(ew.HiddenField(name='forum', if_missing=None)) if ew_core.widget_context.widget: # we are being displayed if ew_core.widget_context.render_context.get('show_subject', self.show_subject): fields.append( ew.TextField(name='subject', attrs=dict(style="width:97%"))) else: # We are being validated validator = fev.UnicodeString(not_empty=True, if_missing='') fields.append(ew.TextField(name='subject', validator=validator)) fields.append(NullValidator(name=self.att_name)) return fields
class fields(ew_core.NameList): display_name = ew.TextField( label='Displayed Name', validator=fev.UnicodeString(not_empty=True)) username = ew.TextField(label='Desired Username', validator=fev.Regex(h.re_path_portion)) username.validator._messages['invalid'] = ( 'Usernames must include only letters, numbers, and dashes.' ' They must also start with a letter and be at least 3 characters' ' long.') pw = ew.PasswordField(label='New Password', validator=fev.UnicodeString(not_empty=True, min=8)) pw2 = ew.PasswordField(label='New Password (again)', validator=fev.UnicodeString(not_empty=True))
class fields(ew_core.NameList): name = ew.TextField() redirect = ew.TextField() homepage = ffw.AutoResizeTextarea() allow_browse = ew.Checkbox(label='') show_title = ew.Checkbox(label='') use_wiki_page_as_root = ew.Checkbox(label='') css = ffw.AutoResizeTextarea() project_template = ffw.AutoResizeTextarea(validator=V.JsonValidator( if_empty='')) icon = ew.FileField(attrs={'accept': 'image/*'}) tracking_id = ew.TextField() project_list_url = ew.TextField() anchored_tools = ffw.AutoResizeTextarea() prohibited_tools = ffw.AutoResizeTextarea()
def fields(self): fields = [ ew.TextField(name='summary', label='Title', attrs={'style':'width: 425px','placeholder':'Title'}, validator=fev.UnicodeString(not_empty=True, messages={'empty':"You must provide a Title"})), ffw.MarkdownEdit(label='Description',name='description', attrs={'style':'width: 95%'}), ew.SingleSelectField(name='status', label='Status', options=lambda: c.app.globals.all_status_names.split()), ffw.ProjectUserCombo(name='assigned_to', label='Owner'), ffw.LabelEdit(label='Labels',name='labels', className='ticket_form_tags'), ew.Checkbox(name='private', label='Mark as Private', attrs={'class':'unlabeled'}), ew.InputField(name='attachment', label='Attachment', field_type='file', attrs={'multiple': 'True'}, validator=fev.FieldStorageUploadConverter(if_missing=None)), ffw.MarkdownEdit(name='comment', label='Comment', attrs={'style':'min-height:7em; width:97%'}), ew.SubmitButton(label=self.submit_text,name='submit', attrs={'class':"ui-button ui-widget ui-state-default ui-button-text-only"}), ew.HiddenField(name='ticket_num', validator=fev.Int(if_missing=None)), ] # milestone is kind of special because of the layout # add it to the main form rather than handle with the other customs if c.app.globals.custom_fields: for cf in c.app.globals.custom_fields: if cf.name == '_milestone': fields.append(TicketCustomField.make(cf)) break return ew_core.NameList(fields)
class fields(ew_core.NameList): email = ew.TextField(label='Your e-mail', attrs={ 'type': 'email', 'required': True, 'autocapitalize': "none" })
def fields(self): fields = [ ew.Checkbox(name='EnableVoting', label='Enable voting on tickets'), ew.Checkbox(name='AllowEmailPosting', label='Allow posting replies via email'), ew.TextField(name='TicketMonitoringEmail', label='Email ticket notifications to', validator=fev.Email(), grid_width='7'), ew.SingleSelectField( name='TicketMonitoringType', label='Send notifications for', grid_width='7', options=[ ew.Option(py_value='NewTicketsOnly', label='New tickets only'), ew.Option(py_value='NewPublicTicketsOnly', label='New public tickets only'), ew.Option(py_value='AllTicketChanges', label='All ticket changes'), ew.Option(py_value='AllPublicTicketChanges', label='All public ticket changes'), ]), ffw.MarkdownEdit(name='TicketHelpNew', label='Help text to display on new ticket page', validator=v.String(), attrs={'style': 'width: 95%'}), ffw.MarkdownEdit( name='TicketHelpSearch', label='Help text to display on ticket list pages (index page,' ' search results, milestone lists)', validator=v.String(), attrs={'style': 'width: 95%'}), ] return fields
def fields(self): return ew_core.NameList([ ew.TextField(name='title', validator=fev.UnicodeString( not_empty=True, messages={'empty': "You must provide a Title"}), attrs=dict(placeholder='Enter your title here', title='Enter your title here', style='width: 425px')), ffw.MarkdownEdit(name='text', show_label=False, attrs=dict(placeholder='Enter your content here', title='Enter your content here')), ew.SingleSelectField(name='state', options=[ ew.Option(py_value='draft', label='Draft'), ew.Option(py_value='published', label='Published') ]), ffw.LabelEdit(name='labels', placeholder='Add labels here', title='Add labels here'), ew.InputField( name='attachment', label='Attachment', field_type='file', attrs={'multiple': 'True'}, validator=fev.FieldStorageUploadConverter(if_missing=None)), ])
class CustomFieldAdminDetail(ffw.StateField): template = 'jinja:forgetracker:templates/tracker_widgets/custom_field_admin_detail.html' defaults = dict( ffw.StateField.defaults, selector=ffw.AdminField(field=ew.SingleSelectField( name='type', options=[ ew.Option(py_value='string', label='Text'), ew.Option(py_value='number', label='Number'), ew.Option(py_value='boolean', label='Boolean'), ew.Option(py_value='select', label='Select'), ew.Option(py_value='milestone', label='Milestone'), ew.Option(py_value='user', label='User'), ], )), states=dict( select=ffw.FieldCluster(fields=[ ffw.AdminField(field=ew.TextField( name='options', label= 'Options (separate with spaces; quote if containing spaces; prefix with * to set a default)', )) ], show_labels=False), milestone=ffw.FieldCluster( # name='milestones', fields=[MilestonesAdmin(name='milestones')])))
def fields(self): fields = [ ew.TextField(name=g.antispam.enc('username'), label='Username', attrs={ 'autofocus': 'autofocus', 'placeholder': 'Username' if plugin.ThemeProvider.get().use_input_placeholders() else '', 'autocomplete': 'username', 'autocapitalize': 'none', }), ew.PasswordField(name=g.antispam.enc('password'), label='Password', attrs={ 'placeholder': 'Password' if plugin.ThemeProvider.get().use_input_placeholders() else '', 'autocomplete': 'current-password', }), ew.Checkbox( name=g.antispam.enc('rememberme'), label='Remember Me', attrs={'style': 'margin-left: 162px;'}), ew.HiddenField(name='return_to'), ] if plugin.AuthenticationProvider.get(request).forgotten_password_process: # only show link if auth provider has method of recovering password fields.append( ew.HTMLField( name='link', text='<a href="/auth/forgotten_password" style="margin-left:162px" target="_top">' 'Forgot password?</a>')) for fld in g.antispam.extra_fields(): fields.append( ew_core.Widget(template=ew.Snippet(fld))) return fields
class FeaturesField(ew.CompoundField): template = 'jinja:allura.ext.admin:templates/admin_widgets/features_field.html' fields = [ew.TextField(name='feature', attrs={'style': 'width:89%'})] def resources(self): yield ew.JSLink('allura/js/jquery-ui.min.js', location='body_top_js') yield ew.CSSLink('allura/css/smoothness/jquery-ui.min.css', compress=False) # compress will also serve from a different location, breaking image refs
def birth_date_fields(self): return [ ew.TextField(name='birthdate', label='Birth date', validator=V.DateValidator(), attrs=dict(value=None)), _HTMLExplanation(text="Use the format DD/MM/YYYY", show_errors=False) ]
class fields(ew_core.NameList): socialnetwork = ew.SingleSelectField( label='Social network', options=[ ew.Option(py_value=name, label=name) for name in socialnetworks ], validator=formencode.All(V.OneOfValidator(socialnetworks), fev.UnicodeString(not_empty=True))) accounturl = ew.TextField(label='Account url', validator=fev.UnicodeString(not_empty=True))
class ModeratePost(ew.SimpleForm): submit_text = None fields = [ ew.FieldSet(legend='Promote post to its own thread', fields=[ ew.TextField(name='subject', label='Thread title'), ew.SubmitButton(name='promote', label='Promote to thread') ]) ]
def fields(self): fields = [ ew.HiddenField(name='app_id', label='App'), ew.TextField(name='name', label='Name', validator=fev.UnicodeString()), ew.TextField(name='shortname', label='Short Name', validator=All( fev.Regex(ur"^[^\s\/\.]*$", not_empty=True, messages={ 'invalid': 'Shortname cannot contain space . or /', 'empty': 'You must create a short name for the forum.'}), UniqueForumShortnameValidator())), ew.TextField(name='parent', label='Parent Forum'), ew.TextField(name='description', label='Description', validator=fev.UnicodeString()), ew.TextField(name='monitoring_email', label='Monitoring Email', validator=fev.Email()), ew.Checkbox(name="members_only", label="Developer Only"), ew.Checkbox(name="anon_posts", label="Allow Anonymous Posts") ] return fields
def fields(self): result = [ ew.TextField(name='summary', attrs={'style': 'width: 93.5%;'}), ew.SingleSelectField(name='source_branch', label='Source Branch', options=self.source_branches), ew.SingleSelectField(name='target_branch', label='Target Branch', options=self.target_branches), ffw.MarkdownEdit(name='description') ] return result
def fields(self): result = [ ew.TextField(name='summary'), ew.SingleSelectField(name='source_branch', label='Source Branch', options=self.source_branches), ew.SingleSelectField(name='target_branch', label='Target Branch', options=self.target_branches), ffw.AutoResizeTextarea(name='description') ] return result
class fields(ew_core.NameList): sex = ew.SingleSelectField( label='Gender', options=[ ew.Option(py_value=v, label=v, selected=False) for v in ['Male', 'Female', 'Unknown', 'Other'] ], validator=formencode.All( V.OneOfValidator(['Male', 'Female', 'Unknown', 'Other']), fev.UnicodeString(not_empty=True))) birthdate = ew.TextField(label='Birth date', validator=V.DateValidator(), attrs=dict(value=None)) exp = _HTMLExplanation(text="Use the format DD/MM/YYYY", show_errors=False) country = ew.SingleSelectField( label='Country of residence', validator=V.MapValidator(country_names, not_empty=False), options = [ ew.Option( py_value=" ", label=" -- Unknown -- ", selected=False)] +\ [ew.Option(py_value=c, label=n, selected=False) for c,n in sorted(country_names.items(), key=lambda (k,v):v)], attrs={'onchange':'selectTimezone(this.value)'}) city = ew.TextField(label='City of residence', attrs=dict(value=None), validator=fev.UnicodeString(not_empty=False)) timezone=ew.SingleSelectField( label='Timezone', attrs={'id':'tz'}, validator=V.OneOfValidator(common_timezones, not_empty=False), options=[ ew.Option( py_value=" ", label=" -- Unknown -- ")] + \ [ew.Option(py_value=n, label=n) for n in sorted(common_timezones)])
def fields(self): username = ew.TextField(name='username', label='Desired Username', validator=fev.Regex(h.re_project_name)) username.validator._messages['invalid'] = ( 'Usernames must include only small letters, numbers, and dashes.' ' They must also start with a letter and be at least 3 characters' ' long.') fields = [ ew.TextField(name='display_name', label='Displayed Name', validator=fev.UnicodeString(not_empty=True)), username, ] if asbool(config.get('auth.require_email_addr', False)): fields.append( ew.TextField(name='email', label='Your e-mail', validator=fev.Email(not_empty=True))) fields += [ ew.PasswordField( name='pw', label='New Password', attrs=dict( minlength=asint(tg.config.get('auth.min_password_len', 6)), maxlength=asint(tg.config.get('auth.max_password_len', 30))), validator=fev.UnicodeString( not_empty=True, min=asint(tg.config.get('auth.min_password_len', 6)), max=asint(tg.config.get('auth.max_password_len', 30)))), ew.PasswordField(name='pw2', label='New Password (again)', validator=fev.UnicodeString(not_empty=True)), ] return fields
def fields(self): # Since @property is readonly we can't modify field values in display() method # Returns fields modified by display() if self._fields: return self._fields list_of_fields = [ ew.SingleSelectField( name='sex', label='Gender', options=[ ew.Option(py_value=v, label=v, selected=False) for v in ['Male', 'Female', 'Unknown', 'Other'] ], validator=formencode.All( V.OneOfValidator(['Male', 'Female', 'Unknown', 'Other']), fev.UnicodeString(not_empty=True))), ew.SingleSelectField( name='country', label='Country of residence', validator=V.MapValidator(country_names, not_empty=False), options=[ ew.Option( py_value=" ", label=" -- Unknown -- ", selected=False) ] + [ ew.Option(py_value=c, label=n, selected=False) for c, n in sorted(country_names.items(), key=lambda (k, v): v) ], attrs={'onchange': 'selectTimezone(this.value)'}), ew.TextField(name='city', label='City of residence', attrs=dict(value=None), validator=fev.UnicodeString(not_empty=False)), ew.SingleSelectField( name='timezone', label='Timezone', attrs={'id': 'tz'}, validator=V.OneOfValidator(common_timezones, not_empty=False), options=[ew.Option(py_value=" ", label=" -- Unknown -- ")] + [ ew.Option(py_value=n, label=n) for n in sorted(common_timezones) ]) ] if asbool(tg.config.get('auth.allow_birth_date', True)): list_of_fields[1:1] = self.birth_date_fields return list_of_fields
class fields(ew_core.NameList): title = ew.TextField(validator=fev.UnicodeString( not_empty=True, messages={'empty': "You must provide a Title"}), attrs=dict(placeholder='Enter your title here', title='Enter your title here', style='width: 425px')) text = ffw.MarkdownEdit(show_label=False, attrs=dict( placeholder='Enter your content here', title='Enter your content here')) state = ew.SingleSelectField(options=[ ew.Option(py_value='draft', label='Draft'), ew.Option(py_value='published', label='Published') ]) labels = ffw.LabelEdit(placeholder='Add labels here', title='Add labels here')
def fields(self): return [ ew.SingleSelectField(name='grant', label='Award', options=self.award_options()), ffw.NeighborhoodProjectSelect(self._project_select_url, name='recipient'), ew.TextField(name='url', label='Award URL', validator=fev.URL()), ew.TextArea(name='comment', label='Comment', validator=fev.UnicodeString(not_empty=False), attrs={ 'rows': 5, 'cols': 30 }), ]
def fields(self): socialnetworks = aslist( tg.config.get('socialnetworks', ['Facebook', 'Linkedin', 'Twitter', 'Google+']), ',') return [ ew.SingleSelectField(name='socialnetwork', label='Social network', validator=fev.UnicodeString(not_empty=True), options=[ ew.Option(py_value=name, label=name) for name in socialnetworks ]), ew.TextField(name='accounturl', label='Account url', validator=fev.UnicodeString(not_empty=True)) ]
def resources(self): for r in ew.TextField(name='subject').resources(): yield r for r in ffw.MarkdownEdit(name='text').resources(): yield r yield ew.JSScript('''$(document).ready(function () { $("a.attachment_form_add_button").click(function(evt){ $(this).hide(); $(".attachment_form_fields", this.parentNode).show(); evt.preventDefault(); }); $("a.cancel_edit_post").click(function(evt){ $("textarea", this.parentNode).val($("input.original_value", this.parentNode).val()); $(".attachment_form_fields input", this.parentNode).val(''); evt.preventDefault(); }); });''')
class fields(ew_core.NameList): subject = ew.TextField(validator=fev.UnicodeString( not_empty=True, messages={'empty': "You must provide a Subject"}), attrs=dict( placeholder='Enter your subject here', title='Enter your subject here', style='width: 425px'), label='Subject') message = ew.TextArea(validator=fev.UnicodeString( not_empty=True, messages={'empty': "You must provide a Message"}), attrs=dict(placeholder='Enter your message here', title='Enter your message here', style='width: 425px; height:200px'), label='Message') cc = ew.Checkbox(label='Send me a copy')
class CustomFieldAdmin(ew.CompoundField): template = 'jinja:forgetracker:templates/tracker_widgets/custom_field_admin.html' def resources(self): for r in super(CustomFieldAdmin, self).resources(): yield r yield ew.JSLink('tracker_js/custom-fields.js') fields = [ ew.HiddenField(name='name'), ew.TextField(name='label'), ew.Checkbox(name='show_in_search', label='Show in list view', show_label=True, suppress_label=True), CustomFieldAdminDetail() ]
def fields(self): fields = [ ew.TextField(name='username', label='Username', attrs={ 'autofocus': 'autofocus', }), ew.PasswordField(name='password', label='Password'), ew.Checkbox( name='rememberme', label='Remember Me', attrs={'style': 'margin-left: 162px;'}), ew.HiddenField(name='return_to'), ] if plugin.AuthenticationProvider.get(request).forgotten_password_process: # only show link if auth provider has method of recovering password fields.append( ew.HTMLField( name='link', text='<a href="/auth/forgotten_password" style="margin-left:162px" target="_top">' 'Forgot password?</a>')) return fields