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