class IMockCollection(Interface):
    query = schema.List(value_type=schema.Dict(value_type=schema.Field(),
                                               key_type=schema.TextLine()), )
    query_invalid = schema.List(value_type=schema.Dict(
        value_type=schema.Field(), key_type=schema.TextLine()), )
    sort_reversed = schema.Bool()
    sort_on = schema.TextLine()
Beispiel #2
0
class ICatalogTableSourceConfig(ITableSourceConfig):
    """Marker interface for table source configurations used by the
    portal_catalog table source.
    See: catalog_source.py
    """

    filter_path = schema.TextLine(
        title=u'Path filter',
        description=u'Only show objects within this path. If the path is None '
        'no path filter will be applied (all objects are shown). See also '
        'the `depth` attribute.',
        default=None)

    depth = schema.Int(
        title=u'Recursivity depth',
        description=u'Defines the recursivity depth, how depth the contents '
        'should be searched. If it set to -1 (default) the recursivity is '
        'infinite, that means all direct or indirect children are found. If '
        'set to 1 it will only find direct children. If set to 0 it will only '
        'find the current context if it matches the other criterias.',
        default=-1)

    types = schema.List(title=u'Portal types filter',
                        description=u'Filter results by portal type.',
                        value_type=schema.TextLine(),
                        default=[])

    object_provides = schema.TextLine(
        title=u'Object provides interface dotted name',
        description=u'Interface name which the objects have to provide.')

    search_options = schema.Dict(
        title=u'Additional search options',
        description=u'Additional options for filtering results.',
        key_type=schema.TextLine(),
        value_type=schema.Field(),
        default={})

    custom_sort_indexes = schema.Dict(
        title=u'Custom sort indexes',
        description=u'Provides custom sort mechanisms for certain '
        'index types.',
        key_type=schema.TextLine(
            title=u'portal_catalog index type',
            description=u'Name of a portal_catalog index type '
            '(e.g. Products.PluginIndexes.DateIndex.DateIndex)'),
        value_type=schema.Field(
            title=u'custom sort method',
            description=u'pointer to a custom sort method (e.g. '
            'lambda results, sort_on, reverse: ...)'))

    search_index = schema.TextLine(
        title=u'Search index',
        description=u'Search the `filter_text` in this index.',
        default=u'SearchableText')
Beispiel #3
0
class IImagesTileSchema(model.Schema):

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

    form.widget('images', ImageRelatedItemsFieldWidget)
    images = schema.List(
        title=u"Images",
        description=u"Select images or folders of images to display in "
        u"gallery",
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'),
        required=False)

    form.widget(query=QueryFieldWidget)
    query = schema.List(
        title=u'Search terms',
        description=u"Define the search terms for the images you want to use. "
        u"The list of results will be dynamically updated",
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False)

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

    sort_reversed = schema.Bool(
        title=u'Reversed order',
        description=u'Sort the results in reversed order',
        required=False,
    )
Beispiel #4
0
class ICalendarTileSchema(Interface):

    form.widget(query=QueryFieldWidget)
    query = schema.List(
        title=u'Base query',
        description=u"This query can be customized base on user selection",
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False,
        default=[{
            u'i': u'portal_type',
            u'v': [u'Event'],
            u'o': u'plone.app.querystring.operation.selection.any'
        }])

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

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

    limit = schema.Int(
        title=u'Limit',
        description=u'Limit Search Results',
        required=False,
        default=250,
        min=1,
    )
Beispiel #5
0
class IQueryChoice(IChoice):
    query = schema.List(
        title=u'Query',
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        required=False
    )

    sort_on = schema.TextLine(
        title=u'Sort on',
        required=False,
        default=u'effective'
    )

    sort_reversed = schema.Bool(
        title=u'Reversed order',
        required=False,
        default=True
    )

    limit = schema.Int(
        title=u'Limit',
        required=False,
        default=15,
        min=1,
    )
Beispiel #6
0
class IJSEventsWidget(Interface):
    """Offers a jsEvents attribute."""

    jsEvents = schema.Field(
        title=u"JavaScript Events",
        description=u"The javascript events associated with this widget.",
        required=True)
