Esempio n. 1
0
class ITinyMCELayoutSchema(Interface):
    """This interface defines the layout properties."""

    resizing = schema.Bool(
        title=_(u"Enable resizing the editor window."),
        description=_(u"This option gives you the ability to enable/disable "
                      "resizing the editor window. "),
        default=True,
        required=False)

    autoresize = schema.Bool(
        title=_(u"Enable auto resizing of the editor window."),
        description=_(u"This option gives you the ability to enable/disable "
                      "auto resizing the editor window depending "
                      "on the content."),
        default=False,
        required=False)

    # TODO: add validation to assert % and px in the value
    editor_width = schema.TextLine(
        title=_(u"Editor width"),
        description=_(u"This option gives you the ability to specify the "
                      "width of the editor (like 100% or 400px)."),
        default=None,
        required=False)

    # TODO: add validation to assert % and px in the value
    editor_height = schema.TextLine(
        title=_(u"Editor height"),
        description=_(u"This option gives you the ability to specify the "
                      "height of the editor in pixels. "
                      "If auto resize is enabled this value is used "
                      "as minimum height."),
        default=None,
        required=False)

    content_css = schema.TextLine(
        title=_(u"Choose the CSS used in WYSIWYG Editor Area"),
        description=_(
            u"This option enables you to specify a custom CSS file "
            "that provides content CSS. "
            "This CSS file is the one used within the editor "
            "(the editable area). In addition to what is listed here, "
            "the plone bundle CSS and diazo themes using the "
            "tinymce-content-css setting are also added."),
        default=
        u'++plone++static/components/tinymce/skins/lightgray/content.min.css',
        required=False)

    header_styles = schema.List(title=_(u"Header styles"),
                                description=_('Name|tag'),
                                value_type=schema.TextLine(),
                                default=[
                                    u'Header 1|h1', u"Header 2|h2",
                                    u"Header 3|h3", u"Header 4|h4",
                                    u"Header 5|h5", u"Header 6|h6"
                                ])

    inline_styles = schema.List(
        title=_(u"Inline styles"),
        description=_('Name|format|icon'),
        value_type=schema.TextLine(),
        default=[
            u"Bold|bold|bold", u"Italic|italic|italic",
            u"Underline|underline|underline",
            u"Strikethrough|strikethrough|strikethrough",
            u"Superscript|superscript|superscript",
            u"Subscript|subscript|subscript", u"Code|code|code"
        ])

    block_styles = schema.List(title=_(u"Block styles"),
                               description=_('Name|format'),
                               value_type=schema.TextLine(),
                               default=[
                                   u"Paragraph|p", u"Blockquote|blockquote",
                                   u"Div|div", u"Pre|pre"
                               ])

    alignment_styles = schema.List(title=_(u"Alignment styles"),
                                   description=_('Name|format|icon'),
                                   value_type=schema.TextLine(),
                                   default=[
                                       u"Left|alignleft|alignleft",
                                       u"Center|aligncenter|aligncenter",
                                       u"Right|alignright|alignright",
                                       u"Justify|alignjustify|alignjustify"
                                   ])

    formats = schema.Text(
        title=_(u"Formats"),
        description=_(
            u"Enter a JSON-formatted style format configuration. "
            u"A format is for example the style that get applied when "
            u"you press the bold button inside the editor. "
            u"See http://www.tinymce.com/wiki.php/Configuration:formats"),
        constraint=validate_json,
        default=json.dumps(
            {
                'discreet': {
                    'inline': 'span',
                    'classes': 'discreet'
                },
                'clearfix': {
                    'block': 'div',
                    'classes': 'clearfix'
                }
            },
            indent=4).decode('utf8'),
        required=True,
    )
Esempio n. 2
0
class IBusinessData(Interface):
    business_type = schema.Choice(title=u'Business Type',
                                  vocabulary=BusinessTypesVocabulary,
                                  default=None,
                                  required=False)

    business_name = schema.TextLine(title=u'Business Name', required=False)

    business_address = schema.TextLine(title=u'Address', required=False)

    business_city = schema.TextLine(title=u'City', required=False)

    business_state = schema.TextLine(title=u'State', required=False)

    business_postal_code = schema.TextLine(title=u'Postal Code',
                                           required=False)

    business_country = schema.TextLine(title=u'Country',
                                       required=False,
                                       default=u'US')

    business_coordinates = schema.Text(
        title=u'Coordinates',
        description=
        u'Search for address to get the coordinates of business address',
        default=u'{}',
        required=False,
        constraint=validate_json)

    business_telephone = schema.TextLine(title=u'Telephone', required=False)

    business_days_of_week = schema.List(
        title=u'Days open',
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleVocabulary.createTerm('Monday', 'Monday', 'Monday'),
            SimpleVocabulary.createTerm('Tuesday', 'Tuesday', 'Tuesday'),
            SimpleVocabulary.createTerm('Wednesday', 'Wednesday', 'Wednesday'),
            SimpleVocabulary.createTerm('Thursday', 'Thursday', 'Thursday'),
            SimpleVocabulary.createTerm('Friday', 'Friday', 'Friday'),
            SimpleVocabulary.createTerm('Saturday', 'Saturday', 'Saturday'),
            SimpleVocabulary.createTerm('Sunday', 'Sunday', 'Sunday')
        ])))

    business_opens = schema.TextLine(title=u'Opens',
                                     description=u'In the format of 08:00',
                                     required=False)

    business_closes = schema.TextLine(title=u'Closes',
                                      description=u'In the format of 08:00',
                                      required=False)

    business_special_hours = schema.List(
        title=u'Special hours',
        description=
        u'In the format Day|Opens|Closes. Example: Saturday|08:00|12:00',
        value_type=schema.TextLine(),
        default=[],
        required=False)

    business_menu_link = schema.TextLine(
        title=u'Menu link',
        description=u'If your business has a menu, provide link here',
        required=False)

    business_accepts_reservations = schema.Bool(title=u'Accepts Reservations',
                                                default=False)

    business_additional_configuration = schema.Text(
        title=u'Additional Configuration',
        description=
        u'See https://developers.google.com/structured-data/local-businesses/ '
        u'for details on how to configuration business search data',
        constraint=validate_json,
        required=False)
Esempio n. 3
0
class IClinicalSample(ISample):
    """Sample that will contain all the billing info and high level information
    that is applicable to all aliquots made from this material, location of
    tests ordered on sample
    """
    # Clinical Samples "Veracis ID" is stored here, in USN field.
    usn = schema.TextLine(
        title=_(u"Unique Sample Number"),
        description=_(u"Sample ID from the blood draw kit"),
        required=False,
    )

    # want to index this field
    sample_serial_number = schema.Int(
        title=_(u"Sample Serial Number"),
        description=_(u"Sample Serial Number"),
        required=False,
    )
    """ Want to do an n+1 but allow be edited, should be unique"""

    # list or tuple? JP 3-14-17, let this be blank for remote order
    # option at a later date, need test ordered and status!
    # use this to drive a setup handler that will make the lists of what should
    # be tested! (jp 4-11-17)

    research_consent = schema.Choice(
        title=_(u"Patient Consent to Research"),
        description=_(u"Patient Gives consent to research use"),
        values=[_(u'No'), _(u'Yes')],
        required=True,
    )

    front_end_qa = schema.Choice(
        title=_(u"Front End QA Status"),
        description=_(u"Front End QA Status"),
        required=False,
        values=[_(u"Initial"),
                _(u"Review Pass"),
                _(u"Held"), ],
    )

    sample_ordering_healthcare_provider = schema.TextLine(
        title=_(u"Ordering Healthcare Provider"),
        description=_(u"Ordering Healthcare Provider"),
        required=False,
    )

    sample_ordering_healthcare_provider_signature = schema.Bool(
        title=_(u"Ordering Healthcare Provider Signature Provided"),
        description=_(u"Ordering Healthcare Provider Signature Provided"),
        required=False,
    )

    # directives.widget(primary_healthcare_provider=AutocompleteFieldWidget)
    primary_healthcare_provider = schema.TextLine(
        title=_(u"Primary Healthcare Provider"),
        description=_(u"Primary Healthcare Provider"),
        required=False,
    )
    """directives.widget(level=RadioFieldWidget)"""
    ana_testing = schema.Choice(
        title=_(u"ANA Testing Results"),
        description=_(u"ANA Testing Results"),
        required=True,
        values=[_(u'No Response'),
                _(u'Not Performed'),
                _(u'Negative'),
                _(u'Positive')],
    )

    clinical_impression = schema.Choice(
        title=_(u"Clinical Impression of SLE"),
        description=_(u"Clinical Impression of SLE"),
        required=True,
        values=[_(u'Not Specified'),
                _(u'Uncertain'),
                _(u'Yes'),
                _(u'No')],
    )

    xray_ordered = schema.Bool(
        title=_(u"X-Ray Ordered"),
        description=_(u"X-Ray Ordered"),
        required=False,
    )
    other_test_ordered = schema.TextLine(
        title=_(u"Other Test(s) Ordered"),
        description=_(u"Other Test(s) Ordered Enter One Per Line"),
        required=False,
    )

    """working example of multi choice input jp 1-31-17"""
    form.widget(symptoms_choice=CheckBoxFieldWidget)
    symptoms_choice = schema.List(
        title=_(u"Symptoms"),
        description=_(u"Symptoms, Select All That Apply"),
        required=False,
        value_type=schema.Choice(
            values=[_(u"Rash"),
                    _(u"Mouth Sores"),
                    _(u"Joint Pain"),
                    _(u"Inflammation"),
                    _(u"Seizures or Psychosis"),
                    _(u"Hair Loss")]),
    )

    joint_pain_text = schema.TextLine(
        title=_(u"Joint Pain Specifics"),
        description=_(u"Joint Pain Specifics (Enter One Per Line)"),
        required=False,
    )

    inflammation_text = schema.TextLine(
        title=_(u"Inflammation Specifics"),
        description=_(u"Inflammation Specifics (Enter One Per Line)"),
        required=False,
    )

    other_symptoms_text = schema.TextLine(
        title=_(u"Other Symptom(s)"),
        description=_(u"Other Symptom(s) Enter One Per Line"),
        required=False,
    )

    phlebotomist_name = schema.TextLine(
        title=_(u"Phlebotomist Name"),
        description=_(u"Phlebotomist Name"),
        required=False,
    )

    phlebotomist_signature_provided = schema.Bool(
        title=_(u"Ordering Healthcare Provider Signature Provided"),
        description=_(u"Ordering Healthcare Provider Signature Provided"),
        required=False,
    )

    collection_date = schema.Date(
        title=_(u"Sample Collection Date"),
        description=_(u"Sample Collection Date"),
        required=False,
        default=date.today(),
    )

    received_date = schema.Date(
        title=_(u"Sample Received Date"),
        description=_(u"Sample Received Date"),
        required=False,
        default=date.today(),
    )
