class ISendToForm(Interface): """ Interface for describing the 'sendto' form """ send_to_address = Email( title=_('label_send_to_mail', default='Send to'), description=_('help_send_to_mail', default='The e-mail address to send this link to.'), required=True ) send_from_address = Email( title=_('label_send_from', default='From'), description=_('help_send_from', default='Your email address.'), required=True ) comment = schema.Text( title=_('label_comment', default='Comment'), description=_('help_comment_to_link', default='A comment about this link.'), required=False )
class IEmail(Interface): """ Email """ sender = Email( title=_(u"From"), required=True, ) receiver = schema.Set( title=u'Recipients', value_type=schema.Choice( vocabulary='eea.meeting.vocabularies.RecipientsVocabulary')) cc = schema.Text( title=_(u"CC"), description=_(u'Add CC addresses one per line, no separator'), constraint=cc_constraint, required=False, ) subject = schema.TextLine( title=_(u"Subject"), required=True, ) body = RichText( title=_(u"Body"), required=True, output_mime_type='text/plain', allowed_mime_types=('text/html', 'text/structured', 'text/plain'), ) directives.widget('sender', TextFieldWidget, klass=u'mail_widget')
class IContactForm(Interface): """ Interface for describing the contact info form """ sender_fullname = schema.TextLine( title=_('label_sender_fullname', default='Name'), description=_('help_sender_fullname', default='Please enter your full name.'), required=True ) sender_from_address = Email( title=_('label_sender_from_address', default='From'), description=_('help_sender_from_address', default='Please enter your e-mail address.'), required=True ) subject = schema.TextLine( title=_('label_subject', default='Subject'), required=True ) message = schema.Text( title=_('label_message', default='Message'), description=_('help_message', default='Please enter the message you want to send.'), required=False )
class IBoosterClubsFolder(form.Schema): """ Uses IDublinCore """ executive_secretary_email = Email( title=_(u"Executive Secretary Email"), description=_(u"Email address of the Executive Secretary"), required=True, ) absence_notice = schema.Text( title=_(u"Absence Notice"), description=_(u"Text of email to be sent to absent booster club officers. " u"This is a multi line field and line breaks will be recognized. " u"The salutation should not be part of this message."), required=True, defaultFactory=getAbsenceDefaultText, ) training_absence_notice = schema.Text( title=_(u"Training Absence Notice"), description=_(u"Text of email to be sent to absent booster members who did not attend the scheduled training. " u"This is a multi line field and line breaks will be recognized. " u"The salutation should not be part of this message."), required=True, defaultFactory=getTrainingAbsenceDefaultText, ) agreement_file = NamedBlobFile( title=_(u"Agreement File"), description=_(u"This file is to be downloaded by club for the approval process."), required=False, )
class IPerson(model.Schema): """ Marker interface and Dexterity Python Schema for Person """ # bio = RichTextField(title=_(u'Bio'), description=u'', required=False) # directives.widget('bio', RichTextFieldWidget) title = schema.TextLine(title=_('Name'), description=u'', required=True) bio = schema.Text( title=_('Bio'), description=u'Tell us some informations about you.', required=True, ) twitter = schema.TextLine( title=_('Twitter account'), description=_(u'Insert your Twitter account name.'), required=False, ) github = schema.TextLine( title=_('Github account'), description=_(u'Insert your Github account name.'), required=False, ) email = Email( title=_('Email'), description=_(u'Insert your email.'), required=False )
class ISpeaker(model.Schema): directives.mode(oid='hidden') oid = schema.TextLine(title=u"UUID", default=u'{}'.format(uuid.uuid4().hex)) first_name = schema.TextLine(title=_(u"First Name")) last_name = schema.TextLine(title=_(u"Last Name"), ) email = Email(title=_(u'label_email', default=u'Email'), description=_(u'help_email', default=u''), required=False) profession = schema.TextLine( title=_(u"Profession"), required=False, ) description = schema.Text( title=_(u"Biography"), required=False, ) website = schema.URI(title=_(u'label_website', default=u'Website'), description=_(u'help_website', default=u''), required=False) directives.widget('website', LinkWidget) phone = schema.TextLine(title=_(u'label_phone', default=u'Phone'), description=_(u'help_phone', default=u''), required=False) picture = schema.ASCII( title=_(u"Please upload an image"), required=False, ) directives.widget('picture', NamedImageFieldWidget)
class IOrganization(model.Schema): TaxNumber = schema.TextLine(title=_(u'VAT Number'), required=False) fieldset('address', label=_(u'Address'), fields=['EmailAddress', 'PhysicalAddress', 'PostalAddress']) EmailAddress = Email(title=_(u'Email Address'), required=False) PhysicalAddress = schema.Object(title=_(u'Physical Address'), required=False, schema=IAddress) PostalAddress = schema.Object(title=_(u'Postal Address'), required=False, schema=IAddress)
class IOrganization(model.Schema): TaxNumber = schema.TextLine(title=_(u'VAT Number'), required=False) directives.fieldset('address', label=_(u'Address'), fields=[ 'EmailAddress', 'PhysicalAddress', 'PostalAddress', 'BillingAddress' ]) EmailAddress = Email(title=_(u'Email Address'), required=False) PhysicalAddress = schema.Object(title=_(u'Physical Address'), required=False, schema=IAddress) PostalAddress = schema.Object(title=_(u'Postal Address'), required=False, schema=IAddress) BillingAddress = schema.Object(title=_(u'Billing Address'), required=False, schema=IAddress) directives.fieldset( 'bank', label=_(u'Bank Details'), fields=('AccountType', 'AccountName', 'AccountNumber', 'BankName', 'BankBranch'), ) AccountType = schema.TextLine( title=_(u"Account Type"), required=False, ) AccountName = schema.TextLine( title=_(u"Account Name"), required=False, ) AccountNumber = schema.TextLine( title=_(u"Account Number"), required=False, ) BankName = schema.TextLine( title=_(u"Bank Name"), required=False, ) BankBranch = schema.TextLine( title=_(u"Bank Branch"), required=False, )
class ISponsor(model.Schema): directives.mode(oid='hidden') oid = schema.TextLine(title=u"UUID", default=u'{}'.format(uuid.uuid4().hex)) name = schema.TextLine(title=_(u"Name")) email = Email(title=_(u'label_email', default=u'Email'), description=_(u'help_email', default=u''), required=False) website = schema.URI(title=_(u'label_website', default=u'Website'), description=_(u'help_website', default=u''), required=False) picture = schema.ASCII( title=_(u"Please upload an image"), required=False, ) directives.widget('picture', NamedImageFieldWidget)
class IRegisterFormSchema(Interface): """ Register form schema """ username = schema.TextLine( title=_(u'label_username', default=u'Username'), required=True, ) email = Email( title=_(u'label_email', default=u'Email'), required=True, ) password = schema.Password( title=_(u'label_password', default=u'Password'), required=True, ) password_confirm = schema.Password( title=_(u'label_password_confirm', default=u'Confirm password'), required=True, ) @invariant def ensureUsernameUnique(obj): site = api.portal.get() registration = getToolByName(site, 'portal_registration') if not registration.isMemberIdAllowed(obj.username): raise WidgetActionExecutionError( 'username', Invalid( _(u'error_username_alread_taken_or_invalid', default=u'Your ' u'username is already in use or invalid.'))) @invariant def ensureValidPassword(obj): if obj.password != obj.password_confirm: raise WidgetActionExecutionError( 'password', Invalid( _(u'error_password_and_confirm_not_match', default=u'Password ' u'and Confirm password do not match.')))
class IEmail(Interface): """ Email """ sender = Email( title=_(u"From"), required=True, ) receiver = schema.Set( title=u'Recipients', missing_value=set(), value_type=schema.Choice( vocabulary='eea.meeting.vocabularies.RecipientsVocabulary', required=True, ), required=True, ) cc = schema.List( title=_(u"CC"), description=_(u'Add CC addresses one per line, no separator'), value_type=schema.TextLine(), constraint=cc_constraint, required=False, ) subject = schema.TextLine( title=_(u"Subject"), required=True, ) body = schema.Text( title=_(u"Body"), required=True, ) email_type = schema.TextLine( title=_(u"Email type"), required=False, ) directives.widget('sender', TextFieldWidget, klass=u'mail_widget')
def test_email(self): field = Email( title=u"Email", description=u"Email field", default="*****@*****.**", min_length=10, max_length=20, ) adapter = getMultiAdapter( (field, self.portal, self.request), IJsonSchemaProvider ) self.assertEqual( { "type": "string", "title": "Email", "description": "Email field", "widget": "email", "default": "*****@*****.**", "minLength": 10, "maxLength": 20, }, adapter.get_schema(), )
class IMailer(IAction): """A form action adapter that will e-mail form input.""" # default_method='getDefaultRecipientName', directives.write_permission( recipient_name=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_name=MODIFY_PORTAL_CONTENT) recipient_name = zope.schema.TextLine( title=_(u'label_formmailer_recipient_fullname', default=u"Recipient's full name"), description=_( u'help_formmailer_recipient_fullname', default=u'The full name of the recipient of the mailed form.'), default=u'', missing_value=u'', required=False, ) # default_method='getDefaultRecipient', # validators=('isEmail',), # TODO defaultFactory # TODO IContextAwareDefaultFactory directives.write_permission( recipient_email=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_email=MODIFY_PORTAL_CONTENT) recipient_email = Email( title=_(u'label_formmailer_recipient_email', default=u"Recipient's e-mail address"), description=_(u'help_formmailer_recipient_email', default=u'The recipients e-mail address.'), required=False, ) fieldset(u'addressing', label=_('Addressing'), fields=[ 'to_field', 'cc_recipients', 'bcc_recipients', 'replyto_field' ]) directives.write_permission(to_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(to_field=MODIFY_PORTAL_CONTENT) to_field = zope.schema.Choice( title=_(u'label_formmailer_to_extract', default=u'Extract Recipient From'), description=_( u'help_formmailer_to_extract', default=u'Choose a form field from which you wish to extract ' u'input for the To header. If you choose anything other ' u'than "None", this will override the "Recipient\'s " ' u'e-mail address setting above. Be very cautious about ' u'allowing unguarded user input for this purpose.'), required=False, vocabulary=vocabularies.fieldsFactory, ) # default_method='getDefaultCC', directives.write_permission( cc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(cc_recipients=MODIFY_PORTAL_CONTENT) cc_recipients = zope.schema.Text( title=_(u'label_formmailer_cc_recipients', default=u'CC Recipients'), description=_( u'help_formmailer_cc_recipients', default=u'E-mail addresses which receive a carbon copy.'), default=u'', missing_value=u'', required=False, ) # default_method='getDefaultBCC', directives.write_permission( bcc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(bcc_recipients=MODIFY_PORTAL_CONTENT) bcc_recipients = zope.schema.Text( title=_(u'label_formmailer_bcc_recipients', default=u'BCC Recipients'), description=_( u'help_formmailer_bcc_recipients', default=u'E-mail addresses which receive a blind carbon copy.'), default=u'', missing_value=u'', required=False, ) directives.write_permission(replyto_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(replyto_field=MODIFY_PORTAL_CONTENT) replyto_field = zope.schema.Choice( title=_(u'label_formmailer_replyto_extract', default=u'Extract Reply-To From'), description=_( u'help_formmailer_replyto_extract', default=u'Choose a form field from which you wish to extract ' u'input for the Reply-To header. NOTE: You should ' u'activate e-mail address verification for the ' u'designated field.'), required=False, vocabulary=vocabularies.fieldsFactory, ) fieldset(u'message', label=PMF('Message'), fields=[ 'msg_subject', 'subject_field', 'body_pre', 'body_post', 'body_footer', 'showAll', 'showFields', 'includeEmpties' ]) directives.read_permission(msg_subject=MODIFY_PORTAL_CONTENT) msg_subject = zope.schema.TextLine( title=_(u'label_formmailer_subject', default=u'Subject'), description=_(u'help_formmailer_subject', default=u'' u'Subject line of message. This is used if you ' u'do not specify a subject field or if the field ' u'is empty.'), default=u'Form Submission', missing_value=u'', required=False, ) directives.write_permission(subject_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(subject_field=MODIFY_PORTAL_CONTENT) subject_field = zope.schema.Choice( title=_(u'label_formmailer_subject_extract', default=u'Extract Subject From'), description=_(u'help_formmailer_subject_extract', default=u'' u'Choose a form field from which you wish to extract ' u'input for the mail subject line.'), required=False, vocabulary=vocabularies.fieldsFactory, ) # accessor='getBody_pre', directives.read_permission(body_pre=MODIFY_PORTAL_CONTENT) directives.widget('body_pre', TextAreaWidget) body_pre = RichText( title=_(u'label_formmailer_body_pre', default=u'Body (prepended)'), description=_(u'help_formmailer_body_pre', default=u'Text prepended to fields listed in mail-body'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(body_post=MODIFY_PORTAL_CONTENT) directives.widget('body_post', TextAreaWidget) body_post = RichText( title=_(u'label_formmailer_body_post', default=u'Body (appended)'), description=_(u'help_formmailer_body_post', default=u'Text appended to fields listed in mail-body'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(body_footer=MODIFY_PORTAL_CONTENT) directives.widget('body_footer', TextAreaWidget) body_footer = RichText( title=_(u'label_formmailer_body_footer', default=u'Body (signature)'), description=_(u'help_formmailer_body_footer', default=u'Text used as the footer at ' u'bottom, delimited from the body by a dashed line.'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(showAll=MODIFY_PORTAL_CONTENT) showAll = zope.schema.Bool( title=_(u'label_mailallfields_text', default=u'Include All Fields'), description=_(u'help_mailallfields_text', default=u'' u'Check this to include input for all fields ' u'(except label and file fields). If you check ' u'this, the choices in the pick box below ' u'will be ignored.'), default=True, required=False, ) directives.read_permission(showFields=MODIFY_PORTAL_CONTENT) showFields = zope.schema.List( title=_(u'label_mailfields_text', default=u'Show Responses'), description=_( u'help_mailfields_text', default=u'Pick the fields whose inputs you\'d like to include in ' u'the e-mail.'), unique=True, required=False, value_type=zope.schema.Choice(vocabulary=vocabularies.fieldsFactory), ) directives.read_permission(includeEmpties=MODIFY_PORTAL_CONTENT) includeEmpties = zope.schema.Bool( title=_(u'label_mailEmpties_text', default=u'Include Empties'), description=_(u'help_mailEmpties_text', default=u'' u'Check this to include titles ' u'for fields that received no input. Uncheck ' u'to leave fields with no input out of the e-mail.'), default=True, required=False, ) fieldset(u'template', label=PMF('Template'), fields=['body_pt', 'body_type']) # ZPTField('body_pt', # default_method='getMailBodyDefault', # validators=('zptvalidator',), directives.write_permission(body_pt=config.EDIT_TALES_PERMISSION) directives.read_permission(body_pt=MODIFY_PORTAL_CONTENT) body_pt = zope.schema.Text( title=_(u'label_formmailer_body_pt', default=u'Mail-Body Template'), description=_( u'help_formmailer_body_pt', default=u'This is a Zope Page Template used for rendering of ' u'the mail-body. You don\'t need to modify it, but if you ' u'know TAL (Zope\'s Template Attribute Language) have ' u'the full power to customize your outgoing mails.'), default=config.MAIL_BODY_DEFAULT, missing_value=u'', ) # default_method='getMailBodyTypeDefault', directives.write_permission(body_type=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(body_type=MODIFY_PORTAL_CONTENT) body_type = zope.schema.Choice( title=_(u'label_formmailer_body_type', default=u'Mail Format'), description=_( u'help_formmailer_body_type', default=u'Set the mime-type of the mail-body. Change this ' u'setting only if you know exactly what you are doing. ' u'Leave it blank for default behaviour.'), default=u'html', vocabulary=vocabularies.MIME_LIST, ) fieldset(u'headers', label=_('Headers'), fields=['xinfo_headers', 'additional_headers']) directives.widget(xinfo_headers=CheckBoxFieldWidget) # default_method='getDefaultXInfo', directives.write_permission(xinfo_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(xinfo_headers=MODIFY_PORTAL_CONTENT) xinfo_headers = zope.schema.List( title=_(u'label_xinfo_headers_text', default=u'HTTP Headers'), description=_(u'help_xinfo_headers_text', default=u'' u'Pick any items from the HTTP headers that ' u'you\'d like to insert as X- headers in the message.'), unique=True, required=False, default=[u'HTTP_X_FORWARDED_FOR', u'REMOTE_ADDR', u'PATH_INFO'], missing_value=[u'HTTP_X_FORWARDED_FOR', u'REMOTE_ADDR', u'PATH_INFO'], value_type=zope.schema.Choice(vocabulary=vocabularies.XINFO_HEADERS), ) # default_method='getDefaultAddHdrs', directives.write_permission( additional_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(additional_headers=MODIFY_PORTAL_CONTENT) additional_headers = zope.schema.List( title=_(u'label_formmailer_additional_headers', default=u'Additional Headers'), description=_(u'help_formmailer_additional_headers', default=u'Additional e-mail-header lines. Only use ' u'RFC822-compliant headers.'), unique=True, required=False, value_type=zope.schema.TextLine(title=_(u'extra_header', default=u'${name} Header', mapping={u'name': u'HTTP'}), ), ) # if gpg is not None: # formMailerAdapterSchema = formMailerAdapterSchema + Schema(( # StringField('gpg_keyid', # schemata='encryption', # accessor='getGPGKeyId', # mutator='setGPGKeyId', # write_permission=USE_ENCRYPTION_PERMISSION, # read_permission=ModifyPortalContent, # widget=StringWidget( # description=_(u'help_gpg_key_id', default=u""" # Give your key-id, e-mail address or # whatever works to match a public key from current # keyring. # It will be used to encrypt the message body (not # attachments). # Contact the site administrator if you need to # install a new public key. # Note that you will probably wish to change your # message # template to plain text if you're using encryption. # TEST THIS FEATURE BEFORE GOING PUBLIC! # """), # label=_(u'label_gpg_key_id', default=u'Key-Id'), # ), # ), # )) fieldset(u'overrides', label=_('Overrides'), fields=[ 'subjectOverride', 'senderOverride', 'recipientOverride', 'ccOverride', 'bccOverride' ]) directives.write_permission(subjectOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(subjectOverride=MODIFY_PORTAL_CONTENT) subjectOverride = zope.schema.TextLine( title=_(u'label_subject_override_text', default=u'Subject Expression'), description=_( u'help_subject_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the e-mail subject ' u'header. Leave empty if unneeded. Your expression ' u'should evaluate as a string. PLEASE NOTE: errors in ' u'the evaluation of this expression will cause an error ' u'on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(senderOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(senderOverride=MODIFY_PORTAL_CONTENT) senderOverride = zope.schema.TextLine( title=_(u'label_sender_override_text', default=u'Sender Expression'), description=_( u'help_sender_override_text', default=u'A TALES expression that will be evaluated to override ' u'the "From" header. Leave empty if unneeded. ' u'Your expression should evaluate as a string. ' u'PLEASE NOTE: errors in the evaluation of this ' u'expression will cause an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(recipientOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(recipientOverride=MODIFY_PORTAL_CONTENT) recipientOverride = zope.schema.TextLine( title=_(u'label_recipient_override_text', default=u'Recipient Expression'), description=_( u'help_recipient_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the recipient ' u'e-mail address. You are strongly cautioned against using' u'unvalidated data from the request for this purpose. ' u'Leave empty if unneeded. Your expression should ' u'evaluate as a string. PLEASE NOTE: errors in the ' u'evaluation of this expression will cause ' u'an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(ccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(ccOverride=MODIFY_PORTAL_CONTENT) ccOverride = zope.schema.TextLine( title=_(u'label_cc_override_text', default=u'CC Expression'), description=_( u'help_cc_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the CC list. You are ' u'strongly cautioned against using unvalidated data from ' u'the request for this purpose. Leave empty if unneeded. ' u'Your expression should evaluate as a sequence of ' u'strings. PLEASE NOTE: errors in the evaluation of this ' u'expression will cause an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(bccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(bccOverride=MODIFY_PORTAL_CONTENT) bccOverride = zope.schema.TextLine( title=_(u'label_bcc_override_text', default=u'BCC Expression'), description=_( u'help_bcc_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the BCC list. ' u'You are strongly cautioned against using ' u'unvalidated data from the request for this purpose. ' u'Leave empty if unneeded. Your expression should ' u'evaluate as a sequence of strings. PLEASE NOTE: errors ' u'in the evaluation of this expression will cause ' u'an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, )
class IHOANeighborhood(form.Schema): """Uses IDublinCore """ street_addresses = schema.List( title=_(u"Street Addresses"), description=_( u"Please provide a list of street addresses for this neighborhood." ), value_type=schema.TextLine(), ) city = schema.TextLine( title=_(u"City"), description= _(u"Please provide the city to be used with addresses in this neighborhood." )) state = schema.TextLine( title=_(u"State Abbreviation"), description= _(u"Please provide the state abbreviation to be used with addresses in this neighborhood." )) zipcode = schema.TextLine( title=_(u"Zipcode"), description=_(u"Which zipcode does this neighborhood use?")) secretary_email = Email( title=_(u"Executive Secretary Email"), description=_(u"Email address of the Executive Secretary"), required=True, ) fieldset('initial_messages', label=u'Initial Inspection Messages', description=u'', fields=[ 'initial_pass_message', 'initial_fail_message', ]) initial_pass_message = schema.Text( title=_(u"Initial Passed Inspection Message"), description= _(u"This message is used for both email and postal messages to be sent." ), required=False, ) initial_fail_message = schema.Text( title=_(u"Initial Fail Inspection Message"), description= _(u"This message is used for both email and postal messages to be sent." ), required=False, ) fieldset('rewalk_messages', label=u'Re-walk Inspection Messages', description=u'', fields=[ 'rewalk_pass_message', 'rewalk_fail_message', ]) rewalk_pass_message = schema.Text( title=_(u"Reinspect Passed Inspection Message"), description= _(u"This message is used for both email and postal messages to be sent." ), required=False, ) rewalk_fail_message = schema.Text( title=_(u"Reinspect Fail Message"), description= _(u"This message is used for both email and postal messages to be sent." ), required=False, )
class IActorBehavior(model.Schema): """ Add actor behavior""" first_name = schema.TextLine(title=_("Fornavn", default=u"Fornavn"), ) last_name = schema.TextLine( title=_("Etternavn", default=u"Etternavn"), required=True, ) image = namedfile.NamedBlobImage( title=_("profile_image", default=u"Profil image"), required=True, ) sex = schema.List(title=_("sex", default=u"Kjønne etc."), value_type=schema.Choice(title=_("sex etc", default=u"Kjønn etc"), vocabulary=SexVocabulary)) phone = schema.TextLine( title=_("phone", default=u"Telefon"), required=False, ) email = Email( title=_("email", default=u"E-post"), required=False, ) born = schema.Date(title=_("born", default=u"Fødselsdato"), ) adresse = schema.Text( title=_("Adresse", default=u"Adresse"), required=False, ) eye_color = schema.Choice(title=_("eye_color", default=u"Øyefarge"), required=True, vocabulary='medialog.casting.EyeColorVocabulary') hair_color = schema.Choice( title=_("hair_color", default=u"Hår farge"), required=True, vocabulary='medialog.casting.HairColorVocabulary') etnisitet = schema.List( title=_("Etnisitet", default=u"Etnisitet"), value_type=schema.Choice( title=_("Etnisitet", default=u"Etnisitet"), required=False, vocabulary='medialog.casting.EtnisitetVocabulary')) languages = schema.List( title=_("Languages", default=u"Languages"), value_type=schema.Choice( title=_("Language", default=u"Language"), required=False, vocabulary='medialog.casting.LanguageVocabulary')) dialekt = schema.TextLine( title=_("Dialekt", default=u"Dialekt"), required=False, ) height = schema.Int(title=_("height", default=u"Høyde i cm"), min=40, max=240) weight = schema.Int(title=_("Vekt", default=u"Vekt i kilo"), min=25, max=180) driving_licence = schema.List( title=_("driver_lincence", default=u"Førerkort"), value_type=schema.Choice( title=u'Lisenstype', vocabulary='medialog.casting.DriverLicenceVocabulary'), required=False, ) erfaring = schema.List( title=_("Erfaring", default=u"Erfaring"), description=_("En pr linje", default=u"En erfaring pr linje"), value_type=schema.TextLine( title=u'Erfaring', required=False, ), required=False, ) shoe_size = schema.TextLine( title=_("shoe_size", default=u"Skostørrelse"), required=False, ) jacket_size = schema.TextLine( title=_("jacket_size", default=u"Jakkestørrelse"), required=False, ) trousers_size = schema.TextLine( title=_("trousers_size", default=u"Buksestørrelse"), required=False, ) cv = namedfile.NamedFile( title=_("cv", default=u"CV (fil)"), required=False, ) video = schema.URI( title=_("video", default=u"Video link"), required=False, ) relatedItems = RelationList( title=_(u'label_related_items', default=u'Prosjekter'), default=[], value_type=RelationChoice( title=u'Prosjekter', source=CatalogSource(portal_type=['prosjekt', 'Prosjekt']), ), required=False, ) directives.widget('relatedItems', RelatedItemsFieldWidget, pattern_options={ 'basePath': '/', "mode": "auto", "favorites": [] })
class IExample(model.Schema): """Dexterity-Schema with all field-types.""" # The most used fields # textline, text, bool, richtext, email fieldset( "numberfields", label=u"Number fields", fields=("int_field", "float_field"), ) fieldset( "datetimefields", label=u"Date and time fields", fields=( "datetime_field", "date_field", "time_field", "timedelta_field", ), ) fieldset( "choicefields", label=u"Choice and Multiple Choice fields", fields=( "choice_field", "choice_field_radio", "choice_field_select", "choice_field_voc", "list_field", "list_field_checkbox", "list_field_select", "list_field_voc_unconstrained", "tuple_field", "set_field", "set_field_checkbox", ), ) fieldset( "relationfields", label=u"Relation fields", fields=( "relationchoice_field", "relationlist_field", "relationchoice_field_constrained", "relationlist_field_constrained", "relationlist_field_search_mode", "relationchoice_field_select", "relationchoice_field_radio", "relationlist_field_select", "relationlist_field_checkbox", "relationchoice_field_ajax_select", "relationlist_field_ajax_select", ), ) fieldset( "uuidrelationfields", label=u"Relation widgets with uuids", fields=( "uuid_choice_field", "uuid_list_field", "uuid_choice_field_constrained", "uuid_list_field_constrained", "uuid_list_field_search_mode", "uuid_choice_field_select", "uuid_choice_field_radio", "uuid_list_field_select", "uuid_list_field_checkbox", "uuid_choice_field_ajax_select", "uuid_list_field_ajax_select", ), ) fieldset( "filefields", label=u"File fields", fields=("file_field", "image_field"), ) fieldset( "otherfields", label=u"Other fields", fields=( "uri_field", "sourcetext_field", "ascii_field", "bytesline_field", "asciiline_field", "pythonidentifier_field", "dottedname_field", # 'dict_field', # "vocabularyterms_field", # "vocabularytermstranslation_field", # 'dict_field_with_choice', ), ) fieldset( "datagrid", label=u"Datagrid field", fields=("datagrid_field", ), ) primary("title") title = schema.TextLine( title=u"Primary Field (Textline)", description=u"zope.schema.TextLine", required=True, ) description = schema.TextLine( title=u"Description (Textline)", description=u"zope.schema.TextLine", required=False, ) text_field = schema.Text( title=u"Text Field", description=u"zope.schema.Text", required=False, missing_value=u"", ) textline_field = schema.TextLine( title=u"Textline field", description=u"A simple input field (schema.TextLine)", required=False, ) bool_field = schema.Bool( title=u"Boolean field", description=u"zope.schema.Bool", required=False, ) choice_field = schema.Choice( title=u"Choice field", description=u"zope.schema.Choice", values=[u"One", u"Two", u"Three"], required=True, ) directives.widget(choice_field_radio=RadioFieldWidget) choice_field_radio = schema.Choice( title=u"Choice field with radio boxes", description=u"zope.schema.Choice", values=[u"One", u"Two", u"Three"], required=False, ) choice_field_voc = schema.Choice( title=u"Choicefield with values from named vocabulary", description=u"zope.schema.Choice", vocabulary="plone.app.vocabularies.PortalTypes", required=False, ) directives.widget(choice_field_select=SelectFieldWidget) choice_field_select = schema.Choice( title=u"Choicefield with select2 widget", description=u"zope.schema.Choice", vocabulary="plone.app.vocabularies.PortalTypes", required=False, ) list_field = schema.List( title=u"List field", description=u"zope.schema.List", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value=[], ) directives.widget(list_field_checkbox=CheckBoxFieldWidget) list_field_checkbox = schema.List( title=u"List field with checkboxes", description=u"zope.schema.List", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value=[], ) directives.widget(list_field_select=SelectFieldWidget) list_field_select = schema.List( title=u"List field with select widget", description=u"zope.schema.List", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value=[], ) list_field_voc_unconstrained = schema.List( title= u"List field with values from vocabulary but not constrained to them.", description=u"zope.schema.List", value_type=schema.TextLine(), required=False, missing_value=[], ) directives.widget( "list_field_voc_unconstrained", AjaxSelectFieldWidget, vocabulary="plone.app.vocabularies.PortalTypes", pattern_options={ "closeOnSelect": False, # Select2 option to leave dropdown open for multiple selection }, ) tuple_field = schema.Tuple( title=u"Tuple field", description=u"zope.schema.Tuple", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value=(), ) set_field = schema.Set( title=u"Set field", description=u"zope.schema.Set", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value={}, ) directives.widget(set_field_checkbox=CheckBoxFieldWidget) set_field_checkbox = schema.Set( title=u"Set field with checkboxes", description=u"zope.schema.Set", value_type=schema.Choice( values=[u"Beginner", u"Advanced", u"Professional"], ), required=False, missing_value={}, ) # File fields image_field = NamedBlobImage( title=u"Image field", description= u"A upload field for images (plone.namedfile.field.NamedBlobImage)", required=False, ) file_field = NamedBlobFile( title=u"File field", description= u"A upload field for files (plone.namedfile.field.NamedBlobFile)", required=False, ) # Date and Time fields datetime_field = schema.Datetime( title=u"Datetime field", description=u"Uses a date and time picker (zope.schema.Datetime)", required=False, ) date_field = schema.Date( title=u"Date field", description=u"Uses a date picker (zope.schema.Date)", required=False, ) time_field = schema.Time( title=u"Time field", description=u"zope.schema.Time", required=False, ) timedelta_field = schema.Timedelta( title=u"Timedelta field", description=u"zope.schema.Timedelta", required=False, ) # Relation Fields relationchoice_field = RelationChoice( title=u"Relationchoice field", description=u"z3c.relationfield.schema.RelationChoice", vocabulary="plone.app.vocabularies.Catalog", required=False, ) relationlist_field = RelationList( title=u"Relationlist Field", description=u"z3c.relationfield.schema.RelationList", default=[], value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), required=False, missing_value=[], ) relationchoice_field_constrained = RelationChoice( title=u"Relationchoice field (only allows Documents)", description=u"z3c.relationfield.schema.RelationChoice", vocabulary="plone.app.vocabularies.Catalog", required=False, ) directives.widget( "relationchoice_field_constrained", RelatedItemsFieldWidget, pattern_options={"selectableTypes": ["Document"]}, ) relationlist_field_constrained = RelationList( title=u"Relationlist Field (only allows Documents and Events)", description=u"z3c.relationfield.schema.RelationList", default=[], value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"), required=False, missing_value=[], ) directives.widget( "relationlist_field_constrained", RelatedItemsFieldWidget, pattern_options={"selectableTypes": ["Document", "Event"]}, ) relationlist_field_search_mode = RelationList( title= u"Relationlist Field in Search Mode (constrained to published Documents and Events)", description=u"z3c.relationfield.schema.RelationList", default=[], value_type=RelationChoice(source=CatalogSource( portal_type=["Document", "Event"], review_state="published")), required=False, missing_value=[], ) directives.widget( "relationlist_field_search_mode", RelatedItemsFieldWidget, pattern_options={ "baseCriteria": [ # This is a optimization that limits the catalog-query { "i": "portal_type", "o": "plone.app.querystring.operation.selection.any", "v": ["Document", "Event"], }, { "i": "review_state", "o": "plone.app.querystring.operation.selection.any", "v": "published", }, ], "mode": "search", }, ) # From here on we use other widgets than the default RelatedItemsFieldWidget # This one also works in Volto! # All other options use the default ObjectWidget in Volto so far. relationchoice_field_select = RelationChoice( title=u"RelationChoice with Select Widget", vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], "review_state": "published", }), required=False, ) directives.widget( "relationchoice_field_select", SelectFieldWidget, ) relationchoice_field_radio = RelationChoice( title= u"RelationChoice with Radio Widget (and customized title-template)", vocabulary=StaticCatalogVocabulary( { "portal_type": ["Document", "Event"], "review_state": "published", }, title_template="{brain.Title}", ), # Set a custom vocabulary item title required=False, ) directives.widget( "relationchoice_field_radio", RadioFieldWidget, ) relationlist_field_select = RelationList( title= u"RelationList with select widget with items from a named vocabulary", value_type=RelationChoice( vocabulary="example.vocabularies.documents", ), required=False, ) directives.widget( "relationlist_field_select", SelectFieldWidget, pattern_options={ "closeOnSelect": False, # Select2 option to leave dropdown open for multiple selection }, ) relationlist_field_checkbox = RelationList( title=u"RelationList with Checkboxes", value_type=RelationChoice( vocabulary="example.vocabularies.documents", ), required=False, ) directives.widget( "relationlist_field_checkbox", CheckBoxFieldWidget, ) relationchoice_field_ajax_select = RelationChoice( title=u"Relationchoice Field with AJAXSelect", description=u"z3c.relationfield.schema.RelationChoice", vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], }), required=False, ) directives.widget( "relationchoice_field_ajax_select", AjaxSelectFieldWidget, vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], }), pattern_options={ # Options for Select2 "minimumInputLength": 2, # - Don't query until at least two characters have been typed "ajax": { "quietMillis": 500 }, # - Wait 500ms after typing to make query }, ) relationlist_field_ajax_select = RelationList( title=u"Relationlist Field with AJAXSelect", description=u"z3c.relationfield.schema.RelationList", value_type=RelationChoice(vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], "review_state": "published", })), required=False, ) directives.widget( "relationlist_field_ajax_select", AjaxSelectFieldWidget, vocabulary=StaticCatalogVocabulary( { "portal_type": ["Document", "Event", "Folder"], }, title_template="{brain.Type}: {brain.Title} at {path}", ), # Custom item rendering pattern_options={ # Options for Select2 "minimumInputLength": 2, # - Don't query until at least two characters have been typed "ajax": { "quietMillis": 500 }, # - Wait 500ms after typing to make query }, ) # These look like relationsfields (see above) but only store the uuid(s) of the selected target # as a string in a the field instead of a RelationValue. # A good way to use these is in combination with a index that allows you to query these connenctions. uuid_choice_field = schema.Choice( title=u"Choice field with RelatedItems widget storing uuids", description=u"schema.Choice", vocabulary="plone.app.vocabularies.Catalog", required=False, ) directives.widget("uuid_choice_field", RelatedItemsFieldWidget) uuid_list_field = schema.List( title=u"List Field with RelatedItems widget storing uuids", description=u"schema.List", default=[], value_type=schema.Choice(vocabulary="plone.app.vocabularies.Catalog"), required=False, missing_value=[], ) directives.widget("uuid_list_field", RelatedItemsFieldWidget) uuid_choice_field_constrained = schema.Choice( title= u"Choice field with RelatedItems widget storing uuids (only allows Documents)", description=u"schema.Choice", vocabulary="plone.app.vocabularies.Catalog", required=False, ) directives.widget( "uuid_choice_field_constrained", RelatedItemsFieldWidget, pattern_options={"selectableTypes": ["Document"]}, ) uuid_list_field_constrained = schema.List( title= u"List Field with RelatedItems widget storing uuids (only allows Documents and Events)", description=u"schema.List", default=[], value_type=schema.Choice(vocabulary="plone.app.vocabularies.Catalog"), required=False, missing_value=[], ) directives.widget( "uuid_list_field_constrained", RelatedItemsFieldWidget, pattern_options={"selectableTypes": ["Document", "Folder"]}, ) uuid_list_field_search_mode = schema.List( title= u"List Field with RelatedItems widget in Search Mode storing uuids", description=u"schema.List", default=[], value_type=schema.Choice(source=CatalogSource( portal_type=["Document", "Event"], review_state="published")), required=False, missing_value=[], ) directives.widget( "uuid_list_field_search_mode", RelatedItemsFieldWidget, pattern_options={ "selectableTypes": ["Document", "Folder"], "basePath": "", # Start the search at the portal root "mode": "search", }, ) # From here on we use other widgets than the default RelatedItemsFieldWidget uuid_choice_field_select = schema.Choice( title=u"UUID Choice with select widget storing uuids", vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], "review_state": "published", }), required=False, ) directives.widget( "uuid_choice_field_select", SelectFieldWidget, ) uuid_choice_field_radio = schema.Choice( title=u"RelationChoice with Radio widget storing uuids", vocabulary=StaticCatalogVocabulary( { "portal_type": ["Document", "Event"], "review_state": "published", }, title_template="{brain.Title}", ), # Set a custom vocabulary item title required=False, ) directives.widget( "uuid_choice_field_radio", RadioFieldWidget, ) uuid_list_field_select = schema.List( title= u"RelationList with select widget with items from a named vocabulary storing uuids", value_type=schema.Choice( vocabulary="example.vocabularies.documents", ), required=False, ) directives.widget( "uuid_list_field_select", SelectFieldWidget, pattern_options={ "closeOnSelect": False, # Select2 option to leave dropdown open for multiple selection }, ) uuid_list_field_checkbox = schema.List( title=u"RelationList with Checkboxes storing uuids", value_type=schema.Choice( vocabulary="example.vocabularies.documents", ), required=False, ) directives.widget( "uuid_list_field_checkbox", CheckBoxFieldWidget, ) uuid_choice_field_ajax_select = schema.Choice( title=u"Relationchoice Field with AJAXSelect storing uuids", description=u"z3c.relationfield.schema.RelationChoice", vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], }), required=False, ) directives.widget( "uuid_choice_field_ajax_select", AjaxSelectFieldWidget, vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], }), pattern_options={ # Options for Select2 "minimumInputLength": 2, # - Don't query until at least two characters have been typed "ajax": { "quietMillis": 500 }, # - Wait 500ms after typing to make query }, ) uuid_list_field_ajax_select = schema.List( title=u"Relationlist Field with AJAXSelect storing uuids", description=u"z3c.relationfield.schema.RelationList", value_type=schema.Choice(vocabulary=StaticCatalogVocabulary({ "portal_type": ["Document", "Event"], "review_state": "published", })), required=False, ) directives.widget( "uuid_list_field_ajax_select", AjaxSelectFieldWidget, vocabulary=StaticCatalogVocabulary( { "portal_type": ["Document", "Event"], }, title_template="{brain.Type}: {brain.Title} at {path}", ), # Custom item rendering pattern_options={ # Options for Select2 "minimumInputLength": 2, # - Don't query until at least two characters have been typed "ajax": { "quietMillis": 500 }, # - Wait 500ms after typing to make query "closeOnSelect": False, # - Leave dropdown open for multiple selection }, ) # Number fields int_field = schema.Int( title=u"Integer Field (e.g. 12)", description=u"zope.schema.Int", required=False, ) float_field = schema.Float( title=u"Float field, e.g. 12.7", description=u"zope.schema.Float", required=False, ) # Text fields email_field = Email( title=u"Email field", description= u"A simple input field for a email (plone.schema.email.Email)", required=False, ) uri_field = schema.URI( title=u"URI field", description=u"A simple input field for a URLs (zope.schema.URI)", required=False, ) richtext_field = RichText( title=u"RichText field", description= u"This uses a richtext editor. (plone.app.textfield.RichText)", max_length=2000, required=False, ) sourcetext_field = schema.SourceText( title=u"SourceText field", description=u"zope.schema.SourceText", required=False, ) ascii_field = schema.ASCII( title=u"ASCII field", description=u"zope.schema.ASCII", required=False, ) bytesline_field = schema.BytesLine( title=u"BytesLine field", description=u"zope.schema.BytesLine", required=False, ) asciiline_field = schema.ASCIILine( title=u"ASCIILine field", description=u"zope.schema.ASCIILine", required=False, ) pythonidentifier_field = schema.PythonIdentifier( title=u"PythonIdentifier field", description=u"zope.schema.PythonIdentifier", required=False, ) dottedname_field = schema.DottedName( title=u"DottedName field", description=u"zope.schema.DottedName", required=False, ) # dict_field = schema.Dict( # title=u'Dict field', # description=u"zope.schema.Dict", # required=False, # key_type=schema.TextLine( # title=u'Key', # required=False, # ), # value_type=schema.TextLine( # title=u'Value', # required=False, # ), # ) # vocabularyterms_field = Dict( # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget' # title=u"Vocabulary terms field", # description=u"plone.schema.Dict field with value_type schema.TextLine and frontend widget 'VocabularyTermsWidget'", # required=False, # key_type=schema.TextLine( # title=u"Key", # required=False, # ), # value_type=schema.TextLine( # title=u"Value", # required=False, # ), # widget="vocabularyterms", # we use the widget attribute to apply the frontend widget VocabularyWidget # ) # vocabularytermstranslation_field = Dict( # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget' # title=u"Vocabulary terms field with translations", # description=u"plone.schema.Dict field with value_type Dict and frontend widget 'VocabularyTermsWidget'", # required=False, # key_type=schema.TextLine( # title=u"Key", # required=False, # ), # value_type=Dict( # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget' # title=u"Term translation", # description=u"plone.schema.Dict field for translations of vocabulary term", # required=True, # key_type=schema.TextLine( # title=u"Key", # required=False, # ), # value_type=schema.TextLine( # title=u"Value", # required=False, # ), # ), # widget="vocabularyterms", # we use the widget attribute to apply the frontend widget VocabularyWidget # ) # dict_field_with_choice = schema.Dict( # title=u'Dict field with key and value as choice', # description=u"zope.schema.Dict", # required=False, # key_type=schema.Choice( # title=u'Key', # values=[u'One', u'Two', u'Three'], # required=False, # ), # value_type=schema.Set( # title=u'Value', # value_type=schema.Choice( # values=[u'Beginner', u'Advanced', u'Professional'], # ), # required=False, # missing_value={}, # ), # ) datagrid_field = schema.List( title=u"Datagrid field", description=u"schema.List", value_type=DictRow(title=u"Table", schema=IMyRowSchema), default=[], required=False, ) directives.widget("datagrid_field", DataGridFieldFactory)
class ResetPasswordRequestSchema(model.Schema): email = Email(title=_("label_email", default="Email address"), )
class IMailer(IAction): """A form action adapter that will e-mail form input.""" directives.write_permission( recipient_name=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_name=MODIFY_PORTAL_CONTENT) recipient_name = zope.schema.TextLine( title=_(u'label_formmailer_recipient_fullname', default=u"Recipient's full name"), description=_( u'help_formmailer_recipient_fullname', default=u'The full name of the recipient of the mailed form.'), default=u'', missing_value=u'', required=False, ) directives.write_permission( recipient_email=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_email=MODIFY_PORTAL_CONTENT) recipient_email = Email( title=_(u'label_formmailer_recipient_email', default=u"Recipient's e-mail address"), description=_(u'help_formmailer_recipient_email', default=u'The recipients e-mail address.'), required=False, ) fieldset(u'addressing', label=_('Addressing'), fields=[ 'to_field', 'cc_recipients', 'bcc_recipients', 'replyto_field' ]) directives.write_permission(to_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(to_field=MODIFY_PORTAL_CONTENT) to_field = zope.schema.Choice( title=_(u'label_formmailer_to_extract', default=u'Extract Recipient From'), description=_( u'help_formmailer_to_extract', default=u'Choose a form field from which you wish to extract ' u'input for the To header. If you choose anything other ' u'than "None", this will override the "Recipient\'s " ' u'e-mail address setting above. Be very cautious about ' u'allowing unguarded user input for this purpose.'), required=False, vocabulary='easyform.Fields', ) directives.write_permission( cc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(cc_recipients=MODIFY_PORTAL_CONTENT) cc_recipients = zope.schema.Text( title=_(u'label_formmailer_cc_recipients', default=u'CC Recipients'), description=_( u'help_formmailer_cc_recipients', default=u'E-mail addresses which receive a carbon copy.'), default=u'', missing_value=u'', required=False, ) directives.write_permission( bcc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(bcc_recipients=MODIFY_PORTAL_CONTENT) bcc_recipients = zope.schema.Text( title=_(u'label_formmailer_bcc_recipients', default=u'BCC Recipients'), description=_( u'help_formmailer_bcc_recipients', default=u'E-mail addresses which receive a blind carbon copy.'), default=u'', missing_value=u'', required=False, ) directives.write_permission(replyto_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(replyto_field=MODIFY_PORTAL_CONTENT) replyto_field = zope.schema.Choice( title=_(u'label_formmailer_replyto_extract', default=u'Extract Reply-To From'), description=_( u'help_formmailer_replyto_extract', default=u'Choose a form field from which you wish to extract ' u'input for the Reply-To header. NOTE: You should ' u'activate e-mail address verification for the ' u'designated field.'), required=False, vocabulary='easyform.Fields', ) fieldset(u'message', label=PMF('Message'), fields=[ 'msg_subject', 'subject_field', 'body_pre', 'body_post', 'body_footer', 'showAll', 'showFields', 'includeEmpties', 'sendCSV', ]) directives.read_permission(msg_subject=MODIFY_PORTAL_CONTENT) msg_subject = zope.schema.TextLine( title=_(u'label_formmailer_subject', default=u'Subject'), description=_(u'help_formmailer_subject', default=u'' u'Subject line of message. This is used if you ' u'do not specify a subject field or if the field ' u'is empty.'), default=u'Form Submission', missing_value=u'', required=False, ) directives.write_permission(subject_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(subject_field=MODIFY_PORTAL_CONTENT) subject_field = zope.schema.Choice( title=_(u'label_formmailer_subject_extract', default=u'Extract Subject From'), description=_(u'help_formmailer_subject_extract', default=u'' u'Choose a form field from which you wish to extract ' u'input for the mail subject line.'), required=False, vocabulary='easyform.Fields', ) directives.read_permission(body_pre=MODIFY_PORTAL_CONTENT) directives.widget('body_pre', TextAreaWidget) body_pre = RichText( title=_(u'label_formmailer_body_pre', default=u'Body (prepended)'), description=_(u'help_formmailer_body_pre', default=u'Text prepended to fields listed in mail-body'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(body_post=MODIFY_PORTAL_CONTENT) directives.widget('body_post', TextAreaWidget) body_post = RichText( title=_(u'label_formmailer_body_post', default=u'Body (appended)'), description=_(u'help_formmailer_body_post', default=u'Text appended to fields listed in mail-body'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(body_footer=MODIFY_PORTAL_CONTENT) directives.widget('body_footer', TextAreaWidget) body_footer = RichText( title=_(u'label_formmailer_body_footer', default=u'Body (signature)'), description=_(u'help_formmailer_body_footer', default=u'Text used as the footer at ' u'bottom, delimited from the body by a dashed line.'), default=u'', missing_value=u'', default_mime_type='text/x-web-intelligent', allowed_mime_types=('text/x-web-intelligent', ), output_mime_type='text/x-html-safe', required=False, ) directives.read_permission(showAll=MODIFY_PORTAL_CONTENT) showAll = zope.schema.Bool( title=_(u'label_mailallfields_text', default=u'Include All Fields'), description=_(u'help_mailallfields_text', default=u'' u'Check this to include input for all fields ' u'(except label and file fields). If you check ' u'this, the choices in the pick box below ' u'will be ignored.'), default=True, required=False, ) directives.read_permission(showFields=MODIFY_PORTAL_CONTENT) showFields = zope.schema.List( title=_(u'label_mailfields_text', default=u'Show Responses'), description=_( u'help_mailfields_text', default=u'Pick the fields whose inputs you\'d like to include in ' u'the e-mail.'), unique=True, required=False, value_type=zope.schema.Choice(vocabulary='easyform.Fields'), ) directives.read_permission(includeEmpties=MODIFY_PORTAL_CONTENT) includeEmpties = zope.schema.Bool( title=_(u'label_mailEmpties_text', default=u'Include Empties'), description=_(u'help_mailEmpties_text', default=u'' u'Check this to include titles ' u'for fields that received no input. Uncheck ' u'to leave fields with no input out of the e-mail.'), default=True, required=False, ) directives.read_permission(sendCSV=MODIFY_PORTAL_CONTENT) sendCSV = zope.schema.Bool( title=_(u'label_sendCSV_text', default=u'Send CSV data attachment'), description=_(u'help_sendCSV_text', default=u'' u'Check this to send a CSV file ' u'attachment containing the values ' u'filled out in the form.'), default=False, required=False, ) fieldset(u'template', label=PMF('Template'), fields=['body_pt', 'body_type']) directives.write_permission(body_pt=config.EDIT_TALES_PERMISSION) directives.read_permission(body_pt=MODIFY_PORTAL_CONTENT) body_pt = zope.schema.Text( title=_(u'label_formmailer_body_pt', default=u'Mail-Body Template'), description=_( u'help_formmailer_body_pt', default=u'This is a Zope Page Template used for rendering of ' u'the mail-body. You don\'t need to modify it, but if you ' u'know TAL (Zope\'s Template Attribute Language) have ' u'the full power to customize your outgoing mails.'), defaultFactory=default_mail_body, missing_value=u'', ) directives.write_permission(body_type=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(body_type=MODIFY_PORTAL_CONTENT) body_type = zope.schema.Choice( title=_(u'label_formmailer_body_type', default=u'Mail Format'), description=_( u'help_formmailer_body_type', default=u'Set the mime-type of the mail-body. Change this ' u'setting only if you know exactly what you are doing. ' u'Leave it blank for default behaviour.'), default=u'html', vocabulary='easyform.MimeList', ) fieldset(u'headers', label=_('Headers'), fields=['xinfo_headers', 'additional_headers']) directives.widget(xinfo_headers=CheckBoxFieldWidget) directives.write_permission(xinfo_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(xinfo_headers=MODIFY_PORTAL_CONTENT) xinfo_headers = zope.schema.List( title=_(u'label_xinfo_headers_text', default=u'HTTP Headers'), description=_(u'help_xinfo_headers_text', default=u'' u'Pick any items from the HTTP headers that ' u'you\'d like to insert as X- headers in the message.'), unique=True, required=False, default=[u'HTTP_X_FORWARDED_FOR', u'REMOTE_ADDR', u'PATH_INFO'], missing_value=[u'HTTP_X_FORWARDED_FOR', u'REMOTE_ADDR', u'PATH_INFO'], value_type=zope.schema.Choice(vocabulary='easyform.XinfoHeaders'), ) directives.write_permission( additional_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(additional_headers=MODIFY_PORTAL_CONTENT) additional_headers = zope.schema.List( title=_(u'label_formmailer_additional_headers', default=u'Additional Headers'), description=_(u'help_formmailer_additional_headers', default=u'Additional e-mail-header lines. Only use ' u'RFC822-compliant headers.'), unique=True, required=False, value_type=zope.schema.TextLine(title=_(u'extra_header', default=u'${name} Header', mapping={u'name': u'HTTP'}), ), ) fieldset(u'overrides', label=_('Overrides'), fields=[ 'subjectOverride', 'senderOverride', 'recipientOverride', 'ccOverride', 'bccOverride' ]) directives.write_permission(subjectOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(subjectOverride=MODIFY_PORTAL_CONTENT) subjectOverride = zope.schema.TextLine( title=_(u'label_subject_override_text', default=u'Subject Expression'), description=_( u'help_subject_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the e-mail subject ' u'header. Leave empty if unneeded. Your expression ' u'should evaluate as a string. PLEASE NOTE: errors in ' u'the evaluation of this expression will cause an error ' u'on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(senderOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(senderOverride=MODIFY_PORTAL_CONTENT) senderOverride = zope.schema.TextLine( title=_(u'label_sender_override_text', default=u'Sender Expression'), description=_( u'help_sender_override_text', default=u'A TALES expression that will be evaluated to override ' u'the "From" header. Leave empty if unneeded. ' u'Your expression should evaluate as a string. ' u'PLEASE NOTE: errors in the evaluation of this ' u'expression will cause an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(recipientOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(recipientOverride=MODIFY_PORTAL_CONTENT) recipientOverride = zope.schema.TextLine( title=_(u'label_recipient_override_text', default=u'Recipient Expression'), description=_( u'help_recipient_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the recipient ' u'e-mail address. You are strongly cautioned against using' u'unvalidated data from the request for this purpose. ' u'Leave empty if unneeded. Your expression should ' u'evaluate as a string. PLEASE NOTE: errors in the ' u'evaluation of this expression will cause ' u'an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(ccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(ccOverride=MODIFY_PORTAL_CONTENT) ccOverride = zope.schema.TextLine( title=_(u'label_cc_override_text', default=u'CC Expression'), description=_( u'help_cc_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the CC list. You are ' u'strongly cautioned against using unvalidated data from ' u'the request for this purpose. Leave empty if unneeded. ' u'Your expression should evaluate as a sequence of ' u'strings. PLEASE NOTE: errors in the evaluation of this ' u'expression will cause an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, ) directives.write_permission(bccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(bccOverride=MODIFY_PORTAL_CONTENT) bccOverride = zope.schema.TextLine( title=_(u'label_bcc_override_text', default=u'BCC Expression'), description=_( u'help_bcc_override_text', default=u'A TALES expression that will be evaluated to override ' u'any value otherwise entered for the BCC list. ' u'You are strongly cautioned against using ' u'unvalidated data from the request for this purpose. ' u'Leave empty if unneeded. Your expression should ' u'evaluate as a sequence of strings. PLEASE NOTE: errors ' u'in the evaluation of this expression will cause ' u'an error on form display.'), required=False, default=u'', missing_value=u'', constraint=isTALES, )
class IMailer(IAction): """A form action adapter that will e-mail form input.""" directives.write_permission(recipient_name=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_name=MODIFY_PORTAL_CONTENT) recipient_name = zope.schema.TextLine( title=_( u"label_formmailer_recipient_fullname", default=u"Recipient's full name" ), description=_( u"help_formmailer_recipient_fullname", default=u"The full name of the recipient of the mailed form.", ), default=u"", missing_value=u"", required=False, ) directives.write_permission(recipient_email=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(recipient_email=MODIFY_PORTAL_CONTENT) recipient_email = Email( title=_( u"label_formmailer_recipient_email", default=u"Recipient's e-mail address" ), description=_( u"help_formmailer_recipient_email", default=u"The recipients e-mail address.", ), required=False, ) fieldset( u"addressing", label=_("Addressing"), fields=["to_field", "cc_recipients", "bcc_recipients", "replyto_field"], ) directives.write_permission(to_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(to_field=MODIFY_PORTAL_CONTENT) to_field = zope.schema.Choice( title=_(u"label_formmailer_to_extract", default=u"Extract Recipient From"), description=_( u"help_formmailer_to_extract", default=u"Choose a form field from which you wish to extract " u"input for the To header. If you choose anything other " u'than "None", this will override the "Recipient\'s " ' u"e-mail address setting above. Be very cautious about " u"allowing unguarded user input for this purpose.", ), required=False, vocabulary="easyform.Fields", ) directives.write_permission(cc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(cc_recipients=MODIFY_PORTAL_CONTENT) cc_recipients = zope.schema.Text( title=_(u"label_formmailer_cc_recipients", default=u"CC Recipients"), description=_( u"help_formmailer_cc_recipients", default=u"E-mail addresses which receive a carbon copy.", ), default=u"", missing_value=u"", required=False, ) directives.write_permission(bcc_recipients=config.EDIT_ADDRESSING_PERMISSION) directives.read_permission(bcc_recipients=MODIFY_PORTAL_CONTENT) bcc_recipients = zope.schema.Text( title=_(u"label_formmailer_bcc_recipients", default=u"BCC Recipients"), description=_( u"help_formmailer_bcc_recipients", default=u"E-mail addresses which receive a blind carbon copy.", ), default=u"", missing_value=u"", required=False, ) directives.write_permission(replyto_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(replyto_field=MODIFY_PORTAL_CONTENT) replyto_field = zope.schema.Choice( title=_(u"label_formmailer_replyto_extract", default=u"Extract Reply-To From"), description=_( u"help_formmailer_replyto_extract", default=u"Choose a form field from which you wish to extract " u"input for the Reply-To header. NOTE: You should " u"activate e-mail address verification for the " u"designated field.", ), required=False, vocabulary="easyform.Fields", ) fieldset( u"message", label=PMF("Message"), fields=[ "msg_subject", "subject_field", "body_pre", "body_post", "body_footer", "showAll", "showFields", "includeEmpties", "sendCSV", "sendXML", ], ) directives.read_permission(msg_subject=MODIFY_PORTAL_CONTENT) msg_subject = zope.schema.TextLine( title=_(u"label_formmailer_subject", default=u"Subject"), description=_( u"help_formmailer_subject", default=u"" u"Subject line of message. This is used if you " u"do not specify a subject field or if the field " u"is empty.", ), default=u"Form Submission", missing_value=u"", required=False, ) directives.write_permission(subject_field=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(subject_field=MODIFY_PORTAL_CONTENT) subject_field = zope.schema.Choice( title=_(u"label_formmailer_subject_extract", default=u"Extract Subject From"), description=_( u"help_formmailer_subject_extract", default=u"" u"Choose a form field from which you wish to extract " u"input for the mail subject line.", ), required=False, vocabulary="easyform.Fields", ) directives.read_permission(body_pre=MODIFY_PORTAL_CONTENT) directives.widget("body_pre", TextAreaWidget) body_pre = RichText( title=_(u"label_formmailer_body_pre", default=u"Body (prepended)"), description=_( u"help_formmailer_body_pre", default=u"Text prepended to fields listed in mail-body", ), default=u"", missing_value=u"", default_mime_type="text/x-web-intelligent", allowed_mime_types=("text/x-web-intelligent",), output_mime_type="text/x-html-safe", required=False, ) directives.read_permission(body_post=MODIFY_PORTAL_CONTENT) directives.widget("body_post", TextAreaWidget) body_post = RichText( title=_(u"label_formmailer_body_post", default=u"Body (appended)"), description=_( u"help_formmailer_body_post", default=u"Text appended to fields listed in mail-body", ), default=u"", missing_value=u"", default_mime_type="text/x-web-intelligent", allowed_mime_types=("text/x-web-intelligent",), output_mime_type="text/x-html-safe", required=False, ) directives.read_permission(body_footer=MODIFY_PORTAL_CONTENT) directives.widget("body_footer", TextAreaWidget) body_footer = RichText( title=_(u"label_formmailer_body_footer", default=u"Body (signature)"), description=_( u"help_formmailer_body_footer", default=u"Text used as the footer at " u"bottom, delimited from the body by a dashed line.", ), default=u"", missing_value=u"", default_mime_type="text/x-web-intelligent", allowed_mime_types=("text/x-web-intelligent",), output_mime_type="text/x-html-safe", required=False, ) directives.read_permission(showAll=MODIFY_PORTAL_CONTENT) showAll = zope.schema.Bool( title=_(u"label_mailallfields_text", default=u"Include All Fields"), description=_( u"help_mailallfields_text", default=u"" u"Check this to include input for all fields " u"(except label and file fields). If you check " u"this, the choices in the pick box below " u"will be ignored.", ), default=True, required=False, ) directives.read_permission(showFields=MODIFY_PORTAL_CONTENT) showFields = zope.schema.List( title=_(u"label_mailfields_text", default=u"Show Responses"), description=_( u"help_mailfields_text", default=u"Pick the fields whose inputs you'd like to include in " u"the e-mail.", ), unique=True, required=False, value_type=zope.schema.Choice(vocabulary="easyform.Fields"), ) directives.read_permission(includeEmpties=MODIFY_PORTAL_CONTENT) includeEmpties = zope.schema.Bool( title=_(u"label_mailEmpties_text", default=u"Include Empties"), description=_( u"help_mailEmpties_text", default=u"" u"Check this to include titles " u"for fields that received no input. Uncheck " u"to leave fields with no input out of the e-mail.", ), default=True, required=False, ) directives.read_permission(sendCSV=MODIFY_PORTAL_CONTENT) sendCSV = zope.schema.Bool( title=_(u"label_sendCSV_text", default=u"Send CSV data attachment"), description=_( u"help_sendCSV_text", default=u"" u"Check this to send a CSV file " u"attachment containing the values " u"filled out in the form.", ), default=False, required=False, ) directives.read_permission(sendXML=MODIFY_PORTAL_CONTENT) sendXML = zope.schema.Bool( title=_(u"label_sendXML_text", default=u"Send XML data attachment"), description=_( u"help_sendXML_text", default=u"" u"Check this to send an XML file " u"attachment containing the values " u"filled out in the form.", ), default=False, required=False, ) fieldset(u"template", label=PMF("Template"), fields=["body_pt", "body_type"]) directives.write_permission(body_pt=config.EDIT_TALES_PERMISSION) directives.read_permission(body_pt=MODIFY_PORTAL_CONTENT) body_pt = zope.schema.Text( title=_(u"label_formmailer_body_pt", default=u"Mail-Body Template"), description=_( u"help_formmailer_body_pt", default=u"This is a Zope Page Template used for rendering of " u"the mail-body. You don't need to modify it, but if you " u"know TAL (Zope's Template Attribute Language) have " u"the full power to customize your outgoing mails.", ), defaultFactory=default_mail_body, missing_value=u"", ) directives.write_permission(body_type=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(body_type=MODIFY_PORTAL_CONTENT) body_type = zope.schema.Choice( title=_(u"label_formmailer_body_type", default=u"Mail Format"), description=_( u"help_formmailer_body_type", default=u"Set the mime-type of the mail-body. Change this " u"setting only if you know exactly what you are doing. " u"Leave it blank for default behaviour.", ), default=u"html", vocabulary="easyform.MimeList", ) fieldset( u"headers", label=_("Headers"), fields=["xinfo_headers", "additional_headers"] ) directives.widget(xinfo_headers=CheckBoxFieldWidget) directives.write_permission(xinfo_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(xinfo_headers=MODIFY_PORTAL_CONTENT) xinfo_headers = zope.schema.List( title=_(u"label_xinfo_headers_text", default=u"HTTP Headers"), description=_( u"help_xinfo_headers_text", default=u"" u"Pick any items from the HTTP headers that " u"you'd like to insert as X- headers in the message.", ), unique=True, required=False, default=[u"HTTP_X_FORWARDED_FOR", u"REMOTE_ADDR", u"PATH_INFO"], missing_value=[u"HTTP_X_FORWARDED_FOR", u"REMOTE_ADDR", u"PATH_INFO"], value_type=zope.schema.Choice(vocabulary="easyform.XinfoHeaders"), ) directives.write_permission(additional_headers=config.EDIT_ADVANCED_PERMISSION) directives.read_permission(additional_headers=MODIFY_PORTAL_CONTENT) additional_headers = zope.schema.List( title=_(u"label_formmailer_additional_headers", default=u"Additional Headers"), description=_( u"help_formmailer_additional_headers", default=u"Additional e-mail-header lines. Only use " u"RFC822-compliant headers.", ), unique=True, required=False, value_type=zope.schema.TextLine( title=_( u"extra_header", default=u"${name} Header", mapping={u"name": u"HTTP"} ) ), ) fieldset( u"overrides", label=_("Overrides"), fields=[ "subjectOverride", "senderOverride", "recipientOverride", "ccOverride", "bccOverride", ], ) directives.write_permission(subjectOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(subjectOverride=MODIFY_PORTAL_CONTENT) subjectOverride = zope.schema.TextLine( title=_(u"label_subject_override_text", default=u"Subject Expression"), description=_( u"help_subject_override_text", default=u"A TALES expression that will be evaluated to override " u"any value otherwise entered for the e-mail subject " u"header. Leave empty if unneeded. Your expression " u"should evaluate as a string. PLEASE NOTE: errors in " u"the evaluation of this expression will cause an error " u"on form display.", ), required=False, default=u"", missing_value=u"", constraint=isTALES, ) directives.write_permission(senderOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(senderOverride=MODIFY_PORTAL_CONTENT) senderOverride = zope.schema.TextLine( title=_(u"label_sender_override_text", default=u"Sender Expression"), description=_( u"help_sender_override_text", default=u"A TALES expression that will be evaluated to override " u'the "From" header. Leave empty if unneeded. ' u"Your expression should evaluate as a string. " u"PLEASE NOTE: errors in the evaluation of this " u"expression will cause an error on form display.", ), required=False, default=u"", missing_value=u"", constraint=isTALES, ) directives.write_permission(recipientOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(recipientOverride=MODIFY_PORTAL_CONTENT) recipientOverride = zope.schema.TextLine( title=_(u"label_recipient_override_text", default=u"Recipient Expression"), description=_( u"help_recipient_override_text", default=u"A TALES expression that will be evaluated to override " u"any value otherwise entered for the recipient " u"e-mail address. You are strongly cautioned against using" u"unvalidated data from the request for this purpose. " u"Leave empty if unneeded. Your expression should " u"evaluate as a string. PLEASE NOTE: errors in the " u"evaluation of this expression will cause " u"an error on form display.", ), required=False, default=u"", missing_value=u"", constraint=isTALES, ) directives.write_permission(ccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(ccOverride=MODIFY_PORTAL_CONTENT) ccOverride = zope.schema.TextLine( title=_(u"label_cc_override_text", default=u"CC Expression"), description=_( u"help_cc_override_text", default=u"A TALES expression that will be evaluated to override " u"any value otherwise entered for the CC list. You are " u"strongly cautioned against using unvalidated data from " u"the request for this purpose. Leave empty if unneeded. " u"Your expression should evaluate as a sequence of " u"strings. PLEASE NOTE: errors in the evaluation of this " u"expression will cause an error on form display.", ), required=False, default=u"", missing_value=u"", constraint=isTALES, ) directives.write_permission(bccOverride=config.EDIT_TALES_PERMISSION) directives.read_permission(bccOverride=MODIFY_PORTAL_CONTENT) bccOverride = zope.schema.TextLine( title=_(u"label_bcc_override_text", default=u"BCC Expression"), description=_( u"help_bcc_override_text", default=u"A TALES expression that will be evaluated to override " u"any value otherwise entered for the BCC list. " u"You are strongly cautioned against using " u"unvalidated data from the request for this purpose. " u"Leave empty if unneeded. Your expression should " u"evaluate as a sequence of strings. PLEASE NOTE: errors " u"in the evaluation of this expression will cause " u"an error on form display.", ), required=False, default=u"", missing_value=u"", constraint=isTALES, )