8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 from zope.container.constraints import contains |
13 from zope.container.constraints import contains |
16 from zope.container.interfaces import IContainer |
14 from zope.container.interfaces import IContainer |
17 from zope.interface import Attribute |
15 from zope.interface import Attribute |
18 from zope.location.interfaces import ILocation |
16 from zope.location.interfaces import ILocation |
19 from zope.schema import TextLine, List, Choice |
17 from zope.schema import Bool, Choice, List, TextLine |
20 |
18 |
21 from pyams_content.reference.pictograms.interfaces import PICTOGRAM_VOCABULARY |
19 from pyams_content.reference.pictograms.interfaces import PICTOGRAM_VOCABULARY |
22 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, IBaseContentPortalContext |
20 from pyams_content.shared.common.interfaces import IBaseContentPortalContext, ISharedTool, \ |
|
21 IWfSharedContent |
23 from pyams_i18n.schema import I18nTextLineField |
22 from pyams_i18n.schema import I18nTextLineField |
24 from pyams_portal.interfaces import IPortalContext |
23 from pyams_portal.interfaces import IPortalContext |
25 from pyams_sequence.schema import InternalReferenceField |
24 from pyams_sequence.schema import InternalReferenceField |
|
25 |
|
26 |
|
27 __docformat__ = 'restructuredtext' |
26 |
28 |
27 from pyams_content import _ |
29 from pyams_content import _ |
28 |
30 |
29 |
31 |
30 ALL_DATA_TYPES_VOCABULARY = 'PyAMS all data types' |
32 ALL_DATA_TYPES_VOCABULARY = 'PyAMS all data types' |
42 |
44 |
43 label = I18nTextLineField(title=_("Label"), |
45 label = I18nTextLineField(title=_("Label"), |
44 required=True) |
46 required=True) |
45 |
47 |
46 source_folder = InternalReferenceField(title=_("Source folder"), |
48 source_folder = InternalReferenceField(title=_("Source folder"), |
47 description=_("Source folder (or search engine) to which content is attached; " |
49 description=_("Source folder (or search engine) to " |
48 "if this reference is set, canonical URL will be based on this " |
50 "which content is attached; if this " |
49 "object's URL"), |
51 "reference is set, canonical URL will be " |
|
52 "based on this object's URL"), |
50 required=False) |
53 required=False) |
51 |
54 |
52 def get_source_folder(self): |
55 def get_source_folder(self): |
53 """Return source folder as object""" |
56 """Return source folder as object""" |
54 |
57 |
68 |
71 |
69 class IDataType(IBaseDataType, IContainer): |
72 class IDataType(IBaseDataType, IContainer): |
70 """Data type interface""" |
73 """Data type interface""" |
71 |
74 |
72 contains(ISubType) |
75 contains(ISubType) |
|
76 |
|
77 display_as_tag = Bool(title=_("Display as tag?"), |
|
78 description=_("Some portlets renderers can display a small tag above " |
|
79 "each content to show their content type; if this option " |
|
80 "is checked, data type label will be displayed instead " |
|
81 "of content type"), |
|
82 required=True, |
|
83 default=False) |
73 |
84 |
74 field_names = List(title=_("Field names"), |
85 field_names = List(title=_("Field names"), |
75 description=_("List of fields associated with this data type"), |
86 description=_("List of fields associated with this data type"), |
76 value_type=Choice(vocabulary=DATA_TYPE_FIELDS_VOCABULARY)) |
87 value_type=Choice(vocabulary=DATA_TYPE_FIELDS_VOCABULARY)) |
77 |
88 |