Esempio n. 4
0
class ISolgemaFullcalendarProperties(Interface):
    """An interface for specific calendar content stored in the object"""

    slotMinutes = schema.Int(title=_(u"label_slotMinutes"),
                             required=True,
                             description=_(u"help_slotMinutes"),
                             default=30)

    allDaySlot = schema.Bool(title=_(u"label_allDaySlot"), default=True)

    defaultCalendarView = schema.Choice(
        title=_(u"label_defaultCalendarView"),
        required=True,
        description=_(u"help_defaultCalendarView"),
        source="solgemafullcalendar.availableViews",
        default='agendaWeek')

    shortDayNameFormat = schema.Choice(
        title=_(u"label_shortDayNameFormat"),
        required=True,
        description=_(u"help_shortDayNameFormat"),
        source="solgemafullcalendar.shortNameFormats",
        default='a')

    headerRight = schema.List(title=_(u"label_headerRight"),
                              description=_(u"help_headerRight"),
                              value_type=schema.Choice(
                                  title=_(u"label_headerRight"),
                                  source="solgemafullcalendar.availableViews"),
                              default=['month', 'agendaWeek', 'agendaDay'])

    weekends = schema.Bool(title=_(u"label_weekends"),
                           description=_(u"help_weekends"),
                           default=True)

    firstDay = schema.Choice(title=_(u"label_firstDay"),
                             required=True,
                             description=_(u"help_firstDay"),
                             source="solgemafullcalendar.daysOfWeek",
                             default=1)

    relativeFirstDay = schema.TextLine(title=_(u"label_relativeFirstDay"),
                                       required=False,
                                       description=_(u"help_relativeFirstDay"),
                                       default=u'')

    firstHour = schema.TextLine(title=_(u"label_firstHour"),
                                required=True,
                                description=_(u"help_firstHour"),
                                default=u'-1')

    minTime = schema.TextLine(title=_(u"label_minTime"),
                              required=True,
                              description=_(u"help_minTime"),
                              default=u'0')

    maxTime = schema.TextLine(title=_(u"label_maxTime"),
                              description=_(u"help_minTime"),
                              default=u'24')

    target_folder = schema.Choice(
        title=_(u"label_target_folder"),
        description=_(u"help_target_folder"),
        required=False,
        source=CustomSearchableTextSourceBinder(
            {'object_provides': IATFolder.__identifier__},
            default_query='path:'))

    calendarHeight = schema.TextLine(title=_(u"label_calendarHeight"),
                                     required=False,
                                     description=_(u"help_calendarHeight"),
                                     default=u'600')

    availableCriterias = schema.List(
        title=_(u"label_availableCriterias"),
        required=False,
        description=_(u"help_availableCriterias"),
        value_type=schema.Choice(
            title=_(u"label_availableCriterias"),
            source="solgemafullcalendar.availableCriterias"),
        default=[])

    queryColors = CustomUpdatingDict(title=_(u"label_queryColors"),
                                     required=False,
                                     description=_(u"help_queryColors"),
                                     default={})

    displayUndefined = schema.Bool(title=_(u"label_displayUndefined"),
                                   required=False,
                                   description=_(u"help_displayUndefined"),
                                   default=False)

    overrideStateForAdmin = schema.Bool(
        title=_(u"label_overrideStateForAdmin"),
        required=False,
        description=_(u"help_overrideStateForAdmin"),
        default=True)

    displayNoscriptList = schema.Bool(
        title=_(u"label_displayNoscriptList"),
        required=False,
        description=_(u"help_displayNoscriptList"),
        default=True)

    def isSolgemaFullcalendar(self):
        """get name of days"""
Esempio n. 5
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,
    )
Esempio n. 6
0
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)
Esempio n. 7
0
class INavigationPortlet(IPortletDataProvider):
    """A portlet which can render the navigation tree
    """

    name = schema.TextLine(
        title=_(u"label_navigation_title", default=u"Title"),
        description=_(u"help_navigation_title",
                      default=u"The title of the navigation tree."),
        default=u"",
        required=False)

    root_uid = schema.Choice(
        title=_(u"label_navigation_root_path", default=u"Root node"),
        description=_(u'help_navigation_root',
                      default=u"You may search for and choose a folder "
                      "to act as the root of the navigation tree. "
                      "Leave blank to use the Plone site root."),
        required=False,
        source=CatalogSource(is_folderish=True),
    )

    includeTop = schema.Bool(
        title=_(u"label_include_top_node", default=u"Include top node"),
        description=_(u"help_include_top_node",
                      default=u"Whether or not to show the top, or 'root', "
                      "node in the navigation tree. This is affected "
                      "by the 'Start level' setting."),
        default=False,
        required=False)

    currentFolderOnly = schema.Bool(
        title=_(u"label_current_folder_only",
                default=u"Only show the contents of the current folder."),
        description=_(u"help_current_folder_only",
                      default=u"If selected, the navigation tree will "
                      "only show the current folder and its "
                      "children at all times."),
        default=False,
        required=False)

    topLevel = schema.Int(
        title=_(u"label_navigation_startlevel", default=u"Start level"),
        description=_(
            u"help_navigation_start_level",
            default=u"An integer value that specifies the number of folder "
            "levels below the site root that must be exceeded "
            "before the navigation tree will display. 0 means "
            "that the navigation tree should be displayed "
            "everywhere including pages in the root of the site. "
            "1 means the tree only shows up inside folders "
            "located in the root and downwards, never showing "
            "at the top level."),
        default=1,
        required=False)

    bottomLevel = schema.Int(
        title=_(u"label_navigation_tree_depth",
                default=u"Navigation tree depth"),
        description=_(u"help_navigation_tree_depth",
                      default=u"How many folders should be included "
                      "before the navigation tree stops. 0 "
                      "means no limit. 1 only includes the "
                      "root folder."),
        default=0,
        required=False)
Esempio n. 8
0
class IOrgangovern(form.Schema):
    """ Organ de Govern
    """

    fieldset('organ',
             label=_(u'Tab organ'),
             fields=[
                 'title', 'acronim', 'descripcioOrgan', 'fromMail',
                 'organType', 'logoOrgan', 'visiblefields', 'eventsColor',
                 'estatsLlista', 'FAQmembres'
             ])

    fieldset(
        'assistents',
        label=_(u'Assistents'),
        fields=['membresOrgan', 'convidatsPermanentsOrgan', 'adrecaLlista'])

    fieldset(
        'afectats',
        label=_(u'Afectats'),
        fields=['adrecaAfectatsLlista'],
    )

    fieldset(
        'plantilles',
        label=_(u'Plantilles'),
        fields=['bodyMailconvoquing', 'bodyMailSend', 'footerMail', 'footer'],
    )

    dexterity.write_permission(title='genweb.webmaster')
    dexteritytextindexer.searchable('title')
    title = schema.TextLine(title=_(u'Organ Title'), required=True)

    dexterity.write_permission(acronim='genweb.webmaster')
    dexteritytextindexer.searchable('acronim')
    acronim = schema.TextLine(title=_(u'Acronym'),
                              description=_(u"Acronym Description"),
                              required=True)

    dexteritytextindexer.searchable('descripcioOrgan')
    directives.widget(descripcioOrgan=WysiwygFieldWidget)
    descripcioOrgan = schema.Text(
        title=_(u"Organ Govern description"),
        description=_(u"Organ Govern description help"),
        required=False,
    )

    dexterity.write_permission(organType='genweb.webmaster')
    organType = schema.Choice(
        title=_(u"Organ Govern type"),
        vocabulary=types,
        default=_(u'open_organ'),
        required=True,
    )

    directives.widget(membresOrgan=WysiwygFieldWidget)
    membresOrgan = schema.Text(
        title=_(u"Organ Govern members"),
        description=_(u"Organ Govern members Description"),
        required=False,
    )

    directives.widget(convidatsPermanentsOrgan=WysiwygFieldWidget)
    convidatsPermanentsOrgan = schema.Text(
        title=_(u"Invited members"),
        description=_(u"Organ permanently invited people description."),
        required=False,
    )

    fromMail = schema.TextLine(
        title=_(u'From mail'),
        description=_(u'Enter the from used in the mail form'),
        required=True,
        constraint=checkEmailAddress)

    adrecaLlista = schema.Text(
        title=_(u"mail address"),
        description=_(u"Mail address help"),
        required=True,
    )

    adrecaAfectatsLlista = schema.Text(
        title=_(u"Stakeholders mail address"),
        description=_(u"Stakeholders mail address help."),
        required=False,
    )

    logoOrgan = NamedBlobImage(
        title=_(u"Organ logo"),
        description=_(u'Logo description'),
        required=False,
    )

    eventsColor = schema.TextLine(
        title=_(u"Color del esdeveniments"),
        description=_(u"Events color help"),
        required=False,
    )

    dexterity.write_permission(estatsLlista='genweb.webmaster')
    directives.widget(estatsLlista=WysiwygFieldWidget)
    estatsLlista = schema.Text(
        title=_(u"Agreement and document labels"),
        description=_(u"Enter labels, separated by commas."),
        default=defaultEstats,
        required=False,
    )

    directives.widget(bodyMailconvoquing=WysiwygFieldWidget)
    bodyMailconvoquing = schema.Text(
        title=_(u"Body Mail"),
        description=_(u"Body Mail convoquing description"),
        required=False,
    )

    directives.widget(bodyMailSend=WysiwygFieldWidget)
    bodyMailSend = schema.Text(
        title=_(u"Body Mail send"),
        description=_(u"Body Mail send description"),
        required=False,
    )

    directives.widget(footerMail=WysiwygFieldWidget)
    footerMail = schema.Text(
        title=_(u"footerMail"),
        description=_(u"footerMail description"),
        required=False,
    )

    directives.widget(footer=WysiwygFieldWidget)
    dexteritytextindexer.searchable('footer')
    footer = schema.Text(
        title=_(u"Footer"),
        description=_(u"Footer help"),
        required=False,
    )

    directives.read_permission(visiblefields='genweb.organs.add.organs')
    directives.write_permission(visiblefields='genweb.organs.add.organs')
    visiblefields = schema.Bool(
        title=_(u"Visible fields"),
        description=
        _(u"Make the sessions and composition members fields visibles to everyone, omitting the security systems."
          ),
        required=False,
    )

    FAQmembres = RichTextField(
        title=_(u"FAQ membres"),
        description=_(u'Preguntes freqüents de membres'),
        required=False,
    )
