示例#1
0
class IStyledText(Schema):
    title = schema.TextLine(
        title=_(u"Text Block Title"),
        required=True,
    )
    body = RichText(
        title=_(u"Text Block body"),
        description=_(u"Text to appear within the block"),
        required=True,
    )
    image = schema.Choice(
        title=_(u"Select image to be used as the title background"),
        required=False,
        vocabulary='plone.app.vocabularies.Catalog',
    )
    form.widget('image',
                RelatedItemsFieldWidget,
                vocabulary='plone.app.vocabularies.Catalog',
                pattern_options={
                    'recentlyUsed': True,
                    'selectableTypes': ['Image'],
                })
    bgcolor = schema.Choice(
        title=_(u"Background Color"),
        required=False,
        vocabulary=SimpleVocabulary.fromItems([
            ("White", "white"),
            ("Blue", "blue"),
            ("Red", "red"),
            ("Purple", "purple"),
        ]),
    )
示例#2
0
class IImageTile(Schema):

    image = NamedBlobFile(title=_(u'Please, upload an image'), )

    title = schema.TextLine(title=_(u'Set optional title'), required=False)

    widget(scale=RadioFieldWidget)
    scale = schema.Choice(title=_(u'Select maximum display size'),
                          source=image_scales)
示例#3
0
class IViewletManagerTile(Interface):

    manager = schema.TextLine(title=_(u"Name of the viewlet manager."),
                              required=True)

    view = schema.TextLine(title=_(u"Name of the view"), required=False)

    section = schema.Choice(title=_(u"Section of the page"),
                            values=(u"head", "body"),
                            required=False,
                            default="body")

    viewlet = schema.TextLine(title=_(u"Name of the viewlet"), required=False)
示例#4
0
class IRSSTile(Schema):
    """RSS tile schema interface."""

    portlet_title = schema.TextLine(
        title=_(u"Title"),
        description=_(u"Title of the portlet. If omitted, the title of the "
                      u"feed will be used."),
        required=False,
        default=u'')

    count = schema.Int(title=_(u"Number of items to display"),
                       description=_(u"How many items to list."),
                       required=True,
                       default=5)

    url = schema.TextLine(title=_(u"URL of RSS feed"),
                          description=_(u"Link of the RSS feed to display."),
                          required=True,
                          default=u'')

    timeout = schema.Int(title=_(u"Feed reload timeout"),
                         description=_(
                             u"Time in minutes after which the feed should be "
                             u"reloaded."),
                         required=True,
                         default=100)
示例#5
0
    def get_terms(self, context):
        # XXX: not working (see below the other XXX)
        # from zope.globalrequest import getRequest
        # if hasattr(context, 'REQUEST'):
        #     request = context.REQUEST
        # else:
        #     request = getRequest()

        manager = getUtility(IPortletManager, name=PORTLET_MANAGER)

        # view = context.restrictedTraverse('@@plone')

        # XXX: not working
        # manager_renderer = getMultiAdapter(
        #     (context,
        #      request,
        #      view,
        #      manager),
        #     IPortletManagerRenderer
        # )
        # portlets = manager_renderer.addable_portlets()
        portlets = manager.getAddablePortletTypes()
        yield SimpleTerm(value=None, token='', title=_(u'-- select type --'))
        for item in portlets:
            title = item.title
            token = value = item.addview
            yield SimpleTerm(value=value, token=token, title=title)
示例#6
0
class IPresentationTile(model.Schema):

    content_uid = schema.Choice(
        title=_(u"Select an existing content"),
        required=True,
        source=CatalogSource(portal_type=['presentation', 'training_class']),
    )
    def get_terms(self, context):
        # XXX: not working (see below the other XXX)
        # from zope.globalrequest import getRequest
        # if hasattr(context, 'REQUEST'):
        #     request = context.REQUEST
        # else:
        #     request = getRequest()

        manager = getUtility(IPortletManager, name=PORTLET_MANAGER)

        # view = context.restrictedTraverse('@@plone')

        # XXX: not working
        # manager_renderer = getMultiAdapter(
        #     (context,
        #      request,
        #      view,
        #      manager),
        #     IPortletManagerRenderer
        # )
        # portlets = manager_renderer.addable_portlets()
        portlets = manager.getAddablePortletTypes()
        yield SimpleTerm(value=None, token='', title=_(u'-- select type --'))
        for item in portlets:
            title = item.title
            token = value = item.addview
            yield SimpleTerm(value=value,
                             token=token,
                             title=title)