Beispiel #7
0
class INetworkAddressLocations(ILocations):
    """A set IIPNetworkAddress objects"""
    locations = schema.Set(
        title=u'IP Addresses',
        description=u'a set of INetworkAddress objects',
        value_type=schema.Field(
            constraint=lambda v: INetworkAddress.providedBy(v)))
Beispiel #8
0
class IIPNetworkAddress(INetworkAddress, IIPNetwork):
    """Network address locaton identified via Python ipaddress.ip_address"""
    address = schema.Field(
        title=u'IIPNetworkAddress',
        description=
        u'An IPv4Address/IPv6Address address from ipaddress package',
        constraint=_is_valid_ipaddress)
Beispiel #9
0
class INavigationTileSchema(model.Schema):

    display_type = schema.Choice(title=u"Display Type",
                                 source=TileViewsSource('navigation'),
                                 default='horizontal')

    form.widget(content=RelatedItemsFieldWidget)
    content = schema.List(
        title=u"Navigation items",
        description=u"Select items for navigation",
        required=False,
        default=[],
        value_type=schema.Choice(vocabulary='plone.app.vocabularies.Catalog'))

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

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

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

    form.widget(nav_type=NavigationTypeWidget)
    nav_type = schema.Choice(
        title=u'Use dynamic query to populate this menu',
        description=
        u'Otherwise, the navigation will be built from site section',
        vocabulary=SimpleVocabulary([
            SimpleVocabulary.createTerm('query', 'query', u'Query'),
            SimpleVocabulary.createTerm('content', 'content', u'Select items'),
            SimpleVocabulary.createTerm('currentlocation', 'currentlocation',
                                        u'Build from here'),
            SimpleVocabulary.createTerm(
                'secondlevel', 'secondlevel',
                u'Build from second level from site root'),
        ]),
        default=u'currentlocation')

    limit = schema.Int(title=u'Limit',
                       description=u'Limited number of items',
                       required=True,
                       default=10)
Beispiel #10
0
class IATBlob(Interface):
    """ a chunk of binary data, i.e. a blob """

    title = schema.TextLine(title=_(u'Title'))

    blob = schema.Field(
        title=_(u'Blob'),
        description=_(u'Binary data, similar to a file in the filesystem'),
        required=True,
    )
class IMgalleryTile(model.Schema):
    """M Gallery Tile schema"""

    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,
    )

    maxwidth = schema.Int(
        title=_(u'Max width'),
        required=True,
        default=1440,
        min=500,
    )

    speed = schema.Int(
        title=_(u'Speed'),
        required=True,
        default=500,
        min=10,
    )

    timeout = schema.Int(
        title=_(u'Speed'),
        required=True,
        default=1500,
        min=10,
    )
Beispiel #12
0
class IQuerySchema(Interface):

    query = schema.List(title=u'Search terms',
                        value_type=schema.Dict(value_type=schema.Field(),
                                               key_type=schema.TextLine()),
                        required=False)

    lines = schema.List(title=u'Strings',
                        value_type=schema.TextLine(),
                        required=False)

    title = schema.TextLine(title=u'Title')
Beispiel #13
0
class ICollection(model.Schema):

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

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

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

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

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

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

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

    form.widget(content=RelatedItemFieldWidget)
    content = schema.List(
        title=u"Item",
        description=u"Selected item to display",
        required=False,
        default=[],
        value_type=schema.Choice(
            vocabulary='plone.app.vocabularies.Catalog'
        )
    )

    @invariant
    def validate_content(data):
        if data.content and len(data.content) != 1:
            raise Invalid("Must select 1 item")

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

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

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

    more_text = schema.TextLine(
        title=u'More text',
        default=u'',
        required=False)