class IUser(Interface):
    anrede = schema.Choice(title=u"Anrede",
                           source=bgetemanrede,
                           constraint=validateAnrede)
    name1 = schema.TextLine(title=u"Firma/Vorname Name",
                            description=u"(Maximal 40 Zeichen)")
    name2 = schema.TextLine(title=u"Abteilung/Ansprechpartner",
                            description=u"(Maximal 40 Zeichen)",
                            required=False)
    name3 = schema.TextLine(title=u"ggfs. Fortsetzung",
                            description=u"(Maximal 40 Zeichen)",
                            required=False)
    name4 = schema.TextLine(title=u"ggfs. Fortsetzung",
                            description=u"(Maximal 40 Zeichen)",
                            required=False)
    strasse = schema.TextLine(title=u"Strasse und Hausnummer")
    plz = schema.TextLine(title=u"Postleitzahl")
    meinort = schema.TextLine(title=u"Ort")
    land = schema.Choice(title=u"Land", source=saplaender, default=u"DE")

    versand = schema.Bool(
        title=u'Abweichende Versandanschrift',
        description=
        u'Bitte klicken Sie hier für eine abweichende Versandanschrift',
        required=False)

    anrede_v = schema.Choice(title=u"Anrede*",
                             source=bgetemanrede,
                             required=False)
    name1_v = schema.TextLine(title=u"Firma/Vorname Name*",
                              description=u"(Maximal 40 Zeichen)",
                              required=False)
    name2_v = schema.TextLine(title=u"Abteilung/Ansprechpartner",
                              description=u"(Maximal 40 Zeichen)",
                              required=False)
    name3_v = schema.TextLine(title=u"ggfs. Fortsetzung",
                              description=u"(Maximal 40 Zeichen)",
                              required=False)
    name4_v = schema.TextLine(title=u"ggfs. Fortsetzung",
                              description=u"(Maximal 40 Zeichen)",
                              required=False)
    strasse_v = schema.TextLine(title=u"Strasse und Hausnummer*",
                                required=False)
    plz_v = schema.TextLine(title=u"Postleitzahl*", required=False)
    ort_v = schema.TextLine(title=u"Ort*", required=False)
    land_v = schema.Choice(title=u"Land*",
                           source=saplaender,
                           default=u"DE",
                           required=False)

    email = schema.TextLine(title=u"E-Mail")
    telefon = schema.TextLine(
        title=u"Telefon",
        description=
        u"Bitte geben Sie uns Ihre Telefonnummer für evtl. Rückfragen.\
                              Format: +49 30 1234567 (Vorwahl ohne „0“, keine Sonderzeichen, max. 20 Zeichen)",
        required=False)
    #art = schema.TextLine(title=u"Art", default=u"R")
    mitnr = schema.TextLine(
        title=u"Mitgliedsnummer (8-stellig, ohne Betriebsstätten-Nr.)",
        required=False)
    passwort = schema.Password(title=u"Passwort", constraint=validatePassword)
    passwort2 = schema.Password(title=u"Passwort wiederholen")

    datenschutz = schema.Bool(
        title=u'Datenschutz',
        constraint=validateCheckbox,
        description=
        u'Ich bin einverstanden, dass meine Daten gespeichert und zum Zwecke der Abwicklung meiner Bestellungen\
                                            an den vertraglichen Versanddienstleister der BG ETEM weitergeleitet werden. Die Datenschutzerklärung\
                                            der BG ETEM habe ich gelesen.')
Esempio n. 10
0
class IListProperties(IVisualizationEditFacet):
    """ Edit numeric facet
    """
    ex_height = schema.TextLine(
        title=_(u"Height"),
        description=_(u"height of the facet's body, e.g., '20em', '200px'"),
        required=False,
        default=u""
    )

    ex_sortMode = schema.Choice(
        title=_(u"Sort mode"),
        description=_(u"how to sort the choices in the facet"),
        required=False,
        default=u"value",
        vocabulary=SimpleVocabulary([
            SimpleTerm(u"value", u"value", u"Value"),
            SimpleTerm(u"count", u"count", u"Count"),
        ])
    )

    ex_sortDirection = schema.Choice(
            title=_(u"Sort direction"),
            description=_(u"whether to reverse the sort direction"),
            required=False,
            default=u"forward",
            vocabulary=SimpleVocabulary([
                SimpleTerm(u"forward", u"forward", u"Forward"),
                SimpleTerm(u"reverse", u"reverse", u"Reverse"),
            ])
        )

    ex_showMissing = schema.Bool(
        title=_(u"Show missing"),
        description=_(u"whether to provide a selection for items missing "
                      "the facet -- this will suppress the "
                      "'(missing this field)' text"),
        required=False,
        default=True
    )

    ex_missingLabel = schema.TextLine(
        title=_(u"Missing label"),
        description=_(u"missing label"),
        required=False,
        default=u""
    )

    ex_selection = schema.TextLine(
        title=_(u"Selection"),
        description=_(u"semicolon-separated list of default selections"),
        required=False,
        default=u""
    )

    ex_fixedOrder = schema.TextLine(
        title=_(u"Fixed Order"),
        description=_(u"semicolon-separated list of values specifying a "
                      "fixed order for sorting the choices in the facet, "
                      "e.g., 'Mo;Tu;We;Th;Fr' for weekdays"),
        required=False,
        default=u""
    )

    ex_scroll = schema.Bool(
        title=_(u"Scroll"),
        description=_(u"if true, facet values are in a scrollable window "
                      "of fixed size. If false, all facet values are shown "
                      "in as much space as needed, without a scroll bar."),
        required=False,
        default=True
    )

    ex_collapsible = schema.Bool(
        title=_(u"Collapsible"),
        description=_(u"collapsible"),
        required=False,
        default=False
    )

    ex_collapsed = schema.Bool(
        title=_(u"Collapsed"),
        description=_(u"collapsed"),
        required=False,
        default=False
    )

    ex_colorCoder = schema.TextLine(
        title=_(u"Color coder"),
        description=_(u"color coder"),
        required=False,
        default=u""
    )

    ex_formatter = schema.TextLine(
        title=_(u"Formatter"),
        description=_(u"formatter"),
        required=False,
        default=u""
    )
Esempio n. 11
0
class IRemoteProxySchema(Interface):
    """Schema interface for the remote proxy behavior and portlet."""

    remote_url = schema.TextLine(
        title=_("label_remote_url", default="Remote URL"),
        description=_(
            "help_remote_url",
            default="URL of the remote content which should be displayed here.",
        ),
        required=True,
    )

    content_selector = schema.TextLine(
        title=_("label_content_selector", default="Content selector"),
        description=_(
            "help_remote_url",
            default="CSS Selector of the content."
            " If given, only the matching content will be used. "
            " If not given, the content response will be used as a whole."
            " Only relevant for text/html content.",
        ),
        required=False,
        missing_value=None,
        default="html body > *",
    )

    keep_scripts = schema.Bool(
        title=_(
            "label_keep_scripts",
            default="Keep scripts",
        ),
        description=_(
            "help_keep_scripts",
            default="Keep or drop script tags."
            " Tags in the body are kept as they are,"
            " those from the header are appended to the content.",
        ),
        required=False,
        default=False,
    )

    keep_styles = schema.Bool(
        title=_(
            "label_styles",
            default="Keep styles",
        ),
        description=_(
            "help_keep_styles",
            default="Keep or drop CSS link and style tags."
            " Tags in the body are kept as they are,"
            " those from the header are appended to the content.",
        ),
        required=False,
        default=False,
    )

    extra_replacements = schema.Tuple(
        title=_("label_extra_replacements", default="Extra Replacement Map"),
        description=_(
            "help_extra_replacements",
            default='List of search and replacement strings, separated by a "|" sign.'
            ' For search or replacement characters containing a "|", escape them like so: "\\|".'
            " One search|replacement definition per line."
            " The replacement happens for each text based mime type, "
            "including application/javascript and appplication/json.",
        ),
        value_type=schema.TextLine(),
        required=False,
        missing_value=(),
        default=(),
    )

    auth_user = schema.TextLine(
        title=_("label_auth_user", default="Username"),
        description=_(
            "help_auth_user",
            default="Optional username for basic HTTP authentication.",
        ),
        required=False,
        default="",
    )

    auth_pass = schema.TextLine(
        title=_("label_auth_pass", default="Password"),
        description=_(
            "help_auth_pass",
            default="Optional password for basic HTTP authentication.",
        ),
        required=False,
        default="",
    )

    send_cookies = schema.Bool(
        title=_(
            "label_send_cookies",
            default="Send cookies",
        ),
        description=_(
            "help_send_cookies",
            default="Send cookies of your own domain to the server.",
        ),
        required=False,
        default=False,
    )

    standalone = schema.Bool(
        title=_(
            "label_standalone",
            default="Standalone proxy",
        ),
        description=_(
            "help_standalone",
            default="Let this proxy be a standalone proxy which ignores "
            "other proxies and is ignored by other proxies. "
            "This way it will not rewrite to other remote URLs "
            "configured by other proxies.",
        ),
        required=False,
        default=False,
    )

    cache_time = schema.TextLine(
        title=_("label_cache_time", default="Cache time"),
        description=_(
            "help_cache_time",
            default="Time to cache the remote content in seconds. "
            "Empty or 0 for no caching.",
        ),
        required=False,
        default="3600",
    )
Esempio n. 12
0
class ITalk(model.Schema):
    """ Marker interface and Dexterity Python Schema for Talk
    """

    title = schema.TextLine(
        title=_('Talk'), description=u'Title of talk.', required=True
    )
    description = schema.Text(
        title=_('Description'),
        description=u'Please provide a description of your talk. This text '
        u'will be shown in talks overview and details, so try to arouse '
        u'curiosity of attendants.',
        required=True,
    )

    text = RichTextField(
        title=_(u'Formatted description'),
        description=u'Used to better format the description (for presentation purposes).',
        required=False,
    )
    directives.widget('text', RichTextFieldWidget)

    duration = schema.Choice(
        title=_('Duration'),
        description=u'Choose the talk length. Short will be 20 minutes and '
        u'Long will be 40 minutes. Remember that a short talk doesn\'t mean '
        u'it\'s a worst talk.',
        required=True,
        source=PRESENTATION_DURATION_TYPES,
    )

    level = schema.Choice(
        title=_('Level'),
        description=u'What should be the technical level needed to understand'
        u'this talk? This is useful for people to choose what talks to attend '
        u'or not based on their skills.',
        required=True,
        source=LEVEL_TYPES,
    )
    audience = schema.List(
        title=_('Audience'),
        description=u'What kind of people should be interested listening this'
        u' talk?',
        required=True,
        value_type=schema.Choice(source=AUDIENCE_TYPES),
    )
    topic = schema.List(
        title=_('Topic'),
        description=u'Choose one or more topics related to your talk.'
        u'This will help us to create a better talks schedule.',
        required=True,
        value_type=schema.Choice(source=TALK_TOPICS),
    )
    directives.widget('topic', CheckBoxFieldWidget)

    other_topics = schema.TextLine(
        title=_('Other topics'),
        description=_(
            u'If you selected "Other", please insert your topics here.'
        ),
        required=False,
    )
    slides_url = schema.TextLine(
        title=_('Slides'), description=_(u'Url of slides.'), required=False
    )
    slides_embed = schema.Text(
        title=_('Embed code for slides'), description=u'', required=False
    )

    video_embed = schema.Text(
        title=_('Video embed code'),
        description=_('Embed code for video recording.'),
        required=False,
    )

    room = schema.Choice(
        title=_('Room'),
        description=u'',
        required=False,
        vocabulary='ploneconf.vocabularies.Rooms',
    )

    start = schema.Datetime(title=u'Start', required=False)
    directives.widget(
        'start',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_start',
    )

    end = schema.Datetime(title=u'End', required=False)
    directives.widget(
        'end',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_end',
    )

    is_keynote = schema.Bool(title=u'Is keynote', required=False)
