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' |
13 from zope.interface import Attribute, Interface |
|
14 from zope.schema import Bool, Choice, InterfaceField, TextLine, URI |
|
15 |
|
16 from pyams_content.component.association.interfaces import IAssociationContainerTarget, \ |
|
17 IAssociationItem |
|
18 from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY |
|
19 from pyams_i18n.schema import I18nTextField, I18nTextLineField |
|
20 from pyams_sequence.interfaces import IInternalReference |
|
21 from pyams_utils.schema import MailAddressField |
14 |
22 |
15 |
23 |
16 # import standard library |
24 __docformat__ = 'restructuredtext' |
17 |
|
18 # import interfaces |
|
19 from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationItem |
|
20 from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY |
|
21 from pyams_sequence.interfaces import IInternalReference |
|
22 |
|
23 # import packages |
|
24 from pyams_i18n.schema import I18nTextLineField, I18nTextField |
|
25 from pyams_utils.schema import MailAddressField |
|
26 from zope.interface import Attribute |
|
27 from zope.schema import Choice, TextLine, URI, Bool |
|
28 |
25 |
29 from pyams_content import _ |
26 from pyams_content import _ |
30 |
27 |
31 |
28 |
32 class IBaseLink(IAssociationItem): |
29 class IBaseLink(IAssociationItem): |
35 title = I18nTextLineField(title=_("Alternate title"), |
32 title = I18nTextLineField(title=_("Alternate title"), |
36 description=_("Link title, as shown in front-office"), |
33 description=_("Link title, as shown in front-office"), |
37 required=False) |
34 required=False) |
38 |
35 |
39 description = I18nTextField(title=_("Description"), |
36 description = I18nTextField(title=_("Description"), |
40 description=_("Link description displayed by front-office template"), |
37 description=_( |
|
38 "Link description displayed by front-office template"), |
41 required=False) |
39 required=False) |
42 |
40 |
43 pictogram_name = Choice(title=_("Pictogram"), |
41 pictogram_name = Choice(title=_("Pictogram"), |
44 description=_("Name of the pictogram associated with this link"), |
42 description=_("Name of the pictogram associated with this link"), |
45 required=False, |
43 required=False, |
53 |
51 |
54 class IInternalLink(IBaseLink, IInternalReference): |
52 class IInternalLink(IBaseLink, IInternalReference): |
55 """Internal link interface""" |
53 """Internal link interface""" |
56 |
54 |
57 force_canonical_url = Bool(title=_("Force canonical URL?"), |
55 force_canonical_url = Bool(title=_("Force canonical URL?"), |
58 description=_("By default, internal links use a \"relative\" URL, which tries to " |
56 description=_("By default, internal links use a \"relative\" URL, " |
59 "display link target in the current context; by using a canonical URL, " |
57 "which tries to display link target in the current " |
60 "you can display target in it's attachment context (if defined)"), |
58 "context; by using a canonical URL, you can display " |
|
59 "target in it's attachment context (if defined)"), |
61 required=False, |
60 required=False, |
62 default=False) |
61 default=False) |
|
62 |
|
63 |
|
64 # |
|
65 # Custom internal link properties support |
|
66 # These interfaces are used to be able to add custom properties to an internal link |
|
67 # when it's target is of a given content type |
|
68 # |
|
69 |
|
70 class IInternalLinkCustomInfoTarget(Interface): |
|
71 """Internal link target info |
|
72 |
|
73 This optional interface can be supported be any content to be able to provide any |
|
74 additional information to link properties |
|
75 """ |
|
76 |
|
77 internal_link_marker_interface = InterfaceField(title=_("Marker interface provided by links " |
|
78 "directed to contents supporting this " |
|
79 "interface")) |
|
80 |
|
81 |
|
82 class ICustomInternalLinkTarget(Interface): |
|
83 """Base interface for custom internal link target""" |
|
84 |
|
85 |
|
86 class IInternalLinkCustomInfo(Interface): |
|
87 """Base interface for custom link properties""" |
|
88 |
|
89 properties_interface = InterfaceField(title=_("Info properties interface")) |
|
90 |
|
91 def get_url_params(self): |
|
92 """Get custom params to generate link URL""" |
63 |
93 |
64 |
94 |
65 class IExternalLink(IBaseLink): |
95 class IExternalLink(IBaseLink): |
66 """External link interface""" |
96 """External link interface""" |
67 |
97 |