class ISliderBase(Schema):
    """Basic Image Tile Schema."""

    form.widget('use_query', UseQueryFieldWidget)
    use_query = schema.Bool(
        default=False,
        title=_(u'Use dynamic query'),
    )

    form.widget('images', RelatedItemsFieldWidget)
    images = schema.List(
        description=_(
            u'Select images or folders of images to display in slider', ),
        required=False,
        title=_(u'Images'),
        value_type=schema.Choice(
            vocabulary='plone.app.vocabularies.Catalog', ),
    )

    form.widget('query', QueryStringFieldWidget)
    query = schema.List(
        description=_(
            u'Define the search terms for the images you want to use. '
            u'The list of results will be dynamically updated', ),
        required=False,
        title=_(u'Search terms'),
        value_type=schema.Dict(
            value_type=schema.Field(),
            key_type=schema.TextLine(),
        ),
    )

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

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

    image_scale = schema.Choice(
        default='large',
        title=_(u'Image Scale'),
        source=image_scales,
    )
Beispiel #16
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)
Beispiel #17
0
class IQueryPortlet(IPortletDataProvider):
    """A portlet which renders the results of a collection object.
    """

    header = schema.TextLine(title=_(u"Portlet header"),
                             description=_(u"Title of the rendered portlet"),
                             required=True)

    query = schema.List(
        title=_(u'label_query', default=u'Search terms'),
        description=_(u"""Define the search terms for the items you want to
            list by choosing what to match on.
            The list of results will be dynamically updated"""),
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        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"Specify the maximum number of items to show in the "
                      u"portlet. Leave this blank to show all items."),
        required=False)

    random = schema.Bool(
        title=_(u"Select random items"),
        description=_(u"If enabled, items will be selected randomly from the "
                      u"collection, rather than based on its sort order."),
        required=True,
        default=False)

    more = schema.TextLine(
        title=_(u"Show more link"),
        description=_(
            u"Link to display in the footer, leave empty to hide it"),
        required=False)
Beispiel #18
0
class IRecord(Interface):
    """A record stored in the registry.

    A record may be "bound" or "unbound". If bound, it will have a
    __parent__ attribute giving the IRegistry it belongs to. It will then
    get and set its field and value attributes from the internal storage in
    the registry. If unbound, it will store its own values.

    A record becomes bound when added to the registry. Records retrieved from
    the registry are always bound.
    """

    field = schema.Object(title=u"A field describing this record",
                          schema=IPersistentField)

    value = schema.Field(
        title=u"The value of this record",
        description=u"Must be valid according to the record's field")
Beispiel #19
0
class IAlert(IEntity):
    """An alert"""
    def events():
        """Returns iterable of ordered IEvent objects related to alert"""
        
    datetime = schema.Datetime(
            title = _(u'Alert datetime'),
            description = _(u'The datetime of the alert'),
            required = True
            )
    severity = schema.Choice(
            title = _(u'Alert severity'),
            description = _(u'Severity is based on criticality and fidelity'),
            required = True,
            values=[u'informational',u'low',u'medium',u'high',u'critical']
            )
    system = schema.Field(
            title = _(u'Alert source'),
            description = _(u'System that alert was emitted from'),
            constraint = lambda v: ISystem.providedBy(v)
            )
Beispiel #20
0
class IMessage(interface.Interface):
    """Messages are objects ready for sending.
    """
    payload = schema.Field(
        title=_(u"The message's payload, e.g. the e-mail message."), )

    subscription = schema.Object(
        title=_(u"Subscription, referenced for bookkeeping purposes only."),
        schema=ISubscription,
    )

    status = schema.Choice(
        title=_(u"State"),
        description=_(u"IMessageChanged is fired automatically when this "
                      u"is set"),
        values=MESSAGE_STATES)

    status_message = schema.Text(title=_(u"Status details"), required=False)

    status_changed = schema.Datetime(
        title=_(u"Last time this message changed its status"), )
Beispiel #21
0
class IMetaTileSchema(model.Schema):

    # dict structure:
    #   id: < generated id of file >
    #   type type: < type of tile >
    tiles = schema.List(title=u'Tiles',
                        value_type=schema.Dict(value_type=schema.Field(),
                                               key_type=schema.TextLine()),
                        required=False,
                        default=[],
                        missing_value=[])

    mode = schema.Choice(title=u"Mode",
                         vocabulary=SimpleVocabulary([
                             SimpleTerm('hide', 'hide', u'Hide'),
                             SimpleTerm('parent', 'parent',
                                        u'Use parent settings'),
                             SimpleTerm('show', 'show',
                                        u'Show(hides parent tiles)'),
                             SimpleTerm('add', 'add', u'Add')
                         ]),
                         default='parent')
