1 | # -*- coding: utf-8 -*- |
---|
2 | from zope import schema |
---|
3 | from zope.interface import Interface |
---|
4 | |
---|
5 | from plone.theme.interfaces import IDefaultPloneLayer |
---|
6 | from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
---|
7 | |
---|
8 | from quintagroup.dropdownmenu import _ |
---|
9 | |
---|
10 | cachings = SimpleVocabulary( |
---|
11 | [SimpleTerm(value=u'anonymous', title=_(u'Cache only for anonymous')), |
---|
12 | SimpleTerm(value=u'all', title=_(u'Cache for all users')), ] |
---|
13 | ) |
---|
14 | |
---|
15 | |
---|
16 | class IDropDownMenuLayer(IDefaultPloneLayer): |
---|
17 | """Request marker installed via browserlayer.xml. |
---|
18 | """ |
---|
19 | |
---|
20 | |
---|
21 | class IDropDownMenuSettings(Interface): |
---|
22 | """Global dropdown menu settings. This describes records stored in the |
---|
23 | configuration registry and obtainable via plone.registry. |
---|
24 | """ |
---|
25 | |
---|
26 | show_icons = schema.Bool( |
---|
27 | title=_(u"Show tabs icons"), |
---|
28 | description=_(u"Use this setting to switch on/off icons for menu " |
---|
29 | u"items."), |
---|
30 | default=False) |
---|
31 | |
---|
32 | show_content_tabs = schema.Bool( |
---|
33 | title=_(u"Show navigation strategy based dropdown menu"), |
---|
34 | description=_(u"Use this setting to switch on/off navigation " |
---|
35 | u"strategy built dropdown menu"), |
---|
36 | default=True) |
---|
37 | |
---|
38 | show_nonfolderish_tabs = schema.Bool( |
---|
39 | title=_(u"Show non-folderish menu items"), |
---|
40 | description=_(u"Use this setting to switch on/off non-folderish " |
---|
41 | u"objects in navigation strategy based dropdown menu"), |
---|
42 | default=True) |
---|
43 | |
---|
44 | content_before_actions_tabs = schema.Bool( |
---|
45 | title=_(u"Show content tabs before portal_actions tabs"), |
---|
46 | description=_(u""), |
---|
47 | default=False) |
---|
48 | |
---|
49 | content_tabs_level = schema.Int( |
---|
50 | title=_(u"Navigation strategy dropdown menu depth"), |
---|
51 | description=_(u"How many levels folders to list after the " |
---|
52 | u"top level."), |
---|
53 | default=0) |
---|
54 | |
---|
55 | show_actions_tabs = schema.Bool( |
---|
56 | title=_(u"Show actions tabs"), |
---|
57 | description=_(u"Use this setting to enable/disable portal_actions " |
---|
58 | u"based dropdown menu"), |
---|
59 | default=True) |
---|
60 | |
---|
61 | actions_tabs_level = schema.Int( |
---|
62 | title=_(u"Actions dropdown menu depth"), |
---|
63 | description=_(u"How many levels of portal_actions to list after the " |
---|
64 | u"top level."), |
---|
65 | default=0) |
---|
66 | |
---|
67 | actions_category = schema.TextLine( |
---|
68 | title=_(u"Root portal actions category"), |
---|
69 | description=_(u"Root category id of portal_actions based dropdown " |
---|
70 | u"menu tree"), |
---|
71 | default=u"portal_tabs") |
---|
72 | |
---|
73 | nested_category_prefix = schema.TextLine( |
---|
74 | title=_(u"Nested category prefix"), |
---|
75 | description=_(u"Prefix of category id, used to bind category " |
---|
76 | u"with action"), |
---|
77 | default=u"", |
---|
78 | required=False) |
---|
79 | |
---|
80 | nested_category_sufix = schema.TextLine( |
---|
81 | title=_(u"Nested category sufix"), |
---|
82 | description=_(u"Sufix of category id, used to bind category " |
---|
83 | u"with action"), |
---|
84 | default=u"_sub", |
---|
85 | required=False) |
---|
86 | |
---|
87 | enable_caching = schema.Bool( |
---|
88 | title=_(u"Enable menu caching"), |
---|
89 | description=_(u"Caching of the menu viewlet improves page rendering " |
---|
90 | u"speed."), |
---|
91 | default=True |
---|
92 | ) |
---|
93 | |
---|
94 | caching_strategy = schema.Choice( |
---|
95 | title=_(u"Select caching strategy"), |
---|
96 | description=_(u"Caching strategy defines how the cache key will be built." |
---|
97 | ), |
---|
98 | default="anonymous", |
---|
99 | vocabulary=cachings |
---|
100 | ) |
---|