class IPerson(Interface): """ Fields to be used with DataGridField below """ first_name = schema.TextLine( title=_(u'First Name'), description=_(u'First Name'), required=False, ) last_name = schema.TextLine( title=_(u'Last Name'), description=_(u'Family Name'), required=False, ) #we probably need 'many relation fields', since one person can have #several relations to same person #Teoretically, your x-wife is not your brothers wife family_relation = RelationChoice( title=_(u"Realation"), source=CatalogSource( portal_type=['DatagridDemoType', 'Person', 'etc']), required=False, )
class ICreateDX(IAction): """Create a Dexterity Type""" location = schema.TextLine( title=_(u'Location'), description=_( u'Select the location where content items should be created'), required=True, ) content_type = schema.Choice( title=_(u'label_content_type', default=u'Content Type'), vocabulary='plone.app.vocabularies.PortalTypes', required=True, default='', missing_value='', ) directives.widget('content_type', SelectFieldWidget) mappings = schema.List( title=_(u'Form field to item field mappings'), description= _(u"""One mapping per line. Format: "formfieldid itemfieldid:fieldtype". Make sure you have at least the title mapping defined, because it will also be used to create the id of the item!""" ), default=[], required=True, value_type=schema.TextLine(), ) directives.widget('mappings', TextLinesFieldWidget)
class IExpert(model.Schema): """ """ dexteritytextindexer.searchable('competence') # dexteritytextindexer.searchable('region') # extra index for filtering by region dexteritytextindexer.searchable('organisation') competence = schema.TextLine( title=_(u'Competence'), required=False, ) region = schema.TextLine( title=_(u'Region'), required=False ) organisation = schema.TextLine( title=_(u'Organisation'), required=False, ) widget(is_expert=RadioFieldWidget) is_expert = schema.Bool( title=_(u'Ist Experte. In Expertensuche aufnehmen.'), default=True, required=False, ) order_after(is_expert='last_name') order_after(organisation='last_name') order_after(region='last_name') order_after(competence='last_name')
class ICalltoactionSchema(Interface): """Call to action. internal link, external link, sharing """ ctalabel = schema.TextLine( title=_(u'Label'), required=False, default=u'', missing_value=u'call to action', ) widget('ctaurl', LinkFieldWidget) ctaurl = schema.TextLine( title=_(u'Target of call to action'), required=False, default=u'', missing_value=u'', ) ctasharing = schema.Bool( title=_(u'Sharing'), required=False, default=False, missing_value=False, ) ctacategory = schema.Choice( title=_(u'Category'), required=True, vocabulary='collective.multiplecalltoactions.CtoCategoryVocabulary')
class INewsletterSubscriber(model.Schema): """Marker interface and Dexterity Python Schema for NewsletterSubscriber""" salutation = schema.Choice( title=_("EasyNewsletter_label_salutation", default="Salutation"), description=_("EasyNewsletter_help_salutation", default=""), vocabulary="Products.EasyNewsletter.Salutations", required=False, ) name_prefix = schema.TextLine( title=_("EasyNewsletter_label_name_prefix", default="Name Prefix"), description=_("EasyNewsletter_help_name_prefix", default=""), default="", required=False, ) firstname = schema.TextLine( title=_("EasyNewsletter_label_firstname", default="First Name"), required=False, ) lastname = schema.TextLine(title=_("EasyNewsletter_label_lastname", default="Last Name"), required=False) organization = schema.TextLine( title=_("EasyNewsletter_label_organization", default="Organization"), required=False, ) email = schema.TextLine(title=_("EasyNewsletter_label_email", default="Email"), required=True)
class INameTokenTableRowSchema(Interface): """Schema for dict rows used in DataGridFields. name is the 'real' name token is the token used in the vocabularies """ token = schema.TextLine(title=_(u'Token')) name = schema.TextLine(title=_(u'Name'))
class IBaseUser(IEmail): """"Membrane based based user Class.""" first_name = schema.TextLine(title=_('First Name'), ) last_name = schema.TextLine(title=_('Last name')) mfa = schema.Choice(title=_('Multi-factor authentication (MFA)'), required=False, vocabulary='mfa_types') oidc_enabled = schema.Bool( title=_('Is OpenID Connect enabled'), required=False, )
class ITokenCodeBase(model.Schema): """OID Map: :user_id = user :client_id = client""" user_id = ps.TextLine(title=_('User ID'), required=True) client_id = ps.TextLine(title=_('Client ID'), required=True) scope = ps.List(title=_('List of scopes'), required=False, value_type=ps.TextLine()) expire_at = ps.Datetime(title=_('Token Expire Date'), required=True) @invariant def validate_existance(self, data): """Validate if User and Application Is exists""" return Invalid('')
class ISomefields(Interface): """ Fields to be used with DataGridField below """ first_field = schema.TextLine( title=_(u'First Field'), description=_(u'FirstField here'), required=False, ) second_field = schema.TextLine( title=_(u'Second field'), description=_(u'No good description'), required=False, )
class ITableColumns(Interface): """ Fields to be used with DataGridField below """ label = schema.TextLine( title=_(u'Label'), description=_(u'Label Name'), required=False, ) information = schema.TextLine( title=_(u'Info'), description=_(u'Information'), required=False, )
class IDataTableBehavior(model.Schema): """ """ #fieldset('Settings', # fields=['pagelenght', # 'pagelenghts', # 'table'] #) csv_file = NamedFile( title=_(u"Please upload CSV file"), required=True, ) #pagelenght = schema.Int( # title=_(u'Page Length'), # default=25, # min=5, #) #pagelenghts = schema.Text( # title=_(u'Page Length'), # #) directives.widget(table=DataTableFieldWidget) #directives.mode(table='hidden') table = schema.TextLine( title=_(u"List items"), required=False, )
class IElasticSearchBlocks(model.Schema): """ """ directives.read_permission(blocks_plaintext='cmf.ManagePortal') directives.write_permission(blocks_plaintext='cmf.ManagePortal') blocks_plaintext = schema.TextLine( title=_(u'Blocks content in plain text'), required=False, default="")
class IActeur(IDexterityItem): firstname = schema.TextLine( title=u"Prénom", required=True, ) lastname = schema.TextLine( title=u"Nom", required=False, ) description = schema.Text( title=u"Description", required=False, ) image = NamedBlobImage( title=u"Photo", required=False, )
class ISourceType(model.Schema): """ """ project = schema.TextLine( title=_(u'Project'), description=_(u'Give in a project name'), required=False, )
class IRegistrationForm(model.Schema): """""" email = schema.Email(title=_(u"Email address"), required=True) first_name = schema.TextLine(title=_(u"First name"), required=True) last_name = schema.TextLine(title=_(u"Last name"), required=True) number_of_people = schema.Int(title=_(u"Number of people"), required=True, default=1, min=1) period = schema.Choice( title=_(u"Period"), source="collective.registration.vocabularies.periods", required=True, )
class INewsletterSubscribe(Interface): email = schema.Email( title=_("Email address"), description=_("help_email", default="Please enter your email address."), required=True, ) captcha = schema.TextLine(title="Captcha", description="", required=False)
class IPhoneRowSchema(Interface): label = schema.TextLine( title=_("Label (direction, Main number,...)"), description=_(""), required=False, ) type = schema.Choice( title=_("Type"), source="imio.directory.vocabulary.PhoneTypes", description=_(""), required=True, ) number = schema.TextLine( title=_("Number (format: +32475010203)"), required=True, constraint=phone_constraint, )
class IImageRights(model.Schema): """ """ directives.order_after(image_rights='image') image_rights = schema.TextLine( title=_(u'Image Rights'), description=_( u'Copyright statement or other rights information on this item.'), required=False, )
class INotizData(model.Schema): title = schema.TextLine( title=u'Titel der Notiz im Notizbuch') description = schema.Text( title=u'Frage, These oder Aufgabe zu der sich der Lernende eine Notiz machen soll') fieldformat = schema.Choice( title=u'Format des Eingabefeldes', vocabulary=input_vocabulary, default=u'Text')
class IGalerie(IFolder): title = schema.TextLine( title=u"Titre de la galerie", required=True, ) start = schema.Date( title=u"Date", description=u"Utilisée pour filtrer sur la date de début/fin", required=False, )
class INewsletterPluginFlaskSettings(Interface): """ Plugin settings""" queue_endpoint = schema.TextLine( title=_(u'queue_endpoint_label', default=u'Queue endpoint'), description=_( u'queue_endpoint_help', default=u'Insert the url of the Flask server that will handle the' u' queue (for example: http://127.0.0.1:5000/add-to-queue).', ), default=u'http://127.0.0.1:5000/add-to-queue', required=True, )
class IGndId(model.Schema): """ """ gnd_id = schema.TextLine( title=_(u'GND-ID'), description=_( u'GND ID, see ' u'<a href="https://www.wikidata.org/wiki/Property:P227"' u' target="_blank">https://www.wikidata.org/wiki/Property:P227' u'</a>'), required=False, )
class IEnhancedUserDataSchema(model.Schema): last_name = schema.TextLine(title=_(u"Last name or institution"), required=True) first_name = schema.TextLine(title=_(u"First name"), required=False) address = schema.Text(title=_(u"Address"), required=False) gender = schema.Choice(title=_(u"Gender"), required=True, vocabulary=u"ideabox.vocabularies.gender") birthdate = schema.Date(title=_(u"Birthdate"), required=True) zip_code = schema.Choice(title=_(u"Zip code"), required=True, vocabulary=u"ideabox.vocabularies.zip_code") iam = schema.Choice(title=_(u"I am"), required=True, vocabulary=u"collective.taxonomy.iam")
class ILieu(IDexterityItem): title = schema.TextLine( title=u"Titre du lieu", required=True, ) description = schema.Text( title=u"Description", required=False, ) image = NamedBlobImage( title=u"Photo du lieu", required=False, )
class IMailRowSchema(Interface): label = schema.TextLine( title=_("Label (Secretariat, Manager office, Sales,...)"), description=_(""), required=False, ) type = schema.Choice( title=_("Type"), source="imio.directory.vocabulary.MailTypes", description=_(""), required=True, ) mail_address = schema.Email(title=_("E-mail"), required=True)
class IWebcode(model.Schema): """ """ directives.fieldset( 'webcode_dexterity', label=u'Webcode', fields=('webcode', ), ) webcode = schema.TextLine( title=u"Webcode", description=u"Eingabe des Webcodes für diesen Inhalt", defaultFactory=createWebcode, required=False, )
class IDatagridPersons(model.Schema): """ Here we use the fields defined in IPerson for field 'table' """ group = schema.TextLine( title=_(u'Group name'), description=_(u'Group name for persons'), required=False, ) widget(table=DataGridFieldFactory) table = schema.List( title=u"Persons", value_type=DictRow(title=u"personrow", schema=IPerson), required=False, )
class ISendForm(Interface): channels = schema.List( title=_(u"send_channels_title", default=u"Channels"), description=_( u"send_channels_description", default=u"Select which channels should receive this Comunicato. " u"All email address subscribed to this channel will receive it. ", ), required=False, missing_value=(), value_type=schema.Choice(source="rer.ufficiostampa.vocabularies.channels"), ) additional_addresses = schema.List( title=_(u"additional_addresses_title", default=u"Additional addresses"), description=_( u"additional_addresses_description", default=u"Insert a list of additional addressed that will receive " u"the mail. One per line. You can use this field also for testing " u"without sending emails to all subscribed addresses.", ), required=False, missing_value=(), value_type=schema.TextLine(), constraint=check_emails, ) notes = schema.Text( title=_(u"notes_title", default=u"Notes"), description=_( u"notes_description", default=u"Additional notes.", ), required=False, ) attachments = schema.List( title=_(u"send_attachments_title", default=u"Attachments"), description=_( u"send_attachments_description", default=u"Select which attachment you want to send via email. " u"You can only select first level Files and Images.", ), required=False, missing_value=(), value_type=schema.Choice(source="rer.ufficiostampa.vocabularies.attachments"), defaultFactory=default_attachments, )
class IContact(IPrivateContactInformations, IContactInformations, IAddress): """ """ directives.order_before(type="IBasic.title") directives.widget(type=RadioFieldWidget) type = schema.Choice( title=_("Type"), source="imio.directory.vocabulary.ContactTypes", required=True, ) directives.order_after(subtitle="IBasic.title") subtitle = schema.TextLine(title=_("Subtitle"), required=False) logo = NamedBlobImage(title=_("Logo"), description=_(""), required=False) model.fieldset("categorization", fields=["selected_entities", "facilities"]) directives.widget(selected_entities=SelectFieldWidget) selected_entities = schema.List( title=_("Selected entities"), description= _("Select entities where this contact will be displayed. Current entity will always be selected." ), value_type=schema.Choice( vocabulary="imio.directory.vocabulary.EntitiesUIDs"), default=[], required=False, ) facilities = schema.List( title=_("Facilities"), description= _("Important! These categories make it possible to highlight and geolocate certain basic services" ), value_type=schema.Choice( vocabulary="imio.directory.vocabulary.Facilities"), required=False, ) directives.widget(facilities=SelectFieldWidget) read_permission(selected_entities="imio.directory.core.AddEntity") write_permission(selected_entities="imio.directory.core.AddEntity")
class ICallToActionBehavior(model.Schema): """Call to Action behavior with one list of cta.""" color = schema.TextLine( title=_(u'Background Color of Call to Action'), description=_(u'Hexcode or name: #00aa22, magenta, yellow, ...'), default=u"#D9017A", required=False, ) widget('ctas', DataGridFieldFactory, allow_reorder=True) ctas = schema.List(title=_(u'List of Call to Action'), required=False, value_type=DictRow(title=u"calltoaction", schema=ICalltoactionSchema), missing_value=[], readonly=False) model.fieldset('options', fields=['color', 'ctas'])