class ICollection(model.Schema):

    form.widget(query=QueryStringFieldWidget)
    query = schema.List(
        title=_(u'Search terms'),
        description=
        _(u"Define the search terms for the items you want to list by choosing what to match on. The list of results will be dynamically updated."
          ),
        value_type=schema.Dict(value_type=schema.Field(),
                               key_type=schema.TextLine()),
        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'label_limit', default=u'Limit'),
        description=_(u'Limit Search Results'),
        required=False,
        default=1000,
    )

    item_count = schema.Int(
        title=_(u'label_item_count', default=u'Item count'),
        description=_(u'Number of items that will show up in one batch.'),
        required=False,
        default=30,
    )
Beispiel #23
0
class IFeaturedPortlet(IPortletDataProvider):

    image = schema.Field(
        title=_(u'Featured Image'),
        description=_(u'A small image from the current feature'),
        required=False)

    featured_title = schema.TextLine(
        title=_(u'Title of Current Feature'),
        description=_(
            u'Title to appear on the front page about current feature.'),
        required=False)

    featured_description = schema.Text(
        title=_(u'Description of Current Feature'),
        description=
        _(u'Description of current feature as it will appear on the front page.'
          ),
        required=False)

    featured_lefttext = schema.TextLine(
        title=_(u'The text that appears to the left of this portlet'),
        description=_(u'Text to appear on the left'),
        required=False)