示例#8
0
class IExistingContentTile(model.Schema):

    content_uid = schema.Choice(
        title=_(u"Select an existing contentt"),
        required=True,
        vocabulary='plone.app.vocabularies.Catalog',
    )
    form.widget('content_uid',
                RelatedItemsFieldWidget,
                vocabulary='plone.app.vocabularies.Catalog',
                pattern_options={
                    'recentlyUsed': True,
                })

    show_title = schema.Bool(
        title=_(u'Show content title'),
        default=True,
    )

    show_description = schema.Bool(title=_(u'Show content description'),
                                   default=True)

    show_text = schema.Bool(
        title=_(u'Show content text'),
        default=True,
    )

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

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

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

    tile_class = schema.TextLine(
        title=_(u'Tile additional styles'),
        description=_(u'Insert a list of additional CSS classes that will',
                      ' be added to the tile'),
        default=u'',
        required=False,
    )
示例#9
0
def image_scales(context):
    values = []
    settings = get_settings()
    for allowed_size in settings.allowed_sizes:
        name = allowed_size.split()[0]
        if name not in ("thumb", "tile", "icon", "listing"):
            values.append(SimpleTerm(name, name, _(allowed_size)))
    return SimpleVocabulary(values)
class IHTMLTile(Schema):

    ignore_querystring('content')
    primary('content')
    content = schema.Text(
        title=_(u'HTML'),
        required=True,
    )
示例#11
0
def image_scales(context):
    values = []
    settings = get_settings()
    for allowed_size in settings.allowed_sizes:
        name = allowed_size.split()[0]
        if name not in ("thumb", "tile", "icon", "listing"):
            values.append(SimpleTerm(name, name, _(allowed_size)))
    return SimpleVocabulary(values)
class IExistingContentTile(model.Schema):

    content_uid = schema.Choice(
        title=_(u"Select an existing content"),
        required=True,
        source=CatalogSource(),
    )

    show_title = schema.Bool(
        title=_(u'Show content title'),
        default=True
    )

    show_description = schema.Bool(
        title=_(u'Show content description'),
        default=True
    )

    show_text = schema.Bool(
        title=_(u'Show content text'),
        default=True
    )

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

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

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

    tile_class = schema.TextLine(
        title=_(u'Tile additional styles'),
        description=_(
            u'Insert a list of additional CSS classes that will',
            ' be added to the tile'),
        default=u'',
        required=False,
    )
def image_scales(context):
    values = []
    if HAS_PLONE_5:
        settings = get_settings()
    else:
        settings = IImagingSchema(getSite())
    for allowed_size in settings.allowed_sizes:
        name = allowed_size.split()[0]
        if name not in ("thumb", "tile", "icon", "listing"):
            values.append(SimpleTerm(name, name, _(allowed_size)))
    return SimpleVocabulary(values)
示例#14
0
class INewsTile(Schema):
    """A tile that displays a listing of content items"""

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

    uid = schema.Choice(
        title=_(u"Select an existing content"),
        required=True,
        vocabulary='plone.app.vocabularies.Catalog',
    )
    directives.widget(
        'uid',
        RelatedItemsFieldWidget,
        pattern_options={'selectableTypes': ['Collection', 'Folder']},
    )

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

    limit_slider = schema.Int(
        title=_(u'Limit slider'),
        description=_(u'Number of element in slider'),
        required=False,
        default=4,
        min=1,
    )
示例#15
0
class IIndexTile(IContentListingTile):
    image_format = schema.Choice(
        title=_(u"Choose image format"),
        description=_(u"Square is used by default"),
        values=[_(u'Square'), _(u'Landscape')],
        default=_(u'Square'),
        required=False
    )

    show_authors = schema.Bool(
        title=_(u"Show authors"),
        description=_(u"Show authors by default - according to the design"),
        default=True,
        required=True,
    )

    view_template = schema.Choice(
        title=_(u"Display mode"), source=_(u"Available Index Views"), required=True
    )
class IRawEmbedTile(Schema):
    """ Raw Embed Tile
    """

    tile_title = schema.TextLine(
        title=_(u'Title'),
        description=_(u"""The title will also be used to create
            identifying class on that tile"""),
        required=True,
    )

    show_title = schema.Bool(
        title=_(u'Show tile title'),
        default=True
    )

    ignore_querystring('html_snippet')
    html_snippet = schema.SourceText(
        title=_(u"HTML Snippet"),
        description=_(u"""Be CAREFUL what you paste here, no security
            checks or transforms to safe_html will be done!"""),
        required=False,
    )
