class CreationCulturelleApplicationSchema(VisualisableElementSchema): """Schema for application configuration.""" name = NameSchemaNode(editing=context_is_a_root, ) titles = colander.SchemaNode( colander.Sequence(), colander.SchemaNode(colander.String(), name=_("Title")), widget=SequenceWidget(), default=DEFAULT_TITLES, title=_('List of titles'), ) tree = colander.SchemaNode( typ=DictSchemaType(), validator=colander.All(keywords_validator), widget=keyword_widget, default=DEFAULT_TREE, title=_('Categories'), ) organizations = colander.SchemaNode( colander.Sequence(), omit( OrganizationSchema(factory=Organization, editable=True, name=_('Organization'), widget=SimpleMappingWidget( css_class='object-well default-well'), omit=['managers']), ['_csrf_token_']), widget=organizations_choice, title=_('Organizations'), )
class GameSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for Web advertising""" name = NameSchemaNode(editing=context_is_a_game, ) description = colander.SchemaNode(colander.String(), widget=RichTextWidget(), title=_("Description"), missing="") winners = colander.SchemaNode(colander.Set(), widget=winners_widget, title=_('Winners')) winner_number = colander.SchemaNode(colander.Int(), title=_('Winner number')) participants = colander.SchemaNode(colander.Set(), widget=participants_widget, title=_('Participants')) start_date = colander.SchemaNode(colander.DateTime(), title=_('Start date')) end_date = colander.SchemaNode(colander.DateTime(), title=_('End date')) announcement = colander.SchemaNode(ObjectType(), widget=announcement_choice, missing=None, title=_("Cultural event")) picture = colander.SchemaNode(ObjectData(Image), widget=picture_widget, title=_('Picture'), missing=None)
class ContactSchema(Schema): name = NameSchemaNode( editing=lambda c, r: r.registry.content.istype(c, 'Contact'), ) firstname= colander.SchemaNode( colander.String(), ) lastname= colander.SchemaNode( colander.String(), ) email= colander.SchemaNode( colander.String(), ) telephone= colander.SchemaNode( colander.String(), ) bio = colander.SchemaNode( colander.String(), widget=deform.widget.RichTextWidget() )
class DocumentSchema(Schema): name = NameSchemaNode(editing=context_is_a_document, ) title = colander.SchemaNode(colander.String(), ) icon = colander.SchemaNode( colander.String(), missing='', ) image = colander.SchemaNode( colander.String(), missing='', ) body = colander.SchemaNode( colander.String(), missing='', widget=deform.widget.TextAreaWidget(rows=20, cols=70), ) body_format = colander.SchemaNode( colander.String(), validator=colander.OneOf(['rst', 'html']), widget=deform.widget.SelectWidget(values=[('rst', 'rst'), ('html', 'html')]), ) created = colander.SchemaNode( colander.Date(), default=today, ) modified = colander.SchemaNode( colander.Date(), default=today, ) creator = colander.SchemaNode( colander.String(), default=current_username, )
class DocumentSchema(Schema): name = NameSchemaNode(editing=context_is_a_document, ) title = colander.SchemaNode(colander.String(), ) author = colander.SchemaNode(colander.String(), ) body = colander.SchemaNode(colander.String(), widget=deform.widget.RichTextWidget()) refs = MultireferenceIdSchemaNode(choices_getter=get_all_documents, )
class IdeaSchema(Schema): name = NameSchemaNode( editing=lambda c, r: r.registry.content.istype(c, 'Idea'), ) title = colander.SchemaNode(colander.String(), ) author = colander.SchemaNode(colander.String(), ) text = colander.SchemaNode(colander.String(), widget=deform.widget.RichTextWidget())
class WebAdvertisingSchema(AdvertisingSchema): """Schema for Web advertising""" name = NameSchemaNode(editing=context_is_a_webadvertising, ) tree = colander.SchemaNode( typ=DictSchemaType(), widget=keyword_widget, default=DEFAULT_TREE, missing=None, title=_('Categories'), ) home_page = colander.SchemaNode( colander.Boolean(), default=False, missing=False, label=_('Not'), title=None, description=_('Home page'), ) picture = colander.SchemaNode( ObjectData(File), widget=get_file_widget(item_css_class="advertising-file-content", css_class="file-content", file_type=['image', 'flash']), title=_('Advertisement file'), description=_("Only image and flash files are supported."), missing=None) html_content = colander.SchemaNode( colander.String(), widget=RichTextWidget(item_css_class="advertising-html-content", css_class="html-content-text"), title=_("Or HTML content"), missing="") advertisting_url = colander.SchemaNode(colander.String(), title=_('URL'), missing="#") positions = colander.SchemaNode(colander.Set(), widget=advertisting_widget, title=_('Positions')) @invariant def content_invariant(self, appstruct): if not (appstruct['html_content'] or appstruct['picture']): raise colander.Invalid(self, _('Content will be defined.')) @invariant def banner_invariant(self, appstruct): positions = appstruct['positions'] if positions: for position in positions: ADVERTISING_CONTAINERS[position]['validator']( self.get('picture'), appstruct)
class ArtistInformationSheetSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for artist""" name = NameSchemaNode( editing=context_is_a_artist, ) id = colander.SchemaNode( colander.String(), widget=deform.widget.HiddenWidget(), title=_('Id'), missing="" ) title = colander.SchemaNode( colander.String(), widget=deform.widget.HiddenWidget(), title=_('Title') ) description = colander.SchemaNode( colander.String(), widget=deform.widget.TextAreaWidget(rows=4, cols=60), title=_('Description'), missing="" ) biography = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Biography"), missing="" ) picture = colander.SchemaNode( ObjectData(Image), widget=picture_widget, title=_('Picture'), required=False, missing=None, ) is_director = colander.SchemaNode( colander.Boolean(), widget=deform.widget.CheckboxWidget(), label=_('Is a director'), title='', default=False, missing=False ) origin_oid = colander.SchemaNode( colander.Int(), widget=deform.widget.HiddenWidget(), title=_('OID'), missing=0 )
class OptionalVenueSchema(VisualisableElementSchema, SearchableEntitySchema): typ_factory = ObjectData name = NameSchemaNode( editing=context_is_a_venue, ) id = colander.SchemaNode( colander.String(), widget=deform.widget.HiddenWidget(), title="ID", missing="" ) title = colander.SchemaNode( colander.String(), widget=venue_choice, title=_('Venue title'), description=_('Indicate the venue (room, theatre, lecture hall, square, etc.).'), ) description = colander.SchemaNode( colander.String(), widget=RichTextWidget(), description=_("Vous pouvez ajouter ou éditer la description du lieu. Cette description doit porter sur le lieu de l'annonce et non sur l'annonce."), title=_("Venue description") ) addresses = colander.SchemaNode( colander.Sequence(), omit(AddressSchema(name='address', widget=SimpleMappingWidget( css_class='address-well object-well default-well')), ['_csrf_token_']), widget=SimpleSequenceWidget( min_len=1, add_subitem_text_template=_('Add a new address'), remove_subitem_text_template=_('Remove the address')), title=_('Venue addresses'), ) other_conf = omit(MoreInfoVebueSchema(widget=SimpleMappingtWidget( mapping_css_class='controled-form' ' object-well hide-bloc', ajax=True, control_css_class='optional-venue-form', activator_css_class="glyphicon glyphicon-map-marker", activator_title=_("Avez-vous une minute ? Afin d'améliorer la visibilité et la pertinence de votre événement, pensez à vérifier ou compléter les informations associées au lieu en cliquant ici."))), ["_csrf_token_"]) origin_oid = colander.SchemaNode( colander.Int(), widget=deform.widget.HiddenWidget(), title=_('OID'), missing=0 )
class ProposalSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for Proposal""" name = NameSchemaNode( editing=context_is_a_proposal, ) challenge = colander.SchemaNode( ObjectType(), widget=challenge_choice, missing=None, title=_("Challenge (optional)"), description=_("You can select and/or modify the challenge associated to this proposal. " "For an open proposal, do not select anything in the « Challenge » field.") ) description = colander.SchemaNode( colander.String(), validator=colander.Length(max=600), widget=LimitedTextAreaWidget(rows=5, cols=30, limit=600), title=_("Abstract") ) text = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Text") ) related_ideas = colander.SchemaNode( colander.Set(), widget=ideas_choice, title=_('Related ideas'), validator=Length(_, min=1), default=[], ) add_files = omit(AddFilesSchemaSchema( widget=SimpleMappingtWidget( mapping_css_class='controled-form' ' object-well default-well hide-bloc', ajax=True, activator_icon="glyphicon glyphicon-file", activator_title=_('Add files'))), ["_csrf_token_"]) anonymous = colander.SchemaNode( colander.Boolean(), widget=anonymous_widget, label=_('Remain anonymous'), description=_('Check this box if you want to remain anonymous.'), title='', missing=False, default=False )
class BlogEntrySchema(Schema): title = colander.SchemaNode(colander.String()) body = colander.SchemaNode( colander.String(), widget=deform.widget.RichTextWidget(options={ "menubar": False, "plugins": "link image", })) pub_date = colander.SchemaNode(colander.DateTime()) name = NameSchemaNode(editing=True)
class CandidacySchema(VisualisableElementSchema): """Schema for Candidacy""" name = NameSchemaNode(editing=context_is_a_candidacy, ) body = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_('Application'), )
class OrganizationSchema(GroupSchema): """Schema for Organization""" name = NameSchemaNode(editing=context_is_a_organization, ) function = colander.SchemaNode( colander.String(), widget=function_widget, title=_('Function'), ) logo = colander.SchemaNode( ObjectData(Image), widget=get_file_widget(), required=False, missing=None, title=_('Logo'), ) email = colander.SchemaNode( colander.String(), widget=EmailInputWidget(), validator=colander.All(colander.Email(), colander.Length(max=100)), missing='', title=_('Email'), ) phone = colander.SchemaNode( DictSchemaType(), validator=colander.All(PhoneValidator()), missing="", widget=PhoneWidget(css_class="contact-phone"), title=_("Phone number"), description= _("Indicate the phone number. Only spaces are allowed as separator for phone numbers." )) fax = colander.SchemaNode( DictSchemaType(), validator=colander.All( PhoneValidator( _('${phone} fax number not valid for the selected country (${country})' ))), widget=PhoneWidget(css_class="contact-fax"), title=_("Fax"), missing='', description= _("Indicate the fax number. Only spaces are allowed as separator for fax numbers." )) managers = colander.SchemaNode( colander.Set(), widget=members_choice, title=_('Managers'), )
class IdeaSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for idea""" name = NameSchemaNode(editing=context_is_a_idea, ) challenge = colander.SchemaNode( ObjectType(), widget=challenge_choice, missing=None, title=_("Challenge (optional)"), description= _("You can select and/or modify the challenge associated to this idea. " "For an open idea, do not select anything in the « Challenge » field." )) text = colander.SchemaNode( colander.String(), widget=LimitedTextAreaWidget( rows=5, cols=30, limit=2000, alert_template='novaideo:views/templates/idea_text_alert.pt', alert_values={'limit': 2000}, item_css_class='content-preview-form', placeholder=_('I have an idea!')), title=_("Text")) note = colander.SchemaNode(colander.String(), widget=LimitedTextAreaWidget( rows=3, cols=30, limit=300, alert_values={'limit': 300}), title=_("Note"), missing="") attached_files = colander.SchemaNode( colander.Sequence(), colander.SchemaNode(ObjectData(File), name=_("File"), widget=get_file_widget()), widget=FilesWidget(add_subitem_text_template='', item_css_class='files-block'), missing=[], title=_('Attached files'), ) anonymous = colander.SchemaNode( colander.Boolean(), widget=anonymous_widget, label=_('Remain anonymous'), description=_('Check this box if you want to remain anonymous.'), title='', missing=False, default=False)
class BookFolderSchema(Schema): """ **Substanced** schemas are defined using the **colander** library. Note the use of ``context_is_a_book_folder`` defined above. """ name = NameSchemaNode( editing=context_is_a_book_folder, ) title = colander.SchemaNode( colander.String(), )
class DocumentSchema(Schema): name = NameSchemaNode( editing=context_is_a_document, ) title = colander.SchemaNode( colander.String(), ) body = colander.SchemaNode( colander.String(), widget=deform.widget.RichTextWidget() )
class KeywordSchema(VisualisableElementSchema): """Schema for keyword""" name = NameSchemaNode(editing=context_is_a_keyword, ) title = colander.SchemaNode( colander.String(), widget=keywords_choice, title=_('/'), missing="", )
class ScheduleSchema(VisualisableElementSchema): """Schema for schedule""" name = NameSchemaNode(editing=context_is_a_schedule, ) dates = colander.SchemaNode( colander.String(), validator=dates_validator, widget=DateIcalWidget(css_class="schedule-dates"), description=_('Indicate the dates and hours of the event.'), title=_('Dates'), ) ticket_type = colander.SchemaNode( colander.String(), widget=ticket_type_choice, title=_('Ticket type'), ) ticketing_url = colander.SchemaNode( colander.String(), widget=TextInputWidget(item_css_class="hide-bloc item-price"), title=_('Ticketing URL'), description= _('If you have an online ticketing service, you can enter the URL here.' ), missing='') price = colander.SchemaNode( colander.String(), default='0', widget=TextInputWidget(item_css_class="hide-bloc item-price"), title=_('Price'), ) venue = omit( select( OptionalVenueSchema( editable=True, factory=Venue, omit=('id', ), name='venue', title=_('Venue'), oid='venue', widget=SimpleMappingWidget( css_class="venue-block", mapping_title=_("The venue of the event"))), [ 'id', 'origin_oid', 'title', 'description', 'addresses', 'other_conf' ]), #'kind', 'website','phone', 'capacity', ['_csrf_token_', '__objectoid__'])
class InterviewSchema(BaseReviewSchema): """Schema for interview""" name = NameSchemaNode( editing=context_is_a_interview, ) review = colander.SchemaNode( ObjectType(), widget=review_choice, missing=None, title=_("Review") )
class ServiceSchema(VisualisableElementSchema): """Schema for service""" name = NameSchemaNode(editing=context_is_a_service, ) perimeter = colander.SchemaNode(colander.Set(), widget=perimeter_widget, title=_('Perimeter')) delegate = colander.SchemaNode(ObjectType(), widget=delegate_widget, title=_('Delegate this service to'), default=default_delegate)
class TwitterConnectorSchema(ConnectorSchema): """Schema for idea""" typ_factory = ObjectData name = NameSchemaNode(editing=context_is_a_twitter, ) auth_conf = omit( AuthSchema(widget=SimpleMappingtWidget( mapping_css_class='controled-form object-well', ajax=True, activator_icon="glyphicon glyphicon-log-in", activator_title=_('Configure the autentication policy'))), ["_csrf_token_"])
class WorkspaceSchema(VisualisableElementSchema): """Schema for working group""" name = NameSchemaNode(editing=context_is_a_workspace, ) files = colander.SchemaNode( colander.Sequence(), colander.SchemaNode(ObjectData(File), name=_("File"), widget=get_file_widget()), widget=FilesWidget(add_subitem_text_template=_('Attach file'), item_css_class='files-block'), missing=[], title=_('Attached files'), )
class FilmScheduleSchema(SearchableEntitySchema, ScheduleSchema): """Schema for film schedule""" name = NameSchemaNode(editing=context_is_a_film_schedule, ) picture = colander.SchemaNode( ObjectData(Image), widget=picture_widget, description=_( "Thank you to upload a picture and select an area of interest. " "The different formats of the picture used on the site will be generated from this area." ), title=_('Picture'), missing=None, )
class CommentSchema(VisualisableElementSchema): """Schema for comment""" name = NameSchemaNode(editing=context_is_a_comment, ) intention = colander.SchemaNode(colander.String(), widget=intention_choice, title=_('Intention'), description=_('Choose your intention'), default=_('Remark')) associated_contents = colander.SchemaNode( colander.Set(), widget=relatedcontents_choice, title=_('Associated contents'), description=_('Choose contents to associate'), missing=[], default=[], ) files = colander.SchemaNode( colander.Sequence(), colander.SchemaNode(ObjectData(File), name=_("File"), widget=get_file_widget()), widget=FilesWidget( add_subitem_text_template='', item_css_class="files-block comment-form-group comment-files"), missing=[], description=_('Add files to your comment'), title=_('Attached files'), ) comment = colander.SchemaNode(colander.String(), validator=colander.Length(max=2000), widget=comment_textarea, title=_("Message")) anonymous = colander.SchemaNode( colander.Boolean(), widget=deform.widget.CheckboxWidget( item_css_class="comment-form-group comment-anonymous-form"), label=_('Remain anonymous'), description=_('Check this box if you want to remain anonymous.'), title='', missing=False, default=False)
class FilmSynopsesSchema(CinemaReviewSchema): """FilmSynopses schema""" name = NameSchemaNode( editing=context_is_a_film_synopses, ) film_release_date = colander.SchemaNode( colander.Date(), title=_('Release date') ) abstract = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Abstract") )
class CinemaReviewSchema(BaseReviewSchema): """Schema for review""" name = NameSchemaNode(editing=context_is_a_cinema_review, ) nationality = colander.SchemaNode(colander.String(), widget=TextInputWidget(), title=_("Nationality")) directors_ids = colander.SchemaNode(colander.Set(), widget=directors_choice, title=_('Directors'), missing=[]) directors = colander.SchemaNode( colander.Sequence(), omit( select( ArtistInformationSheetSchema( editable=True, factory=ArtistInformationSheet, omit=('id', ), widget=SimpleMappingWidget( css_class='director-data object-well' ' default-well'), name=_('Director')), [ 'id', 'origin_oid', 'title', 'description', 'picture', 'biography' ]), ['_csrf_token_', '__objectoid__']), widget=SequenceWidget(css_class='directors-values', template='lac:views/' 'templates/sequence_modal.pt', item_template='lac:views/' 'templates/sequence_modal_item.pt'), title=_('Directors'), ) duration = colander.SchemaNode(colander.String(), widget=TextInputWidget(), title=_("Duration")) appreciation = colander.SchemaNode(colander.String(), widget=appreciation_choice, title=_("Appreciation")) opinion = colander.SchemaNode(colander.String(), widget=RichTextWidget(), title=_("Opinion"))
class OrganizationSchema(VisualisableElementSchema): """Schema for Organization""" name = NameSchemaNode(editing=context_is_a_organization, ) logo = colander.SchemaNode( ObjectData(Image), widget=get_file_widget(), required=False, missing=None, title=_('Logo'), ) cover_picture = colander.SchemaNode( ObjectData(File), widget=get_file_widget(file_extensions=['png', 'jpg', 'svg']), title=_('Cover picture'), missing=None, description=_("Only PNG and SVG files are supported."), ) contacts = colander.SchemaNode( colander.Sequence(), omit( select( ContactSchema( name='contact', widget=SimpleMappingWidget( css_class='contact-well object-well default-well')), [ 'title', 'address', 'phone', 'surtax', 'email', 'website', 'fax' ]), ['_csrf_token_']), widget=SequenceWidget( min_len=1, add_subitem_text_template=_('Add a new contact')), title='Contacts', oid='contacts') members = colander.SchemaNode(colander.Set(), widget=members_choice, title=_('Members'), missing=[]) managers = colander.SchemaNode(colander.Set(), widget=managers_choice, title=_('The managers'), missing=[])
class NewsletterSchema(VisualisableElementSchema): """Schema for newsletter""" name = NameSchemaNode(editing=context_is_a_newsletter, ) subject = colander.SchemaNode( colander.String(), title=_('Subject'), default=default_subject, description=_('The subject of the newsletter.')) description = colander.SchemaNode(colander.String(), widget=deform.widget.TextAreaWidget( rows=4, cols=60), title=_("Description")) content_template = colander.SchemaNode( ObjectData(File), widget=get_file_widget(file_extensions=['html']), title=_('Content template'), missing=None, description=_("Only HTML files are supported."), ) content = colander.SchemaNode( colander.String(), widget=RichTextWidget(), default=default_content, missing='', title=_("Content"), description=_("The content to send."), ) recurrence = colander.SchemaNode(colander.Boolean(), widget=deform.widget.CheckboxWidget(), label=_('Sends automatic'), title='', missing=False) sending_date = colander.SchemaNode(colander.Date(), title=_('Sending date')) recurrence_nb = colander.SchemaNode(colander.Int(), title=_('Frequency/days'), default=7)
class EventSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for event""" name = NameSchemaNode(editing=context_is_a_event, ) text = colander.SchemaNode( colander.String(), widget=deform.widget.TextAreaWidget(), title=_("Details"), description= _('The details of the event. Connexion mode or location, agenda, how to register, when appropriate, link to the external registration site...' ), ) date = colander.SchemaNode( colander.DateTime(), widget=deform.widget.DateTimeInputWidget( default_time_options=(('format', 'HH:i'), ('interval', 30))), title=_('Date and hour'), description=_('The date of the event.'), ) kind = colander.SchemaNode( colander.String(), widget=kind_choices, title=_('The discussion event mode'), description=_('The event mode.'), default='physical', ) tzname = colander.SchemaNode( colander.String(), title=_('Timezone'), description=_( 'You can specify the timezone of the date of the event.'), widget=tzname_widget, validator=colander.OneOf(EUROPEAN_ZONES)) locale = colander.SchemaNode( colander.String(), title=_('The discussion event language'), description=_('You can specify the language of the event.'), widget=locale_widget, validator=colander.OneOf(EUROPEAN_LOCALES), default='en')
class BriefSchema(SearchableEntitySchema): """Brief schema""" name = NameSchemaNode( editing=context_is_a_brief, ) title = colander.SchemaNode( colander.String(), widget=TextInputWidget(), title=_('Title') ) picture = colander.SchemaNode( ObjectData(Image), widget=picture_widget, title=_('Picture'), ) tree = colander.SchemaNode( typ=DictSchemaType(), widget=keyword_widget, default=DEFAULT_TREE, missing=DEFAULT_TREE, title=_('Categories'), ) details = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Details") ) informations = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Additional information") ) publication_number = colander.SchemaNode( colander.Integer(), default=publication_number_value, missing=publication_number_value, title=_('Publication number'), )