Beispiel #24
0
class IFormatter(interface.Interface):

    annotations = schema.Dict(
        title=u"Annotations",
        description=
        u"""Stores arbitrary application data under package-unique keys.

        By "package-unique keys", we mean keys that are are unique by
        virtue of including the dotted name of a package as a prefix.  A
        package name is used to limit the authority for picking names for
        a package to the people using that package.

        For example, when implementing annotations for a zc.foo package, the
        key would be (or at least begin with) the following::

          "zc.foo"
        """)

    request = schema.Field(
        title=u'Request',
        description=u'The request object.',
    )

    context = schema.Field(
        title=u'Context',
        description=u'The (Zope ILocation) context for which the table '
        u'formatter is rendering')

    items = schema.List(
        title=u'Items',
        description=u'The items that will be rendered by __call__.  items '
        'preferably support a way to get a slice (__getitem__ or the '
        'deprecated getslice) or alternatively may merely be iterable.  '
        'see getItems.')

    columns = schema.Tuple(
        title=u'All the columns that make up this table.',
        description=u'All columns that may ever be a visible column.  A non-'
        u'visible column may still have an effect on operations such as '
        u'sorting.  The names of all columns must be unique within the '
        u'sequence.',
        unique=True,
    )

    visible_columns = schema.Tuple(
        title=u'The visible columns that make up this table.',
        description=u'The columns to display when rendering this table.',
        unique=True,
    )

    batch_size = schema.Int(
        title=u'Number of rows per page',
        description=u'The number of rows to show at a time.  '
        u'Set to 0 for no batching.',
        default=20,
        min=0,
    )

    batch_start = schema.Int(
        title=u'Batch Start',
        description=u'The starting index for batching.',
        default=0,
    )

    prefix = schema.BytesLine(
        title=u'Prefix',
        description=u'The prefix for all form names',
        constraint=pythonLikeNameConstraint,
    )

    columns_by_name = schema.Dict(
        title=u'Columns by Name',
        description=u'A mapping of column name to column object')

    cssClasses = schema.Dict(
        title=u'CSS Classes',
        description=u'A mapping from an HTML element to a CSS class',
        key_type=schema.TextLine(title=u'The HTML element name'),
        value_type=schema.TextLine(title=u'The CSS class name'))

    def __call__():
        """Render a complete HTML table from self.items."""

    def renderHeaderRow():
        """Render an HTML table header row from the column headers.

        Uses renderHeaders."""

    def renderHeaders():
        """Render the individual HTML headers from the columns.

        Uses renderHeader."""

    def renderHeader(column):
        """Render a header for the given column.

        Uses getHeader."""

    def getHeader(column):
        """Render header contents for the given column.

        Includes appropriate code for enabling ISortableColumn.

        Uses column.renderHeader"""

    def getHeaders():
        """Retrieve a sequence of rendered column header contents.

        Uses getHeader.

        Available for more low-level use of a table; not used by the other
        table code."""

    def renderRows():
        """Render HTML rows for the self.items.

        Uses renderRow and getItems."""

    def getRows():
        """Retrieve a sequence of sequences of rendered cell contents.

        Uses getCells and getItems.

        Available for more low-level use of a table; not used by the other
        table code."""

    def getCells(item):
        """Retrieve a sequence rendered cell contents for the item.

        Uses getCell.

        Available for more low-level use of a table; not used by the other
        table code."""

    def getCell(item, column):
        """Render the cell contents for the item and column."""

    def renderRow(item):
        """Render a row for the given item.

        Uses renderCells."""

    def renderCells(item):
        """Render the cells--the contents of a row--for the given item.

        Uses renderCell."""

    def renderCell(item, column):
        """Render the cell for the item and column.

        Uses getCell."""

    def getItems():
        """Returns the items to be rendered from the full set of self.items.
class ISortableCollectionBehavior(model.Schema):

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    form.widget('display_type', PreviewSelectFieldWidget,
                tile_name='querylisting')
    display_type = schema.Choice(
        title=u"Display Type",
        source=TileViewsSource('querylisting'),
        default=defaults.get('querylisting_tile_displaytype', u'default')
    )
Beispiel #27
0
class IRecordModifiedEvent(IRecordEvent):
    """Event fired when a record's value is modified.
    """

    oldValue = schema.Field(title=u"The record's previous value")
    newValue = schema.Field(title=u"The record's new value")
Beispiel #28
0
class ISmart(IPortletDataProvider):
    """A portlet which renders the results of a collection object.
    """

    header = schema.TextLine(title=_(u"Portlet header"),
                             description=_(u"Title of the rendered portlet"),
                             required=True)

    show_header = schema.Bool(title=_(u'label_show_header',
                                      default=u'Show header'),
                              description=_(u'Renders the header'),
                              required=False,
                              default=True)

    description = schema.TextLine(title=_(u"Portlet description"),
                                  description=_(u"Description of the portlet"),
                                  required=False)

    container_view = schema.Choice(
        title=_(u'label_container_view', default=u'Portlet view to use'),
        description=_(u"""Portlet view to use"""),
        vocabulary="base.portlet.smart.AvailablePortletContainerRenderers",
        required=True)

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

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

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

    sort_folderorder = schema.Bool(
        title=_(u'label_sort_folderorder', default=u'Order as in folder'),
        description=_(u'Override query sort order using folder order'),
        required=False,
    )

    limit = schema.Int(
        title=_(u"Limit"),
        description=_(u"Specify the maximum number of items to show in the "
                      u"portlet. Leave this blank to show all items."),
        required=False)

    random = schema.Bool(
        title=_(u"Select random items"),
        description=_(u"If enabled, items will be selected randomly from the "
                      u"collection, rather than based on its sort order."),
        required=True,
        default=False)

    more_link = schema.TextLine(
        title=_(u"Show more link"),
        description=_(
            u"Link to display in the footer, leave empty to hide it"),
        required=False)

    more_text = schema.TextLine(
        title=_(u"Show more link text"),
        description=_(u"Label the 'Show more link' defined avobe"),
        default=u'+',
        required=False)
Beispiel #29
0
class IMapTileSchema(model.Schema):

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

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

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

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

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

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

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

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

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

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

    initialZoom = schema.Int(
        title=u"Initial Zoom",
        default=11
    )
Beispiel #30
0
class IIPNetwork(INetwork):
    """Network location identified via Python ipaddress.ip_network"""
    network = schema.Field(
        title=u'IIPNetwork',
        description=u'An IP network identifier from ipaddress package',
        constraint=_is_valid_ipnetwork)