class IDocument(form.Schema, IImageScaleTraversable): """ Document """ dexteritytextindexer.searchable('title') title = schema.TextLine( title=_(u"Title"), required=False, ) dexteritytextindexer.searchable('multifile') write_permission(multifile='cmf.ReviewPortalContent') read_permission(multifile='cmf.ReviewPortalContent') # multifile = NamedBlobFile( # title=_(u"Document"), # description=_(u"Please attach a file"), # required=False, # ) form.widget(multifile=MultiFileFieldWidget) multifile = schema.List( title=_(u"Document"), required=False, value_type=NamedFile(), ) pass
class ISource(model.Schema): """ Marker interface and Dexterity Python Schema for Source """ # If you want, you can load a xml model created TTW here # and customize it in Python: # model.load('source.xml') # TODO A Selection field of fields in Parent Object dexteritytextindexer.searchable('title') title = schema.TextLine( title=_(u'Title'), description=_(u'Title of publication, article ..'), ) dexteritytextindexer.searchable('description') description = schema.Text( title=_(u'Description'), description=_(u'One line description of this source'), required=False, ) dexteritytextindexer.searchable('author') author = schema.TextLine( title=_(u'Author or Website Name'), required=False, ) url = schema.URI(title=_(u'Source Link'), )
class IResource(form.Schema, IImageScaleTraversable): """ Publications, Training Materials, Videos and more """ dexteritytextindexer.searchable('title') title = schema.TextLine(title=u'Name', description=u'Name of resource.') dexteritytextindexer.searchable('description') description = schema.Text(title=u'Description', description=u'Brief description ' 'of resource.') resource_type = schema.Choice(title=_(u'Type'), vocabulary="sinarngo.resource.types") dexteritytextindexer.searchable('details') form.widget(details="plone.app.z3cform.wysiwyg.WysiwygFieldWidget") details = schema.Text( title=_(u"Details"), required=False, ) attachment_1 = NamedFile(title=_(u'Attachment 1'), required=False) attachment_2 = NamedFile(title=_(u'Attachment 2'), required=False) attachment_3 = NamedFile(title=_(u'Attachment 2'), required=False) url = schema.TextLine(title=_(u'URL'), required=False)
class IUserProfile(form.Schema): """The core user profile schema. Most of the plone intranet UI relies on these fields. """ dexteritytextindexer.searchable('username') username = schema.TextLine( title=_(u"Username"), required=True ) person_title = schema.TextLine( title=_(u"Person title"), required=False ) dexteritytextindexer.searchable('first_name') first_name = schema.TextLine( title=_(u"First name"), required=True ) dexteritytextindexer.searchable('last_name') last_name = schema.TextLine( title=_(u"Last name"), required=True ) dexteritytextindexer.searchable('email') email = schema.TextLine( title=_(u"Email"), required=True ) portrait = NamedBlobImage( title=_(u"Photo"), required=False )
class IContactDetail(model.Schema): """ Marker interface and Dexterity Python Schema for ContactDetail """ # If you want, you can load a xml model created TTW here # and customize it in Python: # model.load('contact_detail.xml') dexteritytextindexer.searchable('label') label = schema.TextLine( title=_(u'Label'), description=_(u"A human-readable label for the contact detail"), ) type = schema.Choice( title=_(u'Type'), description=_(u'A type of medium, eg. mobile phone or email'), vocabulary=contact_types, ) dexteritytextindexer.searchable('value') value = schema.TextLine( title=_(u'Value'), description=_(u"A value, e.g. a phone number or email address"), ) dexteritytextindexer.searchable('note') note = schema.Text( title=_(u'Note'), description=_(u"A note, e.g. for grouping contact details by " + u"physical location"), required=False, )
class ISubpunt(form.Schema): """ Subpunt: Molt similar el PUNT """ fieldset( 'subpunt', label=_(u'Tab subpunt'), fields=['title', 'proposalPoint', 'defaultContent', 'estatsLlista']) dexteritytextindexer.searchable('title') title = schema.TextLine(title=_(u'Subpunt Title'), required=True) form.mode(proposalPoint='hidden') proposalPoint = schema.TextLine(title=_(u'Proposal point number'), required=False) directives.widget(defaultContent=WysiwygFieldWidget) dexteritytextindexer.searchable('defaultContent') defaultContent = schema.Text( title=_(u"Proposal description"), required=False, ) estatsLlista = schema.Choice( title=_(u"Agreement and document labels"), source=llistaEstats, required=True, )
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 IFile(form.Schema): """ File: Per adjuntar els fitxers públics i/o privats A la part pública només fitxers PDF """ fieldset('file', label=_(u'Tab file'), fields=['title', 'description', 'visiblefile', 'hiddenfile']) dexteritytextindexer.searchable('title') title = schema.TextLine(title=_PMF(u'label_title', default=u'Title'), required=True) dexteritytextindexer.searchable('description') description = schema.Text( title=_PMF(u'label_description', default=u'Summary'), description=_PMF(u'help_description', default=u'Used in item listings and search results.'), required=False, missing_value=u'', ) visiblefile = NamedBlobFile( title=_(u"Please upload a public file"), description=_(u"Published file description"), required=False, ) hiddenfile = NamedBlobFile( title=_(u"Please upload a reserved file"), description=_(u"Reserved file description"), required=False, )
class IOtherName(model.Schema): """ Marker interface and Dexterity Python Schema for OtherName Used for Persons """ # If you want, you can load a xml model created TTW here # and customize it in Python: # model.load('other_name.xml') dexteritytextindexer.searchable('name') name = schema.TextLine( title=_(u'Name'), required=False, ) dexteritytextindexer.searchable('note') note = schema.Text( title=_(u'Note'), description=_(u'Birth name'), required=False, ) start_date = schema.Date( title=_(u'Start Date'), required=False, ) end_date = schema.Date( title=_(u'End Date'), required=False, )
class IAudio(form.Schema): """ Audio: only audio files are permitted """ fieldset('audio', label=_(u'Tab audio'), fields=['title', 'description', 'file'] ) dexteritytextindexer.searchable('title') title = schema.TextLine( title=_PMF(u'label_title', default=u'Title'), required=True ) dexteritytextindexer.searchable('description') description = schema.Text( title=_PMF(u'label_description', default=u'Summary'), description=_PMF( u'help_description', default=u'Used in item listings and search results.' ), required=False, missing_value=u'', ) file = NamedBlobFile( title=_(u"Please upload a media file"), description=_(u"Only audio files are permitted."), required=True, )
class IOpenGeverBase(model.Schema): """ IOpengeverBase contains title and description fields This is a schema interface, not a marker interface! """ model.fieldset( u'common', label=_(u'fieldset_common', default=u'Common'), fields=[ u'title', u'description', ], ) dexteritytextindexer.searchable('title') title = schema.TextLine( title=_(u'label_title', default=u'Title'), required=True ) dexteritytextindexer.searchable('description') description = schema.Text( title=_(u'label_description', default=u'Description'), required=False, missing_value=u'', default=u'', )
class IContatti(model.Schema): """ """ telefono = schema.TextLine( title=_("telefono_label", default="Telefono"), description=_( "telefono_help", default="Indicare un riferimento telefonico per poter contattare" " i referenti.", ), required=False, ) fax = schema.TextLine( title=_("fax_label", default="Fax"), description=_("fax_help", default="Indicare un numero di fax."), required=False, ) email = schema.TextLine( title=_("email_label", default="E-mail"), description=_( "email_help", default="Indicare un indirizzo mail per poter contattare" " i referenti.", ), required=False, ) pec = schema.TextLine( title=_("pec_label", default="Pec"), description=_( "pec_help", default="Indicare un indirizzo pec per poter contattare" " i referenti.", ), required=False, ) web = schema.TextLine( title=_("web_label", default="Sito web"), description=_("web_help", default="Indicare un indirizzo web di riferimento."), required=False, ) orario_pubblico = BlocksField( title=_("orario_pubblico_label", default="Orario per il pubblico"), description=_( "orario_pubblico_help", default="Indicare eventuali orari di accesso al pubblico", ), required=False, ) dexteritytextindexer.searchable("orario_pubblico") dexteritytextindexer.searchable("email") dexteritytextindexer.searchable("pec") dexteritytextindexer.searchable("web")
class IMissingFieldBehavior(form.Schema): """A behavior defining a field as searchable which does not exist. """ dexteritytextindexer.searchable('foo') foo = schema.TextLine(title=u'Foo') dexteritytextindexer.searchable('bar')
class IABCTune(form.Schema): dexteritytextindexer.searchable('abc') form.primary('abc') abc = schema.Text(title=_(u"Tune abc"), description=_(u'The tune in abc format'),) dexteritytextindexer.searchable('tunekeys') form.omitted('tunekeys') tunekeys = schema.List(title=u'keys', description=u'set by abc content', required=False, value_type=schema.TextLine(required=False), ) dexteritytextindexer.searchable('tunetype') form.omitted('tunetype') tunetype = schema.TextLine(title=_(u"The type of the tune"), description=_(u"from the field R:"), required=False, ) # NOTE: as specified in the v2.1 standard, A: field is deprecated # so, only O: is used to specified country and areas... separated # by ';' dexteritytextindexer.searchable('tunearea') form.omitted('tunearea') tunearea = schema.TextLine(title=tunearea_title, description=tunearea_desc, required=False, ) dexteritytextindexer.searchable('tunecountry') form.omitted('tunecountry') tunecountry = schema.TextLine(title=tunecountry_title, description=_(u"The country"), required=False, ) form.omitted('score') score = NamedBlobImage(title=_(u"Score"), description=score_desc, required=False,) form.omitted('pdfscore') pdfscore = NamedBlobFile(title=_(u"PDF Score"), description=_(u'The score of the tune as PDF'), required=False, ) form.omitted('midi') midi = NamedBlobFile(title=_(u"Midi"), description=_(u'Midi sound of the tune'), required=False, ) form.omitted('sound') sound = NamedBlobFile(title=_(u"sound"), description=_(u'The mp3 sound of the tune'), required=False, )
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 IDirectoryItemBase(IDirectoryRoot): searchable('title') title = TextLine(title=_(u'Name'), ) searchable('description') description = Text(title=_(u'Description'), required=False, default=u'', missing_value=u'')
class IAcord(form.Schema): """ Acord """ fieldset('acord', label=_(u'Tab acord'), fields=[ 'title', 'proposalPoint', 'agreement', 'defaultContent', 'estatsLlista' ]) dexteritytextindexer.searchable('title') title = schema.TextLine(title=_(u'Acord Title'), required=True) form.mode(proposalPoint='hidden') proposalPoint = schema.TextLine( title=_(u'Proposal point number'), required=False, ) form.mode(agreement='hidden') dexteritytextindexer.searchable('agreement') agreement = schema.TextLine( title=_(u'Agreement number'), required=False, ) directives.widget(defaultContent=WysiwygFieldWidget) dexteritytextindexer.searchable('defaultContent') defaultContent = schema.Text( title=_(u"Proposal description"), required=False, ) estatsLlista = schema.Choice( title=_(u"Agreement and document label"), source=llistaEstats, required=True, ) directives.omitted('estatVotacio') estatVotacio = schema.Choice(title=u'', source=llistaEstatsVotacio, required=False) directives.omitted('tipusVotacio') tipusVotacio = schema.Choice(title=u'', source=llistaTipusVotacio, required=False) directives.omitted('horaIniciVotacio') horaIniciVotacio = schema.Text(title=u'', required=False) directives.omitted('horaFiVotacio') horaFiVotacio = schema.Text(title=u'', required=False) directives.omitted('infoVotacio') infoVotacio = schema.Text(title=u'', required=False, default=u'{}')
class ITranslatedTitle(model.Schema): """Behavior schema adding translated title fields to dexterity content. """ form.order_before(title_de='*') searchable('title_de') title_de = TextLine(title=_(u'label_title_de', default=u'Title (German)'), required=True) form.order_before(title_fr='*') searchable('title_fr') title_fr = TextLine(title=_(u'label_title_fr', default=u'Title (French)'), required=True)
class IQuestion(form.Schema, IImageScaleTraversable): """ Question """ # topic = schema.TextLine( # title=_(u"Topic"), # required=True, # ) # topic = schema.Choice(title = u"Topic",source=topics(), required=True) title = schema.TextLine( title=_(u"Question Title"), required=True, ) dexteritytextindexer.searchable('question_details') form.widget(question_details=WysiwygFieldWidget) question_details = schema.Text( title=u"Question Details", required=False, ) form.mode(IEditForm, topic='display') form.widget(topic=RadioFieldWidget) topic = schema.List(title=u'Topic', required=False, value_type=schema.Choice(source=topics())) dexteritytextindexer.searchable('question_creator') form.mode(question_creator='hidden') question_creator = schema.TextLine( title=_(u"Question Creator"), required=False, ) dexteritytextindexer.searchable('topic_officer') form.mode(topic_officer='hidden') topic_officer = schema.TextLine( title=_(u"Topic Creator"), required=False, ) dexteritytextindexer.searchable('topics_str') form.mode(topics_str='hidden') topics_str = schema.TextLine( title=_(u"Topics"), required=False, ) pass
class IWorkGroup(IGroup, IMembraneGroupProperties, form.Schema): """The core group schema. Most of the plone intranet UI relies on these fields. """ dexteritytextindexer.searchable('id') id = schema.TextLine( title=_(u"ID"), required=True, missing_value=u'', ) canonical = schema.TextLine( title=_(u"Canonical Group ID (may contain spaces)"), required=False, default=u'', missing_value=u'', ) dexteritytextindexer.searchable('title') title = schema.TextLine( title=_(u"Title"), required=False, default=u'', missing_value=u'', ) dexteritytextindexer.searchable('description') description = schema.TextLine( title=_(u"Description"), required=False, default=u'', missing_value=u'', ) dexteritytextindexer.searchable('mail') mail = schema.TextLine( title=_(u"Email"), required=False, default=u'', missing_value=u'', ) members = schema.List( value_type=schema.ASCIILine(title=_(u'label_member_id', u'ID of a member'), required=True, default=''), title=_(u"Members"), required=False, default=[], missing_value=[], )
class IArea(model.Schema): """ Marker interface and Dexterity Python Schema for Area Reference Schema Popolo-spec Area JSON Schema https://www.popoloproject.com/specs/area.html """ # The Area class should have properties for: name, identifier, classification, parent area, geometry. dexteritytextindexer.searchable('name') name = schema.TextLine( title=_(u'Area Name'), description=_(u'A primary name, e.g. a legally recognized ' + 'name'), required=True, ) classification = schema.Choice( title=_(u'Area Classification'), description=_(u'An area category, e.g. city'), required=False, vocabulary='popolo.contenttypes.geonamefeaturecodes', ) directives.widget('parent_area', RelatedItemsFieldWidget, pattern_options={ 'basePath': '/', 'mode': 'auto', 'favourites': [], }) parent_area = RelationChoice( title=_(u'Parent Area'), description=_(u'The area that contains this area'), source=CatalogSource(portal_type='Area'), required=False, ) dexteritytextindexer.searchable('identifier') description = schema.Text( title=_(u'Identifier'), description=_( u'An issued identifier, e.g. an Open Civic Data Division Identifier' ), required=False, ) description = schema.Text( title=_(u'Geometry'), description=_(u'A geometry'), required=False, )
class IItem(model.Schema): """ Marker interface and Dexterity Python Schema for Item """ dexteritytextindexer.searchable("formatted_title") formatted_title = RichText(title=plone_(u"Title"), required=False, readonly=True) number = schema.TextLine(title=_(u"Item number"), required=True, readonly=True) sortable_number = schema.Int(title=_(u"Sortable Item number"), required=True, readonly=True) plonemeeting_uid = schema.TextLine(title=_(u"UID Plonemeeting"), required=True, readonly=True) representatives_in_charge = schema.List( value_type=schema.Choice( vocabulary="plonemeeting.portal.vocabularies.representatives"), title=_(u"Representative group in charge"), required=False, readonly=True, ) additional_data = RichText(title=_(u"Additional data"), required=False, readonly=True) dexteritytextindexer.searchable("decision") decision = RichText(title=_(u"Decision"), required=False, readonly=True) category = schema.Choice( vocabulary="plonemeeting.portal.vocabularies.global_categories", title=_(u"Category"), required=False, readonly=True, ) custom_info = RichText(title=_(u"Custom info"), required=False) plonemeeting_last_modified = schema.Datetime( title=_(u"Last modification in iA.Delib"), required=True, readonly=True)
class IPost(model.Schema): """ Marker interface and Dexterity Python Schema for Post """ # If you want, you can load a xml model created TTW here # and customize it in Python: # model.load('post.xml') dexteritytextindexer.searchable('label') label = schema.TextLine( title=_(u'Label'), description=_(u"A describing the Post"), required=True, ) dexteritytextindexer.searchable('role') role = schema.TextLine( title=_(u'Role'), description=_(u"THe function that the holder of the " + "post fulfills"), required=True, ) # Organization directives.widget('organization', RelatedItemsFieldWidget, pattern_options={ 'basePath': '/', 'mode': 'auto', 'favourites': [], }) organization = RelationChoice( title=u'Organization', source=CatalogSource(portal_type='Organization'), required=False, ) start_date = schema.Date( title=_(u'Start Date'), description=_(u'Date this post was created'), required=False, ) end_date = schema.Date( title=_('End Date'), description=_(u'Date which this post was eliminated'), required=False, )
class IDocumentSchema(model.Schema): """Document Schema Interface.""" model.fieldset( u'common', label=_(u'fieldset_common', u'Common'), fields=[ u'title', u'file', ], ) dexteritytextindexer.searchable('title') form.order_before(title='IDocumentMetadata.description') title = schema.TextLine(title=_(u'label_title', default=u'Title'), required=False) model.primary('file') form.order_after(file='IDocumentMetadata.document_author') file = field.NamedBlobFile( title=_(u'label_file', default='File'), description=_(u'help_file', default=''), required=False, ) @invariant def title_or_file_required(data): if not data.title and not data.file: raise Invalid( _(u'error_title_or_file_required', default=u'Either the title or the file is ' 'required.'))
class ICOPItem(form.Schema, IImageScaleTraversable): """ COP Item """ title = schema.TextLine( title=_(u"Title"), required=True, ) description = schema.Text( title=_(u"Description"), required=True, ) dexteritytextindexer.searchable('body') form.widget(body=WysiwygFieldWidget) body = schema.Text(title=u"Body") #leadimage = NamedBlobImage( # title=_(u"Lead Image"), # required=False, #) pass
class Ilocalizacao(Schema): title = schema.TextLine(title=_(u'País'), required=True) cidade = schema.TextLine(title=_(u'Cidade'), required=True) sigla = schema.TextLine(title=_(u'Sigla(estado/paíss)'), description=_(u'abreviatura'), required=False) dexteritytextindexer.searchable('title', 'cidade', 'sigla')
class Iusuario(Interface): title = schema.TextLine(title=_(u'Nome'), required=True) description = schema.TextLine(title=_(u'Sobrenome'), required=False) apelido = schema.TextLine(title=_(u'Apelido'), required=True) cpf = schema.TextLine(title=_(u'CPF'), description=_(u'Deve ter 11 digitos'), required=True, min_length=0, max_length=11) sexo = schema.Choice(title=_(u'sexo'), vocabulary=opSexos, required=False) #Add varios elementos na lista filmesFavoritos = RelationList( title=_(u'Filmes Favoritos'), value_type=RelationChoice(source=CatalogSource(portal_type='filme')), description=_( u'Dos filmes que estao no sistema, dizer quais declara favorito'), required=False, ) #Add um elemento # filmesFavoritos = RelationChoice( # title = _(u'Filmes Favoritos'), # source = CatalogSource(portal_type = 'filme'), # required = False, # ) endereco = schema.Choice(title=_(u"Endereco"), source=getPaises, required=False) aniversario = schema.Date(title=(u'Data de Nascimento'), required=False) dexteritytextindexer.searchable('title', 'description', 'apelido')
class IListBehavior(form.Schema): """More advanced behavior with a list of fields. """ dexteritytextindexer.searchable('list_field') list_field = schema.List(title=u'List field', value_type=schema.TextLine())
class ILayoutAware(model.Schema): """Behavior interface to make a type support layout. """ if HAS_DXTEXTINDEXER: searchable('content') content = LayoutField( title=_(u"Custom layout"), description=_(u"Custom content and content layout of this page"), defaultFactory=layoutFieldDefaultValueFactory, required=False) pageSiteLayout = schema.Choice(title=_(u"Site layout"), description=_( u"Site layout to apply to this page " u"instead of the default site layout"), vocabulary="plone.availableSiteLayouts", required=False) sectionSiteLayout = schema.Choice( title=_(u"Section site layout"), description=_(u"Site layout to apply to sub-pages of this page " u"instead of the default site layout"), vocabulary="plone.availableSiteLayouts", required=False) fieldset('layout', label=_('Layout'), fields=('content', 'pageSiteLayout', 'sectionSiteLayout'))
class IOGMail(form.Schema): """Opengever specific behavior, which add a title Field to the form. """ form.fieldset( u'common', label=base_mf(u'fieldset_common', u'Common'), fields=[u'title', 'original_message', 'message_source']) form.order_before(title='message') dexteritytextindexer.searchable('title') title = schema.TextLine( title=dossier_mf(u'label_title', default=u'Title'), required=False, ) form.mode(original_message=DISPLAY_MODE) form.read_permission(original_message='cmf.ManagePortal') form.write_permission(original_message='cmf.ManagePortal') original_message = field.NamedBlobFile( title=_(u'label_original_message', default=u'Raw *.msg message before conversion'), required=False, ) form.mode(message_source=DISPLAY_MODE) form.read_permission(message_source='cmf.ManagePortal') form.write_permission(message_source='cmf.ManagePortal') message_source = schema.Choice( title=_('label_message_source', default='Message source'), vocabulary=get_message_source_vocabulary(), required=False, )