--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/interfaces/types.py Fri Nov 10 12:07:43 2017 +0100
@@ -0,0 +1,102 @@
+#
+# Copyright (c) 2008-2015 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.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.interfaces import ISharedTool
+from zope.container.interfaces import IContainer
+from zope.location.interfaces import ILocation
+
+# import packages
+from pyams_i18n.schema import I18nTextLineField, I18nThumbnailImageField
+from zope.container.constraints import contains
+from zope.interface import Attribute
+from zope.schema import TextLine, List, Choice
+
+from pyams_content import _
+
+
+class IBaseDataType(ILocation):
+ """Data interface for data-types and sub-types"""
+
+ name = TextLine(title=_("Name"),
+ description=_("Name of this data type; must be unique between all data types"),
+ required=True)
+
+ label = I18nTextLineField(title=_("Label"),
+ required=True)
+
+ navigation_label = I18nTextLineField(title=_("Navigation label"),
+ description=_("Label used for navigation entries"),
+ required=False)
+
+ tabfolder_label = I18nTextLineField(title=_("Tab-folder label"),
+ description=_("Label used to include into tab folder"),
+ required=False)
+
+ seealso_label = I18nTextLineField(title=_("'See also' label"),
+ description=_("This label can be used when contents of this type will be "
+ "displayed in a 'See also' entries block"),
+ required=False)
+
+ single_label = I18nTextLineField(title=_("'Single value' label"),
+ description=_("Label given to this type when a single value is displayed"),
+ required=False)
+
+ seeall_label = I18nTextLineField(title=_("'Link to list' label"),
+ description=_("Label used to display a link to a list of items of this type"),
+ required=False)
+
+ next_label = I18nTextLineField(title=_("Next content label"),
+ description=_("Label used to announce next date for this type"),
+ required=False)
+
+ pictogram = I18nThumbnailImageField(title=_("Pictogram"),
+ description=_("Image associated to this data type"),
+ required=False)
+
+
+class ISubType(IBaseDataType):
+ """Data sub-type interface"""
+
+
+class IDataType(IBaseDataType, IContainer):
+ """Data type interface"""
+
+ contains(ISubType)
+
+ field_names = List(title=_("Field names"),
+ description=_("List of fields associated with this data type"),
+ value_type=Choice(vocabulary='PyAMS types interface fields'))
+
+
+#
+# Types data manager interfaces
+#
+
+DATA_MANAGER_ANNOTATION_KEY = 'pyams_content.types.manager'
+
+
+class ITypedDataManager(IContainer):
+ """Typed shared data manager interface"""
+
+ contains(IDataType)
+
+
+class ITypedSharedTool(ISharedTool):
+ """Shared tool containing typed data"""
+
+ shared_content_types_fields = Attribute("Content fields interface")