def fields(self): provider = plugin.ProjectRegistrationProvider.get() tools_options = [] for ep, tool in six.iteritems(g.entry_points["tool"]): if tool.status == 'production' and tool._installable(tool_name=ep, nbhd=c.project.neighborhood, project_tools=[]): tools_options.append(ew.Option(label=tool.tool_label, html_value=ep)) return ew_core.NameList([ ew.HiddenField(name='project_description', label='Public Description'), ew.HiddenField(name='neighborhood', label='Neighborhood'), ew.Checkbox(name='private_project', label="", attrs={'class': 'unlabeled'}), ew.InputField(name='project_name', label='Project Name', field_type='text', validator=formencode.All( V.UnicodeString(not_empty=True, max=40), V.MaxBytesValidator(max=40)), ), ew.InputField(name='project_unixname', label='Short Name', field_type='text', attrs={ 'title': 'Create a URL name that matches your project name as closely as possible to improve search indexing and maximize visibility.', 'class': 'tooltip' }, validator=provider.shortname_validator), ew.CheckboxSet(name='tools', options=tools_options), ])
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.ProjectUserSelect(name='assigned_to', label='Assigned To'), 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', 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)), ew.HiddenField(name='super_id', validator=fev.UnicodeString(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): project_description = ew.HiddenField(label='Public Description') neighborhood = ew.HiddenField(label='Neighborhood') private_project = ew.Checkbox(label="", attrs={'class': 'unlabeled'}) project_name = ew.InputField(label='Project Name', field_type='text', validator=formencode.All( fev.UnicodeString(not_empty=True, max=40), V.MaxBytesValidator(max=40))) project_unixname = ew.InputField( label='Short Name', field_type='text', validator=formencode.All( fev.String(not_empty=True), fev.MinLength(3), fev.MaxLength(15), fev.Regex( r'^[A-z][-A-z0-9]{2,}$', messages={ 'invalid': 'Please use only letters, numbers, and dashes 3-15 characters long.' }), NeighborhoodProjectTakenValidator())) tools = ew.CheckboxSet( name='tools', options=[ ## Required for Neighborhood functional tests to pass ew.Option(label='Wiki', html_value='wiki', selected=True) ])
def extra_fields(self): yield ew.HiddenField(name='timestamp', value=self.timestamp_text).display() yield ew.HiddenField(name='spinner', value=self.spinner_text).display() for fldno in range(self.num_honey): fld_name = self.enc('honey%d' % (fldno)) fld_id = self.enc('honey%d%d' % (self.counter, fldno)) yield literal(self.honey_field_template.substitute( honey_class=self.honey_class, fld_id=fld_id, fld_name=fld_name)) self.counter += 1
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()), ffw.FileChooser(name='icon', label='Icon'), ew.Checkbox(name="members_only", label="Developer Only"), ew.Checkbox(name="anon_posts", label="Allow Anonymous Posts") ] return fields
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
def fields(self): return [ ew.PasswordField( name='oldpw', label='Old Password', validator=V.UnicodeString(not_empty=True), attrs=dict( required=True, autocomplete='current-password', ), ), 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)), required=True, autocomplete='new-password', ), validator=V.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=V.UnicodeString(not_empty=True), attrs=dict( required=True, autocomplete='new-password', ), ), ew.HiddenField(name='return_to'), ]
class PostFilter(ff.ForgeForm): defaults = dict( ew.SimpleForm.defaults, submit_text=None, method='GET') fields = [ ew.HiddenField( name='page', validator=fev.Int()), ew.FieldSet(label='Post Filter', fields=[ ew.SingleSelectField( name='status', label='Show posts with status', options=[ ew.Option(py_value='-', label='Any'), ew.Option(py_value='spam', label='Spam'), ew.Option(py_value='pending', label='Pending moderation'), ew.Option(py_value='ok', label='Ok')], if_missing='pending'), ew.InputField(name='username', label='Show post filtered by username'), ew.SubmitButton(label='Filter Posts') ]) ]
class fields(ew_core.NameList): _id = ew.HiddenField(validator=V.Ming(M.Thread)) subscription = ew.Checkbox(suppress_label=True) subject = ffw.DisplayOnlyField(label='Topic') url = ffw.DisplayOnlyField() num_replies = ffw.DisplayOnlyField(label='Posts') num_views = ffw.DisplayOnlyField(label='Views') last_post = ffw.DisplayOnlyField(label='Last Post')
class fields(ew_core.NameList): _id = ew.HiddenField(validator=V.Ming(M.ForumThread)) subject = ffw.DisplayOnlyField(show_label=True, label='Subject') url = ffw.DisplayOnlyField() num_replies = ffw.DisplayOnlyField( show_label=True, label='Num Replies') num_views = ffw.DisplayOnlyField(show_label=True) flags = ffw.DisplayOnlyField(show_label=True) last_post = ffw.DisplayOnlyField(show_label=True)
class fields(ew_core.NameList): project_description = ew.HiddenField(label='Public Description') neighborhood = ew.HiddenField(label='Neighborhood') private_project = ew.Checkbox(label="", attrs={'class': 'unlabeled'}) project_name = ew.InputField(label='Project Name', field_type='text', validator=formencode.All( fev.UnicodeString(not_empty=True, max=40), V.MaxBytesValidator(max=40))) project_unixname = ew.InputField( label='Short Name', field_type='text', validator=None) # will be set in __init__ tools = ew.CheckboxSet( name='tools', options=[ ## Required for Neighborhood functional tests to pass ew.Option(label='Wiki', html_value='wiki', selected=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'})
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 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): return [ ew.PasswordField(name='oldpw', label='Old Password', validator=fev.UnicodeString(not_empty=True)), ew.PasswordField( name='pw', label='New Password', 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)), ew.HiddenField(name='return_to'), ]
class fields(ew_core.NameList): selected_skill = ew.HiddenField( attrs={'value': ''}, show_errors=False, validator=V.UnicodeString(not_empty=True)) level = ew.SingleSelectField( label="Level of knowledge", options=[ ew.Option(py_value="low", label="Low level"), ew.Option(py_value="medium", label="Medium level"), ew.Option(py_value="high", label="Advanced level")], validator=formencode.All( V.OneOfValidator(['low', 'medium', 'high']), V.UnicodeString(not_empty=True))) comment = ew.TextArea( label="Additional comments", validator=V.UnicodeString(not_empty=False), attrs={'rows': 5, 'cols': 30})
def display(self, **kw): cat = kw.get('category') self.fields = [ ew.RowField(show_errors=False, show_label=False, fields=[ ew.LinkField(text=cat.fullname, href="/categories/%s" % cat.trove_cat_id), ew.SubmitButton(show_errors=False, attrs={'value': 'Remove'}) ], hidden_fields=[ ew.HiddenField(name='categoryid', attrs={'value': cat.trove_cat_id}) ]) ] return super(ForgeForm, self).display(**kw)
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
class MilestonesAdmin(ffw.SortableTable): defaults = dict( ffw.SortableTable.defaults, button=ffw.AdminField(field=ew.InputField( css_class='add', field_type='button', value='New Milestone')), empty_msg='No milestones have been created.', nonempty_msg='Drag and drop the milestones to reorder.', repetitions=0) fields = [ ew.HiddenField(name='old_name'), ffw.Radio(name='default', label='Default', css_class='default-milestone'), ew.Checkbox(name='complete', show_label=True, suppress_label=True), ew.TextField(name='name', attrs={'style': 'width: 80px'}), ffw.DateField(name='due_date', attrs={'style': 'width: 80px'}), ffw.AutoResizeTextarea(name='description', attrs={'style': 'height:1em; width: 150px'}), ew.InputField(label='Delete', field_type='button', attrs={ 'class': 'delete', 'value': 'Delete' }), ] button = ew.InputField(css_class='add', field_type='button', value='New Milestone') def prepare_context(self, context): response = super(MilestonesAdmin, self).prepare_context(context) if 'value' in response: for milestone_data in response['value']: if 'name' in milestone_data: milestone_data['old_name'] = milestone_data['name'] return response def resources(self): for r in super(MilestonesAdmin, self).resources(): yield r yield ew.CSSScript('''div.state-field table{ width: 700px; }''')
def display(self, **kw): skill = kw.get('skill') comment = skill['comment'] if not comment: comment = " " self.fields = [ ew.RowField(show_errors=False, hidden_fields=[ ew.HiddenField( name="categoryid", attrs={'value': skill['skill'].trove_cat_id}, show_errors=False) ], fields=[ ffw.DisplayOnlyField(text=skill['skill'].fullpath), ffw.DisplayOnlyField(text=skill['level']), ffw.DisplayOnlyField(text=comment), ew.SubmitButton(show_label=False, attrs={'value': 'Remove'}, show_errors=False) ]) ] return super(ForgeForm, self).display(**kw)
class hidden_fields(ew_core.NameList): subscription_id = ew.HiddenField(validator=V.Ming(M.Mailbox)) tool_id = ew.HiddenField() project_id = ew.HiddenField() topic = ew.HiddenField() artifact_index_id = ew.HiddenField()
class hidden_fields(ew_core.NameList): _id = ew.HiddenField( validator=V.Ming(M.ProjectRole))
class fields(ew_core.NameList): follow = ew.HiddenField(validator=fev.StringBool())
class hidden_fields(ew_core.NameList): return_to = ew.HiddenField()
def hidden_fields(self): f = super(GroupSettings, self).hidden_fields f.append(ew.HiddenField(name='_id', validator=V.Ming(M.ProjectRole))) return f
class fields(ew_core.NameList): uppercategory_id = ew.HiddenField(attrs={'value': ''}, show_errors=False) categoryname = ew.TextField( label="Category name", validator=fev.UnicodeString(not_empty=True))
class fields(ew_core.NameList): _id = ew.HiddenField(validator=V.Ming(M.ForumThread)) num_topics = ffw.DisplayOnlyField(show_label=True, label='Topics') num_posts = ffw.DisplayOnlyField(show_label=True, label='Posts') last_post = ffw.DisplayOnlyField(show_label=True) subscribed = ew.Checkbox(suppress_label=True, show_label=True)
class fields(ew_core.NameList): subscribe = SubmitButton() unsubscribe = SubmitButton() shortname = ew.HiddenField()
def hidden_fields(self): return [ew.HiddenField(name='_session_id')]
class hidden_fields(ew.NameList): _id = jinja2_ew.HiddenField(validator=V.Ming(model.Bin), if_missing=None)