示例#17
0
class ISitemapTile(Schema):
    """A tile which can render the sitemap."""
    name = schema.TextLine(title=_(u"Title"),
                           description=_(u"The title of the sitemap."),
                           default=u"",
                           required=False)
示例#18
0
class ISliderTile(Schema):
    """
    """
    collection_uid = schema.Choice(
        title=_(u"Select an existing content"),
        required=True,
        vocabulary="plone.app.vocabularies.Catalog",
    )
    directives.widget(
        "collection_uid",
        RelatedItemsFieldWidget,
        pattern_options={"selectableTypes": ["Collection"]},
    )

    infinite = schema.Bool(title=_(u"Infinite"), required=False, default=True)

    dots = schema.Bool(title=_(u"Dots"), required=False, default=True)

    arrows = schema.Bool(title=_(u"Arrows"), required=False, default=True)

    centerMode = schema.Bool(title=_(u"Center"), required=False, default=False)

    fade = schema.Bool(title=_(u"fade"), required=False, default=False)

    vertical = schema.Bool(title=_(u"vertical mode"),
                           required=False,
                           default=False)

    autoplay = schema.Bool(title=_(u"Autoplay mode"),
                           required=False,
                           default=False)

    pauseOnFocus = schema.Bool(title=_(u"pause on focus"),
                               required=False,
                               default=True)

    cssEase = schema.TextLine(
        title=_(u"ccsEase"),
        description=_(u"Use css ease"),
        required=False,
        default=_(u"linear"),
    )
    autoplaySpeed = schema.Int(
        title=_(u"autoplaySpeed"),
        description=_(u"Speed of autoplay"),
        required=False,
        default=2000,
    )

    slidesToShow = schema.Int(
        title=_(u"Show"),
        description=_(u"Slides to show"),
        required=False,
        default=4,
    )

    slidesToScroll = schema.Int(
        title=_(u"Scroll"),
        description=_(u"Slider to scroll"),
        required=False,
        default=4,
    )

    speed = schema.Int(
        title=_(u"Speed"),
        description=_(u"Speed"),
        required=False,
        default=300,
        min=100,
    )

    limit = schema.Int(
        title=_(u"Limit"),
        description=_(u"Limit of slides"),
        required=False,
        default=10,
    )
    size = schema.TextLine(
        title=_(u"Image size"),
        description=_(u"Size of image slider (ex: thumb, large,...)"),
        required=False,
        default=_(u"thumb"),
    )
    model.fieldset(
        'display',
        label=_(u'Display options'),
        fields=[
            'title',
            'description',
            'date',
            'all_button',
        ],
    )

    title = schema.Bool(
        title=_(u"Title"),
        required=False,
        default=True,
    )

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

    date = schema.Bool(
        title=_(u"Date"),
        required=False,
        default=True,
    )

    all_button = schema.Bool(
        title=_(u"All button"),
        required=False,
        default=True,
    )

    breakpoint_full = schema.Int(
        title=_(u"breakpoint_full"),
        description=_(u"What size to display in breakpoint_full"),
        required=False,
        default=1024,
    )
    slidesToShow_full = schema.Int(
        title=_(u"slidesToShow_full"),
        description=_(u"how many element to display in breakpoint_full"),
        required=False,
        default=1,
    )

    slidesToScroll_full = schema.Int(
        title=_(u"slidesToScroll_full"),
        description=_(u"how many element scroll in breakpoint_full"),
        required=False,
        default=1,
    )

    breakpoint_medium = schema.Int(
        title=_(u"breakpoint_medium"),
        description=_(u"What size to display in breakpoint_medium"),
        required=False,
        default=600,
    )
    slidesToShow_medium = schema.Int(
        title=_(u"slidesToShow_medium"),
        description=_(u"how many element to display in breakpoint_medium"),
        required=False,
        default=1,
    )
    slidesToScroll_medium = schema.Int(
        title=_(u"slidesToScroll_medium"),
        description=_(u"how many element scroll in breakpoint_medium"),
        required=False,
        default=1,
    )
    breakpoint_small = schema.Int(
        title=_(u"breakpoint_small"),
        description=_(u"What size to display in breakpoint_small"),
        required=False,
        default=480,
    )
    slidesToShow_small = schema.Int(
        title=_(u"slidesToShow_small"),
        description=_(u"how many element to display in breakpoint_small"),
        required=False,
        default=1,
    )
    slidesToScroll_small = schema.Int(
        title=_(u"slidesToScroll_small"),
        description=_(u"how many element scroll in breakpoint_small"),
        required=False,
        default=1,
    )