Esempio n. 13
0
class IDocumentMetadata(model.Schema):
    """Schema behavior for common GEVER document metadata
    """

    model.fieldset(
        u'common',
        label=_(u'fieldset_common', u'Common'),
        fields=[
            u'description',
            u'keywords',
            u'foreign_reference',
            u'document_date',
            u'receipt_date',
            u'delivery_date',
            u'document_type',
            u'document_author',
            u'digitally_available',
            u'preserved_as_paper',
            u'thumbnail',
            u'preview',
        ],
    )

    model.fieldset(u'archive_file',
                   label=_(u'fieldset_archive_file', u'Archive file'),
                   fields=[u'archival_file'])

    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(u'label_description', default=u'Description'),
        required=False,
        missing_value=u'',
    )

    form.widget('keywords', KeywordFieldWidget, new_terms_as_unicode=True)
    keywords = schema.Tuple(
        title=_(u'label_keywords', default=u'Keywords'),
        description=_(u'help_keywords', default=u''),
        value_type=ChoicePlus(vocabulary='plone.app.vocabularies.Keywords'),
        required=False,
        missing_value=(),
        default=(),
    )

    foreign_reference = schema.TextLine(
        title=_(u'label_foreign_reference', default='Foreign Reference'),
        description=_('help_foreign_reference', default=''),
        required=False,
    )

    # workaround because ftw.datepicker wasn't working
    form.widget(document_date=DatePickerFieldWidget)
    document_date = schema.Date(
        title=_(u'label_document_date', default='Document Date'),
        description=_(u'help_document_date', default=''),
        required=False,
        defaultFactory=document_date_default,
    )

    # workaround because ftw.datepicker wasn't working
    form.widget(receipt_date=DatePickerFieldWidget)
    receipt_date = schema.Date(
        title=_(u'label_receipt_date', default='Date of receipt'),
        description=_(u'help_receipt_date', default=''),
        required=False,
    )

    # workaround because ftw.datepicker wasn't working
    form.widget(delivery_date=DatePickerFieldWidget)
    delivery_date = schema.Date(
        title=_(u'label_delivery_date', default='Date of delivery'),
        description=_(u'help_delivery_date', default=''),
        required=False,
    )

    document_type = schema.Choice(
        title=_(u'label_document_type', default='Document Type'),
        source=wrap_vocabulary(
            'opengever.document.document_types',
            visible_terms_from_registry='opengever.document' +
            '.interfaces.IDocumentType.document_types'),
        required=False,
    )

    dexteritytextindexer.searchable('document_author')
    document_author = schema.TextLine(
        title=_(u'label_author', default='Author'),
        description=_(u'help_author',
                      default="Surname firstname or a userid"
                      "(would be automatically resolved to fullname)"),
        required=False,
    )

    form.mode(digitally_available='hidden')
    digitally_available = schema.Bool(
        title=_(u'label_digitally_available', default='Digital Available'),
        required=False,
    )

    form.widget(preserved_as_paper=checkbox.SingleCheckBoxFieldWidget)
    preserved_as_paper = schema.Bool(
        title=_(u'label_preserved_as_paper', default='Preserved as paper'),
        description=_(u'help_preserved_as_paper', default=''),
        required=False,
        defaultFactory=preserved_as_paper_default,
    )

    form.read_permission(archival_file='opengever.document.ModifyArchivalFile')
    form.write_permission(
        archival_file='opengever.document.ModifyArchivalFile')
    archival_file = NamedBlobFile(
        title=_(u'label_archival_file', default='Archival File'),
        description=_(u'help_archival_file', default=''),
        required=False,
    )

    form.omitted('archival_file_state')
    archival_file_state = schema.Int(
        title=_(u'label_archival_file_state', default='Archival file state'),
        required=False,
    )

    form.omitted('thumbnail')
    thumbnail = NamedBlobFile(
        title=_(u'label_thumbnail', default='Thumbnail'),
        required=False,
    )

    form.omitted('preview')
    preview = NamedBlobFile(
        title=_(u'label_preview', default='Preview'),
        description=_(u'help_preview', default=''),
        required=False,
    )
Esempio n. 14
0
class IMapTileSchema(model.Schema):

    form.widget(use_query=UseQueryWidget)
    use_query = schema.Bool(
        title=u'Use dynamic query',
        description=u'For map content.',
        default=False)

    form.widget(content=RelatedItemsFieldWidget)
    content = schema.List(
        title=u"Items",
        description=u"Selected items to show on map",
        required=False,
        default=[],
        value_type=schema.Choice(
            vocabulary='plone.app.vocabularies.Catalog'
        )
    )

    form.widget(query=QueryFieldWidget)
    query = schema.List(
        title=u'Search terms',
        description=u"Define the search terms for the items you want "
                    u"dynamically include in this map",
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False
    )

    sort_on = schema.TextLine(
        title=u'Sort on',
        description=u"Sort on this index",
        required=False,
    )

    sort_reversed = schema.Bool(
        title=u'Reversed order',
        description=u'Sort the results in reversed order',
        required=False,
    )

    limit = schema.Int(
        title=u'Limit',
        description=u'Limit Search Results',
        required=False,
        default=20,
        min=1,
    )

    form.widget(custom_markers=MapMarkersFieldWidget)
    custom_markers = schema.Text(
        title=u'Custom Markers',
        default=u'[]',
        required=False
    )

    form.widget(center=MapPointFieldWidget)
    center = schema.Text(
        title=u'Center point',
        default=u'{}'
    )

    @invariant
    def validate_center(data):
        try:
            center = json.loads(data.center)
        except:
            return
        if len(center) == 0:
            raise Invalid('Must provide a center point')

    height = schema.Int(
        title=u"Height",
        default=200
    )

    initialZoom = schema.Int(
        title=u"Initial Zoom",
        default=11
    )
Esempio n. 15
0
class IRuleStorage(IOrderedContainer, IContainerNamesContainer):
    """A storage for rules. This is registered as a local utility.
    """
    contains('plone.contentrules.rule.interfaces.IRule')

    active = schema.Bool(title=u"Rules in this storage are active")
Esempio n. 16
0
class IQueryListingTileSchema(model.Schema):

    title = schema.TextLine(
        title=u'Title',
        description=u'Provide title above listing',
        required=False,
        default=None
    )

    form.widget(query=QueryFieldWidget)
    query = schema.List(
        title=u'Base query',
        description=u"This query can be customized based on user selection",
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False
    )

    sort_on = schema.TextLine(
        title=u'Sort on',
        description=u"Sort on this index",
        required=False,
        default=defaults.get('querylisting_tile_sort_on', u'effective')
    )

    sort_reversed = schema.Bool(
        title=u'Reversed order',
        description=u'Sort the results in reverse order',
        required=False,
        default=True
    )

    limit = schema.Int(
        title=u'Limit',
        description=u'Limit number of search results',
        required=False,
        default=15,
        min=1,
    )

    form.widget(
        'available_tags',
        AjaxSelectFieldWidget,
        vocabulary='plone.app.vocabularies.Keywords'
    )
    available_tags = schema.Tuple(
        title=u'Tags',
        description=u'Available tags to select from the query widget',
        value_type=schema.TextLine(),
        required=False,
        missing_value=()
    )

    form.widget('display_fields', CheckBoxFieldWidget)
    display_fields = schema.Tuple(
        title=u'Display fields',
        description=u'Fields that should show on the listing',
        default=(
            'image',
            'description'
        ),
        value_type=schema.Choice(
            vocabulary=SimpleVocabulary([
                SimpleTerm('image', 'image', u'Image'),
                SimpleTerm('date', 'date', u'Publication (Effective) Date'),
                SimpleTerm('eventstartend', 'eventstartend', u'Event Start and End'),
                SimpleTerm('description', 'description', u'Overview/Summary')
            ])
        )
    )

    form.widget('display_type', PreviewSelectFieldWidget,
                tile_name='querylisting')
    display_type = schema.Choice(
        title=u"Display Type",
        source=TileViewsSource('querylisting'),
        default=defaults.get('querylisting_tile_displaytype', u'default')
    )
Esempio n. 17
0
class IDiscussionSettings(Interface):
    """Global discussion settings. This describes records stored in the
    configuration registry and obtainable via plone.registry.
    """

    # Todo: Write a short hint, that other discussion related options can
    # be found elsewhere in the Plone control panel:
    #
    # - Types control panel: Allow comments on content types
    # - Search control panel: Show comments in search results

    globally_enabled = schema.Bool(
        title=_(u"label_globally_enabled",
                default=u"Globally enable comments"),
        description=_(
            u"help_globally_enabled",
            default=u"If selected, users are able to post comments on the "
            u"site. Though, you have to enable comments for "
            u"specific content types, folders or content objects "
            u"before users will be able to post comments."),
        required=False,
        default=False,
    )

    anonymous_comments = schema.Bool(
        title=_(u"label_anonymous_comments",
                default="Enable anonymous comments"),
        description=_(u"help_anonymous_comments",
                      default=u"If selected, anonymous users are able to post "
                      u"comments without loggin in. It is highly "
                      u"recommended to use a captcha solution to prevent "
                      u"spam if this setting is enabled."),
        required=False,
        default=False,
    )

    anonymous_email_enabled = schema.Bool(
        title=_(u"label_anonymous_email_enabled",
                default=u"Enable anonymous email field"),
        description=_(u"help_anonymous_email_enabled",
                      default=u"If selected, anonymous user will have to "
                      u"give their email."),
        required=False,
        default=False)

    moderation_enabled = schema.Bool(
        title=_(u"label_moderation_enabled",
                default="Enable comment moderation"),
        description=_(
            u"help_moderation_enabled",
            default=u"If selected, comments will enter a 'Pending' state "
            u"in which they are invisible to the public. A user "
            u"with the 'Review comments' permission ('Reviewer' "
            u"or 'Manager') can approve comments to make them "
            u"visible to the public. If you want to enable a "
            u"custom comment workflow, you have to go to the "
            u"types control panel."),
        required=False,
        default=False,
    )

    edit_comment_enabled = schema.Bool(
        title=_(u"label_edit_comment_enabled",
                default="Enable editing of comments"),
        description=_(u"help_edit_comment_enabled",
                      default=u"If selected, supports editing "
                      "of comments for users with the 'Edit comments' "
                      "permission."),
        required=False,
        default=False,
    )

    delete_own_comment_enabled = schema.Bool(
        title=_(u"label_delete_own_comment_enabled",
                default="Enable deleting own comments"),
        description=_(u"help_delete_own_comment_enabled",
                      default=u"If selected, supports deleting "
                      "of own comments for users with the "
                      "'Delete own comments' permission."),
        required=False,
        default=False,
    )

    text_transform = schema.Choice(
        title=_(u"label_text_transform", default="Comment text transform"),
        description=_(
            u"help_text_transform",
            default=u"Use this setting to choose if the comment text " +
            u"should be transformed in any way. You can choose "
            u"between 'Plain text' and 'Intelligent text'. " +
            u"'Intelligent text' converts plain text into HTML " +
            u"where line breaks and indentation is preserved, " +
            u"and web and email addresses are made into " +
            u"clickable links."),
        required=True,
        default='text/plain',
        vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary',
    )

    captcha = schema.Choice(
        title=_(u"label_captcha", default="Captcha"),
        description=_(u"help_captcha",
                      default=u"Use this setting to enable or disable Captcha "
                      u"validation for comments. Install "
                      u"plone.formwidget.captcha, "
                      u"plone.formwidget.recaptcha, collective.akismet, or "
                      u"collective.z3cform.norobots if there are no options "
                      u"available."),
        required=True,
        default='disabled',
        vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary',
    )

    show_commenter_image = schema.Bool(
        title=_(u"label_show_commenter_image",
                default=u"Show commenter image"),
        description=_(
            u"help_show_commenter_image",
            default=u"If selected, an image of the user is shown next to "
            u"the comment."),
        required=False,
        default=True,
    )

    moderator_notification_enabled = schema.Bool(
        title=_(u"label_moderator_notification_enabled",
                default=u"Enable moderator email notification"),
        description=_(
            u"help_moderator_notification_enabled",
            default=u"If selected, the moderator is notified if a comment "
            u"needs attention. The moderator email address can " +
            u"be set below."),
        required=False,
        default=False,
    )

    moderator_email = schema.ASCIILine(
        title=_(u'label_moderator_email', default=u'Moderator Email Address'),
        description=_(u'help_moderator_email',
                      default=u"Address to which moderator notifications "
                      u"will be sent."),
        required=False,
    )

    user_notification_enabled = schema.Bool(
        title=_(u"label_user_notification_enabled",
                default=u"Enable user email notification"),
        description=_(u"help_user_notification_enabled",
                      default=u"If selected, users can choose to be notified "
                      u"of new comments by email."),
        required=False,
        default=False)
