|
1 # |
|
2 # Copyright (c) 2008-2016 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 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 |
|
20 # import packages |
|
21 from zope.interface import Interface |
|
22 from zope.schema import TextLine, Bool, Choice |
|
23 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
|
24 |
|
25 from pyams_skin import _ |
|
26 |
|
27 |
|
28 ACTIVATED_ON_FRONT = 0 |
|
29 ACTIVATED_ON_BACK = 1 |
|
30 ACTIVATED_ON_BOTH = 2 |
|
31 |
|
32 ACTIVATION_MODES_LABELS = {ACTIVATED_ON_FRONT: _("Front-office only"), |
|
33 ACTIVATED_ON_BACK: _("Back-office only"), |
|
34 ACTIVATED_ON_BOTH: _("Front-office and back-office")} |
|
35 |
|
36 ACTIVATION_MODES = SimpleVocabulary([SimpleTerm(k, title=v) for k, v in ACTIVATION_MODES_LABELS.items()]) |
|
37 |
|
38 |
|
39 GOOGLE_ANALYTICS_INFO_KEY = 'pyams_skin.analytics_info' |
|
40 |
|
41 |
|
42 class IGoogleAnalyticsInfo(Interface): |
|
43 """Google Analytics account info""" |
|
44 |
|
45 enabled = Bool(title=_("Activate Google Analytics?"), |
|
46 description=_("Are Google Analytics statistics activated?"), |
|
47 required=True, |
|
48 default=False) |
|
49 |
|
50 website_id = TextLine(title=_("Web site ID"), |
|
51 description=_("Google Analytics web site ID"), |
|
52 required=False) |
|
53 |
|
54 verification_code = TextLine(title=_("Web site verification code"), |
|
55 description=_("Google site verification code"), |
|
56 required=False) |
|
57 |
|
58 activation_mode = Choice(title=_("Activation mode"), |
|
59 description=_("Mode(s) in which statistics are activated"), |
|
60 vocabulary=ACTIVATION_MODES, |
|
61 default=ACTIVATED_ON_BOTH, |
|
62 required=True) |
|
63 |
|
64 |
|
65 USER_REPORT_INFO_KEY = 'pyams_skin.user_report_info' |
|
66 |
|
67 |
|
68 class IUserReportInfo(Interface): |
|
69 """UserReport account info""" |
|
70 |
|
71 enabled = Bool(title=_("Activate UserReport?"), |
|
72 description=_("Are UserReport comments and feedback activated?"), |
|
73 required=True, |
|
74 default=False) |
|
75 |
|
76 account_id = TextLine(title=_("Account ID"), |
|
77 description=_("UserReport account ID, available in 'initSite' code snippet"), |
|
78 required=False) |
|
79 |
|
80 activation_mode = Choice(title=_("Activation mode"), |
|
81 description=_("Mode(s) in which reports are activated"), |
|
82 vocabulary=ACTIVATION_MODES, |
|
83 default=ACTIVATED_ON_BOTH, |
|
84 required=True) |