示例#19
0
class IAttachmentTile(Schema):

    widget(files=MultiFileFieldWidget)
    files = schema.List(title=_(u'Upload files'),
                        value_type=NamedBlobFile(
                            title=_(u"Please upload a file"), required=True))
示例#20
0
class IContentListingTile(Schema):
    """A tile that displays a listing of content items"""

    title = schema.TextLine(title=_(u'label_title', default=u'Title'),
                            required=False)

    description = schema.Text(
        title=_(u'label_description', default=u'Summary'),
        description=_(u'help_description',
                      default=u'Used in item listings and search results.'),
        required=False,
        missing_value=u'',
    )

    widget(query=QueryStringFieldWidget)
    query = schema.List(
        title=_(u"Search terms"),
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        description=_(u'Define the search terms for the items '
                      u'you want to list by choosing what to match on. The '
                      u'list of results will be dynamically updated'),
        required=False)

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

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

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

    view_template = schema.Choice(title=_(u'Display mode'),
                                  source=_(u'Available Listing Views'),
                                  required=True)
示例#21
0
class IEmbedTile(Schema):
    """ Embed tile.
    """

    media_url = schema.TextLine(title=_(u"Media URL"), required=True)
示例#22
0
class INavigationTile(Schema):
    """A tile which can render the navigation tree."""

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

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

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

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

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

    bottomLevel = schema.Int(
        title=_(u'Navigation tree depth'),
        description=_(
            u'How many folders should be included before the navigation '
            u'tree stops. 0 means no limit. 1 only includes the root '
            u'folder.'
        ),
        default=0,
        required=False,
    )
class IThreecolumnsTile(IExistingContentTile):

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

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

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

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

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

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

    contact = schema.TextLine(title=_(u"Contact"),
                              description=_(u"Contact"),
                              default=u"",
                              required=False)

    linkedin = schema.TextLine(title=_(u"LinkedIn"),
                               description=_(u"LinkedIn"),
                               default=u"",
                               required=False)

    picture_credits = schema.TextLine(title=_(u"Foto credits"),
                                      description=_(u"Foto credits"),
                                      default=u"",
                                      required=False)

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

    use_only_two = schema.Bool(
        title=_(u"Use only the last two columns"),
        default=False,
        required=False,
    )

    form.omitted('show_text')
    form.omitted('show_comments')
    form.omitted('tile_class')
示例#24
0
class IFrontpageTile(IExistingContentTile):

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

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

    show_icon = schema.Bool(
        title=_(u"Show De Gevangenpoort icon (small version)"),
        default=True,
        required=False,
    )

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

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

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

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

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

    form.omitted('show_text')
    form.omitted('show_comments')
    form.omitted('tile_class')
class IPortletManagerTile(Interface):
    manager = schema.TextLine(title=u'Name of the portlet manager to render.',
                              required=True)

    view = schema.TextLine(title=_(u'Name of the view'), required=False)
示例#26
0
class IFrontpageTile(IExistingContentTile):

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

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

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

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

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

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

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

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

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

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

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

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

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

    form.omitted('show_text')
    form.omitted('show_comments')
    form.omitted('tile_class')
class IMultipleitemsTile(IContentListingTile):
    show_url = schema.TextLine(
        title=_(u"show_url", default=u"Show more url"),
        description=_(
            u"If an url is added the 'Show more' button will be shown"),
        required=False,
    )

    image_format = schema.Choice(title=_(u"Choose image format"),
                                 description=_(u"Square is used by default"),
                                 values=[_(u'Square'),
                                         _(u'Landscape')],
                                 default=_(u'Square'),
                                 required=False)

    background_color = schema.Choice(
        title=_(u"Choose background color"),
        description=_(u"White by default"),
        values=[_(u'White'), _(u'Purple'),
                _(u'Red')],
        default=_(u'White'),
        required=False)

    show_description = schema.Bool(
        title=_(u"Show description for each item in the listing."),
        description=_(
            u"Does not show description by default - according to the design"),
        default=False,
        required=False,
    )

    use_awards_view = schema.Bool(
        title=_(u"Use awards view (show description on top of image)"),
        default=False,
        required=False,
    )

    view_template = schema.Choice(title=_(u"Display mode"),
                                  source=_(u"Available Multiple items Views"),
                                  required=True)