class IEUpRelease(model.Schema):
    form.mode(projecttitle='hidden')
    projecttitle = schema.TextLine(
        title=_(u"The Computed Project Title"),
        description=_(
            u"The release title will be computed from the parent project title."
        ),
        defaultFactory=getContainerTitle)

    releasenumber = schema.TextLine(
        title=_(u"Release Number"),
        description=_(u"Release Number (up to twelf chars)"),
        default=_(u"1.0"),
        max_length=12,
    )

    description = schema.Text(title=_(u"Release Summary"), )

    form.primary('details')
    details = RichText(title=_(u"Full Release Description"), required=False)

    form.primary('changelog')
    changelog = RichText(
        title=_(u"Changelog"),
        description=_(
            u"A detailed log of what has changed since the previous release."),
        required=False,
    )

    form.widget(licenses_choice=CheckBoxFieldWidget)
    licenses_choice = schema.List(
        title=_(u'License of the uploaded file'),
        description=_(
            u"Please mark one or more licenses you publish your release."),
        value_type=schema.Choice(source=vocabAvailLicenses),
        required=True,
    )

    form.widget(compatibility_choice=CheckBoxFieldWidget)
    compatibility_choice = schema.List(
        title=_(u"Compatible with versions of LibreOffice"),
        description=
        _(u"Please mark one or more program versions with which this release is compatible with."
          ),
        value_type=schema.Choice(source=vocabAvailVersions),
        required=True,
        default=[])

    form.mode(title_declaration_legal='display')
    title_declaration_legal = schema.TextLine(
        title=_(u""), required=False, defaultFactory=legal_declaration_title)

    form.mode(declaration_legal='display')
    declaration_legal = schema.Text(title=_(u""),
                                    required=False,
                                    defaultFactory=legal_declaration_text)

    accept_legal_declaration = schema.Bool(
        title=_(u"Accept the above legal disclaimer"),
        description=_(
            u"Please declare that you accept the above legal disclaimer."),
        required=True)

    contact_address2 = schema.TextLine(
        title=_(u"Contact email-address"),
        description=_(u"Contact email-address for the project."),
        required=False,
        defaultFactory=contactinfoDefault)

    source_code_inside = schema.Choice(
        title=_(u"Is the source code inside the extension?"),
        vocabulary=yesnochoice,
        required=True)

    link_to_source = schema.URI(
        title=_(u"Please fill in the Link (URL) to the Source Code."),
        required=False)

    file = NamedBlobFile(
        title=_(u"The first file you want to upload."),
        description=_(u"Please upload your file."),
        required=True,
        constraint=validatefileextension,
    )

    form.widget(platform_choice=CheckBoxFieldWidget)
    platform_choice = schema.List(
        title=_(u"First uploaded file is compatible with the Platform(s)"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=True,
    )

    form.mode(information_further_file_uploads='display')
    model.primary('information_further_file_uploads')
    information_further_file_uploads = RichText(
        title=_(u"Further File Uploads for this Release"),
        description=_(u"If you want to upload more files for this release, "
                      u"e.g. because there are files for other operating "
                      u"systems, you'll find the upload fields on the "
                      u"register 'File Upload 1' and 'File Upload 2'."),
        required=False)

    form.fieldset('fileset1',
                  label=u"File Upload 1",
                  fields=[
                      'filetitlefield1', 'file1', 'platform_choice1',
                      'filetitlefield2', 'file2', 'platform_choice2',
                      'filetitlefield3', 'file3', 'platform_choice3'
                  ])

    form.mode(filetitlefield1='display')
    filetitlefield1 = schema.TextLine(title=_(u"Second Release File"), )

    file1 = NamedBlobFile(
        title=_(u"The second file you want to upload (this is optional)"),
        description=_(u"Please upload your file."),
        required=False,
        constraint=validatefileextension,
    )

    form.widget(platform_choice1=CheckBoxFieldWidget)
    platform_choice1 = schema.List(
        title=_(u"Second uploaded file is compatible with the Platform(s)"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    form.mode(filetitlefield2='display')
    filetitlefield2 = schema.TextLine(title=_(u"Third Release File"), )

    file2 = NamedBlobFile(
        title=_(u"The third file you want to upload (this is optional)"),
        description=_(u"Please upload your file."),
        required=False,
        constraint=validatefileextension,
    )

    form.widget(platform_choice2=CheckBoxFieldWidget)
    platform_choice2 = schema.List(
        title=_(u"Third uploaded file is compatible with the Platform(s))"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    form.mode(filetitlefield3='display')
    filetitlefield3 = schema.TextLine(title=_(u"Fourth Release File"), )

    file3 = NamedBlobFile(
        title=_(u"The fourth file you want to upload (this is optional)"),
        description=_(u"Please upload your file."),
        required=False,
        constraint=validatefileextension,
    )

    form.widget(platform_choice3=CheckBoxFieldWidget)
    platform_choice3 = schema.List(
        title=_(u"Fourth uploaded file is compatible with the Platform(s)"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    form.fieldset('fileset2',
                  label=u"File Upload 2",
                  fields=[
                      'filetitlefield4', 'file4', 'platform_choice4',
                      'filetitlefield5', 'file5', 'platform_choice5'
                  ])

    form.mode(filetitlefield4='display')
    filetitlefield4 = schema.TextLine(title=_(u"Fifth Release File"), )

    file4 = NamedBlobFile(
        title=_(u"The fifth file you want to upload (this is optional)"),
        description=_(u"Please upload your file."),
        required=False,
        constraint=validatefileextension,
    )

    form.widget(platform_choice4=CheckBoxFieldWidget)
    platform_choice4 = schema.List(
        title=_(u"Fifth uploaded file is compatible with the Platform(s)"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    form.mode(filetitlefield5='display')
    filetitlefield5 = schema.TextLine(title=_(u"Sixth Release File"), )

    file5 = NamedBlobFile(
        title=_(u"The sixth file you want to upload (this is optional)"),
        description=_(u"Please upload your file."),
        required=False,
        constraint=validatefileextension,
    )

    form.widget(platform_choice5=CheckBoxFieldWidget)
    platform_choice5 = schema.List(
        title=_(u"Sixth uploaded file is compatible with the Platform(s)"),
        description=
        _(u"Please mark one or more platforms with which the uploaded file is compatible."
          ),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    @invariant
    def licensenotchoosen(value):
        if not value.licenses_choice:
            raise Invalid(_(u"Please choose a license for your release."))

    @invariant
    def compatibilitynotchoosen(data):
        if not data.compatibility_choice:
            raise Invalid(
                _(u"Please choose one or more compatible product versions for your release."
                  ))

    @invariant
    def legaldeclarationaccepted(data):
        if data.accept_legal_declaration is not True:
            raise AcceptLegalDeclaration(
                _(u"Please accept the Legal Declaration about your Release and your Uploaded File"
                  ))

    @invariant
    def testingvalue(data):
        if data.source_code_inside is not 1 and data.link_to_source is None:
            raise Invalid(
                _(u"You answered the question, whether the source code is inside your extension with no "
                  u"(default answer). If this is the correct answer, please fill in the Link (URL) "
                  u"to the Source Code."))

    @invariant
    def noOSChosen(data):
        if data.file is not None and data.platform_choice == []:
            raise Invalid(
                _(u"Please choose a compatible platform for the uploaded file."
                  ))
class ISortableCollectionBehavior(model.Schema):

    query = schema.List(
        title=_(u'Search terms'),
        description=_(u'Define the search terms for the items you want '
                      u'to list by choosing what to match on. '
                      u'The list of results will be dynamically updated'),
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False,
        missing_value='')
    # override QueryString widget with our sortable version
    form.widget('query',
                SortableQueryStringFieldWidget,
                wrapper_css_class='sortableCollection-query')

    sort_on = schema.TextLine(
        title=_(u'label_sort_on', default=u'Sort on'),
        description=_(u'Sort the collection on this index'),
        required=False,
    )

    sort_reversed = schema.Bool(
        title=_(u'label_sort_reversed', default=u'Reversed order'),
        description=_(u'Sort the results in reversed order'),
        required=False,
    )

    limit = schema.Int(
        title=_(u'Limit'),
        description=_(u'Limit Search Results'),
        required=False,
        default=1000,
        min=1,
    )

    item_count = schema.Int(
        title=_(u'label_item_count', default=u'Item count'),
        description=_(u'Number of items that will show up in one batch.'),
        required=False,
        default=30,
        min=1,
    )

    customViewFields = schema.List(
        title=_(u'Table Columns'),
        description=_(u'Select which fields to display when '
                      u"'Tabular view' is selected in the display menu."),
        default=['Title', 'Creator', 'Type', 'ModificationDate'],
        value_type=schema.Choice(
            vocabulary='plone.app.contenttypes.metadatafields'),
        required=False,
    )

    # we need an additional field to store the sorting
    # as UIDs of the found objects (brains)
    sorting = schema.List(
        title=_(u'Sorting'),
        description=_(u'Widget specific sorting of the search results'),
        default=[],
        missing_value=[],
        value_type=schema.TextLine(),
        required=False,
    )
    # We have to set the widget to update the widget-settings
    form.widget('sorting',
                TextLinesFieldWidget,
                wrapper_css_class='sortableCollection-sorting')
Esempio n. 20
0
class IVideo(model.Schema):

    form.omitted('image')
    image = namedfile.NamedBlobImage(
        title=_(u"Cover Image"),
        description=u"",
        required=False,
    )

    # main file will always be converted to mp4
    form.widget(video_file=StreamNamedFileFieldWidget)
    model.primary('video_file')
    video_file = namedfile.NamedBlobFile(
        title=_(u"Video File"),
        description=u"",
        required=False,
        constraint=valid_video
    )

    if youtube:
        upload_video_to_youtube = schema.Bool(
            title=_(u'Upload to youtube'),
            description=_(u'Requires having youtube account connected. '
                          u'Videos that are private will remain unlisted on YouTube. '
                          u'Once published, video will be made public on YouTube. '),
            required=False,
            default=False)

    form.omitted(IAddForm, 'video_file_ogv')
    form.omitted(IEditForm, 'video_file_ogv')
    form.widget(video_file_ogv=StreamNamedFileFieldWidget)
    video_file_ogv = namedfile.NamedBlobFile(
        required=False,
    )

    form.omitted(IAddForm, 'video_file_webm')
    form.omitted(IEditForm, 'video_file_webm')
    form.widget(video_file_webm=StreamNamedFileFieldWidget)
    video_file_webm = namedfile.NamedBlobFile(
        required=False,
    )

    youtube_url = schema.TextLine(
        title=_(u"Youtube URL"),
        description=_(u"Alternatively, you can provide a youtube video url. "
                      u"If this is specified, video file will be ignored. "
                      u"If video was uploaded to youtube, this field will be filled "
                      u"with video url."),
        required=False
    )
    retrieve_thumb = schema.Bool(
        title=_(u'Retrieve original thumbnail from youtube'),
        description=_(u"If checked, try to download original thumbnail from "
                      u"youtube into this video."),
        required=False,
        default=False)

    @invariant
    def validate_videos(data):
        if not data.video_file and not data.youtube_url:
            raise Invalid("Must specify either a video file or youtube url")

    width = schema.Int(
        title=_(u"Width"),
        defaultFactory=getDefaultWidth
    )

    height = schema.Int(
        title=_(u"Height"),
        defaultFactory=getDefaultHeight
    )

    subtitle_file = namedfile.NamedBlobFile(
        title=_(u"Subtitle file"),
        description=_(u"Provide a file in srt format"),
        required=False
    )

    form.omitted('metadata')
    metadata = schema.Text(
        required=False
    )

    transcript = RichText(
        title=_(u"Transcript"),
        default_mime_type='text/html',
        output_mime_type='text/html',
        allowed_mime_types=('text/html', 'text/plain'),
        default=u"",
        required=False
    )
Esempio n. 21
0
class IIssue(model.Schema):
    """Marker interface for Poi issue"""

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(u'Poi_label_issue_title', default=u"Title"),
        description=_(u'Poi_help_issue_title',
                      default=u"Enter a short, descriptive title for "
                      u"the issue. A good title will make it easier "
                      u"for project managers to identify and respond "
                      u"to the issue."))

    release = schema.Choice(
        title=_(u'Poi_label_issue_release', default=u'Release'),
        description=_(u'Poi_help_issue_release',
                      default=u"Select the version the issue was found in."),
        required=False,
        source=possibleTargetReleases)

    dexteritytextindexer.searchable('details')
    details = RichText(title=_(u'Poi_label_issue_details', default=u'Details'),
                       description=_(
                           u'Poi_help_issue_details',
                           default=u"Please provide further details."))

    dexteritytextindexer.searchable('steps')
    steps = RichText(
        title=_(u'Poi_label_issue_steps', default=u'Steps To Reproduce'),
        description=_(u'Poi_help_issue_steps',
                      default=u"If applicable, please provide the steps to "
                      u"reproduce the error or identify the issue, one per "
                      u"line."),
        required=False,
    )

    area = schema.Choice(
        title=_(u'Poi_label_issue_area', default=u'Area'),
        description=_(u'Poi_help_issue_area',
                      default=u"Select the area this issue is relevant to."),
        source=possibleAreas)

    issue_type = schema.Choice(title=_(u'Poi_label_issue_type',
                                       default=u'Issue Type'),
                               description=_(
                                   u'Poi_help_issue_type',
                                   default=u"Select the type of issue."),
                               source=possibleIssueTypes)

    read_permission(severity='Poi.ModifyIssueSeverity')
    write_permission(severity='Poi.ModifyIssueSeverity')
    severity = schema.Choice(
        title=_(u'Poi_label_issue_severity', default=u'Severity'),
        description=_(u'Poi_help_issue_severity',
                      default=u"Select the severity of this issue."),
        defaultFactory=default_severity,
        source=possibleSeverities)

    read_permission(target_release='Poi.ModifyIssueTargetRelease')
    write_permission(target_release='Poi.ModifyIssueTargetRelease')
    target_release = schema.Choice(
        title=_(u'Poi_label_issue_target_release', default=u'Target Release'),
        description=_(u'Poi_help_issue_target_release',
                      default=u"Release this issue is targetted to be fixed "
                      u"in."),
        source=possibleTargetReleases,
        required=False,
    )

    read_permission(assignee='Poi.ModifyIssueAssignment')
    write_permission(assignee='Poi.ModifyIssueAssignment')
    assignee = schema.Choice(
        title=_(u'Poi_label_issue_assignee', default=u'Assignee'),
        description=_(u'Poi_help_issue_assignee',
                      default=u"Select which person, if any, is assigned to "
                      u"this issue."),
        source=possibleAssignees,
        required=False,
    )

    contact_email = email.Email(
        title=_(u'Poi_label_issue_contact_email', default=u'Contact Email'),
        description=_(u'Poi_help_issue_contact_email',
                      default=u"Please provide an email address where you can "
                      u"be contacted for further information or when a "
                      u"resolution is available. Note that your email "
                      u"address will not be displayed to others."),
        required=False,
    )

    read_permission(watchers='Poi.ModifyIssueWatchers')
    write_permission(watchers='Poi.ModifyIssueWatchers')
    widget('watchers',
           AjaxSelectFieldWidget,
           vocabulary='plone.app.vocabularies.Users')
    watchers = schema.List(
        title=_(u'Poi_label_issue_watchers', default=u'Watchers'),
        description=_(u'Poi_help_issue_watchers',
                      default=u"Enter the user ids of members who are watching"
                      u" this issue, one per line. E-mail addresses are "
                      u"allowed too. These persons will "
                      u"receive an email when a response is added to the "
                      u"issue. Members can also add themselves as "
                      u"watchers."),
        value_type=schema.TextLine(),
        required=False,
        defaultFactory=default_watchers,
    )

    write_permission(subject='Poi.ModifyIssueTags')
    read_permission(subject='Poi.ModifyIssueTags')
    widget('subject',
           AjaxSelectFieldWidget,
           vocabulary='plone.app.vocabularies.Keywords',
           pattern_options={'allowNewItems': 'true'})
    subject = schema.Tuple(
        title=_(u'Poi_label_issue_subject', default=u'Subject'),
        description=_(u'Poi_help_issue_subject',
                      default=u"Tags can be used to add arbitrary "
                      u"categorisation to issues. The list below shows "
                      u"existing tags which you can select, or you can add "
                      u"new ones."),
        value_type=schema.TextLine(),
        required=False,
        missing_value=[],
    )

    read_permission(related_issue='Poi.ModifyRelatedIssues')
    write_permission(related_issue='Poi.ModifyRelatedIssues')
    widget(
        'related_issue',
        RelatedItemsFieldWidget,
        pattern_options={
            'resultTemplate':
            '' +
            '<div class="pattern-relateditems-result<% if (oneLevelUp) { %> one-level-up<% } %>">'
            +
            '  <a class="pattern-relateditems-result-select<% if (selectable) { %> selectable<% } else if (browsing && is_folderish) { %> pattern-relateditems-result-browse<% } %><% if (oneLevelUp) { %> one-level-up<% } %>" data-path="<%- path %>">'
            +
            '    <% if (getURL && (getIcon || portal_type === "Image")) { %><img src="<%- getURL %>/@@images/image/icon "><br><% } %>'
            +
            '    <span class="pattern-relateditems-result-title" title="<%- portal_type %>"><%- Title %></span>'
            +
            '    <span class="pattern-relateditems-result-path"><%- path %></span>'
            + '  </a>' + '</div>'
        })
    related_issue = RelationList(title=_(u'Poi_label_issue_related',
                                         default=u'Related Issue(s)'),
                                 description=_(
                                     u'Poi_help_issue_related',
                                     default=u'Link related issues.'),
                                 value_type=RelationChoice(
                                     title=u"Related",
                                     source=tracker_issues,
                                 ),
                                 required=False)

    empty = schema.Bool(title=_(u'Poi_label_issue_empty',
                                default=u'Leave this field empty'),
                        required=False,
                        constraint=checkEmpty)
Esempio n. 22
0
class IFormDataSetSpecification(form.Schema):
    """
    Query specification for filtering a set of forms, and methods
    to obtain iterable of forms or brains for forms matching the
    specification.
    """

    form.fieldset('filters',
                  label=u'Query filters',
                  fields=[
                      'query_title',
                      'query_subject',
                      'query_state',
                      'query_start',
                      'query_end',
                  ])

    form.fieldset('aggregation',
                  label=u'Aggregation',
                  fields=[
                      'use_aggregate',
                      'aggregate_datasets',
                      'aggregate_function',
                  ])

    title = schema.TextLine(
        title=u'Title',
        description=u'Name of form set.',
        required=True,
    )

    description = schema.Text(
        title=u'Description',
        description=u'Description of the form set resulting from '
        u'selection or query.',
        required=False,
    )

    # locations can be specific forms or series, or parent* folders
    directives.widget(
        'locations',
        CustomRootRelatedWidget,
        pattern_options={
            'basePath': '/',
            'mode': 'browse'
        },
    )
    locations = schema.List(
        title=u'Included locations',
        description=u'Select locations (specific forms or containing '
        u'folders, including form series and/or parent '
        u'folders) to include.  If you do not choose at '
        u'least one location, all forms will be included and '
        u'optionally filtered. If you choose locations, only '
        u'forms within those locations will be included and '
        u'optionally filtered by any chosen filter criteria.',
        value_type=schema.BytesLine(),
        required=False,
        defaultFactory=list,
    )

    sort_on_start = schema.Bool(
        title=u'Sort on start date?',
        description=u'Should resulting forms included be sorted by '
        u'their respective start dates?',
        required=False,
        default=True,
    )

    query_title = schema.TextLine(
        title=u'Filter: title',
        description=u'Full text search of title of forms.',
        required=False,
    )

    query_subject = schema.List(
        title=u'Filter: tags',
        description=u'Query for any forms matching tags or subject '
        u'(one per line).',
        value_type=schema.TextLine(),
        required=False,
        defaultFactory=list,  # req zope.schema >= 3.8.0
    )

    query_state = schema.List(
        title=u'Filter: workflow state(s)',
        description=u'List of workflow states. If not specified, items in '
        u'any state will be considered.',
        value_type=schema.Choice(
            vocabulary=u'plone.app.vocabularies.WorkflowStates',  # named vocab
        ),
        required=False,
        defaultFactory=list,  # req zope.schema >= 3.8.0
    )

    query_start = schema.Date(
        title=u'Filter: date range start',
        description=u'Date range inclusion query (start).',
        required=False,
    )

    query_end = schema.Date(
        title=u'Filter: date range end',
        description=u'Date range inclusion query (end).',
        required=False,
    )

    use_aggregate = schema.Bool(
        title=u'Use aggregate calculation?',
        description=u'If selected, and other data-sets are selected '
        u'for aggregation, calculate aggregate value '
        u'for these data-sets using function specified?',
        default=False,
    )

    aggregate_datasets = schema.List(
        title=u'Aggregate data-sets',
        value_type=schema.Choice(source=MeasureGroupContentSourceBinder(
            portal_type=DATASET_TYPE), ),
        defaultFactory=list,
        required=False,
    )

    aggregate_function = schema.Choice(
        title=u'Aggregate function',
        vocabulary=CUMULATIVE_FN_CHOICES,
        default='AVG',
    )

    def brains(self):
        """Return an iterable of catalog brains for forms included."""

    def forms(self):
        """Return an iterable of form objects included."""

    def included_locations(self):
        """
        List of catalog brains of included locations in locations field.
        """

    def directly_included(self, spec):
        """
Esempio n. 23
0
class ISlideTileSchema(model.Schema):

    model.fieldset('type_and_text',
                   label=u'Type & Text',
                   fields=[
                       'display_type',
                       'title',
                       'text',
                   ])

    display_type = schema.Choice(
        title=u"Display Type",
        vocabulary=SimpleVocabulary([
            SimpleTerm('background-image', 'background-image',
                       u'Background Image'),  # noqa
            SimpleTerm('left-image-right-text', 'left-image-right-text',
                       u'Left Image Right Text'),  # noqa
            SimpleTerm('background-video', 'background-video',
                       u'Background Video'),  # noqa
            SimpleTerm('left-video-right-text', 'left-video-right-text',
                       u'Left Video Right Text'),  # noqa
            SimpleTerm('resource-slide', 'resource-slide',
                       u'Resource Slide')  # noqa
        ]),
        required=True,
        default='background-image')

    title = schema.TextLine(title=u'Slide Title',
                            description=u'Will be omitted if blank',
                            required=False,
                            default=u'')

    text = schema.Text(title=u'Slide Text',
                       description=u'Will be omitted if blank',
                       required=False,
                       default=u'')

    #######################################################################################################
    model.fieldset('text_positioning',
                   label=u'Text Positioning',
                   fields=[
                       'hor_text_position',
                       'vert_text_position',
                       'text_alignment',
                       'justify_wrapped_text',
                   ])

    hor_text_position = schema.Choice(
        title=u"Slide Text Position (Horizontal)",
        description=u'This setting only applies to large screens. '
        u'On small screens, Center (Full Width) will always be deisplayed.',
        vocabulary=SimpleVocabulary([
            SimpleTerm('start', 'start', u'Left (Half Width)'),
            SimpleTerm('center', 'center', u'Center (Full Width)'),
            SimpleTerm('end', 'end', u'Right (Half Width)'),
        ]),
        required=True,
        default=u'center')

    vert_text_position = schema.Choice(title=u"Slide Text Position (Vertical)",
                                       vocabulary=SimpleVocabulary([
                                           SimpleTerm('top', 'top', u'Top'),
                                           SimpleTerm('middle', 'middle',
                                                      u'Middle'),
                                           SimpleTerm('bottom', 'bottom',
                                                      u'Bottom'),
                                       ]),
                                       required=True,
                                       default=u'middle')

    text_alignment = schema.Choice(
        title=u"Slide Text Alignment",
        description=
        u'The alignment of slide text relative to other text on the page. '
        u'This does not change the position of the text section selected above. '
        u'(Note: this is ignored on smaller screens)',
        vocabulary=SimpleVocabulary([
            SimpleTerm('left', 'left', u'Left'),
            SimpleTerm('center', 'center', u'Center'),
        ]),
        required=True,
        default=u'center')

    justify_wrapped_text = schema.Bool(
        title=u'Justify Wrapped Text Lines',
        description=
        u'Select this option to force any text line that wraps to more than one line to take up the entire width. '  # noqa
        u'This will assure that there are no gaps to the left and/or right when text fills the whole line, regardless of Text Alignment Choice above.',  # noqa 
        default=False,
    )

    #######################################################################################################
    model.fieldset('media_settings',
                   label=u'Media Settings',
                   fields=[
                       'image',
                       'video',
                   ])

    form.widget(image=ImageRelatedItemFieldWidget)
    image = schema.List(
        title=u"Slide Image",
        description=u"Reference image on the site.",
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'))

    form.widget(video=VideoRelatedItemsFieldWidget)
    video = schema.List(
        title=u"Slide Video",
        description=u"Reference video on the site.",
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'))

    #######################################################################################################
    model.fieldset('related_items',
                   label=u'Related Items',
                   fields=['related_items'])

    form.widget('related_items', SlideRelatedItemsFieldWidget)
    related_items = schema.List(
        title=u"Related Items",
        description=u"Items to include on Resource Slide. "
        u"To be selectable, a content item must contain a Title, Description (Summary), and a Lead Image.",  # noqa
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'))
Esempio n. 24
0
class IBackupTumourForm(Interface):
    compression = schema.Bool(
        title=_(u'Data compression'),
        description=_(u'Select this option if you want the data compression '),
        default=False,
    )
Esempio n. 25
0
class IAPISettings(Interface):
    princexml_server_url = schema.TextLine(
        title=u'PrinceXML server url',
        description=u'required in order to convert documents',
        default=u'http://localhost:6543/convert',
        required=False)

    google_maps_api_key = schema.TextLine(title=u'Google Maps API Key',
                                          default=None,
                                          required=False)

    google_api_email = schema.TextLine(title=u'Google API Email',
                                       default=None,
                                       required=False)

    google_api_service_key_file = schema.ASCII(
        title=u"Google API Service Key File",
        description=u'Private key file',
        required=False,
    )

    google_analytics_id = schema.TextLine(
        title=u'Google Analytics ID',
        description=u'for use with gathering content statistics',
        required=False)

    gtm_id = schema.TextLine(title=u'Google Tag Manager Container ID',
                             description=u'Provided by Google',
                             required=False)

    gtm_enabled = schema.Bool(
        title=u'Enable Google Tag Manager Throughout Site', default=False)

    recaptcha_public_key = schema.TextLine(title=u'Recaptcha 3 Public Key',
                                           required=False)

    recaptcha_private_key = schema.TextLine(title=u'Recaptcha 3 Private Key',
                                            required=False)

    aws_s3_key = schema.TextLine(title=u'AWS S3 Key',
                                 required=False,
                                 default=None)

    aws_s3_secret = schema.TextLine(title=u'AWS S3 Secret',
                                    required=False,
                                    default=None)

    aws_s3_bucket_name = schema.TextLine(title=u'AWS S3 Bucket',
                                         required=False,
                                         default=None)

    aws_s3_host_endpoint = schema.TextLine(
        title=u'AWS Host endpoint',
        description=u'Leave empty unless you know what you are doing here.',
        required=False,
        default=None)

    aws_s3_base_url = schema.TextLine(
        title=u'AWS File Base Url',
        description=
        u'If you are providing your own domain name to serve files from',
        required=False,
        default=None)

    plivo_auth_id = schema.TextLine(title=u'Plivo Auth ID',
                                    description=u'Text messaging API',
                                    required=False)

    plivo_auth_token = schema.TextLine(title=u'Plivo Auth Token',
                                       required=False)

    plivo_phone_number = schema.TextLine(
        title=u'Plivo Source Number',
        description=u'For making text messages from',
        required=False)

    etherpad_url = schema.TextLine(
        title=u'Etherpad URL',
        description=
        u'The full address of your Etherpad server, e.g. http://127.0.0.1:9001',
        required=False)

    etherpad_api_key = schema.TextLine(
        title=u'Etherpad API Key',
        description=
        u'The hexadecimal string taken from your Etherpad installation'
        's APIKEY.txt',
        required=False)

    cf_api_key = schema.TextLine(
        title=u'Cloudflare API Key',
        description=u'Setting an API Key here and enabling cache purging '
        u'activates purging against Cloudflare.',
        required=False)

    cf_email = schema.TextLine(
        title=u'Cloudflare Email',
        description=u'One associated with cloudflare api key',
        required=False)

    cf_zone_id = schema.TextLine(title=u'Cloudflare Zone ID', required=False)

    rocket_chat_front_page = schema.TextLine(
        title=u'Rocket.Chat User URL',
        description=u'URL of the Rocket.Chat server to connect to',
        required=False)

    rocket_chat_secret = schema.TextLine(
        title=u'Rocket.Chat secret',
        description=
        u'Text string used to salt Rocket.Chat authentication tokens',
        required=False,
        default=unicode(django_random.get_random_string(64)))

    matomo_base_url = schema.URI(
        title=u'Matomo instance base URL',
        description=u'used to query social media share outlinks via Matomo API, '
        'e.g. https://castlecms.innocraft.cloud',
        default=None,
        required=False)

    matomo_token_auth = schema.TextLine(
        title=u'Matomo authentication token',
        description=
        u'from your Matomo account settings, under Platform > API, User Authentication.',
        default=u'',
        required=False)

    matomo_site_id = schema.TextLine(
        title=u'Matomo Site ID',
        description=
        u'from your Matomo account settings, under Websites > Manage.',
        default=u'1',
        required=False)
Esempio n. 26
0
class IFrontpageTile(IExistingContentTile):

    show_text = schema.Bool(title=_(u"Show content text"), default=False)

    show_comments = schema.Bool(
        title=_(u"Show content comments count (if enabled)"),
        default=False,
        required=False,
    )

    show_image = schema.Bool(
        title=_(u"Show content image (if available)"),
        default=True,
        required=False,
    )

    show_author = schema.Bool(
        title=_(u"Show the authors (if item is a Product)"),
        default=True,
        required=False,
    )

    show_price = schema.Bool(
        title=_(u"Show the price (if item is a Product)"),
        default=True,
        required=False,
    )

    show_buttons = schema.Bool(
        title=_(u"Show the buttons (if item is a Product)"),
        default=True,
        required=False,
    )

    show_as_header = schema.Bool(
        title=_(u"Show content has header"),
        default=False,
        required=False,
    )

    image_scale = schema.Choice(
        title=_(u"Image scale"),
        vocabulary="plone.app.vocabularies.ImagesScales",
        required=False,
        default=u"large")

    tile_class = schema.TextLine(
        title=_(u"Tile additional styles"),
        description=_(u"Insert a list of additional CSS classes that will" +
                      u" be added to the tile"),
        default=u"",
        required=False)

    description_alternative = schema.TextLine(
        title=_(u"Replace the description with a custom text"),
        description=
        _(u"The item's description will be replaced with the text on this field"
          ),
        default=u"",
        required=False)

    video_id = schema.TextLine(
        title=_(u"Video ID"),
        description=_(u"Item will show a video if an id is added"),
        default=u"",
        required=False)

    video_thumb_url = schema.TextLine(
        title=_(u"Video first frame URL"),
        description=_(u"The first frame will be shown before the video loads"),
        default=u"",
        required=False)

    view_template = schema.Choice(title=_(u'Display mode'),
                                  source=_(u'Available Frontpage Views'),
                                  required=True)

    form.omitted('show_text')
    form.omitted('show_comments')
    form.omitted('tile_class')
Esempio n. 27
0
class ISecuritySchema(controlpanel.ISecuritySchema):
    failed_login_attempt_window = schema.Int(
        title=u'Failed login attempts window(seconds)',
        required=True,
        default=900)

    max_failed_login_attempts = schema.Int(title=u'Max failed login attempts',
                                           required=True,
                                           default=8)

    days_to_clean_disabled_users = schema.Int(
        title=u'Number of days before disabled users are removed', default=30)

    login_shield_setting = schema.Choice(
        title=u'Login shield',
        description=u'Require user to login before they can even '
        u'access the site',
        default=constants.SHIELD.NONE,
        vocabulary=SimpleVocabulary([
            create_term(constants.SHIELD.NONE, 'Not active'),
            create_term(constants.SHIELD.BACKEND, 'Protect only backend urls'),
            create_term(constants.SHIELD.ALL,
                        'Protect all traffic. BE CAREFUL ACTIVATING THIS.'),
        ]))

    two_factor_enabled = schema.Bool(
        title=u'Require two factor authentication',
        description=u'Requires users to have email and/or phone number set',
        default=False,
    )

    auth_step_timeout = schema.Int(
        title=
        u'(Seconds) This amount of inactivity will reset the login process',
        description=
        u'Between each step, the allowed time is reset to this amount',
        default=120,
    )

    restrict_logins_to_countries = schema.Tuple(
        title=u'Restrict logins to countries',
        description=u'Choose countries that logins should be restricted to. '
        u'This feature only works if your proxy server is '
        u'forwarding the user country code to the CastleCMS server. '
        u'Leave empty to allow all logins.',
        missing_value=(),
        default=(),
        required=False,
        value_type=schema.Choice(
            vocabulary='castle.cms.vocabularies.Countries'))

    pwexpiry_enabled = schema.Bool(
        title=u'Enable Password Expiration',
        description=u'Toggle whether or not password expiration \
        and password history are enabled.',
        default=False)

    pwexpiry_validity_period = schema.Int(
        title=u'Password Validity Period',
        description=u'Number of days for password validity \
        (set to 0 to disable).',
        default=180)

    pwexpiry_password_history_size = schema.Int(
        title=u'Password History Size',
        description=u'Number of already chosen passwords \
        that must not be re-used (set to 0 to disable).',
        default=5)

    public_url = schema.TextLine(
        title=u'Public site URL',
        description=u'The URL the public will use to view your site.',
        default=None,
        required=False)

    backend_url = schema.Tuple(
        title=u'Backend site URLs',
        description=
        u'The URL(s) from which you will be editing and maintaining site content. '
        u'One URL per line. Please enter the main URL first.',
        value_type=schema.TextLine(),
        default=(),
        required=False)

    only_allow_login_to_backend_urls = schema.Bool(
        title=u'Only allow login at a backend URL',
        description=
        u'If set, users can only log in if visiting from a backend URL.',
        default=False,
        required=False)
Esempio n. 28
0
class IExampleSchema(interface.Interface):
    """
    Field types:
        Datetime - Field containing a DateTime
        Date - Field containing a date
        Timedelta - Field containing a timedelta
        Password - Field containing a unicode string without newlines that is a
            password
        Object - Field containing an Object value
        URI - A field containing an absolute URI
        ASCII - Field containing a 7-bit ASCII string. No characters > DEL
            (chr(127)) are allowed
        ASCIILine - Field containing a 7-bit ASCII string without newlines
        Bytes - Field containing a byte string (like the python str)
        BytesLine - Field containing a byte string without newlines
        Tuple - Field containing a value that implements the API of a
            conventional Python tuple
        List - Field containing a value that implements the API of a
            conventional Python list
        Set - Field containing a value that implements the API of a
            conventional Python standard library sets
        FrozenSet - Field containing a value that implements the API of a
            conventional Python 2.4+ frozenset
        Dict - Field containing a conventional dict
        SourceText - Field for source text of object
        Id - A field containing a unique identifier
            A unique identifier is either an absolute URI or a dotted name.
            If it's a dotted name, it should have a module/package name as a
            prefix
        DottedName - Dotted name field
        InterfaceField - Fields with a value that is an interface (implementing
            zope.interface.Interface)

    Field types arguments:
        title - A short summary or label
        description - A description of the field (to be displayed as a hint)
        required - Tells whether a field requires its value to exist
        readonly - If true, the field's value cannot be changed
        default - The field default value may be None or a legal field value
        missing_value - If a field has no assigned value, set it to this value
        constraint - function checking a constraint on the field
    """

    # Text - Field containing a unicode string
    text_field = schema.Text(title=u'Text field',
                             description=u'field description',
                             required=True,
                             readonly=False,
                             default=u'default value',
                             missing_value=u'missing value')

    # TextLine - Field containing a unicode string without newlines
    textline_field = schema.TextLine(title=u'Textline field',
                                     description=u'field description',
                                     required=True,
                                     readonly=False,
                                     default=u'default value',
                                     missing_value=u'missing value',
                                     constraint=successfull_constraint)

    # Int - Field containing an Integer Value
    int_field = schema.Int(title=u'Integer field',
                           description=u'field description',
                           required=True,
                           readonly=False,
                           default=0,
                           missing_value=1,
                           min=0,
                           max=10)

    # Bool - Boolean Field
    bool_field = schema.Bool(
        title=u'Boolean field',
        description=u'field description',
        required=True,
        readonly=False,
        #        default=True,
        #        missing_value=True
    )

    # Float - Field containing a Float
    float_field = schema.Float(
        title=u'Float field',
        description=u'field description',
        required=True,
        readonly=False,
        #        default=0.0,
        #        missing_value=0.0
    )

    # Choice - Field whose value is contained in a predefined set
    # Only one, values or vocabulary, may be specified for a given choice
    choice_field = schema.Choice(
        title=u'Choice field',
        description=u'field description',
        required=True,
        readonly=False,
        #        default='Title 2',
        #        missing_value='Option 2',
        #        Only one of the arguments: vocabulary, source or values may be used
        vocabulary=SimpleVocabulary((SimpleTerm(value=1,
                                                token='Option 1',
                                                title='Title 1'),
                                     SimpleTerm(value=2,
                                                token='Option 2',
                                                title='Title 2')))
        #        source=VocabularyExample
        #        values=['Option 1', 'Option 2'],
    )
Esempio n. 29
0
class ITagSettings(Interface):
    """A utility used to manage which tags are available and how categories
    are treated.
    """

    allow_uncommon = schema.Bool(
        title=_(u"Allow uncommon tags globally"),
        description=_(u"If enabled, it will be possible to add "
                      "tags other than those in the list below to "
                      "content objects that support this. If disabled, "
                      "all tags must be in the pre-defined list."),
        default=True,
        required=False,
    )

    tags = schema.Set(
        title=_(u"Pre-defined tags"),
        description=_(u"List pre-defined tags here. Tags can either be "
                      "simple strings or categorised using the form "
                      "Category-TagName."),
        required=True,
        default=set(),
        value_type=schema.TextLine(title=_(u"Tag")),
    )

    unique_categories = schema.Set(
        title=_(u"Unique categories"),
        description=_(u"If you want to ensure that users pick at most "
                      "one tag in a given category, list the category "
                      "name here."),
        required=True,
        default=set(),
        value_type=schema.TextLine(title=_(u"Category")),
    )

    required_categories = schema.Set(
        title=u"Required categories",
        description=_(u"If you want to ensure that users pick "
                      "at least one tag in a given category, "
                      "list the category name here."),
        required=True,
        default=set(),
        value_type=schema.TextLine(title=_(u"Category")),
    )

    @invariant
    def validate_categories_subset(obj):
        """Ensure that unique/required categories are a subset of the actual
        categories used in tags.
        """

        from collective.gtags.utils import get_categories

        tags = obj.tags
        if tags is None:
            tags = set()

        categories = get_categories(tags)
        if obj.unique_categories:
            for category in obj.unique_categories:
                if category not in categories:
                    raise InvalidCategories(
                        _(u"${category} is not a valid category",
                          mapping={'category': category}))

        if obj.required_categories:
            for category in obj.required_categories:
                if category not in categories:
                    raise InvalidCategories(
                        _(u"${category} is not a valid category",
                          mapping={'category': category}))
Esempio n. 30
0
class IFilterSchema(Interface):
    """Combined schema for the adapter lookup.
    """

    # class IFilterTagsSchema(Interface):

    disable_filtering = schema.Bool(
        title=_(u'Disable html filtering'),
        description=_(u'Warning, disabling can be potentially dangereous. '
                      u'Only disable if you know what you are doing.'),
        default=False,
        required=False)

    nasty_tags = schema.List(
        title=_(u'Nasty tags'),
        description=_(u"These tags, and their content are completely blocked "
                      "when a page is saved or rendered."),
        default=[u'applet', u'embed', u'object', u'script'],
        value_type=schema.TextLine(),
        required=False)

    stripped_tags = schema.List(
        title=_(u'Stripped tags'),
        description=_(u"These tags are stripped when saving or rendering, "
                      "but any content is preserved."),
        default=[
            u'font',
        ],
        value_type=schema.TextLine(),
        required=False)

    custom_tags = schema.List(
        title=_(u'Custom tags'),
        description=_(u"Add tag names here for tags which are not part of "
                      "XHTML but which should be permitted."),
        default=[],
        value_type=schema.TextLine(),
        required=False)

    # class IFilterAttributesSchema(Interface):

    stripped_attributes = schema.List(
        title=_(u'Stripped attributes'),
        description=_(u"These attributes are stripped from any tag when "
                      "saving."),
        default=(u'dir lang valign halign border frame rules cellspacing '
                 'cellpadding bgcolor').split(),
        value_type=schema.TextLine(),
        required=False)

    stripped_combinations = schema.Dict(
        title=_(u'Stripped combinations'),
        description=_(u"These attributes are stripped from those tags when "
                      "saving."),
        key_type=schema.TextLine(title=u"tags"),
        value_type=schema.TextLine(title=u"attributes"),
        default={},
        # XXX replace with value adapter
        # default={'table th td': 'width height', 'other tags': 'other attrs'}
        required=False)

    # class IFilterEditorSchema(Interface):

    style_whitelist = schema.List(
        title=_(u'Permitted properties'),
        description=_(
            u'These CSS properties are allowed in style attributes.'),
        default=u'text-align list-style-type float text-decoration'.split(),
        value_type=schema.TextLine(),
        required=False)

    class_blacklist = schema.List(
        title=_(u'Filtered classes'),
        description=_(u'These class names are not allowed in class '
                      'attributes.'),
        default=[],
        value_type=schema.TextLine(),
        required=False)