class IBandoAgidSchema(IBandoSchema, IDesignPloneContentType):
    """A Dexterity schema for Annoucements"""

    # ridefinito, così usiamo il campo dei blocchi
    text = BlocksField(
        title=_("text_label", default="Testo"),
        description=_(
            "text_help",
            default="",
        ),
        required=False,
    )
    tipologia_bando = schema.Choice(
        title=_rtbando("tipologia_bando_label", default="Announcement type"),
        description=_rtbando("tipologia_bando_help", default=""),
        vocabulary="redturtle.bandi.tipologia.vocabulary",
        required=True,
    )
    destinatari = schema.List(
        title=_rtbando("destinatari_label", default="Recipients"),
        description=_rtbando("destinatari_help", default=""),
        required=False,
        value_type=schema.Choice(
            vocabulary="redturtle.bandi.destinatari.vocabulary"),
    )
    ente_bando = schema.Tuple(
        title=_rtbando("ente_label", default="Authority"),
        description=_rtbando("ente_help", default="Select some authorities."),
        required=False,
        defaultFactory=getDefaultEnte,
        value_type=schema.TextLine(),
        missing_value=None,
    )
    scadenza_domande_bando = schema.Datetime(
        title=_(
            "scadenza_domande_bando_label",
            default="Termine per le richieste di chiarimenti",
        ),
        description=_(
            "scadenza_domande_bando_help",
            default="Data entro la quale sarà possibile far pervenire domande"
            " e richieste di chiarimento a chi eroga il bando",
        ),
        required=False,
    )
    scadenza_bando = schema.Datetime(
        title=_rtbando("scadenza_bando_label",
                       default="Expiration date and time"),
        description=_rtbando(
            "scadenza_bando_help",
            default="Deadline to participate in the announcement",
        ),
        required=False,
    )

    chiusura_procedimento_bando = schema.Date(
        title=_rtbando(
            "chiusura_procedimento_bando_label",
            default="Closing date procedure",
        ),
        description=_rtbando("chiusura_procedimento_bando_help", default=""),
        required=False,
    )

    riferimenti_bando = BlocksField(
        title=_("riferimenti_bando_agid_label",
                default="Ulteriori informazioni"),
        description=_(
            "riferimenti_bando_agid_help",
            default="Ulteriori informazioni non previste negli altri campi;"
            " si può trattare di contatti o note informative la cui conoscenza"
            " è indispensabile per la partecipazione al bando",
        ),
        required=False,
    )

    ufficio_responsabile = RelationList(
        title=_(
            "ufficio_responsabile_bando_label",
            default="Ufficio responsabile del bando",
        ),
        description=_(
            "ufficio_responsabile_bando_help",
            default="Seleziona l'ufficio responsabile di questo bando.",
        ),
        required=False,
        default=[],
        value_type=RelationChoice(
            title=_("Ufficio responsabile"),
            vocabulary="plone.app.vocabularies.Catalog",
        ),
    )

    area_responsabile = RelationList(
        title=_(
            "area_responsabile_label",
            default="Area responsabile del documento",
        ),
        description=_(
            "area_responsabile_help",
            default="Seleziona l'area amministrativa responsabile del "
            "documento.",
        ),
        required=False,
        default=[],
        value_type=RelationChoice(title=_("Area"),
                                  vocabulary="plone.app.vocabularies.Catalog"),
    )

    # widgets
    directives.widget(
        "ente_bando",
        AjaxSelectFieldWidget,
        vocabulary="redturtle.bandi.enti.vocabulary",
    )
    directives.widget(destinatari=CheckBoxFieldWidget)
    directives.widget(tipologia_bando=RadioFieldWidget)
    form.widget(
        "ufficio_responsabile",
        RelatedItemsFieldWidget,
        vocabulary="plone.app.vocabularies.Catalog",
        pattern_options={
            "maximumSelectionSize": 1,
            "selectableTypes": ["UnitaOrganizzativa"],
        },
    )
    form.widget(
        "area_responsabile",
        RelatedItemsFieldWidget,
        vocabulary="plone.app.vocabularies.Catalog",
        pattern_options={
            "maximumSelectionSize": 1,
            "selectableTypes": ["UnitaOrganizzativa"],
        },
    )

    model.fieldset(
        "correlati",
        label=_("correlati_label", default="Contenuti collegati"),
        fields=["area_responsabile", "ufficio_responsabile"],
    )
class IProtectDossier(model.Schema):
    """Define a form for managing dossier protection."""

    model.fieldset(
        u'protect',
        label=_(
            u'fieldset_protect',
            default=u'Protect',
        ),
        fields=[
            'reading',
            'reading_and_writing',
            'dossier_manager',
        ],
    )

    form.widget(
        'reading',
        KeywordFieldWidget,
        async=True,
        template_result='usersAndGroups',
        template_selection='usersAndGroups',
    )

    form.write_permission(reading='opengever.dossier.ProtectDossier', )

    reading = schema.List(
        title=_(
            u'label_reading',
            default=u'Reading',
        ),
        description=_(
            u'description_reading',
            default=(
                u'Choose users and groups which have only readable access to '
                u'the dossier'),
        ),
        value_type=schema.Choice(source=AllUsersAndGroupsSourceBinder(), ),
        required=False,
        default=[],
        missing_value=[],
    )

    form.widget(
        'reading_and_writing',
        KeywordFieldWidget,
        async=True,
        template_selection='usersAndGroups',
        template_result='usersAndGroups',
    )
    form.write_permission(
        reading_and_writing='opengever.dossier.ProtectDossier', )

    reading_and_writing = schema.List(
        title=_(
            u'label_reading_and_writing',
            default=u'Reading and writing',
        ),
        description=_(
            u'description_reading_and_writing',
            default=(
                u'Choose users and groups which have readable and writing '
                u'access to the dossier'),
        ),
        value_type=schema.Choice(source=AllUsersAndGroupsSourceBinder(), ),
        required=False,
        default=[],
        missing_value=[],
    )

    form.widget(
        'dossier_manager',
        KeywordFieldWidget,
        async=True,
        template_selection='usersAndGroups',
        template_result='usersAndGroups',
    )

    form.write_permission(dossier_manager='opengever.dossier.ProtectDossier', )

    dossier_manager = schema.Choice(
        title=_(
            u'label_dossier_manager',
            default=u'Dossier manager',
        ),
        description=_(
            u'description_dossier_manager',
            default=(
                u'This user or group will get the dossier manager role after '
                u'protecting the dossier.')),
        source=AllUsersAndGroupsSourceBinder(),
        defaultFactory=current_user,
        required=False,
        missing_value=None,
    )
