|
1 # |
|
2 # Copyright (c) 2008-2015 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 |
|
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 from zope.interface import Interface |
|
16 from zope.schema import Choice, TextLine |
|
17 |
|
18 from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationItem |
|
19 from pyams_i18n.schema import I18nAudioField, I18nFileField, I18nTextField, I18nTextLineField, I18nThumbnailImageField, \ |
|
20 I18nVideoField |
|
21 |
|
22 from pyams_content import _ |
|
23 |
|
24 |
|
25 EXTFILE_CONTAINER_KEY = 'pyams_content.extfile' |
|
26 EXTFILE_LINKS_CONTAINER_KEY = 'pyams_content.extfile.links' |
|
27 |
|
28 |
|
29 class IBaseExtFile(IAssociationItem): |
|
30 """Base external file interface""" |
|
31 |
|
32 title = I18nTextLineField(title=_("Download link label"), |
|
33 description=_("Label of download link, as shown in front-office"), |
|
34 required=False) |
|
35 |
|
36 description = I18nTextField(title=_("Description"), |
|
37 description=_("File description displayed by front-office template"), |
|
38 required=False) |
|
39 |
|
40 author = TextLine(title=_("Author"), |
|
41 description=_("Name of document's author"), |
|
42 required=False) |
|
43 |
|
44 language = Choice(title=_("Language"), |
|
45 description=_("File's content language"), |
|
46 vocabulary="PyAMS base languages", |
|
47 required=False) |
|
48 |
|
49 filename = TextLine(title=_("Save file as..."), |
|
50 description=_("Name under which the file will be saved"), |
|
51 required=False) |
|
52 |
|
53 |
|
54 class IExtFile(IBaseExtFile): |
|
55 """Generic external file interface""" |
|
56 |
|
57 data = I18nFileField(title=_("File data"), |
|
58 description=_("File content"), |
|
59 required=True) |
|
60 |
|
61 |
|
62 class IExtMedia(IExtFile): |
|
63 """External media file interface""" |
|
64 |
|
65 |
|
66 class IExtImage(IExtMedia): |
|
67 """External image file interface""" |
|
68 |
|
69 data = I18nThumbnailImageField(title=_("Image data"), |
|
70 description=_("Image content"), |
|
71 required=True) |
|
72 |
|
73 |
|
74 class IExtVideo(IExtMedia): |
|
75 """External video file interface""" |
|
76 |
|
77 data = I18nVideoField(title=_("Video data"), |
|
78 description=_("Video content"), |
|
79 required=True) |
|
80 |
|
81 |
|
82 class IExtAudio(IExtMedia): |
|
83 """External audio file interface""" |
|
84 |
|
85 data = I18nAudioField(title=_("Audio data"), |
|
86 description=_("Audio file content"), |
|
87 required=True) |
|
88 |
|
89 |
|
90 class IExtFileContainerTarget(IAssociationContainerTarget): |
|
91 """External files container marker interface""" |
|
92 |
|
93 |
|
94 # |
|
95 # External files management |
|
96 # |
|
97 |
|
98 EXTFILE_MANAGER_INFO_KEY = 'pyams_content.extfile.manager' |
|
99 |
|
100 |
|
101 class IExtFileManagerInfo(Interface): |
|
102 """External file manager interface""" |
|
103 |
|
104 default_title_prefix = I18nTextLineField(title=_("Default title prefix"), |
|
105 description=_("If used, this prefix will be automatically added to " |
|
106 "download link's label of all files"), |
|
107 required=False) |