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 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 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 AddFilesSchemaSchema(Schema): """Schema for interview""" ws_files = colander.SchemaNode( colander.Set(), widget=files_choice, missing=[], title=_("Connect to the files of the workspace")) attached_files = colander.SchemaNode( colander.Sequence(), colander.SchemaNode(ObjectData(File), name=_("File"), widget=get_file_widget()), widget=FilesWidget(add_subitem_text_template=_('Upload a new file'), item_css_class='files-block'), missing=[], title=_('Upload new files'), )
class ChallengeSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for challenge""" name = NameSchemaNode(editing=context_is_a_challenge, ) description = colander.SchemaNode( colander.String(), validator=colander.Length(max=300), widget=LimitedTextAreaWidget(rows=5, cols=30, limit=300), title=_("Abstract"), description=_("Describe in a few words the challenge.")) text = colander.SchemaNode( colander.String(), widget=RichTextWidget(), title=_("Text"), description=_("You can describe in detail the challenge.")) image = colander.SchemaNode( ObjectData(Image), widget=image_widget, title=_('Image'), description= _('You see a square on the top left of the image if it exceeds the maximum' ' size allowed. Move and enlarge it if necessary, to determine an area of' ' interest. Several images will be generated from this area.'), ) 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'), ) is_restricted = colander.SchemaNode( colander.Boolean(), widget=deform.widget.CheckboxWidget( item_css_class='is-restricted-input'), label=_('Is restricted'), title='', description= _('Check this box if the challenge is restricted to a set of members. ' 'Only concerned members can add and see the contents created in this challenge.' ), missing=False) invited_users = colander.SchemaNode( colander.Set(), widget=users_to_invite, title=_('Concerned users'), description=_( 'Find and select the concerned members or organizations. ' 'If you want to see the members or organizations... already ' 'registered on the platform, enter a *'), missing=[], ) deadline = colander.SchemaNode( colander.Date(), title=_('Deadline'), description= _("If your challenge is punctual, you can add a deadline for participation." ), missing=None) 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 QuestionSchema(VisualisableElementSchema, SearchableEntitySchema): """Schema for question""" name = NameSchemaNode( editing=context_is_a_question, ) challenge = colander.SchemaNode( ObjectType(), widget=challenge_choice, missing=None, title=_("Challenge (optional)"), description=_("You can select and/or modify the challenge associated to this question. " "For an open question, do not select anything in the « Challenge » field.") ) title = colander.SchemaNode( colander.String(), title=_("Question") ) options = colander.SchemaNode( colander.Sequence(), colander.SchemaNode( colander.String(), name=_("Option") ), widget=SequenceWidget( add_subitem_text_template='', orderable=True), title=_('Options'), description=_("You can add options to your question. " "Users can only answer questions with options once. " "Statistics will be provided indicating the percentage " "of each option."), missing=[] ) text = colander.SchemaNode( colander.String(), widget=LimitedTextAreaWidget( rows=5, cols=30, limit=2000, alert_values={'limit': 2000}, item_css_class='content-preview-form', placeholder=_('I have a question!')), title=_("Details"), 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 )