|
1 # |
|
2 # Copyright (c) 2008-2014 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 # import standard packages |
|
16 |
|
17 # import Zope3 interfaces |
|
18 |
|
19 # import local interfaces |
|
20 |
|
21 # import Zope3 packages |
|
22 from zope.interface import Interface, Attribute |
|
23 from zope.schema import TextLine, Password |
|
24 |
|
25 # import local packages |
|
26 |
|
27 from ztfy.baseskin import _ |
|
28 |
|
29 |
|
30 # |
|
31 # Skinning interfaces |
|
32 # |
|
33 |
|
34 class ISkinnable(Interface): |
|
35 """Base skinnable content interface |
|
36 |
|
37 This interface is used for any object managing a skin. |
|
38 An adapter is used during traversal t automatically |
|
39 apply selected skin. |
|
40 """ |
|
41 |
|
42 def getSkin(self): |
|
43 """Get skin name matching current context""" |
|
44 |
|
45 |
|
46 # |
|
47 # Default view interfaces |
|
48 # |
|
49 |
|
50 class IDefaultView(Interface): |
|
51 """Interface used to get object's default view""" |
|
52 |
|
53 viewname = TextLine(title=_("View name"), |
|
54 description=_("Name of the default view matching object, request and (optionally) current view"), |
|
55 required=True, |
|
56 default=u'@@index.html') |
|
57 |
|
58 def getAbsoluteURL(self): |
|
59 """Get full absolute URL of the default view""" |
|
60 |
|
61 |
|
62 class IContainedDefaultView(IDefaultView): |
|
63 """Interface used to get object's default view while displayed inside a container""" |
|
64 |
|
65 |
|
66 # |
|
67 # Dialogs interfaces |
|
68 # |
|
69 |
|
70 class IDialog(Interface): |
|
71 """Base interface for AJAX dialogs""" |
|
72 |
|
73 dialog_class = Attribute(_("Default dialog CSS class")) |
|
74 |
|
75 resources = Attribute(_("List of resources needed by this dialog")) |
|
76 |
|
77 |
|
78 class IDialogTitle(Interface): |
|
79 """Dialog title getter interface""" |
|
80 |
|
81 def getTitle(self): |
|
82 """Get dialog title""" |
|
83 |
|
84 |
|
85 # |
|
86 # Base front-office views |
|
87 # |
|
88 |
|
89 class IBaseViewlet(Interface): |
|
90 """Marker interface for base viewlets""" |
|
91 |
|
92 |
|
93 class IBaseIndexView(Interface): |
|
94 """Marker interface for base index view""" |
|
95 |
|
96 |
|
97 # |
|
98 # Presentation management interfaces |
|
99 # |
|
100 |
|
101 class IBasePresentationInfo(Interface): |
|
102 """Base interface for presentation infos""" |
|
103 |
|
104 |
|
105 class IPresentationForm(Interface): |
|
106 """Marker interface for default presentation edit form""" |
|
107 |
|
108 |
|
109 class IPresentationTarget(Interface): |
|
110 """Interface used inside skin-related edit forms""" |
|
111 |
|
112 target_interface = Attribute(_("Presentation form target interface")) |
|
113 |
|
114 |
|
115 # |
|
116 # Login form attributes |
|
117 # |
|
118 |
|
119 class ILoginFormFields(Interface): |
|
120 """Login form fields interface""" |
|
121 |
|
122 username = TextLine(title=_("login-field", "Login"), |
|
123 required=True) |
|
124 |
|
125 password = Password(title=_("password-field", "Password"), |
|
126 required=True) |
|
127 |
|
128 came_from = TextLine(title=_("came-from", "Original address"), |
|
129 required=False) |