class IProfileQuestion(form.Schema, IRichDescription, IBasic): """Survey Profile question. A profile question is used to determine if parts of a survey should be skipped, or repeated multiple times. """ question = schema.TextLine( title=_('label_profilequestion_question', default=u'Question'), description=_(u'This question must ask the user if this profile ' u'applies to them.'), required=True) form.widget(question="euphorie.content.risk.TextLines4Rows") use_location_question = schema.Bool( title=_("label_use_location_question", default=u"Ask the user about (multiple) locations?"), description=_( u'description_use_location_question', default=u'If this part is active, the user will be asked to ' u'enter the name of all locations for which this module applies. ' u'This means, the module will be repeated as many times as there ' u'are locations. If you do not need this repeatable behaviour, ' u'untick the checkbox to turn it off.' ), required=False, default=True) depends("label_multiple_present", "use_location_question", "on") label_multiple_present = ConditionalTextLine( title=_(u'Multiple item question'), required=True, description=_(u'This question must ask the user if the service is ' u'offered in more than one location.'), ) form.widget(label_multiple_present="euphorie.content.risk.TextLines4Rows") depends("label_single_occurance", "use_location_question", "on") label_single_occurance = ConditionalTextLine( title=_(u'Single occurance prompt'), description=_(u'This must ask the user for the name of the ' u'relevant location.'), required=True) form.widget(label_single_occurance="euphorie.content.risk.TextLines4Rows") depends("label_multiple_occurances", "use_location_question", "on") label_multiple_occurances = ConditionalTextLine( title=_(u'Multiple occurance prompt'), description=_(u'This must ask the user for the names of all ' u'relevant locations.'), required=True) form.widget(label_multiple_occurances="euphorie.content.risk.TextLines4Rows")
class IFrenchEvaluation(form.Schema): depends("default_severity", "type", "==", "risk") depends("default_severity", "evaluation_method", "==", "calculated") default_severity = schema.Choice( title=_("label_default_severity", default=u"Default severity"), description=_("help_default_severity", default=u"Indicate the severity if this risk occurs."), vocabulary=SimpleVocabulary([ SimpleTerm(0, "none", title=_("no default", default=u"No default")), SimpleTerm(1, "weak", title=_("severity_weak", default=u"Weak")), SimpleTerm(5, "not-severe", title=_("severity_not_severe", default=u"Not very severe")), SimpleTerm(7, "severe", title=_("severity_severe", default=u"Severe")), SimpleTerm(10, "very-severe", title=_("severity_very_severe", default=u"Very severe")), ]), required=True, default=0) depends("default_frequency", "type", "==", "risk") depends("default_frequency", "evaluation_method", "==", "calculated") default_frequency = schema.Choice( title=_("label_default_frequency", default=u"Default frequency"), description=_("help_default_frequency", default=u"Indicate how often this risk occurs in a " u"normal situation."), vocabulary=SimpleVocabulary([ SimpleTerm(0, "none", title=_("no default", default=u"No default")), SimpleTerm(1, "rare", title=_("frequency_french_rare", default=u"Rare")), SimpleTerm(3, "not-often", title=_("frequency_french_not_often", default=u"Not very often")), SimpleTerm(7, "often", title=_("frequency_french_often", default=u"Often")), SimpleTerm(9, "regularly", title=_("frequency_french_regularly", default=u"Very often or regularly")), ]), required=True, default=0)
class IExportSurveySchema(Interface): """Fields used for configuring the export""" include_images = schema.Bool( title=_("label_survey_export_include_images", default="Include images"), description=_( "description_survey_export_include_images", default= "All images contained in the OiRA tool can be exported along " "with the textual content. When the OiRA tool is then imported again, " "all images will be present. Please note that including images may " "result in a considerably larger file size.", ), required=False, default=False, ) include_intro_text = schema.Bool( title=_( "label_survey_export_include_intro_text", default="Include introduction text", ), description=_( "description_survey_export_include_intro_text", default= "The introduction text describes the general purpose of the OiRA " "tool. It usually gives the end users an idea what to expect in the tool " "and whether it will be relevant for them. The default is to include " "this text.", ), required=False, default=True, ) include_module_solution_texts = schema.Bool( title=_( "label_survey_export_include_module_solution_texts", default="Include “Solution” texts on modules", ), description=_( "description_survey_export_include_module_solution_texts", "The “Solution” description” on modules is a deprecated kind of text " "that is no longer being used. The default is to skip this.", ), required=False, default=False, ) include_module_description_texts = schema.Bool( title=_( "label_survey_export_include_module_description_texts", default="Include “Description” texts on modules", ), description=_( "description_survey_export_include_module_description_texts", default= "Every module comes with an introductive description. The default " "is to include this text.", ), required=False, default=True, ) include_risk_legal_texts = schema.Bool( title=_( "label_survey_export_include_risk_legal_texts", default="Include “Legal and policy references” texts on risks", ), description=_( "description_survey_export_include_risk_legal_texts", default= "If the OiRA tool is exported because it should be made available " "for a different country, the legal texts might not apply there. Therefore " "the default is to skip these texts.", ), required=False, default=True, ) include_measures = schema.Bool( title=_("label_survey_export_include_measures", default="Include measures"), description=_( "description_survey_export_include_measures", default= "For each risk, a number of common measures – sometimes also " "referred to as “Solutions” – can be defined. While the default setting " "is to include them in the export, they may be excluded if required, " "for example to accommodate for a limited translation budget.", ), required=False, default=True, ) depends("export_as_plain_text", "include_images", "off") export_as_plain_text = schema.Bool( title=_( "label_export_as_plain_text", default="Export additionally as plain text file", ), description=_( "description_export_as_plain_text", default= "The plain text file will contain all translatable text without " "formatting. This file can be used to determine a word count for " "estimating the cost of translation.", ), required=False, default=False, ) is_etranslate_compatible = schema.Bool( title=_( "label_is_etranslate_compatible", default="Export in eTranslate compatible XML", ), description=_( "description_is_etranslate_compatible", default="The default export escapes HTML, which is not supported" "by eTranslate", ), required=False, default=False, )
class IRisk(model.Schema, IRichDescription, IBasic): """A possible risk that can be present in an organisation.""" title = schema.TextLine( title=_("label_statement", default="Affirmative statement"), description=_( "help_statement", default="This is a short affirmative statement about a " "possible risk (e.g. The building is well maintained.)", ), required=True, ) directives.widget(title="euphorie.content.risk.TextLines4Rows") directives.order_before(title="*") problem_description = schema.TextLine( title=_("label_problem_description", default="Negative statement"), description=_( "help_problem_description", default="This is the inverse of the affirmative " "statement (e.g. The building is not well maintained.)", ), required=True, ) directives.widget( problem_description="euphorie.content.risk.TextLines4Rows") directives.order_after(problem_description="title") description = HtmlText( title=_("label_description", default="Description"), description=_( "help_risk_description", default="Describe the risk. Include any relevant information " "that may be helpful for the end-user.", ), required=True, ) directives.widget( description="plone.app.z3cform.wysiwyg.WysiwygFieldWidget") directives.order_after(description="problem_description") existing_measures = TextLinesWithBreaks( title=_( "deprecated_label_existing_measures", default="Measures that are already in place (Only shown here for " "reference! Use the “Add Measure” button on the Risk for adding " "measures that are shown to the user during Identification.)", ), description=_( "help_existing_measures", default="Use this field to define (common) measures that the " "user might have already implemented. " "Separate measures with a line break (Enter). The user will be " "able to deselect those measures that are not applicable to their" "situation.", ), required=False, ) directives.widget(existing_measures="euphorie.content.risk.TextLines8Rows") directives.order_after(existing_measures="description") legal_reference = HtmlText( title=_("label_legal_reference", default="Legal and policy references"), required=False, ) directives.widget( legal_reference="plone.app.z3cform.wysiwyg.WysiwygFieldWidget") directives.order_after(legal_reference="description") model.fieldset( "identification", label=_("header_identification", default="Identification"), fields=["show_notapplicable"], ) show_notapplicable = schema.Bool( title=_("label_show_notapplicable", default="Show `not applicable' option"), description=_( "help_show_notapplicable", default="Offer a `not applicable' option in addition " "to the standard yes/no options.", ), default=False, ) type = schema.Choice( title=_("label_risk_type", default="Risk type"), description=_( "help_risk_type", default='"Priority risk" is one of the high risks in the ' 'sector. "Risk" is related to the workplace or to the work ' 'carried out. "Policy" refers to agreements, procedures, ' "and management decisions.", ), vocabulary=SimpleVocabulary([ SimpleTerm("top5", title=_("risktype_top5", default="Priority risk")), SimpleTerm("risk", title=_("risktype_risk", default="Risk")), SimpleTerm("policy", title=_("risktype_policy", default="Policy")), ]), default="risk", required=True, ) depends("risk_always_present", "type", "==", "risk") risk_always_present = schema.Bool( title=_("label_risk_always_present", default="Risk is always present"), description=_( "description_risk_always_present", default='If selected, the user will not be able to answer "Yes" or ' '"No", since the risk is considered to be always present. The ' "Evaluation and Action Plan will behave in the same way as for " "regular risks.", ), required=False, default=False, ) depends("evaluation_method", "type", "==", "risk") evaluation_method = schema.Choice( title=_("label_evaluation_method", default="Evaluation method"), description=_( "help_evaluation_method", default="Select 'estimated' if calcuation is not necessary " "or not possible.", ), vocabulary=SimpleVocabulary([ SimpleTerm("direct", title=_("evalmethod_direct", default="Estimated")), SimpleTerm( "calculated", title=_("evalmethod_calculated", default="Calculated"), ), SimpleTerm("fixed", title=_("evalmethod_fixed", default="Skip evaluation")), ]), default="calculated", required=False, ) depends("fixed_priority", "type", "==", "risk") depends("fixed_priority", "evaluation_method", "==", "fixed") fixed_priority = schema.Choice( title=_("report_timeline_priority", default="Priority"), vocabulary=SimpleVocabulary([ SimpleTerm("low", title=_("priority_low", default="Low")), SimpleTerm("medium", title=_("priority_medium", default="Medium")), SimpleTerm("high", title=_("priority_high", default="High")), ]), required=False, default="low", ) depends("default_priority", "type", "==", "risk") depends("default_priority", "evaluation_method", "==", "direct") default_priority = schema.Choice( title=_("label_default_priority", default="Default priority"), description=_( "help_default_priority", default="You can help the end-user by selecting a default " "priority. He/she can still change the priority.", ), vocabulary=SimpleVocabulary([ SimpleTerm("none", title=_("no_default", default="No default")), SimpleTerm("low", title=_("priority_low", default="Low")), SimpleTerm("medium", title=_("priority_medium", default="Medium")), SimpleTerm("high", title=_("priority_high", default="High")), ]), required=False, default="low", ) model.fieldset( "main_image", label=_("header_main_image", default="Main image"), description=_( "intro_main_image", default="The main image will get a more prominent position " "in the client than the other images.", ), fields=["image", "caption"], ) image = filefield.NamedBlobImage( title=_("label_image", default="Image file"), description=_( "help_image_upload", default="Upload an image. Make sure your image is of format " "png, jpg or gif and does not contain any special " "characters. The minimum size is 1000 (width) x 430 (height) pixels.", ), required=False, ) caption = schema.TextLine(title=_("label_caption", default="Image caption"), required=False) model.fieldset( "secondary_images", label=_("header_secondary_images", default="Secondary images"), fields=[ "image2", "caption2", "image3", "caption3", "image4", "caption4" ], ) image2 = filefield.NamedBlobImage( title=_("label_image", default="Image file"), description=_( "help_image_upload", default="Upload an image. Make sure your image is of format " "png, jpg or gif and does not contain any special " "characters. The minimum size is 1000 (width) x 430 (height) pixels.", ), required=False, ) caption2 = schema.TextLine(title=_("label_caption", default="Image caption"), required=False) image3 = filefield.NamedBlobImage( title=_("label_image", default="Image file"), description=_( "help_image_upload", default="Upload an image. Make sure your image is of format " "png, jpg or gif and does not contain any special " "characters. The minimum size is 1000 (width) x 430 (height) pixels.", ), required=False, ) caption3 = schema.TextLine(title=_("label_caption", default="Image caption"), required=False) image4 = filefield.NamedBlobImage( title=_("label_image", default="Image file"), description=_( "help_image_upload", default="Upload an image. Make sure your image is of format " "png, jpg or gif and does not contain any special " "characters. The minimum size is 1000 (width) x 430 (height) pixels.", ), required=False, ) caption4 = schema.TextLine(title=_("label_caption", default="Image caption"), required=False) model.fieldset( "additional_content", label=_("header_additional_content", default="Additional content"), description=_( "intro_additional_content", default="Attach any additional content you consider helpful " "for the user", ), fields=[ "file1", "file1_caption", "file2", "file2_caption", "file3", "file3_caption", "file4", "file4_caption", ], ) file1 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file1_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file2 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file2_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file3 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file3_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file4 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file4_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False)
class IKinneyEvaluation(model.Schema): depends("default_probability", "type", "==", "risk") depends("default_probability", "evaluation_method", "==", "calculated") default_probability = schema.Choice( title=_("label_default_probability", default="Default probability"), description=_( "help_default_probability", default="Indicate how likely occurence of this risk " "is in a normal situation.", ), vocabulary=SimpleVocabulary([ SimpleTerm(0, "none", title=_("no default", default="No default")), SimpleTerm(1, "small", title=_("probability_small", default="Small")), SimpleTerm(3, "medium", title=_("probability_medium", default="Medium")), SimpleTerm(5, "large", title=_("probability_large", default="Large")), ]), required=False, default=0, ) depends("default_frequency", "type", "==", "risk") depends("default_frequency", "evaluation_method", "==", "calculated") default_frequency = schema.Choice( title=_("label_default_frequency", default="Default frequency"), description=_( "help_default_frequency", default="Indicate how often this risk occurs in a " "normal situation.", ), vocabulary=SimpleVocabulary([ SimpleTerm(0, "none", title=_("no default", default="No default")), SimpleTerm( 1, "almost-never", title=_("frequency_almostnever", default="Almost never"), ), SimpleTerm(4, "regular", title=_("frequency_regularly", default="Regularly")), SimpleTerm( 7, "constant", title=_("frequency_constantly", default="Constantly"), ), ]), required=False, default=0, ) depends("default_effect", "type", "==", "risk") depends("default_effect", "evaluation_method", "==", "calculated") default_effect = schema.Choice( title=_("label_default_severity", default="Default severity"), description=_( "help_default_severity", default="Indicate the severity if this risk occurs.", ), vocabulary=SimpleVocabulary([ SimpleTerm(0, "none", title=_("no default", default="No default")), SimpleTerm(1, "weak", title=_("effect_weak", default="Weak severity")), SimpleTerm( 5, "significant", title=_("effect_significant", default="Significant severity"), ), SimpleTerm( 10, "high", title=_("effect_high", default="High (very high) severity"), ), ]), required=False, default=0, )
class IOSHASurvey(form.Schema): """ Adds a logo, URL and name of an external reference site to a survey """ enable_external_site_link = schema.Bool( title=_("label_external_site_enabled", default=u"Include a logo which links to an external " u"website."), description=_("help_external_site_enabled", default=u"Tick this option if you would like to create " u"a hyperlink on the OiRA tool which points to an " u"external website. The hyperlink will be in the form " u"of a logo image."), required=False, default=False) depends("IOSHASurvey.external_site_url", "IOSHASurvey.enable_external_site_link", "on") external_site_url = schema.URI( title=_("label_external_site_url", default=u"External site URL"), description=_("help__external_site_url", default=u"This is the URL of an external site that is " u"linked to. Clicking the logo or the name will take " u"the user to this URL."), required=False) depends("IOSHASurvey.external_site_name", "IOSHASurvey.enable_external_site_link", "on") external_site_name = schema.TextLine( title=_("label_external_site_name", default=u"External site name"), description=_("help_external_site_name", default=u"This is the name of the external site that is " u"linked to. It will appear next to the logo."), required=False) depends("IOSHASurvey.external_site_logo", "IOSHASurvey.enable_external_site_link", "on") external_site_logo = filefield.NamedBlobImage( title=_("label_external_site_logo", default=u"External site logo"), description=_( "help_image_upload", default=u"Upload an image. Make sure your image is of format " u"png, jpg or gif and does not contain any special " u"characters."), required=False) enable_custom_evaluation_descriptions = schema.Bool( title=_("label_enable_custom_evaluation_descriptions", default=u"The criteria applied to evaluate risks are specific " u"of this tool? (If not, the common criteria descriptions " u"will apply)."), description=_("help_enable_custom_evaluation_descriptions", default=u"Tick this option if you would like to define " u"your own descriptions for the criteria of the " u"evaluation algorithm. The user will see them as hints " u"when answering the questions to calculate the " u"priority of a risk."), required=False, default=False) depends("IOSHASurvey.description_probability", "IOSHASurvey.enable_custom_evaluation_descriptions", "on") description_probability = schema.Text( title=_(u"Probability"), description=_( u"description_criteria_explanation", default=u'Provide your custom explanation here, to override this ' u'default explanation: "${default_explanation}"', mapping={u'default_explanation': help_default_probability}), required=False, ) depends("IOSHASurvey.description_frequency", "IOSHASurvey.enable_custom_evaluation_descriptions", "on") description_frequency = schema.Text( title=_(u"Frequency"), description=_( u"description_criteria_explanation", default=u'Provide your custom explanation here, to override this ' u'default explanation: "${default_explanation}"', mapping={u'default_explanation': help_default_frequency}), required=False, ) depends("IOSHASurvey.description_severity", "IOSHASurvey.enable_custom_evaluation_descriptions", "on") description_severity = schema.Text( title=_(u"Severity"), description=_( u"description_criteria_explanation", default=u'Provide your custom explanation here, to override this ' u'default explanation: "${default_explanation}"', mapping={u'default_explanation': help_default_severity}), required=False, )
class ISurvey(model.Schema, IBasic): """Survey. The survey is the root of a survey. """ title = schema.TextLine( title=_("label_survey_title", default="Version name"), description=_( "help_survey_title", default="This is the title of this OiRA Tool version. This " "name is never shown to users.", ), required=True, ) directives.order_before(title="*") directives.omitted("description") introduction = HtmlText( title=_("label_introduction", default="Introduction text"), description=_( "The introduction text is shown when starting a new " "OiRA Tool session. If no introduction is provided here a " "standard text will be shown. Please keep this text brief " "so it will easily fit on screens of small devices such as " "phones and PDAs."), required=False, ) directives.widget(introduction=WysiwygFieldWidget) evaluation_optional = schema.Bool( title=_("label_evaluation_optional", default="Evaluation may be skipped"), description=_( "help_evaluation_optional", default="This option allows users to skip the evaluation " "phase.", ), default=False, required=False, ) language = schema.Choice( title=_("label_language", default="Language"), vocabulary="plone.app.vocabularies.AvailableContentLanguages", default="en", required=True, ) classification_code = schema.TextLine( title=_("label_classification_code", default="Classification code"), description=_( "help_classification_code", default="A code identifying this sector. Classification " "codes are defined by national standards bodies " "and based on revision 2 of the NACE standard.", ), required=False, ) tool_type = schema.Choice( title=_("label_tool_type", default="Type of OiRA Tool"), description=_( "description_tool_type", default="This selection determines, which variant of an OiRA Tool" ' will be created. If you are not sure, select "Classic".', ), vocabulary="euphorie.tool_types_vocabulary", defaultFactory=get_tool_type_default, required=True, ) measures_text_handling = schema.Choice( title=_( "measures_text_handling", default="Handling of measures text (if measures-in-place are used)", ), description=_( "description_measures_text_handling", default= ("Defines how the “Measures in place” options are displayed " "to the user. " "Choose “Simple” if the texts for Description and General Approach " "are identical in your measures. " "Choose “Full” if the texts in General Approach " "provide more details than the Description."), ), vocabulary="euphorie.measures_text_handling_vocabulary", default="full", required=True, ) integrated_action_plan = schema.Bool( title=_("label_integrated_action_plan", default="Integrated Action Plan"), description=_( "description_integrated_action_plan", default="If selected, the option to plan measures will be offered " "directly on the “Identification” page. There will be no separate " "“Action Plan” step in the navigation.", ), required=False, default=False, ) enable_web_training = schema.Bool( title=_("label_enable_web_training", default="Enable Web Based Training?"), description=_( "help_enable_web_training", default="If this option is activated, users will be able to take an " "online training with this OiRA tool. A successful training will be " "recorded and shown with a certificate on the user's dashbooard. You " "will be asked to provide Training Questions for the final exam.", ), required=False, ) depends("num_training_questions", "enable_web_training", "on") num_training_questions = schema.Int( title=_( "label_num_training_questions", default="Number of questions asked after training", ), description=_( "help_num_training_questions", default= "Please enter the number of questions to be shown at the end of " "your training session. If the number is lower than the number of existing " "questions, the questions will be picked randomly. Empty the field to show " "all questions.", ), required=False, ) enable_tool_notification = schema.Bool( title=_( "label_enable_tool_notification", default="Show a custom notification for this OiRA tool?", ), description=_( "description_tool_notification", default="If you enter text here, it will be shown to users " "in a pop-up when they open the tool. It can be used for " "notifying users about changes.", ), required=False, default=False, ) depends("tool_notification_title", "enable_tool_notification", "on") tool_notification_title = ConditionalTextLine( title=_("label_tool_notification_title", default="Tool notification title"), required=True, ) depends("tool_notification_message", "enable_tool_notification", "on") tool_notification_message = ConditionalHtmlText( title=_("label_tool_notification", default="Tool notification message"), required=True, ) directives.widget(tool_notification_message=WysiwygFieldWidget)
class ISurvey(form.Schema, IBasic): """Survey. The survey is the root of a survey. """ title = schema.TextLine( title=_("label_survey_title", default=u"Version name"), description=_( "help_survey_title", default=u"This is the title of this OiRA Tool version. This " u"name is never shown to users."), required=True) form.order_before(title="*") form.omitted("description") introduction = HtmlText( title=_("label_introduction", default=u"Introduction text"), description=_( u"The introduction text is shown when starting a new " u"OiRA Tool session. If no introduction is provided here a " u"standard text will be shown. Please keep this text brief " u"so it will easily fit on screens of small devices such as " u"phones and PDAs."), required=False) form.widget(introduction=WysiwygFieldWidget) evaluation_optional = schema.Bool( title=_("label_evaluation_optional", default=u"Evaluation may be skipped"), description=_( "help_evaluation_optional", default=u"This option allows users to skip the evaluation " u"phase."), default=False, required=False) language = schema.Choice( title=_("label_language", default=u"Language"), vocabulary="plone.app.vocabularies.AvailableContentLanguages", default=u"en", required=True) classification_code = schema.TextLine( title=_("label_classification_code", default=u"Classification code"), description=_( "help_classification_code", default=u"A code identifying this sector. Classification " u"codes are defined by national standards bodies " u"and based on revision 2 of the NACE standard."), required=False) enable_tool_notification = schema.Bool( title=_("label_enable_tool_notification", default=u"Show a custom notification for this OiRA tool?"), description=_( u'description_tool_notification', default=u'If you enter text here, it will be shown to users ' u'in a pop-up when they open the tool. It can be used for ' u'notifying users about changes.'), required=False, default=False) depends("tool_notification_title", "enable_tool_notification", "on") tool_notification_title = ConditionalTextLine(title=_( "label_tool_notification_title", default=u"Tool notification title"), required=True) depends("tool_notification_message", "enable_tool_notification", "on") tool_notification_message = ConditionalHtmlText(title=_( "label_tool_notification", default=u"Tool notification message"), required=True) form.widget(tool_notification_message=WysiwygFieldWidget)
class IModule(model.Schema, IRichDescription, IBasic): """Survey Module. A module is (hierarchical) grouping in a survey. """ description = HtmlText( title=_("label_module_description", "Description"), description=_( "help_module_description", default="Include any relevant information that may be " "helpful for the end-user.", ), required=False, ) directives.widget(description=WysiwygFieldWidget) directives.order_after(description="title") optional = schema.Bool( title=_("label_module_optional", default="This module is optional"), description=_( "help_module_optional", default="Allows the end-user to skip this module and " "everything inside it.", ), required=False, default=False, ) depends("question", "optional", "on") question = ConditionalTextLine( title=_("label_module_question", default="Question"), description=_( "help_module_question", default="The question to ask the end-user if this module is " "optional. It must be formulated so that it is answerable " "with YES (the end-user will have to tick a box) or NO", ), required=True, ) image = filefield.NamedBlobImage( title=_("label_image", default="Image file"), description=_( "help_image_upload", default="Upload an image. Make sure your image is of format " "png, jpg or gif and does not contain any special " "characters. The minimum size is 1000 (width) x 430 (height) pixels.", ), required=False, ) caption = schema.TextLine(title=_("label_caption", default="Image caption"), required=False) solution_direction = HtmlText( title=_("label_solution_direction", default="Solution"), description=_( "help_solution_direction", default="This information will appear in the Action plan step " "and should include an overview of general solution(s) " "related to this module.", ), required=False, ) directives.widget(solution_direction=WysiwygFieldWidget) model.fieldset( "additional_content", label=_("header_additional_content", default="Additional content"), description=_( "intro_additional_content", default="Attach any additional content you consider helpful " "for the user", ), fields=[ "file1", "file1_caption", "file2", "file2_caption", "file3", "file3_caption", "file4", "file4_caption", ], ) file1 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file1_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file2 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file2_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file3 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file3_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False) file4 = filefield.NamedBlobFile( title=_("label_file", default="Content file"), description=_( "help_content_upload", default="Upload a file that contains additional information, " "like a PDF, Word document or spreadsheet. Optionally provide " "a descriptive caption for your file.", ), required=False, ) file4_caption = schema.TextLine(title=_("label_file_caption", default="Content caption"), required=False)
class IOSHACountry(model.Schema): """Additional fields for the OSHA countries""" certificates_enabled = schema.Bool( title=_("Enable certificates"), description=_( "If enabled, users will be able to obtain an official certificate of " "completion once they reach the threshold defined below."), default=False, ) depends( "IOSHACountry.certificate_initial_threshold", "IOSHACountry.certificates_enabled", "on", ) certificate_initial_threshold = schema.Int( title=_("Certificate initial threshold (in percent)"), description=_( "After a session completion rate is greater than this limit, " "the user will be informed about the possibility to earn a certificate. " ), default=10, min=0, max=100, ) depends( "IOSHACountry.certificate_completion_threshold", "IOSHACountry.certificates_enabled", "on", ) certificate_completion_threshold = schema.Int( title=_("Certificate completion threshold (in percent)"), description=_( "After a session completion rate is greater than this limit " "the user will earn a certificate."), default=85, min=0, max=100, ) depends( "IOSHACountry.certificate_explanatory_sentence", "IOSHACountry.certificates_enabled", "on", ) certificate_explanatory_sentence = HtmlText( title=_("Explanatory sentence"), description= _("A short explanation that is shown to the user after reaching the initial " "threshold. You can use this to point to an external website that provides " "more information."), required=False, ) directives.widget(certificate_explanatory_sentence= "plone.app.z3cform.wysiwyg.WysiwygFieldWidget") @invariant def threshold_invariant(data): if data.certificate_initial_threshold >= data.certificate_completion_threshold: raise Invalid( _("Completion threshold has to be greater than the initial threshold" ))