class IBluechurchmembraneprofile(IMember): """ Artist or Event Manager """ # TODO: make membrane fields searchable dexteritytextindexer.searchable('first_name') dexteritytextindexer.searchable('last_name') dexteritytextindexer.searchable('bio') website = URI_bluechurch( title=_(u"Website"), description=_(u"e.g. www.abcjazzz.com"), required=False, ) widget(profile_type='z3c.form.browser.checkbox.CheckBoxFieldWidget') profile_type = schema.Set( title=_(u"Profile Type"), value_type=schema.Choice(vocabulary=profile_types), required=True, ) directives.widget( bluechurchtags='z3c.form.browser.checkbox.CheckBoxFieldWidget') bluechurchtags = schema.Set( title=_(u'Bluechurch Tags'), value_type=schema.Choice( vocabulary='rohberg.bluechurch.BluchurchTags'), required=False, ) zip_code = schema.TextLine(title=_(u'label_zip_code', default=u'Zip Code'), description=_(u'help_zip_code', default=u''), required=True) city = schema.TextLine(title=_(u'label_city', default=u'City'), description=_(u'help_city', default=u''), required=True) country = schema.Choice(title=_(u'label_country', default=u'Country'), description=_( u'help_country', default=u'Select the country from the list.'), required=True, vocabulary='collective.address.CountryVocabulary') bluechurchcaptcha = schema.Int( title=_(u"bluechurchcaptcha"), description=_(u"Prevent spam by typing in the result of 13 + 4."), min=17, max=17) directives.omitted('bluechurchcaptcha') directives.no_omit(IAddForm, 'bluechurchcaptcha') model.fieldset('categorization', label=_(u'Relations')) # directives.omitted('relatedItems') # directives.no_omit(IEditForm, 'relatedItems') model.load('bluechurchmembraneprofile.xml')
class IProjectSnapshot(Interface): name = schema.BytesLine() title = schema.TextLine() month = schema.Choice(vocabulary=_mkvocab(MONTHS.values()), ) date = schema.Date() all_users = schema.Set() managers = schema.Set() form_users = schema.Set() project_count = schema.Int(constraint=lambda v: v >= 0) team_count = schema.Int(constraint=lambda v: v >= 0)
class IDescriptiveCataloguingGroups(form.Schema): form.widget(cataloguers=z3c.form.browser.checkbox.CheckBoxFieldWidget) cataloguers = schema.Set( title=u"Katalogizátoři", value_type=schema.Choice( source=CataloguingMembers('Descriptive Cataloguing Members'))) form.widget(reviewers=z3c.form.browser.checkbox.CheckBoxFieldWidget) reviewers = schema.Set( title=u"Revizoři", value_type=schema.Choice( source=CataloguingMembers('Descriptive Cataloguing Members')))
class IProducentUsersForm(form.Schema): form.widget(administrators=CheckBoxFieldWidget) administrators = schema.Set ( title = u"Správci", value_type = schema.Choice(source = allProducentMembers) ) form.widget(editors=CheckBoxFieldWidget) editors = schema.Set ( title = u"Editoři", value_type = schema.Choice(source = allProducentMembers) )
class ISettings(Interface): """Add-on settings.""" enabled = schema.Bool( title=_(u'Enabled'), description=_(u'If enabled, it will by default make the entire site ' u'read-only unless it is in debug mode or one of the ' u'activated conditions are met. Basically, this could ' u'mean that you will prevent yourself from disabling ' u'this feature unless you uninstall the package.'), default=False) activated = schema.Set( title=_(u'Activated Commit Conditions'), description=_(u'Select the conditions under which something can be ' u'committed to the database. Only one rules needs to ' u'be valid to allow commits to occur.'), value_type=schema.Choice(vocabulary=u'wildcard.lockdown.conditions'), default=set(), missing_value=set(), required=False) status_message = schema.Text( title=_(u'Status message'), description=_(u'An status message to be displayed to authenticated ' u'users users when the lockdown is enabled. Leave empty to ' u'display nothing.'), required=False, default=u'')
class IFeedControl(Interface): """Feed control settings.""" feeds = schema.Set( title=_(u"Feeds"), description=_(u"Select one or more items from this list " u"to include in the corresponding feed."), required=False, value_type=schema.Choice( vocabulary="collective.chimpfeed.vocabularies.Feeds", ) ) feedCategory = schema.Choice( title=_(u"Feed category"), description=_(u"Please select a category for this item."), required=False, default=None, vocabulary="collective.chimpfeed.vocabularies.Categories", ) feedSchedule = schema.Date( title=_(u'Feed date'), description=_(u'If this date is set, the content will only be ' u'included in Mailchimp-based feeds from this date on. ' u'Otherwise, the "Publishing date" is used.'), required=False, ) feedModerate = schema.Bool( title=_(u'Feed moderation'), description=_(u'Select this option to approve item.'), required=False, )
class IGlobalSettings(Interface): site_local_managers = schema.Set( title=_(u"Site-local panel managers"), description=_(u"The locations listed here will be assignable " u"only at sites (typically Plone's site " u"root, unless local sites are present)."), required=False, value_type=schema.Choice( vocabulary="collective.panels.vocabularies.Managers", )) navigation_local = schema.Bool( title=_(u"Use navigation root"), description=_(u"Site-local panel managers will be assignable " u"on navigation roots instead of only site roots " u"if you select this option. Check this if you are " u"using LinguaPlone, collective.multilingual or " u"similar, and you want per-language Site-local " u"panel managers."), ) css_classes = schema.Tuple( title=_(u"CSS Classes"), description=_(u"Please enter the list of CSS classes, one per line. " u"Format: class or class|descriptive title."), required=False, value_type=schema.TextLine(), )
class IPizzaOrderForm(model.Schema): # Check: https://docs.plone.org/develop/addons/schema-driven-forms/creating-a-simple-form/creating-a-schema.html # and here: https://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/fieldsets.html name = schema.TextLine(title=_(u"Your full name"), required=True) telephone = schema.ASCIILine( title=_(u"Telephone number"), description=_(u"We prefer a mobile number"), required=False, ) # model.fieldset( # 'order123', # label=_(u"Order 123"), # fields=['address1', 'address2', 'postcode', 'orderItems', 'captcha'] # ) address1 = schema.TextLine(title=_(u"Address line 1"), required=False) address2 = schema.TextLine(title=_(u"Address line 2"), required=False) postcode = schema.TextLine(title=_(u"Postcode"), required=False) orderItems = schema.Set( title=_(u"Your order"), value_type=schema.Choice( values=[_(u"Margherita"), _(u"Pepperoni"), _(u"Hawaiian")] ), required=True, ) directives.widget('captcha', ReCaptchaFieldWidget) captcha = schema.TextLine(title=_(u"ReCaptcha"), required=False)
class IEnhancedUserDataSchema(model.Schema): associated = schema.Choice( title=_(u'docentims_signup_associated_title', default=u'I Am Associated With'), description=_(u'', default=u''), required=True, vocabulary='docentims.signup.vocabularies.associated_with', ) signup_groups = schema.Choice( title=_(u'docentims_signup_groups_title', default=u'I am a'), description=_(u'', default=u''), required=True, vocabulary='docentims.signup.vocabularies.signup_groups', ) is_volunteer = schema.Bool( title=_(u'docentims_signup_is_volunteer_title', default=u'I am available to volunteer'), description=_( u'docentims_signup_is_volunteer_description', default=u'We depend on volunteers... How would you like to help?'), required=False, default=False) skills = schema.Set( title=_(u'docentims_signup_skills_title', default=u'Skills I can offer'), description=_(u'', default=u''), required=False, value_type=schema.Choice( vocabulary='docentims.signup.vocabularies.signup_skills'))
class IBooking(Interface): """ schema for booking object """ cat_id = schema.Int(title=_(u"Catalog id"), required=True) uid = schema.ASCIILine(title=_(u"UID"), required=True) date = schema.Date(title=_(u"Date"), required=True) time = schema.Decimal(title=_(u"Hours"), required=True, min=Decimal('0.1')) text = schema.TextLine(title=_(u"Text"), required=True) owner = schema.ASCIILine(title=_(u"Owner ID"), required=True) references = schema.List(title=_(u"Related objects"), required=False, value_type=schema.Tuple( title=u"Reference", value_type=schema.ASCIILine(title=u'Stuff'))) tags = schema.Set(title=_(u"Tags"), required=False, value_type=schema.TextLine(title=u"Tag")) def index_references(): """ returns the value to be indexed for ``references`` field
class IEventPortlet(IPortletDataProvider): """A portlet It inherits from IPortletDataProvider because for this portlet, the data that is being rendered and the portlet assignment itself are the same. """ portlet_title = schema.TextLine( title=_(u'Title'), description=_(u'Title of the portlet.'), required=False, default=u'') count = schema.Int(title=_(u'Number of items to display'), description=_(u'How many items to list.'), required=True, default=5) url = schema.TextLine(title=_(u'Dataset url'), description=_(u'Link of the Dataset to display.'), required=True, default=u'http://www.itsatrip.org/api/xmlfeed.ashx') timeout = schema.Int(title=_(u'Feed reload timeout'), description=_(u'Time in minutes after which the feed should be reloaded.'), required=True, default=100) event_types_filter = schema.Set(title=u'Event Types', description=_(u'Only display the events of selected types.'), value_type=schema.Choice(vocabulary= 'itsatrip.portlet.event.EventTypeVocabulary'), required=False,) free_events = schema.Bool(title=_(u'Free events'), description=_(u'Display only free events.'), required=False, default=False)
class INetworkAddressLocations(ILocations): """A set IIPNetworkAddress objects""" locations = schema.Set( title=u'IP Addresses', description=u'a set of INetworkAddress objects', value_type=schema.Field( constraint=lambda v: INetworkAddress.providedBy(v)))
def test_multilanguage_indexer(self): portal_catalog = api.portal.get_tool("portal_catalog") utility = queryUtility(ITaxonomy, name="collective.taxonomy.test") taxonomy = utility.data taxonomy_test = schema.Set( title=u"taxonomy_test", description=u"taxonomy description schema", required=False, value_type=schema.Choice( vocabulary=u"collective.taxonomy.taxonomies"), ) portal_types = api.portal.get_tool("portal_types") fti = portal_types.get("Document") document_schema = fti.lookupSchema() schemaeditor = IEditableSchema(document_schema) schemaeditor.addField(taxonomy_test, name="taxonomy_test") notify(ObjectAddedEvent(taxonomy_test, document_schema)) notify(FieldAddedEvent(fti, taxonomy_test)) query = {} query["taxonomy_test"] = "5" taxo_val = taxonomy["en"][u"\u241fInformation Science\u241fSport"] self.document.taxonomy_test = [taxo_val] self.document.reindexObject() self.assertEqual(len(portal_catalog(query)), 1) # clean up schemaeditor.removeField("taxonomy_test")
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 IDexterityMembraneSettings(Interface): """ Enables through-the-web configuration of some aspects of the dexterity.membrane behaviours. """ local_roles = schema.Set( title=u'Local Roles', description=u'The list of additional local roles members will be ' u'granted in the context of their own profile objects', value_type=schema.TextLine(), required=False, missing_value=set([]), default=set([])) use_email_as_username = schema.Bool( title=u'Use email address for username?', description=u'If checked, the value in the "email" field will be ' u'used as a username/login. If unchecked, your content ' u'type must provide a "username" field.', required=False) use_uuid_as_userid = schema.Bool( title=u'Use object UUID for the userid?', description=u'If checked, the UUID value for the adapted object ' u'will be used for a userid. Otherwise, the username ' u'will be used for the userid.', required=False)
def test_multilanguage_indexer(self): portal_catalog = api.portal.get_tool('portal_catalog') utility = queryUtility(ITaxonomy, name='collective.taxonomy.test') taxonomy = utility.data taxonomy_test = schema.Set( title=u"taxonomy_test", description=u"taxonomy description schema", required=False, value_type=schema.Choice( vocabulary=u"collective.taxonomy.taxonomies"), ) portal_types = api.portal.get_tool('portal_types') fti = portal_types.get('Document') document_schema = fti.lookupSchema() schemaeditor = IEditableSchema(document_schema) schemaeditor.addField(taxonomy_test, name='taxonomy_test') notify(ObjectAddedEvent(taxonomy_test, document_schema)) notify(FieldAddedEvent(fti, taxonomy_test)) query = {} query['taxonomy_test'] = '5' simple_tax = [val for val in taxonomy['en'].values()] taxo_val = simple_tax[3] self.document.taxonomy_test = [taxo_val] self.document.reindexObject() self.assertEqual(len(portal_catalog(query)), 1)
class IBluechurchevent(model.Schema): """ Marker interface for Bluechurchevent """ directives.order_after(city='IEventLocation.location') city = schema.TextLine(title=_(u'label_city', default=u'City'), description=_(u'help_city', default=u''), required=True) directives.order_after(country='city') country = schema.Choice(title=_(u'label_country', default=u'Country'), description=_( u'help_country', default=u'Select the country from the list.'), required=True, vocabulary='collective.address.CountryVocabulary') widget(eventformen='z3c.form.browser.checkbox.CheckBoxFieldWidget') eventformen = schema.Set( title=_(u'Event Type'), value_type=schema.Choice(vocabulary='rohberg.bluechurch.Eventformen'), required=False, ) model.load('bluechurchevent.xml')
class IElasticSettings(Interface): hosts = schema.List(title=u'Hosts', default=[u'127.0.0.1'], unique=True, value_type=schema.TextLine(title=u'Host')) enabled = schema.Bool(title=u'Enabled', default=False) es_only_indexes = schema.Set( title=u'Indexes for which all searches are done through ElasticSearch', default={'Title', 'Description', 'SearchableText'}, value_type=schema.TextLine(title=u'Index'), ) sniff_on_start = schema.Bool(title=u'Sniff on start', default=False) sniff_on_connection_fail = schema.Bool(title=u'Sniff on connection fail', default=False) sniffer_timeout = schema.Float(title=u'Sniffer timeout', required=False, default=None) retry_on_timeout = schema.Bool(title=u'Retry on timeout', default=True) timeout = schema.Float( title=u'Read timeout', description=u'how long before timeout connecting to elastic search', default=2.0) bulk_size = schema.Int(title=u'Bulk Size', description=u'bulk size for elastic queries', default=50)
class IProduct(interface.Interface): id = schema.Int( title=_(u"ID"), readonly=True, ) name = schema.TextLine(title=_(u"Name"), ) product_id = schema.TextLine(title=_(u"ProductNumber")) producer = schema.Choice( title=_(u"Producer"), source=sources('producers_query'), required=False, ) categories = schema.Set( title=_(u"Category"), value_type=schema.Choice(title=_(u""), source=sources('categories')), ) hazards = ListField( title=_(u"Hazards"), value_type=schema.Object(title=_(u""), schema=IHazard), )
class IAddSocialButtonConfig(Schema): code_id = schema.Choice(title=_(u'ID'), source='hexagonit.socialbutton.code-ids') content_types = schema.Set( title=_(u'Content Types'), default=set(u'*'), value_type=schema.Choice( source='hexagonit.socialbutton.content-types')) viewlet_manager = schema.Text( title=_(u'Viewlet Manager'), description=_(u'List names of viewlet manager line by line.'), default=u'plone.belowcontent') view_models = schema.Text( title=_(u'View Models'), description=_( u"List names of view model line by line. For all the views, use '*'" ), default=u'*') view_permission_only = schema.Bool( title=_(u'View permission only'), description=_( u'Display button only for views which has View permission.'), default=True) enabled = schema.Bool(title=_(u'Enabled'), default=True)
class IAddTune(form.Schema): tuneType = schema.Set(title=_(u"Tune Type"), value_type=schema.Choice(values=[_(u'Reel'), _(u'Jig'), _(u'Hornpipe')] ), ) name = schema.TextLine(title=_(u"Your full name"))
class IMembershipModifications(Interface): """ User modifications adapter: an unordered queue for bulk changes that are applied to a workspace context: * context is workspace, which is adapted to IMembershipModifications; * Each assignment or un-assignment is role-group specific, and is queued until self.apply() is called. """ planned_assign = schema.Dict( description=u'Queue of additions to assigned users, to be ' 'applied to context when self.apply() is called. ' 'Should be emptied on successful self.apply(). ' 'Keys are role names like "viewers"; values are ' 'each a set of string user names.', key_type=schema.BytesLine(), value_type=schema.Set(value_type=schema.BytesLine()), ) planned_unassign = schema.Dict( description=u'Queue of additions to assigned users, to be ' 'applied to context when self.apply() is called. ' 'Should be emptied on successful self.apply(). ' 'Keys are role names like "viewers"; values are ' 'each a set of string user names.', key_type=schema.BytesLine(), value_type=schema.Set(value_type=schema.BytesLine()), ) def assign(username, group=BASE_GROUPNAME): """ Queue an assignment of a user to a role group, or confirm existing assignment if already assigned to that group. """ def unassign(username, group=BASE_GROUPNAME): """ Queue an removal of a user from a role group, or confirm existing assignment if already assigned to that group. """ def apply(): """
class ISGPastebinSettings(form.Schema): """ Interface for the form on the control panel. """ form.widget(preferred_languages=TextLinesFieldWidget) preferred_languages = schema.Set( title=_(u"Preferred coding languages"), description= _(u"A list of coding languages that will be highlighted according to their specific syntax." ), required=False, default=set(LANGS), value_type=schema.TextLine(title=_(u"Language"))) form.widget(preferred_languages=TextLinesFieldWidget) preferred_styles = schema.Set( title=_(u"Styles for highlighting syntax"), required=False, default=set([]), value_type=schema.TextLine(title=_(u"Highlighting style")))
class IControlPanelSchema(ISettings): ftis = schema.Set( title=_(u"Content types"), description=_(u"Select which content types should support " u"content in multiple content (the " u"\"Multilingual\" behavior)."), required=False, value_type=schema.Choice( vocabulary="collective.multilingual.vocabularies.FTIs"))
class IRelationFieldSettings(schema.interfaces.IField): portal_type = schema.Set( title=_(u'Types'), description=_(u'Allowed target types'), value_type=schema.Choice( title=_(u'Type'), vocabulary='plone.app.vocabularies.ReallyUserFriendlyTypes'), required=False)
class IMarkable(Interface): """A model implementing this interfaces exposes marker interfaces via a 'features' pseudo attributes, and allows users to modify those attributes via set/mk. """ features = schema.Set( title=u"Features", required=False, value_type=schema.Choice(source=MarkerSourceBinder()))
class IProject(Interface): """A project workspace, where special local roles may apply """ title = schema.TextLine(title=_(u"Title"), description=_(u"Name of the project"), required=True) description = schema.Text(title=_(u"Description"), description=_(u"A short summary of the project"), required=True) managers = schema.List( title=_(u"Managers"), description=_( u"The following users should be managers of this project"), value_type=schema.Choice( title=_(u"User id"), source=UsersSource, ), default=[], required=False) members = schema.List( title=_(u"Members"), description=_( u"The following users should be members of this project"), value_type=schema.Choice( title=_(u"User id"), source=UsersSource, ), default=[], required=False) groups = schema.List( title=_(u"Member groups"), description=_( u"Members of the following groups should be members of this project" ), value_type=schema.Choice( title=_(u"Group id"), source=GroupsSource, ), default=[], required=False) workflow_policy = schema.Choice( title=_(u"Workflow policy"), description=_(u"Choose a workflow policy for this project"), vocabulary="borg.project.WorkflowPolicies") addable_types = schema.Set( title=_(u"Addable types"), description=_(u"These types will be addable by project members"), value_type=schema.Choice(title=_(u"Type id"), vocabulary="borg.project.AddableTypes"))
class ICoupon(model.Schema): code = schema.TextLine(title=u'Code', ) categories = schema.Set( title=u'Product Category', description=u'If specified, this coupon will only apply to ' u'products from the specified categories.', value_type=schema.Choice( vocabulary='jazkarta.shop.product_categories', ), ) scope = schema.Choice( title=u'Discount applies to', values=( u'One item', u'All items in cart', ), ) amount = Currency(title=u'Discount Amount', ) unit = schema.Choice( title=u'Discount Unit', values=(u'$', u'%'), ) per_user_limit = schema.Int( title=u'Use Limit Per User', description=u'The number of times this coupon may be used ' u'by an individual. Enter 0 for unlimited.', default=1, ) product = schema.Choice( title=u'Specific Product', description=u'Optionally specify one product to which this coupon ' u'may be applied.', source=CatalogSource( object_provides='jazkarta.shop.interfaces.IProduct'), required=False, ) # excluded_products = schema.Set( # title=u'Excluded Products', # description=u'Products for which this coupon may not be used.', # value_type=schema.Choice( # source=CatalogSource( # object_provides='jazkarta.shop.interfaces.IProduct'), # ), # required=False, # ) start = schema.Datetime(title=u'Start Date', ) end = schema.Datetime(title=u'End Date', )
class IDocTypeSettings(Interface): """设置各种类型项目文档,分析文档/测试文档等,用于构建项目文档的标题词汇 """ types = schema.Set( title=_(u"document types"), description=_(u"List project folder allow add document types."), required=True, default=set(), value_type=schema.TextLine(title=_(u"Type")), )
class IMaking(Interface): """复制文档类型设置 """ types = schema.Set( title=_(u"zhi ding yu xia fa"), description=_(u"List project folder allow add zhi ding yu xia fa."), required=True, default=set(), value_type=schema.TextLine(title=_(u"zhi ding")), )