class IStorage(Interface):
    """ Annotations Storage

        >>> ptool = queryUtility(IProgressTool)
        >>> cid = ptool.invokeFactory('ProgressContentType', id='document')
        >>> sandbox = ptool[cid]

        >>> from eea.progressbar.interfaces import IStorage
        >>> storage = IStorage(sandbox)
        >>> storage
        <eea.progressbar.storage.handler.Storage object at ...>

        >>> storage.fields
        {}

        >>> storage.order
        []

    """

    fields = schema.Dict(title=_(u"Custom fields settings"), readonly=True)
    order = schema.List(title=_(u"Custom order of fields"), readonly=True)

    def add_field(name, kwargs):
        """ Add new field configuration

            >>> storage.add_field('title', icon='eea-icon', ready='Title added')
            'title'

            >>> storage.add_field('effectiveDate')
            'effectiveDate'

            >>> storage.add_field('expirationDate')
            'expirationDate'

        """

    def field(name, default):
        """ Get field by given name

            >>> storage.field('description', {})
            {}

            >>> storage.field('title')
            {...'name': 'title'...}

        """

    def edit_field(name, kwargs):
        """ Edit field configuration

            >>> storage.edit_field('description', icon="eea-icon-pencil")
            'description'

            >>> storage.field('description')
            {...'name': 'description'...}

        """

    def delete_field(name):
        """ Delete field configuration

            >>> storage.delete_field('relatedItems')
            Traceback (most recent call last):
            ...
            KeyError: 'relatedItems'

            >>> storage.delete_field('description')
            {...'name': 'description'...}

            >>> 'description' in storage.fields
            False

        """

    def reorder(order):
        """ Reorder fields

            >>> storage.reorder(('effectiveDate', 'expirationDate', 'title'))
            >>> storage.order
            ['effectiveDate', 'expirationDate', 'title']

        """

    def delete_fields():
        """ Delete all fields
class IBundleRegistry(zope.interface.Interface):

    jscompilation = schema.ASCIILine(
        title=_(u"URL of the last js compilation"), required=False)

    csscompilation = schema.ASCIILine(
        title=_(u"URL of the last css compilation"), required=False)

    last_compilation = schema.Datetime(
        title=_(u"Last compiled date"),
        description=_(u"Date time of the last compilation of this bundle"),
        required=False)

    expression = schema.ASCIILine(
        title=_(u"Expression to render"),
        description=_(
            u"In case its a bundle we can have a condition to render it (it "
            "does not apply if the bundle is merged)."),
        required=False)

    conditionalcomment = schema.ASCIILine(
        title=_(u"Conditional comment"),
        description=_(
            u"In case you want to render this resource on conditional comment "
            "(it does not apply if the bundle is merged)."),
        required=False)

    resources = schema.List(
        title=_(u"Loaded resources"),
        description=_(
            u"The resources that are going to be loaded on this bundle in order"
        ),
        value_type=schema.ASCIILine(title=_(u"Resource name")),
        required=False)

    enabled = schema.Bool(title=_(u"It's enabled?"),
                          default=True,
                          required=False)

    compile = schema.Bool(
        title=_(u"Does your bundle contains any RequireJS or LESS file?"),
        description=
        _(u"If its true and you modify this bundle you need to build it before production"
          ),
        default=True,
        required=False)

    depends = schema.ASCIILine(
        title=_(u"Depends on another bundle"),
        description=
        _(u"In case you want to be the last: *, in case its the first should be empty"
          ),
        required=False)

    develop_javascript = schema.Bool(title=_(u'Develop JavaScript'),
                                     default=False)

    develop_css = schema.Bool(title=_(u'Develop CSS'), default=False)

    stub_js_modules = schema.List(
        title=_(u'Stub JavaScript modules'),
        description=_(
            u'Define list of modules that will be defined empty '
            u'on RequireJS build steps to prevent loading modules multiple times.'
        ),
        value_type=schema.ASCIILine(title=_(u"Resource name")),
        required=False,
        missing_value=[],
        default=[])

    merge_with = schema.Choice(
        title=_(u"Merge with"),
        description=_(
            u"In production mode, bundles are merged together to reduce the "
            "quantity of JS and CSS resources loaded by the browser. Choose "
            "'default' if this bundle must be available for all the visitors, "
            "choose 'logged-in' if it must be available for logged-in users "
            "only, or leave it empty if it must not be merged."),
        vocabulary=SimpleVocabulary([
            SimpleTerm('', '', _(u"")),
            SimpleTerm('default', 'default', 'default'),
            SimpleTerm('logged-in', 'logged-in', 'logged-in')
        ]),
        default=u"",
        required=False)
Example #5
0
class IShopShippingSettings(model.Schema):
    """Shop controlpanel schema for article settings.
    """

    model.fieldset(
        "shipping",
        label=_(u"Shipping", default=u"Shipping"),
        fields=[
            "default_shipping_item_shippable",
            "available_shipping_methods",
            "shipping_method",
            "shipping_vat",
            "shipping_limit_from_gross",
            "free_shipping_limit",
            "flat_shipping_cost",
            "item_shipping_cost",
        ],
    )

    default_shipping_item_shippable = schema.Bool(
        title=_(
            u"label_default_shipping_item_shippable",
            default=u"Item Shippable by default",
        ),
        description=_(
            "help_default_shipping_item_shippable",
            default=u"Flag whether item is shippable by default, "
            u"i.e. downloads are not",
        ),
    )

    available_shipping_methods = schema.List(
        title=_(u"label_available_shipping_methods",
                default=u"Available Shipping Methods"),
        description=_(
            u"help_available_shipping_methods",
            default=u"Available shipping methods in checkout",
        ),
        required=True,
        min_length=1,
        value_type=schema.Choice(vocabulary="bda.plone.shop.vocabularies."
                                 "AvailableShippingMethodsVocabulary"),
    )

    shipping_method = schema.Choice(
        title=_(u"label_shipping_method", default=u"Shipping Method"),
        description=_(u"help_shipping_method",
                      default=u"Default shipping method in checkout"),
        vocabulary="bda.plone.shop.vocabularies."
        "ShippingMethodsVocabulary",
    )

    shipping_vat = schema.Choice(
        title=_(u"label_shipping_vat", default=u"Shipping VAT"),
        description=_(u"help_shipping_vat",
                      default=u"VAT used to calculate shipping costs"),
        vocabulary="bda.plone.shop.vocabularies.VatVocabulary",
    )

    # default shipping related settings

    free_shipping_limit = schema.Float(
        title=_(u"label_free_shipping_limit", default=u"Free Shipping Limit"),
        description=_(
            u"help_free_shipping_limit",
            default=u"Do not add shipping costs to orders "
            u"with price bigger than limit. If limit "
            u"applies to gross or net purchase price "
            u"depends on 'Calculate shipping limit from "
            u"gross' setting",
        ),
        required=True,
        default=200.0,
    )

    shipping_limit_from_gross = schema.Bool(
        title=_(
            u"label_shipping_limit_from_gross",
            default=u"Calculate shipping limit from gross",
        ),
        description=_(
            u"help_shipping_limit_from_gross",
            default=u"If set to False, shipping limit gets "
            u"calculated from net price instead of gross.",
        ),
    )

    flat_shipping_cost = schema.Float(
        title=_(u"label_flat_shipping_cost", default=u"Flat shipping cost"),
        description=_(u"help_flat_shipping_cost",
                      default=u"Net flat shipping cost"),
        required=True,
        default=10.0,
    )

    item_shipping_cost = schema.Float(
        title=_(u"label_item_shipping_cost", default=u"Item shipping cost"),
        description=_(
            u"help_item_shipping_cost",
            default=u"Net shipping cost per item in cart. If flat "
            u"shipping cost set and item shipping cost "
            u"below flat shipping cost, flat shipping cost "
            u"is used",
        ),
        required=True,
        default=0.0,
    )
Example #6
0
class IServeisTICControlPanelSettings(model.Schema):
    """ Global Genweb settings. This describes records stored in the
    configuration registry and obtainable via plone.registry.
    """

    model.fieldset('General',
                   _(u'General'),
                   fields=['url_info_serveistic', 'show_filters'])

    url_info_serveistic = schema.TextLine(
        title=_(u"URL d'informació de Serveis TIC"),
        description=_(u"URL on enllaça la i de la barra superior del lloc "
                      u"web de Serveis TIC"),
        required=False)

    show_filters = schema.Bool(
        title=_(u"Desplegar filtres de cerca"),
        description=_(u"Desplega el filtres de cerca que trobem a la pàgina  "
                      u"principal"),
        required=False)

    model.fieldset('Servei Web Problemes',
                   _(u'Servei Web Problemes'),
                   fields=[
                       'ws_problemes_endpoint', 'ws_problemes_login_username',
                       'ws_problemes_login_password'
                   ])

    ws_problemes_endpoint = schema.TextLine(title=_(u'URL'), required=False)

    ws_problemes_login_username = schema.TextLine(title=_(u'Usuari'),
                                                  required=False)

    ws_problemes_login_password = schema.Password(title=_(u'Contrasenya'),
                                                  required=False)

    model.fieldset('Servei Web Indicadors',
                   _(u'Servei Web Indicadors'),
                   fields=[
                       'ws_indicadors_service_id', 'ws_indicadors_endpoint',
                       'ws_indicadors_key'
                   ])

    ws_indicadors_service_id = schema.TextLine(
        title=_(u"Identificador al servei web d'Indicadors"),
        description=_(u"Identificador de Serveis TIC al servei web"),
        required=False)

    ws_indicadors_endpoint = schema.TextLine(title=_(u'URL'), required=False)

    ws_indicadors_key = schema.Password(title=_(u'API key'), required=False)

    model.fieldset('Actualitzacio Indicadors',
                   _(u"Actualització d'Indicadors"),
                   fields=['update_indicadors_passphrase'])

    update_indicadors_passphrase = schema.TextLine(
        title=_(u"Contrasenya"),
        description=_(u"Contrasenya necessària per a fer servir la vista "
                      u"d'actualització (valor del paràmetre 'passphrase')"),
        required=False)

    model.fieldset('Google Analytics',
                   _(u"Google Analytics"),
                   fields=['ga_key_json', 'ga_view_id'])

    ga_key_json = schema.Text(
        title=_(u"Clau de la API"),
        description=_(u"Contingut JSON de la clau de la API"),
        required=False)

    ga_view_id = schema.TextLine(
        title=_(u"Id de visualització"),
        description=_(
            u"Identificador de la visualització de serveistic.upc.edu"),
        required=False)

    model.fieldset('Facetes', _(u'Facetes'), fields=['facetes_table'])
    form.widget(facetes_table=DataGridFieldFactory)
    facetes_table = schema.List(
        title=_(u'Facetes'),
        description=_(u'help_facetes_table',
                      default=u'Afegir els valors per facetes de cerca'),
        value_type=DictRow(title=_(u'help_facetes_table'),
                           schema=ITableFacetes),
        required=False)
Example #7
0
class IJob(form.Schema, IImageScaleTraversable):
    """
    Description of the Example Type
    """

    searchable('job_code')
    job_code = schema.TextLine(
        title=_(u'Job Code'),
        required=True
    )

    exp_levels = schema.List(
        title=_(u'Experience levels'),
        required=True,
        value_type=schema.Choice(
            vocabulary='dkiscm.jobmatrix.experience'
        )
    )

    searchable('education')
    education = schema.Choice(
        title=_(u'Education'),
        vocabulary='dkiscm.jobmatrix.education',
        required=True
    )

    searchable('education_description')
    education_description = schema.TextLine(
        title=_(u'Education Description'),
        required=False
    )

    searchable('similar_job_titles')
    similar_job_titles = schema.List(
        title=_(u'Similar Job Titles'),
        required=False,
        value_type=schema.TextLine()
    )

    searchable('professional_certification')
    professional_certification = schema.List(
        title=u'Industry Certification',
        value_type=schema.TextLine(),
        required=False
    )

#    form.widget(industry_certification=DataGridFieldFactory)
#    searchable('industry_certification')
#    industry_certification = schema.List(
#        title=u'Industry Certification',
#        value_type=DictRow(schema=IIndustryCertificationGrid),
#        required=False,
#    )

    form.widget(salary_range=DataGridFieldFactory)
    salary_range = schema.List(
        title=u'Salary Range',
        description=u'Enter salary range (eg: 1000-3000)',
        value_type=DictRow(schema=ISalaryRangeGrid),
        required=False,
    )

    form.widget(skills_competency=DataGridFieldFactory)
    searchable('skills_competency')
    skills_competency = schema.List(
        title=_(u'Technical Skills Competency'),
        value_type=DictRow(schema=ISkillGrid),
        required=False
    )

    form.widget(softskills_competency=DataGridFieldFactory)
    searchable('softskills_competency')
    softskills_competency = schema.List(
        title=_(u'Soft Skills Competency'),
        value_type=DictRow(schema=ISoftSkillGrid),
        required=False
    )

    suitable_for_entry = schema.Bool(
        title=_(u'Suitable for Entry'),
        default=False
    )

    job_demand = schema.Int(
        title=_(u'Job Demand'),
        default=0,
        required=False
    )

    job_demand_synovate2013 = schema.Int(
        title=_(u'Job Demand Synovate 2013'),
        default=0,
        required=False,
    )
class ITinyMCEPluginSchema(Interface):
    """This interface defines the toolbar properties."""

    plugins = schema.List(
        title=_("label_tinymce_plugins", default=u"Editor plugins"),
        description=_("help_tinymce_plugins", default=(
            u"Select plugins to include with tinymce")),
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleTerm('advlist', 'advlist', u"advlist"),
            SimpleTerm('anchor', 'anchor', u"anchor"),
            SimpleTerm('autosave', 'autosave', u"autosave"),
            SimpleTerm('charmap', 'charmap', u"charmap"),
            SimpleTerm('code', 'code', u"code"),
            SimpleTerm('colorpicker', 'colorpicker', u"colorpicker"),
            SimpleTerm('contextmenu', 'contextmenu', u"contextmenu"),
            SimpleTerm('directionality', 'directionality', u"directionality"),
            SimpleTerm('emoticons', 'emoticons', u"emoticons"),
            SimpleTerm('fullpage', 'fullpage', u"fullpage"),
            SimpleTerm('fullscreen', 'fullscreen', u"fullscreen"),
            SimpleTerm('hr', 'hr', u"hr"),
            SimpleTerm('insertdatetime', 'insertdatetime', u"insertdatetime"),
            SimpleTerm('layer', 'layer', u"layer"),
            SimpleTerm('lists', 'lists', u"lists"),
            SimpleTerm('media', 'media', u"media"),
            SimpleTerm('nonbreaking', 'nonbreaking', u"nonbreaking"),
            SimpleTerm('noneditable', 'noneditable', u"noneditable"),
            SimpleTerm('pagebreak', 'pagebreak', u"pagebreak"),
            SimpleTerm('paste', 'paste', u"paste"),
            SimpleTerm('preview', 'preview', u"preview"),
            SimpleTerm('print', 'print', u"print"),
            SimpleTerm('save', 'save', u"save"),
            SimpleTerm('searchreplace', 'searchreplace', u"searchreplace"),
            SimpleTerm('tabfocus', 'tabfocus', u"tabfocus"),
            SimpleTerm('table', 'table', u"table"),
            SimpleTerm('textcolor', 'textcolor', u"textcolor"),
            SimpleTerm('textpattern', 'textpattern', u"textpattern"),
            SimpleTerm('visualblocks', 'visualblocks', u"visualblocks"),
            SimpleTerm('visualchars', 'visualchars', u"visualchars"),
            SimpleTerm('wordcount', 'wordcount', u"wordcount")
        ])),
        default=['advlist', 'directionality', 'emoticons',
                 'fullscreen', 'hr', 'insertdatetime', 'lists', 'media',
                 'nonbreaking', 'noneditable', 'pagebreak', 'paste', 'preview',
                 'print', 'save', 'searchreplace', 'tabfocus', 'table',
                 'visualchars', 'wordcount', 'code'],
        required=False)

    menubar = schema.List(
        title=_("label_tinymce_menubar", default=u"Menubar"),
        description=_("help_tinymce_menubar", default=(
            u"Enter what items you would like in the menu bar.")),
        required=True,
        value_type=schema.TextLine(),
        default=[
            u'edit', u'table', u'format',
            u'tools' u'view', u'insert'])

    menu = schema.Text(
        title=_('label_tinymce_menu', 'Menu'),
        description=_('hint_tinymce_menu',
                      default='JSON formatted Menu configuration.'),
        default=json.dumps({
            'file': {'title': 'File', 'items': 'newdocument'},
            'edit': {'title': 'Edit', 'items': 'undo redo | cut '
                              'copy paste pastetext | selectall'},
            'insert': {'title': 'Insert', 'items': 'link media | template hr'},
            'view': {'title': 'View', 'items': 'visualaid'},
            'format': {'title': 'Format',
                       'items': 'bold italic underline strikethrough '
                                'superscript subscript | formats | removeformat'},
            'table': {'title': 'Table', 'items': 'inserttable tableprops deletetable '
                                                 '| cell row column'},
            'tools': {'title': 'Tools', 'items': 'spellchecker code'}
        }, indent=4).decode('utf8')
    )

    templates = schema.Text(
        title=_("label_tinymce_templates", default=u"Templates"),
        description=_("help_tinymce_templates", default=(
            u"Enter the list of templates in json format \
                http://www.tinymce.com/wiki.php/Plugin:template")),
        required=False,
        default=u"")

    toolbar = schema.Text(
        title=_("label_tinymce_toolbar", default=u"Toolbar"),
        description=_("help_tinymce_toolbar", default=(
            u"Enter how you would like the toolbar items to list.")),
        required=True,
        default=u'undo redo | styleselect | bold italic | '
                u'alignleft aligncenter alignright alignjustify | '
                u'bullist numlist outdent indent | '
                u'unlink plonelink ploneimage')

    custom_plugins = schema.List(
        title=_(u"Custom plugins"),
        description=_(u"Enter a list of custom plugins which will be loaded "
                      "in the editor. Format is "
                      "pluginname|location, one per line."),
        required=False,
        value_type=schema.TextLine(),
        default=[])

    custom_buttons = schema.List(
        title=_(u"Custom buttons"),
        description=_(u"Enter a list of custom buttons which will be added to toolbar"),
        required=False,
        value_type=schema.TextLine(),
        default=[])
class ITinyMCESpellCheckerSchema(Interface):
    """This interface defines the libraries properties."""

    libraries_spellchecker_choice = schema.Choice(
        title=_(u"Spellchecker plugin to use"),
        description=_(u"This option allows you to choose the spellchecker for "
                      u"TinyMCE."),
        missing_value=set(),
        vocabulary=SimpleVocabulary([
            SimpleTerm('browser', 'browser',
                       _(u"Default browser spellchecker")),
            SimpleTerm('AtD', 'AtD',
                       _(u"After the deadline (FLOSS)")),
        ]),
        default=u'browser',
        required=False)

    libraries_atd_ignore_strings = schema.List(
        title=_(u"AtD ignore strings"),
        description=_(
            'label_atd_ignore_strings',
            default=u"A list of strings which the \"After the Deadline\" "
                    u"spellchecker should ignore. "
                    u"Note: This option is only applicable when the "
                    u"appropriate spellchecker has been chosen above."),
        default=[
            u"Zope",
            u"Plone",
            u"TinyMCE"],
        value_type=schema.TextLine(),
        required=False)

    libraries_atd_show_types = schema.List(
        title=_(u"AtD error types to show"),
        description=_(
            'help_atderrortypes_to_show',
            default=u"A list of error types which the "
                    u"\"After the Deadline\" spellchecker should check for. "
                    u"By default, all the available error type will be "
                    u"listed here."),
        value_type=schema.TextLine(),
        default=[
            u"Bias Language",
            u"Cliches",
            u"Complex Expression",
            u"Diacritical Marks",
            u"Double Negatives",
            u"Hidden Verbs",
            u"Jargon Language",
            u"Passive voice",
            u"Phrases to Avoid",
            u"Redundant Expression"],
        required=False)

    libraries_atd_service_url = schema.TextLine(
        title=_(u"AtD service URL"),
        description=_(
            'help_atd_service_url',
            default=u"The URL of the \"After the Deadline\" grammar and spell "
                    u"checking server. "
                    u"The default value is the public server, "
                    u"but ideally you should download and install your own "
                    u"and specify its address here."),
        required=True,
        default=u"service.afterthedeadline.com",)
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.List(
        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."),
        value_type=schema.TextLine(),
        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,
    )
class IEditingSchema(Interface):

    visible_ids = schema.Bool(
        title=_(u"Show 'Short Name' on content?"),
        description=_(
            u"Display and allow users to edit the "
            u"'Short name' content identifiers, which form the "
            u"URL part of a content item's address. Once "
            u"enabled, users will then be able to enable this "
            u"option in their preferences."),
        default=False,
        required=False)

    available_editors = schema.List(
        title=_(u'Available editors'),
        description=_(u"Available editors in the portal."),
        default=['TinyMCE'],
        value_type=schema.TextLine(),
        required=True
    )

    default_editor = schema.Choice(
        title=_(u'Default editor'),
        description=_(
            u"Select the default wysiwyg "
            u"editor. Users will be able to choose their "
            u"own or select to use the site default."),
        default=u'TinyMCE',
        missing_value=set(),
        vocabulary="plone.app.vocabularies.AvailableEditors",
        required=True)

    ext_editor = schema.Bool(
        title=_(u'Enable External Editor feature'),
        description=_(
            u"Determines if the external editor "
            u"feature is enabled. This feature requires a "
            u"special client-side application installed. The "
            u"users also have to enable this in their "
            u"preferences."),
        default=False,
        required=False)

    enable_link_integrity_checks = schema.Bool(
        title=_(u"Enable link integrity checks"),
        description=_(
            u"Determines if the users should get "
            u"warnings when they delete or move content that "
            u"is linked from inside the site."),
        default=True,
        required=False)

    lock_on_ttw_edit = schema.Bool(
        title=_(u"Enable locking for through-the-web edits"),
        description=_(
            u"Disabling locking here will only "
            u"affect users editing content through the "
            u"Plone web UI.  Content edited via WebDAV "
            u"clients will still be subject to locking."),
        default=True,
        required=False)
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)
class ILanguageSchema(Interface):
    model.fieldset(
        'general',
        label=_(u'General', default=u'General'),
        fields=[
            'default_language',
            'available_languages',
            'use_combined_language_codes',
            'display_flags',
            'always_show_selector'
        ],
    )

    default_language = schema.Choice(
        title=_(u"heading_site_language",
                default=u"Site language"),
        description=_(
            u"description_site_language",
            default=u"The language used for the content and the UI "
                    u"of this site."),
        default='en',
        required=True,
        vocabulary="plone.app.vocabularies.AvailableContentLanguages"
    )

    available_languages = schema.List(
        title=_(u"heading_available_languages",
                default=u"Available languages"),
        description=_(u"description_available_languages",
                      default=u"The languages in which the site should be "
                              u"translatable."),
        required=True,
        default=['en'],
        value_type=schema.Choice(
            vocabulary="plone.app.vocabularies.AvailableContentLanguages"
        )
    )

    use_combined_language_codes = schema.Bool(
        title=_(
            u'label_allow_combined_language_codes',
            default=u"Show country-specific language variants"
        ),
        description=_(
            u"help_allow_combined_language_codes",
            default=u"Examples: pt-br (Brazilian Portuguese), "
                    u"en-us (American English) etc."
        ),
        default=True,
        required=False
    )

    display_flags = schema.Bool(
        title=_(
            u'label_display_flags',
            default=u"Show language flags"
        ),
        description=u"",
        default=False,
        required=False
    )

    always_show_selector = schema.Bool(
        title=_(
            u'label_always_show_selector',
            default=u"Always show language selector"
        ),
        description=_(
            u"help_always_show_selector",
            default=u""
        ),
        default=False,
        required=False
    )

    model.fieldset(
        'negotiation_scheme',
        label=_(u'Negotiation scheme', default=u'Negotiation scheme'),
        fields=[
            'use_content_negotiation',
            'use_path_negotiation',
            'use_cookie_negotiation',
            'authenticated_users_only',
            'set_cookie_always',
            'use_subdomain_negotiation',
            'use_cctld_negotiation',
            'use_request_negotiation',
            ],
        )
    use_content_negotiation = schema.Bool(
        title=_(u"heading_language_of_the_content",
                default=u"Use the language of the content item"),
        description=_(u"description_language_of_the_content",
                      default=u"Use the language of the content item."),
        default=False,
        required=False,
    )

    use_path_negotiation = schema.Bool(
        title=_(
            u"heading_language_codes_in_URL",
            default=u"Use language codes in URL path for manual override"),
        description=_(
            u"description_language_codes_in_URL",
            default=u"Use language codes in URL path for manual override."),
        default=False,
        required=False,
    )

    use_cookie_negotiation = schema.Bool(
        title=_(u"heading_cookie_manual_override",
                default=(u"Use cookie for manual override")),
        description=_(
            u"description_cookie_manual_override",
            default=(u"Required for the language selector viewlet to be rendered.")
        ),
        default=False,
        required=False,
    )

    authenticated_users_only = schema.Bool(
        title=_(u"heading_auth_cookie_manual_override",
                default=u"Authenticated users only"),
        description=_(
            u"description_auth_ookie_manual_override",
            default=(u"Related to Use cookie for manual override")
        ),
        default=False,
        required=False,
    )

    set_cookie_always = schema.Bool(
        title=_(
            u"heading_set_language_cookie_always",
            default=(u"Set the language cookie always")),
        description=_(
            u"description_set_language_cookie_always",
            default=(u"i.e. also when the 'set_language' request parameter is absent")),
        default=False,
        required=False,
        )

    use_subdomain_negotiation = schema.Bool(
        title=_(u"heading_use_subdomain",
                default=u"Use subdomain"),
        description=_(u"description_use_subdomain",
                      default=u"e.g.: de.plone.org"),
        default=False,
        required=False,
        )

    use_cctld_negotiation = schema.Bool(
        title=_(u"heading_top_level_domain",
                default=u"Use top-level domain"),
        description=_(u"description_top_level_domain",
                      default=u"e.g.: www.plone.de"),
        default=False,
        required=False,
        )

    use_request_negotiation = schema.Bool(
        title=_(u"heading_browser_language_request_negotiation",
                default=u"Use browser language request negotiation"),
        description=_(u"description_browser_language_request_negotiation",
                      default=u"Use browser language request negotiation."),
        default=False,
        required=False,
        )
Example #14
0
class ICountry(model.Schema, IBasic):
    """Country grouping in the online client."""

    country_type = schema.Choice(
        title=_("Country grouping"),
        vocabulary=SimpleVocabulary([
            SimpleTerm("region", title=_("Region")),
            SimpleTerm("eu-member", title=_("EU member state")),
            SimpleTerm("efta", title=_("EFTA country")),
            SimpleTerm("candidate-eu", title=_("Candidate country")),
            SimpleTerm("potential-candidate-eu",
                       title=_("Potential candidate country")),
        ]),
        default="eu-member",
        required=True,
    )

    directives.widget(risk_default_collapsible_sections=CheckBoxFieldWidget)
    risk_default_collapsible_sections = schema.List(
        title=_(
            "label__risk_default_collapsible_sections",
            "Expanded sections on risk page",
        ),
        description=_(
            "help__risk_default_collapsible_sections",
            "Define, which information sections should be open by "
            "default on a risk identification page. Sections not checked "
            "will be shown intially in collapsed mode, but the user can always "
            "open those sections with a click.",
        ),
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleTerm("collapsible_section_information",
                       title=_("Information")),
            SimpleTerm(
                "collapsible_section_resources",
                title=_("Resources: Legal references and attachments"),
            ),
            SimpleTerm("collapsible_section_comments", title=_("Comments")),
        ])),
        default=["collapsible_section_information"],
        required=False,
    )

    directives.widget(default_reports=CheckBoxFieldWidget)
    default_reports = schema.List(
        title=_("label__default_reports", "Available reports"),
        description=_(
            "help__default_reports",
            "Define, which reports are offered to the user on the Report page.",
        ),
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleTerm("report_full", title=_("Full report (Word document)")),
            SimpleTerm(
                "report_action_plan",
                title=_("Action plan (Excel spreadsheet)"),
            ),
            SimpleTerm("report_overview_risks",
                       title=_("Overview of risks (PDF)")),
            SimpleTerm(
                "report_overview_measures",
                title=_("Overview of measures (PDF)"),
            ),
        ])),
        default=["report_full", "report_action_plan", "report_overview_risks"],
        required=False,
    )

    enable_web_training = schema.Bool(
        title=_("label_enable_web_training",
                default="Enable Web Based Training?"),
        description=_(
            "help_enable_web_training_country",
            default=
            "If this option is activated, an online training can be enabled on "
            "OiRA tools in this country.",
        ),
        required=False,
        default=True,
    )
class IGlobalDocumentViewerSettings(Interface):
    large_size = schema.Int(title=u"Large Image Size", default=1000)
    normal_size = schema.Int(title=u"Normal Image Size", default=700)
    thumb_size = schema.Int(title=u"Thumb Image Size", default=180)
    storage_type = schema.Choice(
        title=u"Storage Type",
        description=u"Blob storage using the normal ZODB blob mechanism. "
        u"File storage is for just storage the files on the "
        u"file system with no hard reference on write to the "
        u"ZODB. This allows you to easily push the files to "
        u"be served off-site.",
        default='Blob',
        vocabulary=SimpleVocabulary.fromValues(['Blob', 'File']))
    storage_location = schema.TextLine(
        title=u"Storage location",
        description=u'Only for file storage not with zodb. '
        u'Plone client must have write access to directory.',
        default=u"/opt/dvpdffiles")
    storage_obfuscate = schema.Bool(
        title=u"Obfuscate private file paths",
        description=u"*experimental* If you're serving files straight from "
        u"a web server, there is no way to do permission checks "
        u"on them. This provides a bit more security as the path "
        u"to the resources will be more difficult to guess and "
        u"never publisized. Of course, do not have your web "
        u"server list directory contents. *If you don't know what "
        u"this does, you probably do NOT want to enable it*",
        default=False)
    pdf_image_format = schema.Choice(title=u"Image Format",
                                     default=u"gif",
                                     vocabulary=SimpleVocabulary.fromValues(
                                         ['gif', 'png', 'jpg']))
    ocr = schema.Bool(
        title=u"OCR",
        description=u"extract the text from the PDF using OCR technology",
        default=False)
    detect_text = schema.Bool(
        title=u"Detect text",
        description=u"Detect if pdf has text before performing OCR on it. "
        u"If text is found, ocr will be skipped. "
        u"If OCR is disabled, text will always try to be "
        u"retrieved from the PDF file anyways.",
        default=True)
    auto_select_layout = schema.Bool(title=u"Auto select layout",
                                     description=u"For pdf files",
                                     default=True)
    auto_layout_file_types = schema.List(
        title=u"Auto layout file types",
        description=u"extra types only work with "
        u"openoffice/libreoffice installed",
        default=['pdf'],
        value_type=schema.Choice(
            vocabulary=SimpleVocabulary(FILE_TYPES_VOCAB)))
    auto_convert = schema.Bool(
        title=u"Auto Convert",
        description=u"Automatically convert files on creation "
        u"and modification. ",
        default=True)
    override_contributor = schema.TextLine(
        title=u"Override Contributor",
        description=u"What to override the contributor field on viewer with."
        u"Leave blank to use document owner",
        default=None,
        required=False)
    override_organization = schema.TextLine(
        title=u"Override Contributor Organization",
        description=u"What to override the organization field on viewer with."
        u"Leave blank to use site title.",
        default=None,
        required=False)
    override_base_resource_url = schema.URI(
        title=u"Override Base Resource URL",
        description=u"If you're syncing your storage to another server you "
        u"would like to serve the pdf resources from, please "
        u"specify the base url path.",
        default=None,
        required=False)
    width = schema.Int(title=u"Viewer Width",
                       description=u"Leave blank to take full width.",
                       default=None,
                       required=False)
    height = schema.Int(
        title=u"Viewer Height",
        description=u"Default height to use for viewer(only for "
        u"non-fullscreen mode).",
        default=700)
    show_sidebar = schema.Bool(
        title=u"Show sidebar",
        description=u"Default to show sidebar on Document Viewer.",
        default=True)
    show_search = schema.Bool(title=u"Show search box",
                              description=u"On Document Viewer.",
                              default=True)
    show_search_on_group_view = schema.Bool(
        title=u"Show search on group view",
        description=u"Enable search on group view.",
        default=True)
    group_view_batch_size = schema.Int(
        title=u"Group View Batch Size",
        description=u"For folders. Does not apply to topics.",
        default=20)
    async_quota_size = schema.Int(
        title=u"Async Quota Size",
        description=u"Number of conversions to run at a time. "
        u"The quota name assigned is `dv`.",
        default=3)
class ITinyMCEResourceTypesSchema(Interface):
    """This interface defines the resource types properties."""

    # XXX Not implemented in new tinymce version. Need to decide about this
    # rooted = schema.Bool(
    #    title=_(u"Rooted to current object"),
    #    description=_(u"When enabled the user will be rooted to the current "
    #                  "object and can't add links and images from other parts "
    #                  "of the site."),
    #    default=False,
    #    required=False)

    contains_objects = schema.List(
        title=_(u"Contains objects"),
        description=_(u"Enter a list of content types which can contain other "
                      "objects. Format is one contenttype per line."),
        value_type=schema.TextLine(),
        default=[
            u"Folder",
            u"Large Plone Folder",
            u"Plone Site"],
        required=False)

    # XXX not implements
    # containsanchors = schema.Text(
    #    title=_(u"Contains Anchors"),
    #    description=_(u"Enter a list of content types which can contain "
    #                  "anchors. Format is one contenttype per line."),
    #    default=u"Event\n"
    #            u"News Item\n"
    #            u"Document\n"
    #            u"ATRelativePathCriterion",
    #    required=False)

    # XXX do we still want this?
    # seems like it could be really annoying for users
    # creating new types.
    # linkable = schema.Text(
    #    title=_(u"Linkable Objects"),
    #    description=_(u"Enter a list of content types which can be linked. "
    #                  "Format is one contenttype per line."),
    #    required=False)

    image_objects = schema.List(
        title=_(u"Image objects"),
        description=_(u"Enter a list of content types which can be used as "
                      "images. Format is one contenttype per line."),
        default=[u"Image"],
        value_type=schema.TextLine(),
        required=False)

    entity_encoding = schema.Choice(
        title=_(u"Entity encoding"),
        description=_(
            u"This option controls how entities/characters get processed. "
            "Named: Characters will be converted into named entities "
            "based on the entities option. "
            "Numeric: Characters will be converted into numeric entities. "
            "Raw: All characters will be stored in non-entity form "
            "except these XML default entities: amp lt gt quot"),
        missing_value=set(),
        vocabulary=SimpleVocabulary(
            [SimpleTerm('named', 'named', _(u"Named")),
             SimpleTerm('numeric', 'numeric', _(u"Numeric")),
             SimpleTerm('raw', 'raw', _(u"Raw"))]),
        default=u"raw",
        required=False)
Example #17
0
class IMission(IBasic, IImageScaleTraversable):
    """
    Plone UN Mission
    """

    title = schema.TextLine(title=u'Mission',
                            description=u'Brief title of mission. eg. '
                            'Public Consultation for UN Workshop.')

    description = schema.Text(title=u'Mission Objective',
                              description=u'Briefly describe the objectives '
                              'of the mission.')

    dexteritytextindexer.searchable('mission_scope')
    mission_scope = schema.Choice(
        title=_(u'Mission Scope'),
        vocabulary='ploneun.missions.mission_scope',
    )

    dexteritytextindexer.searchable('mission_city')
    mission_city = schema.TextLine(title=_(u'City'), required=False)

    country = schema.Choice(
        title=_(u'Country'),
        description=_(u'If Mission Scope is International, please select '
                      'a country.'),
        vocabulary='ploneun.vocabulary.country',
        required=True,
        missing_value=None,
    )

    startDate = schema.Datetime(title=_(u'Start date'), )

    endDate = schema.Datetime(title=_(u'End date'), )

    dexteritytextindexer.searchable('mission_members')
    form.widget(mission_members=AutocompleteMultiFieldWidget)
    mission_members = schema.List(
        title=_(u'Mission Members'),
        description=_(
            u'List of Mission Members. Enter '
            'name to search, select and press Enter to add. Repeat to '
            'to add additional members.'),
        value_type=schema.Choice(vocabulary=u"plone.principalsource.Users", ),
        required=True,
    )

    dexteritytextindexer.searchable('text')
    form.widget(text="plone.app.z3cform.wysiwyg.WysiwygFieldWidget")
    text = schema.Text(title=_(u'Notes'), required=False)

    dexteritytextindexer.searchable('contactName')
    contactName = schema.TextLine(title=_(u'Contact Person'), required=False)

    dexteritytextindexer.searchable('contactEmail')
    contactEmail = schema.TextLine(title=_(u'Contact Person Email'),
                                   required=False)

    dexteritytextindexer.searchable('contactPhone')
    contactPhone = schema.TextLine(title=_(u'Contact Person Phone'),
                                   required=False)

    @invariant
    def start_end_dates_validation(self):
        if self.startDate and self.endDate:
            if self.endDate < self.startDate:
                raise Invalid(
                    _("End date should not be earlier than start date."))
Example #18
0
class IImageTileSchema(model.Schema):

    model.fieldset('link', label='Link', fields=('link', 'external_link'))

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

    @invariant
    def validate_image(data):
        if data.image and len(data.image) != 1:
            raise Invalid("Must select 1 image")
        if data.image:
            utils = getMultiAdapter((getSite(), getRequest()),
                                    name="castle-utils")
            obj = utils.get_object(data.image[0])
            if obj.portal_type != 'Image':
                raise Invalid('Must provide image file')

    scale = schema.Choice(title=u'Scale',
                          required=True,
                          source=image_scales,
                          default=u'large')

    display_type = schema.Choice(title=u'Display type',
                                 required=True,
                                 default=u'fullwidth',
                                 vocabulary=SimpleVocabulary([
                                     SimpleTerm('natural', 'natural',
                                                u'Natural'),
                                     SimpleTerm('fullwidth', 'fullwidth',
                                                u'Natural(Full width)'),
                                     SimpleTerm('portrait', 'portrait',
                                                u'Portrait'),
                                     SimpleTerm('landscape', 'landscape',
                                                u'Landscape'),
                                     SimpleTerm('square', 'square', u'Square'),
                                     SimpleTerm('short', 'short', u'Short'),
                                 ]))

    caption = schema.TextLine(
        title=u'Caption',
        description=
        u'The caption shows under the image. This is different than the summary'
        u' field on the image',
        required=False)

    form.widget(override_focal_point=FocalPointSelectFieldWidget)
    override_focal_point = schema.Text(title=u'Override Focal point',
                                       default=u'',
                                       required=False)

    form.widget(link=RelatedItemFieldWidget)
    link = schema.List(
        title=u"Link",
        description=u"Content to link this image to.",
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'))

    external_link = schema.TextLine(
        title=u'External Link',
        description=u'If provided, internal link is ignored',
        required=False,
        default=u'')

    @invariant
    def validate_link(data):
        if data.link and len(data.link) != 1:
            raise Invalid("Must select 1 link only")
Example #19
0
class RegistrationMailSchema(interface.Interface):
    title = schema.TextLine(title=_(safe_unicode('Firstname Lastname')), )

    street = schema.TextLine(
        title=_(safe_unicode('Street')),
        description=_(
            safe_unicode(
                'This data is mandatory and required for our internal procedures'
            )),
        required=True,
    )

    city = schema.TextLine(
        title=_(safe_unicode('City')),
        description=_(
            safe_unicode(
                'This data is mandatory and required for our internal procedures'
            )),
        required=True,
    )

    postalcode = schema.TextLine(
        title=_(safe_unicode('Postal Code')),
        description=_(
            safe_unicode(
                'This data is mandatory and required for our internal procedures'
            )),
        required=True,
    )

    country = schema.TextLine(
        title=_(safe_unicode('Country')),
        description=_(
            safe_unicode(
                'This data is mandatory and required for our internal procedures'
            )),
        required=True,
    )

    email = schema.TextLine(
        title=_(safe_unicode('E-Mail')),
        description=_(
            safe_unicode(
                'We need this mandatory data to get in contact with you, if we have any questions'
            )),
        constraint=validateEmail,
        required=True,
    )

    organisation = schema.TextLine(
        title=_(safe_unicode('Organisation')),
        required=False,
    )

    registrationpayed = schema.Choice(
        title=_(safe_unicode('Payment of the Registration Fee')),
        description=_(
            safe_unicode('Have you already paid the registration fee?')),
        vocabulary=yesnochoice,
        required=False,
    )

    paymentway = schema.List(
        title=_(safe_unicode('Way of Registration Fee Payment')),
        description=_(
            safe_unicode(
                'If you already payed the registration fee, please tell us, which way you used to transfer the money.'
            )),
        value_type=schema.Choice(source='PaymentOptions'),
        required=False,
    )

    usedbank = schema.TextLine(
        title=_(safe_unicode('Used Bank Account')),
        description=_(
            safe_unicode(
                'If you transfered the Registration Fee via a bank account, please tell us the name and branch '
                'of the bank you used. We need this information to identify your payment more quickly.'
            )),
        required=False,
    )
Example #20
0
class IProduktdatenblatt(form.Schema, IImageScaleTraversable):
    """
    Datenblatt eines Produkts
    """

    hersteller = RelationChoice(
        title=_(u"Hersteller"),
        description=
        _(u"Bitte wählen Sie hier den Hersteller des Wasch- und Reingigungsmittels aus."
          ),
        source=ObjPathSourceBinder(object_provides=IHersteller.__identifier__),
        required=True,
    )

    produktkategorie = schema.List(
        title=_(u"Produktkategorie"),
        description=
        _(u"Bitte wählen Sie eine Produktkategorie für das Wasch- und Reinigungsmittel aus."
          ),
        value_type=schema.Choice(source=wmkategorie),
        required=True,
    )

    produktklasse = schema.Choice(
        title=_(u"Produktklasse"),
        description=
        _(u"Bitte wählen Sie eine Produktklasse für das Waschn- und Reinigungsmittel aus."
          ),
        vocabulary=wmklasse,
        required=True,
    )

    flammpunkt = schema.Int(
        title=_(u"Flammpunkt"),
        description=
        _(u"Bitte geben Sie hier den Wert des Flammpunktes in Grad Celsius an."
          ),
        required=False,
    )

    form.widget(chemikalienliste=DataGridFieldFactory)
    chemikalienliste = schema.List(
        title=u'EG Sicherheitsdatenblatt',
        description=u'Zusammensetzung/Angaben zu Bestandteilen',
        value_type=DictRow(title=u"Chemikalien", schema=IChemikalien),
        required=False,
    )

    wertebereich = schema.Bool(
        title=_(u"Wertebereich für den Flammpunkt"),
        description=_(
            u"Bitte treffen Sie hier eine Auswahl wenn der Wertebereich für den\
                              Flammpunkt größer als der angegebene Zahlenwert ist."
        ),
        required=False,
    )

    emissionsgeprueft = schema.Bool(
        title=_(u"Emissionsarmes Produkt"),
        description=
        _(u"Bitte markieren Sie hier, wenn für das Produkt die Kriterien des Gütesiegels\
                              erfüllt sind."),
        required=False,
    )

    maschinen = schema.List(
        title=_(u"Druckmaschinen und automatische Waschanlagen"),
        description=
        _(u"Bitte geben Sie hier die Druckmaschinen und automatischen Waschanlagen an,\
                              für das dieses Wasch- und Reinigungsmittel zugelassen wurde."
          ),
        value_type=schema.Choice(source=dmvocab),
        required=True,
    )

    materialvertraeglichkeit = schema.Choice(
        title=_(u"Materialverträglichkeit"),
        description=
        _(u"Bitte wählen Sie hier die Institute aus, von denen die Materialverträglichkeit getestet wurde."
          ),
        vocabulary=institute,
        required=True,
    )

    hskategorie = schema.Choice(title=u"Hautschutzmittelgruppe",
                                vocabulary=hskategorieVocabulary,
                                required=False)

    bemerkungen = RichText(
        title=_(u"Bemerkungen"),
        description=
        _(u"Hier können zusätliche Bemerkungen zum Produktdatenblatt eingefügt werden."
          ),
        required=False,
    )
Example #21
0
 class IReorderForm(interface.Interface):
     ordering = schema.List(title=u"Ordering", value_type=schema.TextLine())
class IDynamicVocabularies(Interface):

    fieldset('vocabulary_01_fieldset',
             label=_(u'Vocabulary 01'),
             fields=[
                 'dynamic_vocabulary_01',
             ])
    dynamic_vocabulary_01 = schema.List(
        title=_(u'dynamic_vocabulary_01'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')),
    )
    fieldset('vocabulary_02_fieldset',
             label=_(u'Vocabulary 02'),
             fields=[
                 'dynamic_vocabulary_02',
             ])
    dynamic_vocabulary_02 = schema.List(
        title=_(u'dynamic_vocabulary_02'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_03_fieldset',
             label=_(u'Vocabulary 03'),
             fields=[
                 'dynamic_vocabulary_03',
             ])
    dynamic_vocabulary_03 = schema.List(
        title=_(u'dynamic_vocabulary_03'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_04_fieldset',
             label=_(u'Vocabulary 04'),
             fields=[
                 'dynamic_vocabulary_04',
             ])
    dynamic_vocabulary_04 = schema.List(
        title=_(u'dynamic_vocabulary_04'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_05_fieldset',
             label=_(u'Vocabulary 05'),
             fields=[
                 'dynamic_vocabulary_05',
             ])
    dynamic_vocabulary_05 = schema.List(
        title=_(u'dynamic_vocabulary_05'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_06_fieldset',
             label=_(u'Vocabulary 06'),
             fields=[
                 'dynamic_vocabulary_06',
             ])
    dynamic_vocabulary_06 = schema.List(
        title=_(u'dynamic_vocabulary_06'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_07_fieldset',
             label=_(u'Vocabulary 07'),
             fields=[
                 'dynamic_vocabulary_07',
             ])
    dynamic_vocabulary_07 = schema.List(
        title=_(u'dynamic_vocabulary_07'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_08_fieldset',
             label=_(u'Vocabulary 08'),
             fields=[
                 'dynamic_vocabulary_08',
             ])
    dynamic_vocabulary_08 = schema.List(
        title=_(u'dynamic_vocabulary_08'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_09_fieldset',
             label=_(u'Vocabulary 09'),
             fields=[
                 'dynamic_vocabulary_09',
             ])
    dynamic_vocabulary_09 = schema.List(
        title=_(u'dynamic_vocabulary_09'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_10_fieldset',
             label=_(u'Vocabulary 10'),
             fields=[
                 'dynamic_vocabulary_10',
             ])
    dynamic_vocabulary_10 = schema.List(
        title=_(u'dynamic_vocabulary_10'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_11_fieldset',
             label=_(u'Vocabulary 11'),
             fields=[
                 'dynamic_vocabulary_11',
             ])
    dynamic_vocabulary_11 = schema.List(
        title=_(u'dynamic_vocabulary_11'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_12_fieldset',
             label=_(u'Vocabulary 12'),
             fields=[
                 'dynamic_vocabulary_12',
             ])
    dynamic_vocabulary_12 = schema.List(
        title=_(u'dynamic_vocabulary_12'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_13_fieldset',
             label=_(u'Vocabulary 13'),
             fields=[
                 'dynamic_vocabulary_13',
             ])
    dynamic_vocabulary_13 = schema.List(
        title=_(u'dynamic_vocabulary_13'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_14_fieldset',
             label=_(u'Vocabulary 14'),
             fields=[
                 'dynamic_vocabulary_14',
             ])
    dynamic_vocabulary_14 = schema.List(
        title=_(u'dynamic_vocabulary_14'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
    fieldset('vocabulary_15_fieldset',
             label=_(u'Vocabulary 15'),
             fields=[
                 'dynamic_vocabulary_15',
             ])
    dynamic_vocabulary_15 = schema.List(
        title=_(u'dynamic_vocabulary_15'),
        description=_('dynamic_vocabulary_desc'),
        required=False,
        unique=True,
        value_type=schema.TextLine(title=_(u'Value')))
Example #23
0
class IShopArticleSettings(model.Schema):
    """Shop controlpanel schema for article settings.
    """

    model.fieldset(
        "article",
        label=_(u"Article", default=u"Article"),
        fields=[
            "quantity_units",
            "default_item_net",
            "default_item_quantity_unit",
            "default_item_comment_enabled",
            "default_item_comment_required",
            "default_item_quantity_unit_float",
            "default_item_cart_count_limit",
            "default_item_stock_warning_threshold",
        ],
    )

    widget("quantity_units", CheckBoxFieldWidget)
    quantity_units = schema.List(
        title=_(u"label_quantity_units",
                default=u"Specify quantity units allowed in shop."),
        description=_(
            u"help_quantity_units",
            default=u"Quantity units (what the buyable items are measured in)",
        ),
        required=True,
        missing_value=set(),
        value_type=schema.Choice(vocabulary="bda.plone.shop.vocabularies."
                                 "AvailableQuantityUnitVocabulary"),
    )

    default_item_quantity_unit = schema.Choice(
        title=_(u"label_default_quantity_units",
                default=u"Specify default quantity name."),
        description=_(u"help_default_quantity_unit",
                      default=u"default measurement"),
        vocabulary="bda.plone.shop.vocabularies.QuantityUnitVocabulary",
    )

    default_item_net = schema.Float(
        title=_(u"label_default_item_net", default=u"Default Item net price"),
        required=False,
    )

    default_item_comment_enabled = schema.Bool(
        title=_(u"label_default_item_comment_enabled",
                default="Comment enabled by default"),
        required=False,
    )

    default_item_comment_required = schema.Bool(
        title=_(
            u"label_default_item_comment_required",
            default="Comment required by default",
        ),
        required=False,
    )

    default_item_quantity_unit_float = schema.Bool(
        title=_(
            u"label_default_item_quantity_unit_float",
            default="Quantity as float as default",
        ),
        required=False,
    )

    default_item_cart_count_limit = schema.Float(
        title=_(
            u"label_default_item_cart_count_limit",
            default="Quantity limit of an item in the cart.",
        ),
        required=False,
    )

    default_item_stock_warning_threshold = schema.Float(
        title=_(
            u"label_default_item_stock_warning_threshold",
            default="Item stock warning threshold.",
        ),
        description=_(
            "help_default_item_stock_warning_threshold",
            default=u"Shop administrator will be notified if stock is less "
            u"than the specified threshold.",
        ),
        required=False,
    )
Example #24
0
class IEUpCenter(model.Schema):
    """ An Extension Upload Center for LibreOffice extensions.
    """

    title = schema.TextLine(title=_(u"Name of the Extensions Center"), )

    description = schema.Text(
        description=_(u"Description of the Extensions Center"), )

    product_description = schema.Text(
        description=_(u"Description of the features of extensions"))

    product_title = schema.TextLine(
        title=_(u"Extension Product Name"),
        description=
        _(u"Name of the Extension product, e.g. only Extensions or LibreOffice Extensions"
          ),
    )

    form.fieldset('categories_et_all',
                  label=u"Categories et all",
                  fields=[
                      'available_category', 'available_licenses',
                      'available_versions', 'available_platforms'
                  ])

    available_category = schema.List(title=_(u"Available Categories"),
                                     default=[
                                         'All modules',
                                         'Dictionary',
                                         'Clipart',
                                         'Macro',
                                         'Template Extension',
                                         'Gallery Contents',
                                         'Language Tools',
                                         'Writer Extension',
                                         'Calc Extension',
                                         'Impress Extension',
                                         'Draw Extension',
                                         'Base Extension',
                                         'Math Extension',
                                         'Extension Building',
                                     ],
                                     value_type=schema.TextLine())

    available_licenses = schema.List(
        title=_(u"Available Licenses"),
        default=[
            'GNU-GPL-v2 (GNU General Public License Version 2)',
            'GNU-GPL-v3 (General Public License Version 3)',
            'LGPL-v2.1 (GNU Lesser General Public License Version 2.1)',
            'LGPL-v3+ (GNU Lesser General Public License Version 3 and later)',
            'BSD (BSD License (revised))',
            'MPL-v1.1 (Mozilla Public License Version 1.1)',
            'MPL-v2.0+ (Mozilla Public License Version 2.0 or later)',
            'CC-by-sa-v3 (Creative Commons Attribution-ShareAlike 3.0)',
            'CC-BY-SA-v4 (Creative Commons Attribution-ShareAlike 4.0 International)',
            'AL-v2 (Apache License Version 2.0)', 'Public Domain',
            'OSI (Other OSI Approved)'
        ],
        value_type=schema.TextLine())

    available_versions = schema.List(
        title=_(u"Available Versions"),
        default=[
            'LibreOffice 3.3', 'LibreOffice 3.4', 'LibreOffice 3.5',
            'LibreOffice 3.6', 'LibreOffice 4.0', 'LibreOffice 4.1',
            'LibreOffice 4.2', 'LibreOffice 4.3', 'LibreOffice 4.4',
            'LibreOffice 5.0', 'LibreOffice 5.1', 'LibreOffice 5.2',
            'LibreOffice 5.3', 'LibreOffice 5.4', 'LibreOffice 6.0',
            'LibreOffice 6.1'
        ],
        value_type=schema.TextLine())

    available_platforms = schema.List(title=_(u"Available Platforms"),
                                      default=[
                                          'All platforms', 'Linux',
                                          'Linux-x64', 'Mac OS X', 'Windows',
                                          'BSD', 'UNIX (other)'
                                      ],
                                      value_type=schema.TextLine())

    form.fieldset('instructions',
                  label=u'Instructions',
                  fields=[
                      'install_instructions',
                      'reporting_bugs',
                  ])

    form.primary('install_instructions')
    install_instructions = RichText(
        title=_(u"Extension Installation Instructions"),
        description=_(u"Please fill in the install instructions"),
        required=False)

    form.primary('reporting_bugs')
    reporting_bugs = RichText(title=_(u"Instruction how to report Bugs"),
                              required=False)

    form.fieldset('disclaimer',
                  label=u'Legal Disclaimer',
                  fields=[
                      'title_legaldisclaimer', 'legal_disclaimer',
                      'title_legaldownloaddisclaimer',
                      'legal_downloaddisclaimer'
                  ])

    title_legaldisclaimer = schema.TextLine(
        title=_(u"Title for Legal Disclaimer and Limitations"),
        default=_(u"Legal Disclaimer and Limitations"),
        required=False)

    legal_disclaimer = schema.Text(
        title=_(u"Text of the Legal Disclaimer and Limitations"),
        description=_(u"Enter the text of the legal disclaimer and "
                      u"limitations that should be displayed to the "
                      u"project creator and should be accepted by "
                      u"the owner of the project."),
        default=_(u"Fill in the legal disclaimer, that had to be "
                  u"accepted by the project owner."),
        required=False)

    title_legaldownloaddisclaimer = schema.TextLine(
        title=_(
            u"Title of the Legal Disclaimer and Limitations for Downloads"),
        default=_(u"Legal Disclaimer and Limitations for Downloads"),
        required=False)

    form.primary('legal_downloaddisclaimer')
    legal_downloaddisclaimer = RichText(
        title=_(u"Text of the Legal Disclaimer and Limitations for Downlaods"),
        description=_(u"Enter any legal disclaimer and limitations for "
                      u"downloads that should appear on each page for "
                      u"dowloadable files."),
        default=_(u"Fill in the text for the legal download disclaimer."),
        required=False)

    form.primary('information_oldversions')
    information_oldversions = RichText(
        title=_(u"Information About Search For Old LibreOffice Versions"),
        description=_(u"Enter an information about the search for older "
                      u"versions of LibreOffice, if they are not on the "
                      u"versions list (compatibility) anymore."),
        required=False)

    form.fieldset('contactadresses',
                  label=u'Special Email Adresses',
                  fields=['releaseAllert', 'contactForCenter'])

    releaseAllert = schema.ASCIILine(
        title=_(u"EMail address for the messages about new releases"),
        description=
        _(u"Enter an email address to which information about a new release should be send."
          ),
        required=False)

    contactForCenter = schema.ASCIILine(
        title=
        _(u"EMail address for communication with the extension center manager and reviewer"
          ),
        description=
        _(u"Enter an email address for the communication with extension center manager and reviewer"
          ),
        default='*****@*****.**',
        constraint=validateEmail)
Example #25
0
class INotificationTextSettings(model.Schema, IGlobalNotificationText,
                                IItemNotificationText):

    model.fieldset(
        "notifications",
        label=_(u"Notifications", default=u"Notifications"),
        fields=[
            "global_order_text",
            "global_overbook_text",
            "order_text",
            "overbook_text",
        ],
    )

    widget("order_text", DataGridFieldFactory)
    order_text = schema.List(
        title=_(
            u"label_site_item_notification_text",
            default=u"Default notification text for items in order "
            u"confirmation mail",
        ),
        value_type=DictRow(title=_(u"order_text", default="Order Text"),
                           schema=ILanguageAwareTextRow),
        required=False,
    )

    widget("overbook_text", DataGridFieldFactory)
    overbook_text = schema.List(
        title=_(
            u"label_site_item_overbook_notification_text",
            default=u"Default notification text for items in order "
            u"confirmation mail if item out of stock.",
        ),
        value_type=DictRow(
            title=_(u"overbook_text", default="Overbook Text"),
            schema=ILanguageAwareTextRow,
        ),
        required=False,
    )

    widget("global_order_text", DataGridFieldFactory)
    global_order_text = schema.List(
        title=_(
            u"label_site_global_notification_text",
            default=u"Overall notification text for order confirmation mail",
        ),
        value_type=DictRow(title=_(u"order_text", default="Order Text"),
                           schema=ILanguageAwareTextRow),
        required=False,
    )

    widget("global_overbook_text", DataGridFieldFactory)
    global_overbook_text = schema.List(
        title=_(
            u"label_site_global_overbook_notification_text",
            default=u"Overall notification text for order confirmation mail "
            u"if order contains items out of stock",
        ),
        value_type=DictRow(
            title=_(u"overbook_text", default="Overbook Text"),
            schema=ILanguageAwareTextRow,
        ),
        required=False,
    )
Example #26
0
class IArticle(form.Schema, IImageScaleTraversable):
    """
    Contribute article
    """
    form.fieldset(
        _(u'Review State'),
        label=_(u"Review State"),
        fields=[
            'blindSetup',
            'assignInternalReviewer',
            'retractReason',
            'reviewFeedbackText',
            'reviewFeedback',
            'assignExternalReviewer1',
            'invitEmail1',
            'acceptInvit1',
            'acceptOrReject1',
            'externalReviewerComment1',
            'reviewCommentAttached1',
            'reviewConfirm1',
            'assignExternalReviewer2',
            'invitEmail2',
            'acceptInvit2',
            'acceptOrReject2',
            'externalReviewerComment2',
            'reviewCommentAttached2',
            'reviewConfirm2',
            'assignExternalReviewer3',
            'invitEmail3',
            'acceptInvit3',
            'acceptOrReject3',
            'externalReviewerComment3',
            'reviewCommentAttached3',
            'reviewConfirm3',
        ],
    )

    dexterity.write_permission(sn='ntpu.content.IsSiteAdministrator')
    dexterity.read_permission(sn='ntpu.content.IsSiteAdministrator')
    form.mode(sn='hidden')
    sn = schema.Int(
        title=_('sn'),
        required=False,
    )

    dexterity.write_permission(blindSetup='ntpu.content.IsSuperEditor')
    dexterity.read_permission(blindSetup='ntpu.content.IsSuperEditor')
    blindSetup = schema.Choice(
        title=_(u'Blind setup'),
        description=_(u'Recommend using double-blind review'),
        vocabulary=BlindSetup,
        default=True,
        required=True,
    )

    dexterity.write_permission(
        assignInternalReviewer='ntpu.content.IsSuperEditor')
    dexterity.read_permission(
        assignInternalReviewer='ntpu.content.IsSuperEditor')
    form.widget(assignInternalReviewer=AutocompleteFieldWidget)
    assignInternalReviewer = RelationChoice(
        title=_(u'Assign internal reviewer'),
        description=
        _(u'Double click or press down key to show selection, or input user name.'
          ),
        source=availableInternalReviewer,
        #        vocabulary=u"plone.principalsource.Users",
        default=None,
        #        required=True,
        required=False,
    )

    dexterity.write_permission(
        reviewFeedbackText='ntpu.content.IsInternalReviewer')
    #    dexterity.read_permission(assignExternalReviewer1='ntpu.content.IsInternalReviewer')
    #    form.mode(reviewFeedback='hidden')
    reviewFeedbackText = schema.Text(
        title=_(u'Review comment file'),
        required=False,
    )

    dexterity.write_permission(
        reviewFeedback='ntpu.content.IsInternalReviewer')
    #    dexterity.read_permission(assignExternalReviewer1='ntpu.content.IsInternalReviewer')
    #    form.mode(reviewFeedback='hidden')
    reviewFeedback = NamedBlobFile(
        title=_(u'Review comment file'),
        required=False,
    )

    dexterity.write_permission(
        retractReason='ntpu.content.IsSiteAdministrator')
    dexterity.read_permission(retractReason='ntpu.content.IsOwner')
    form.mode(retractReason='input')
    retractReason = schema.Text(
        title=_(u'Retract Reason'),
        required=False,
    )

    #### external reviewer 1
    dexterity.write_permission(
        assignExternalReviewer1='ntpu.content.IsInternalReviewer')
    dexterity.read_permission(
        assignExternalReviewer1='ntpu.content.IsInternalReviewer')
    form.widget(assignExternalReviewer1=AutocompleteFieldWidget)
    assignExternalReviewer1 = RelationChoice(
        title=_(u'Assign first external reviewer'),
        description=
        _(u'Double click or press down key to show selection, or input user name.'
          ),
        source=availableExternalReviewer,
        required=False,
    )

    dexterity.write_permission(invitEmail1='ntpu.content.IsInternalReviewer')
    form.mode(invitEmail1='hidden')
    invitEmail1 = schema.TextLine(
        title=_(u'Invit email'),
        default=None,
        required=False,
    )

    dexterity.write_permission(acceptInvit1='ntpu.content.IsExternalReviewer')
    form.omitted('acceptInvit1')
    acceptInvit1 = schema.Bool(
        title=_(u'Accept invitation'),
        description=_(u'Accept the invitation to review'),
        default=None,
        required=False,
    )

    dexterity.write_permission(
        acceptOrReject1='ntpu.content.IsExternalReviewer')
    acceptOrReject1 = schema.Choice(
        title=_(u'Result of Review'),
        vocabulary=AcceptOrReject,
        default=None,
        required=False,
    )

    dexterity.write_permission(
        externalReviewerComment1='ntpu.content.IsExternalReviewer')
    externalReviewerComment1 = schema.Text(
        title=_(u'External reviewer comment'),
        required=False,
    )

    dexterity.write_permission(
        reviewCommentAttached1='ntpu.content.IsExternalReviewer')
    reviewCommentAttached1 = NamedBlobFile(
        title=_(u'External reviewer comment attached file'),
        required=False,
    )

    dexterity.write_permission(
        reviewConfirm1='ntpu.content.IsExternalReviewer')
    form.mode(reviewConfirm1='hidden')
    reviewConfirm1 = schema.Choice(
        title=_(u'Review confirm'),
        vocabulary=ReviewConfirm,
        default=None,
        required=False,
    )

    #### external reviewer 2
    dexterity.write_permission(
        assignExternalReviewer2='ntpu.content.IsInternalReviewer')
    dexterity.read_permission(
        assignExternalReviewer2='ntpu.content.IsInternalReviewer')
    form.widget(assignExternalReviewer2=AutocompleteFieldWidget)
    assignExternalReviewer2 = RelationChoice(
        title=_(u'Assign second external reviewer'),
        description=
        _(u'Double click or press down key to show selection, or input user name.'
          ),
        source=availableExternalReviewer,
        required=False,
    )

    dexterity.write_permission(invitEmail2='ntpu.content.IsInternalReviewer')
    form.mode(invitEmail2='hidden')
    invitEmail2 = schema.TextLine(
        title=_(u'Invit email'),
        default=None,
        required=False,
    )

    dexterity.write_permission(acceptInvit2='ntpu.content.IsExternalReviewer')
    form.omitted('acceptInvit2')
    acceptInvit2 = schema.Bool(
        title=_(u'Accept invitation'),
        description=_(u'Accept the invitation to review'),
        default=None,
        required=False,
    )

    dexterity.write_permission(
        acceptOrReject2='ntpu.content.IsExternalReviewer')
    acceptOrReject2 = schema.Choice(
        title=_(u'Result of Review'),
        vocabulary=AcceptOrReject,
        default=None,
        required=False,
    )

    dexterity.write_permission(
        externalReviewerComment2='ntpu.content.IsExternalReviewer')
    externalReviewerComment2 = schema.Text(
        title=_(u'External reviewer comment'),
        required=False,
    )

    dexterity.write_permission(
        reviewCommentAttached2='ntpu.content.IsExternalReviewer')
    reviewCommentAttached2 = NamedBlobFile(
        title=_(u'External reviewer comment attached file'),
        required=False,
    )

    dexterity.write_permission(
        reviewConfirm2='ntpu.content.IsExternalReviewer')
    form.mode(reviewConfirm2='hidden')
    reviewConfirm2 = schema.Choice(
        title=_(u'Review confirm'),
        vocabulary=ReviewConfirm,
        default=None,
        required=False,
    )

    #### external reviewer 3
    dexterity.write_permission(
        assignExternalReviewer3='ntpu.content.IsInternalReviewer')
    dexterity.read_permission(
        assignExternalReviewer3='ntpu.content.IsInternalReviewer')
    form.widget(assignExternalReviewer3=AutocompleteFieldWidget)
    assignExternalReviewer3 = RelationChoice(
        title=_(u'Assign third external reviewer'),
        description=
        _(u'Double click or press down key to show selection, or input user name.'
          ),
        source=availableExternalReviewer,
        required=False,
    )

    dexterity.write_permission(invitEmail3='ntpu.content.IsInternalReviewer')
    form.mode(invitEmail3='hidden')
    invitEmail3 = schema.TextLine(
        title=_(u'Invit email'),
        default=None,
        required=False,
    )

    dexterity.write_permission(acceptInvit3='ntpu.content.IsExternalReviewer')
    form.omitted('acceptInvit3')
    acceptInvit3 = schema.Bool(
        title=_(u'Accept invitation'),
        description=_(u'Accept the invitation to review'),
        default=None,
        required=False,
    )

    dexterity.write_permission(
        acceptOrReject3='ntpu.content.IsExternalReviewer')
    acceptOrReject3 = schema.Choice(
        title=_(u'Result of Review'),
        vocabulary=AcceptOrReject,
        default=None,
        required=False,
    )

    dexterity.write_permission(
        externalReviewerComment3='ntpu.content.IsExternalReviewer')
    externalReviewerComment3 = schema.Text(
        title=_(u'External reviewer comment'),
        required=False,
    )

    dexterity.write_permission(
        reviewCommentAttached3='ntpu.content.IsExternalReviewer')
    reviewCommentAttached3 = NamedBlobFile(
        title=_(u'External reviewer comment attached file'),
        required=False,
    )

    dexterity.write_permission(
        reviewConfirm3='ntpu.content.IsExternalReviewer')
    form.mode(reviewConfirm3='hidden')
    reviewConfirm3 = schema.Choice(
        title=_(u'Review confirm'),
        vocabulary=ReviewConfirm,
        default=None,
        required=False,
    )

    form.fieldset(
        _(u'Manuscript Metadata'),
        label=_(u"Manuscript Metadata"),
        fields=[
            'submittingFrom', 'articleLanguage', 'articleType', 'articleTitle',
            'engTitle', 'runningTitle', 'keywords', 'engKeywords', 'abstract',
            'engAbstract', 'category', 'coverLetter'
        ],
        description=_(
            u"Submit a new manuscript(fields in RED DOT are Required)"),
    )

    dexterity.write_permission(submittingFrom='ntpu.content.IsOwner')
    submittingFrom = schema.Choice(
        title=_(u'Submitting from'),
        description=_(u'I am submitting from'),
        vocabulary=CountryList,
        default=_(u"Taiwan"),
        required=True,
    )

    dexterity.write_permission(articleLanguage='ntpu.content.IsOwner')
    articleLanguage = schema.Choice(
        title=_(u'Language'),
        vocabulary=ArticleLanguage,
        default=_(u"zh-tw"),
        required=True,
    )

    dexterity.write_permission(articleType='ntpu.content.IsOwner')
    articleType = schema.Choice(
        title=_(u'Article type'),
        vocabulary=ArticleType,
        default=_(u'Original paper'),
        required=True,
    )

    dexteritytextindexer.searchable('articleTitle')
    dexterity.write_permission(articleTitle='ntpu.content.IsOwner')
    articleTitle = schema.TextLine(
        title=_(u'Article title'),
        required=True,
    )

    dexteritytextindexer.searchable('engTitle')
    dexterity.write_permission(engTitle='ntpu.content.IsOwner')
    engTitle = schema.TextLine(
        title=_(u'English title'),
        #default=u' ',
        required=True,
    )

    dexterity.write_permission(runningTitle='ntpu.content.IsOwner')
    runningTitle = schema.TextLine(
        title=_(u'Running title'),
        required=False,
    )

    dexteritytextindexer.searchable('keywords')
    dexterity.write_permission(keywords='ntpu.content.IsOwner')
    keywords = schema.TextLine(
        title=_(u'Keywords'),
        description=_(u'Maximum 5 keywords, separated with commas.'),
        required=True,
    )

    dexteritytextindexer.searchable('engKeywords')
    dexterity.write_permission(engKeywords='ntpu.content.IsOwner')
    engKeywords = schema.TextLine(
        title=_(u'English keywords'),
        description=_(u'Maximum 5 keywords, separated with commas.'),
        required=False,
    )

    dexteritytextindexer.searchable('abstract')
    dexterity.write_permission(abstract='ntpu.content.IsOwner')
    abstract = schema.Text(
        title=_(u'Abstract'),
        description=_(
            u'Please limit the number of words in 500 words or less'),
        required=True,
    )

    dexteritytextindexer.searchable('engAbstract')
    dexterity.write_permission(engAbstract='ntpu.content.IsOwner')
    engAbstract = schema.Text(
        title=_(u'English abstract'),
        #default=u' ',
        required=True,
    )

    dexterity.write_permission(category='ntpu.content.IsOwner')
    category = schema.Choice(
        title=_(u'Category'),
        vocabulary=Category,
        default=None,
        required=True,
    )

    dexteritytextindexer.searchable('coverLetter')
    dexterity.write_permission(coverLetter='ntpu.content.IsOwner')
    coverLetter = schema.Text(
        title=_(u'Cover letter'),
        description=_(u'help_coverLetter',
                      default=u'Enter your cover letter here. \
                      DO NOT include your cover letter \
                      in the manuscript file that you \
                      will upload.The word limit of this \
                      column is 1024 characters.'),
        max_length=1024,
        required=False,
    )

    form.fieldset(
        _(u'Authors'),
        label=_(u"Authors"),
        fields=['authors', 'corresponging', 'allAuthorConsent', 'license'],
        description=_(
            u"help_authors",
            default=u"Select authors and order, first is main author,\
                                second is 2'nd author...<br> \
                                Note: Before submitting, you mustbe agree 'All author consent' \
                                , 'Exclusive or non-exclusive license' and check them."
        ),
    )

    dexterity.write_permission(authors='ntpu.content.IsOwner')
    authors = schema.List(
        title=_(u'Authors'),
        description=_(u'Please select authors'),
        value_type=schema.Choice(
            title=_(u'name'),
            source=availableAuthor,
            required=False,
        ),
        #        min_length=1,
        required=False,
    )

    dexterity.write_permission(corresponging='ntpu.content.IsOwner')
    corresponging = schema.List(
        title=_(u'Corresponding authors'),
        description=_(u'Select at least one corresponding author.'),
        value_type=schema.Choice(
            title=_(u'name'),
            source=availableAuthor,
            required=False,
        ),
        max_length=1,
        required=False,
    )

    dexterity.write_permission(allAuthorConsent='ntpu.content.IsOwner')
    allAuthorConsent = schema.Bool(
        title=_(u'All author consent'),
        description=_(
            u'help_allAuthorConsent',
            default='I confirm this manuscript has not been accepted \
                          for publication elsewhere, is not being considered \
                          for publication elsewhere and does not duplicate material \
                          already published. I confirm all authors consent to \
                          publication of this manuscript.'),
        default=False,
        required=True,
    )

    dexterity.write_permission(license='ntpu.content.IsOwner')
    license = schema.Bool(
        title=_(u'Exclusive or non-exclusive license'),
        description=_(
            u'help_license',
            default='I have read and agreed with the following statements: \
                          1. I am authorized by all co-author(s) to submit this article \
                          on their behalf and as the contact for the Editorial process. \
                          I am responsible for communicating with the other authors about \
                          progress, submissions of revisions and final approval of proofs. \
                          2. All authors agree with the Personal Information Collection \
                          Statement , and the staff of the journal will be using the \
                          personal information that I provided in the APSERS system for \
                          the sole purpose of contacting me concerning the publishing of \
                          the Article. \
                          3. The article I have submitted to the journal for review is \
                          original, has been written by the stated authors and has not been \
                          published elsewhere. Also, the Article is not currently being \
                          considered for publication by any other journal and will not be \
                          submitted for such review while under review by this journal.'
        ),
        default=False,
        required=True,
    )

    form.omitted('logText')
    logText = schema.Text(
        title=_(u'Log'),
        required=False,
    )

    @invariant
    def checkAuthor(data):
        portal = api.portal.get()
        request = portal.REQUEST
        message = _(u"Corresponging must select from authors.")

        if data.authors == [] and data.corresponging == []:
            return
        if data.authors and not data.corresponging:
            api.portal.show_message(message=message,
                                    request=request,
                                    type='error')
            raise Invalid(message)
        if not data.authors and data.corresponging:
            api.portal.show_message(message=message,
                                    request=request,
                                    type='error')
            raise Invalid(message)
        if data.corresponging[0] not in data.authors:
            api.portal.show_message(message=message,
                                    request=request,
                                    type='error')
            raise Invalid(message)

    @invariant
    def validateExternalReviewer(data):
        if data.assignExternalReviewer1 == data.assignExternalReviewer2 and data.assignExternalReviewer1 is not None:
            raise Invalid(_(u"This External reviewer already selected."))
        if data.assignExternalReviewer2 == data.assignExternalReviewer3 and data.assignExternalReviewer2 is not None:
            raise Invalid(_(u"This External reviewer already selected."))
        if data.assignExternalReviewer1 == data.assignExternalReviewer3 and data.assignExternalReviewer1 is not None:
            raise Invalid(_(u"This External reviewer already selected."))
Example #27
0
class ITUpProject(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(
            safe_unicode(
                "The Dialog to create a new project consists of different "
                "register. Please go through these register and fill in the "
                "appropriate data for your project.")))

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(safe_unicode("Title")),
        description=_(
            safe_unicode(
                "Project Title - minimum 5 and maximum 50 characters")),
        min_length=5,
        max_length=50)

    dexteritytextindexer.searchable('description')
    description = schema.Text(title=_(safe_unicode("Project Summary")), )

    dexteritytextindexer.searchable('details')
    primary('details')
    details = RichText(title=_(safe_unicode("Full Project Description")),
                       required=False)

    model.fieldset('Categories',
                   label='Category / Categories',
                   fields=['category_choice'])
    model.fieldset('logo_screenshot',
                   label='Logo / Screenshot',
                   fields=[
                       'tucimageextension', 'project_logo',
                       'tucimageextension1', 'screenshot'
                   ])

    dexteritytextindexer.searchable('category_choice')
    directives.widget(category_choice=CheckBoxFieldWidget)
    category_choice = schema.List(
        title=_(safe_unicode("Choose your categories")),
        description=_(
            safe_unicode(
                "Please select the appropriate categories (one or more) for "
                "your project.")),
        value_type=schema.Choice(source=vocabCategories),
        constraint=isNotEmptyCategory,
        required=True)

    contactAddress = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        constraint=validateEmail)

    homepage = schema.URI(
        title=_(safe_unicode("Homepage")),
        description=_(
            safe_unicode(
                "If the project has an external home page, enter its URL "
                "(example: 'http://www.mysite.org').")),
        required=False)

    documentation_link = schema.URI(
        title=_(safe_unicode("URL of documentation repository ")),
        description=_(
            safe_unicode(
                "If the project has externally hosted documentation, enter its "
                "URL (example: 'http://www.mysite.org').")),
        required=False)

    directives.mode(tucimageextension='display')
    tucimageextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for screenshot '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimagefileextensions,
    )

    project_logo = NamedBlobImage(
        title=_(safe_unicode("Logo")),
        description=_(
            safe_unicode(
                "Add a logo for the project (or organization/company) by "
                "clicking the 'Browse' button. You could provide an image of "
                "the file format 'png', 'gif' or 'jpg'.")),
        required=False,
        constraint=validateimagefileextension)

    directives.mode(tucimageextension1='display')
    tucimageextension1 = schema.TextLine(
        title=_(u'The following file extensions are allowed for screenshot '
                u'files (upper case and lower case and mix of both):'),
        defaultFactory=allowedimagefileextensions,
    )

    screenshot = NamedBlobImage(
        title=_(safe_unicode("Screenshot of the Template")),
        description=_(
            safe_unicode(
                "Add a screenshot by clicking the 'Browse' button. You could "
                "provide an image of the file format 'png', 'gif' or 'jpg'. ")
        ),
        required=False,
        constraint=validateimagefileextension)

    @invariant
    def missingScreenshotOrLogo(data):
        if not data.screenshot and not data.project_logo:
            raise ProvideScreenshotLogo(
                _(u'Please add a screenshot or a logo to your project page. '
                  u'You will find the appropriate fields below on this page.'))
class IAdvancedSearch(directives_form.Schema):

    searchableText = schema.TextLine(
        title=_('label_searchable_text', default='Text'),
        description=_('help_searchable_text', default=''),
        required=False,
    )

    object_provides = schema.Choice(
        title=_('label_portal_type', default="Type"),
        description=_('help_portal_type',
                      default='Select the contenttype to be searched for.'),
        source=get_types,
        required=True,
    )

    ### Dossier
    start_1 = schema.Date(
        title=_('label_start', default='Start date'),
        description=_('label_from', default='From'),
        required=False,
    )

    start_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    end_1 = schema.Date(
        title=_('label_end', default='End date'),
        description=_('label_from', default='From'),
        required=False,
    )

    end_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    reference = schema.TextLine(
        title=_('label_reference_number', default='Reference number'),
        description=_('help_reference_number', default=''),
        required=False,
    )

    sequence_number = schema.Int(
        title=_('label_sequence_number', default='Sequence number'),
        description=_('help_sequence_number', default=''),
        required=False,
    )

    directives_form.widget(responsible=AutocompleteFieldWidget)
    responsible = schema.Choice(
        title=_('label_reponsible', default='Responsible'),
        description=_('help_responsible', default=''),
        vocabulary=u'opengever.ogds.base.AssignedUsersVocabulary',
        required=False,
    )

    dossier_review_state = schema.List(
        title=_('label_review_state', default='State'),
        description=_('help_review_state', default=''),
        value_type=schema.Choice(source=get_possible_dossier_states, ),
        required=False,
    )

    ### Document
    receipt_date_1 = schema.Date(
        title=_('label_receipt_date', default='Receipt date'),
        description=_('label_from', default='From'),
        required=False,
    )

    receipt_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    delivery_date_1 = schema.Date(
        title=_('label_delivery_date', default='delivery date'),
        description=_('label_from', default='From'),
        required=False,
    )

    delivery_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    document_date_1 = schema.Date(
        title=_('label_document_date', default='Document Date'),
        description=_('label_from', default='From'),
        required=False,
    )

    document_date_2 = schema.Date(
        description=_('label_to', default='To'),
        required=False,
    )

    document_author = schema.TextLine(
        title=_('label_document_author', default='Document author'),
        description=_('help_document_author', default=''),
        required=False,
    )

    directives_form.widget(responsible=AutocompleteFieldWidget)
    checked_out = schema.Choice(
        title=_('label_checked_out', default='Checked out by'),
        description=_('help_checked_out', default=''),
        vocabulary=u'opengever.ogds.base.UsersVocabulary',
        required=False,
    )

    trashed = schema.Bool(
        title=_('label_trashed', default='Also search in the recycle bin'),
        description=_('help_trashed', default=''),
        required=False,
    )

    ### Task
    directives_form.widget(issuer=AutocompleteFieldWidget)
    issuer = schema.Choice(
        title=_(u"label_issuer", default=u"Issuer"),
        description=_('help_issuer', default=u""),
        vocabulary=u'opengever.ogds.base.ContactsAndUsersVocabulary',
        required=False,
    )

    deadline_1 = schema.Date(
        title=_('label_deadline', default='Deadline'),
        description=_('label_from', default='From'),
        required=False,
    )

    deadline_2 = schema.Date(
        title=_('label_deadline_2', default=''),
        description=_('label_to', default='To'),
        required=False,
    )

    task_type = schema.Choice(
        title=_('label_tasktype', default=''),
        description=_('help_tasktyp', default=''),
        source=getTaskTypeVocabulary,
        required=False,
    )
    task_review_state = schema.List(
        title=_('label_review_state', default='State'),
        description=_('help_review_state', default=''),
        value_type=schema.Choice(source=get_possible_task_states, ),
        required=False,
    )
Example #29
0
class IRedturtleAgidthemeSettings(model.Schema):

    available_types = schema.List(
        title=_(u'heading_available_portaltypes',
                default=u'Shareable content types'),
        description=_(u'description_available_portaltypes',
                      default=u'List of content-types that can be enable '
                      u'for social sharing.'),
        required=False,
        default=[],
        missing_value=[],
        value_type=schema.Choice(
            vocabulary='plone.app.vocabularies.UserFriendlyTypes'))

    available_socials = schema.List(
        title=_(u'heading_available_socials',
                default=u'Enabled social networks'),
        description=_(u'description_available_socials',
                      default=u'List of social networks enabled for sharing.'),
        required=False,
        default=[],
        missing_value=[],
        value_type=schema.Choice(
            vocabulary='redturtle.agidtheme.vocabularies.SocialsVocabulary'))

    follow_us_links = schema.List(
        title=_(u'follow_us_links_label', default=u'Follow us links'),
        description=_(u'follow_us_links_description',
                      default=u'List of links to external social networks.'
                      u' These links are showed in the header.\n'
                      u'If there isn\'t a related icon in the theme, '
                      u'the link will not appear properly.\n'
                      u'Available icons are: facebook, twitter, '
                      u'youtube, medium, linkedin, storify, rss, '
                      u'newsletter.\n'
                      u'Insert a list of values (one per row) in the '
                      u'following form: social_id|url where social_id'
                      u' is one of the social with available icons.'),
        required=False,
        default=[],
        missing_value=[],
        value_type=schema.TextLine())

    header_link_label = schema.TextLine(
        title=_(u'header_link_label', default=u'Header link label'),
        description=_(u'header_link_label_desc',
                      default=u'Label for the link in the header of the site'),
        required=False,
    )

    header_link_url = schema.URI(
        title=_(u'header_link_url', default=u'Header link url'),
        description=_(u'header_link_url_desc',
                      default=u'URL of the link in the header'),
        required=False,
    )

    header_second_link_label = schema.TextLine(
        title=_(u'header_second_link_label',
                default=u'Header second link label'),
        description=_(u'header_second_link_label_desc',
                      default=u'Label for the link in the header of\
                              the site at right'),
        required=False)

    header_second_link_url = schema.URI(
        title=_(u'header_second_link_url', default=u'Header second link url'),
        description=_(u'header_second_link_url_desc',
                      default=u'URL of the link in the header at right'),
        required=False)
Example #30
0
class ICarouselSettings(Interface):
    """
    Settings for a Carousel.
    """

    enabled = schema.Bool(
        title=_('Enabled'),
        description=_('Uncheck this box to hide the Carousel temporarily.'),
        default=True,
    )

    banner_template = schema.Choice(
        title=_('Banner Type'),
        description=_('The banner is the part of the Carousel that rotates.'
                      ' Choose Default for the standard Carousel banner.'),
        vocabulary='Products.Carousel.BannerTemplates',
    )

    banner_elements = schema.List(
        title=_('Banner Elements'),
        description=_(
            'Select the elements that should be visible on the'
            ' banner. Note that custom banner types may not provide all elements.'
        ),
        value_type=schema.Choice(vocabulary=SimpleVocabulary.fromItems((
            (_('Title'), 'title'),
            (_('Text'), 'text'),
            (_('Image'), 'image'),
        )), ),
        default=['title', 'text', 'image'],
        required=False,
    )

    width = schema.Int(
        title=_('Banner Width'),
        description=_(
            'Enter the width of the banner in pixels. If you leave'
            ' this field blank, Carousel will use the width of the first banner.'
        ),
        required=False,
    )

    height = schema.Int(
        title=_('Banner Height'),
        description=_(
            'Enter the height of the banner in pixels. If you leave'
            ' this field blank, Carousel will use the height of the first banner.'
        ),
        required=False,
    )

    pager_template = schema.Choice(
        title=_('Pager Type'),
        description=_(
            'The pager allows user to navigate between banners.'
            ' Choose the type of pager to display, or select None for no pager.'
        ),
        vocabulary='Products.Carousel.PagerTemplates',
    )

    element_id = schema.TextLine(
        title=_('Unique ID'),
        description=_('Enter an ID for the Carousel container element.'
                      ' It can be used to apply CSS to the Carousel.'),
    )

    transition_type = schema.Choice(
        title=_('Transition'),
        vocabulary=SimpleVocabulary.fromItems((
            (_('Cross Fade'), 'fade'),
            (_('Slide'), 'slide'),
        )),
        default='fade',
    )

    transition_speed = schema.Float(
        title=_('Transition Speed'),
        description=_('Enter the speed of the transition in seconds.'),
        default=0.5,
        min=0.0,
    )

    transition_delay = schema.Float(
        title=_('Transition Delay'),
        description=_('Enter the number of seconds that Carousel should pause'
                      ' between banners.'),
        default=8.0,
        min=0.0,
    )

    default_page_only = schema.Bool(
        title=_('Only display on the default item'),
        description=_(
            'Only display the Carousel on the default item of this'
            ' folder. Otherwise, the Carousel appears on every item in'
            ' the folder.'),
        default=True,
    )

    random_order = schema.Bool(
        title=_('Random order'),
        description=
        _('Carousel pictures will reappear in random order on every page refresh.'
          ),
        default=True,
    )

    lazyload = schema.Bool(
        title=_('Enabled lazily load carousel images'),
        description=_('Check this box to conserve the user and the server'
                      ' bandwidth if the full carousel cycle is not shown.'),
        default=False,
    )