src/pyams_content/features/search/interfaces.py
changeset 1061 d1db251eeea3
child 1121 852aa448da04
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/features/search/interfaces.py	Wed Nov 07 17:29:54 2018 +0100
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+from zope.interface import Interface
+
+from pyams_content.interfaces import MANAGER_ROLE, GUEST_ROLE
+from pyams_i18n.schema import I18nTextLineField
+from pyams_portal.interfaces import DESIGNER_ROLE
+from pyams_security.schema import PrincipalsSet
+
+
+__docformat__ = 'restructuredtext'
+
+from zope.schema import Choice, Set, Bool
+
+from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY
+from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY
+from pyams_content.shared.site.interfaces import ISiteElement, IBaseSiteItem
+from pyams_content.shared.view import IWfView
+from pyams_sequence.interfaces import ISequentialIdTarget
+
+from pyams_content import _
+
+
+class ISearchFolderRoles(Interface):
+    """Search folder roles"""
+
+    managers = PrincipalsSet(title=_("Managers"),
+                             description=_("Managers can handle main operations in tool's workflow, like publish "
+                                           "or retire contents"),
+                             role_id=MANAGER_ROLE,
+                             required=False)
+
+    designers = PrincipalsSet(title=_("Designers"),
+                              description=_("Designers are users which are allowed to manage presentation templates"),
+                              role_id=DESIGNER_ROLE,
+                              required=False)
+
+    guests = PrincipalsSet(title=_("Guests"),
+                           description=_("Guests are users which are allowed to view contents with restricted access"),
+                           role_id=GUEST_ROLE,
+                           required=False)
+
+
+class ISearchFolder(IBaseSiteItem, ISiteElement, IWfView, ISequentialIdTarget):
+    """Search folder interface"""
+
+    visible_in_list = Bool(title=_("Visible in folders list"),
+                           description=_("If 'no', folder will not be displayed into folders list"),
+                           required=True,
+                           default=True)
+
+    navigation_title = I18nTextLineField(title=_("Navigation title"),
+                                         description=_("Folder's title displayed in navigation pages; "
+                                                       "original title will be used if none is specified"),
+                                         required=False)
+
+    selected_content_types = Set(title=_("Selected content types"),
+                                 description=_("Searched content types; leave empty for all"),
+                                 value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY),
+                                 required=False)
+
+    selected_datatypes = Set(title=_("Selected data types"),
+                             description=_("Searched data types; leave empty for all"),
+                             value_type=Choice(vocabulary=ALL_DATA_TYPES_VOCABULARY),
+                             required=False)