src/pyams_content/features/search/interfaces.py
changeset 1061 d1db251eeea3
child 1121 852aa448da04
equal deleted inserted replaced
1060:29b1aaf9e080 1061:d1db251eeea3
       
     1 #
       
     2 # Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 from zope.interface import Interface
       
    13 
       
    14 from pyams_content.interfaces import MANAGER_ROLE, GUEST_ROLE
       
    15 from pyams_i18n.schema import I18nTextLineField
       
    16 from pyams_portal.interfaces import DESIGNER_ROLE
       
    17 from pyams_security.schema import PrincipalsSet
       
    18 
       
    19 
       
    20 __docformat__ = 'restructuredtext'
       
    21 
       
    22 from zope.schema import Choice, Set, Bool
       
    23 
       
    24 from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY
       
    25 from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
       
    26 from pyams_content.shared.site.interfaces import ISiteElement, IBaseSiteItem
       
    27 from pyams_content.shared.view import IWfView
       
    28 from pyams_sequence.interfaces import ISequentialIdTarget
       
    29 
       
    30 from pyams_content import _
       
    31 
       
    32 
       
    33 class ISearchFolderRoles(Interface):
       
    34     """Search folder roles"""
       
    35 
       
    36     managers = PrincipalsSet(title=_("Managers"),
       
    37                              description=_("Managers can handle main operations in tool's workflow, like publish "
       
    38                                            "or retire contents"),
       
    39                              role_id=MANAGER_ROLE,
       
    40                              required=False)
       
    41 
       
    42     designers = PrincipalsSet(title=_("Designers"),
       
    43                               description=_("Designers are users which are allowed to manage presentation templates"),
       
    44                               role_id=DESIGNER_ROLE,
       
    45                               required=False)
       
    46 
       
    47     guests = PrincipalsSet(title=_("Guests"),
       
    48                            description=_("Guests are users which are allowed to view contents with restricted access"),
       
    49                            role_id=GUEST_ROLE,
       
    50                            required=False)
       
    51 
       
    52 
       
    53 class ISearchFolder(IBaseSiteItem, ISiteElement, IWfView, ISequentialIdTarget):
       
    54     """Search folder interface"""
       
    55 
       
    56     visible_in_list = Bool(title=_("Visible in folders list"),
       
    57                            description=_("If 'no', folder will not be displayed into folders list"),
       
    58                            required=True,
       
    59                            default=True)
       
    60 
       
    61     navigation_title = I18nTextLineField(title=_("Navigation title"),
       
    62                                          description=_("Folder's title displayed in navigation pages; "
       
    63                                                        "original title will be used if none is specified"),
       
    64                                          required=False)
       
    65 
       
    66     selected_content_types = Set(title=_("Selected content types"),
       
    67                                  description=_("Searched content types; leave empty for all"),
       
    68                                  value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY),
       
    69                                  required=False)
       
    70 
       
    71     selected_datatypes = Set(title=_("Selected data types"),
       
    72                              description=_("Searched data types; leave empty for all"),
       
    73                              value_type=Choice(vocabulary=ALL_DATA_TYPES_VOCABULARY),
       
    74                              required=False)