/usr/share/pyshared/zope/browsermenu/metadirectives.py is in python-zope.browsermenu 3.9.1-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | #############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Menu ZCML directives
$Id: metadirectives.py 103270 2009-08-27 13:56:02Z nadako $
"""
from zope.interface import Interface
from zope.configuration.fields import GlobalObject, GlobalInterface
from zope.configuration.fields import Tokens, Path, PythonIdentifier, MessageID
from zope.schema import TextLine, Id, Int, Bool
from zope.security.zcml import Permission
from zope.component.zcml import IBasicViewInformation
from zope.browsermenu.field import MenuField
class IMenuDirective(Interface):
"""Define a browser menu"""
id = TextLine(
title=u"The name of the menu.",
description=u"This is, effectively, an id.",
required=False
)
title = MessageID(
title=u"Title",
description=u"A descriptive title for documentation purposes",
required=False
)
description = MessageID(
title=u"Description",
description=u"A description title of the menu.",
required=False
)
class_ = GlobalObject(
title=u"Menu Class",
description=u"The menu class used to generate the menu.",
required=False
)
interface = GlobalInterface(
title=u"The menu's interface.",
required=False
)
class IMenuItemsDirective(Interface):
"""
Define a group of browser menu items
This directive is useful when many menu items are defined for the
same interface and menu.
"""
menu = MenuField(
title=u"Menu name",
description=u"The (name of the) menu the items are defined for",
required=True,
)
for_ = GlobalObject(
title=u"Interface",
description=u"The interface the menu items are defined for",
required=True
)
layer = GlobalInterface(
title=u"Layer",
description=u"The Layer for which the item is declared.",
required=False
)
permission = Permission(
title=u"The permission needed access the item",
description=u"""
This can usually be inferred by the system, however, doing so
may be expensive. When displaying a menu, the system tries to
traverse to the URLs given in each action to determine whether
the url is accessible to the current user. This can be
avoided if the permission is given explicitly.""",
required=False
)
class IMenuItem(Interface):
"""Common menu item configuration
"""
title = MessageID(
title=u"Title",
description=u"The text to be displayed for the menu item",
required=True
)
description = MessageID(
title=u"A longer explanation of the menu item",
description=u"""
A UI may display this with the item or display it when the
user requests more assistance.""",
required=False
)
icon = TextLine(
title=u"Icon Path",
description=u"Path to the icon resource representing this menu item.",
required=False
)
permission = Permission(
title=u"The permission needed access the item",
description=u"""
This can usually be inferred by the system, however, doing so
may be expensive. When displaying a menu, the system tries to
traverse to the URLs given in each action to determine whether
the url is accessible to the current user. This can be
avoided if the permission is given explicitly.""",
required=False
)
filter = TextLine(
title=u"A condition for displaying the menu item",
description=u"""
The condition is given as a TALES expression. The expression
has access to the variables:
context -- The object the menu is being displayed for
request -- The browser request
nothing -- None
The menu item will not be displayed if there is a filter and
the filter evaluates to a false value.""",
required=False
)
order = Int(
title=u"Order",
description=u"A relative position of the menu item in the menu.",
required=False,
default=0
)
item_class = GlobalObject(
title=u"Menu item class",
description=u"""
A class to be used as a factory for creating menu item""",
required=False
)
class IMenuItemSubdirective(IMenuItem):
"""Define a menu item within a group of menu items"""
action = TextLine(
title=u"The relative url to use if the item is selected",
description=u"""
The url is relative to the object the menu is being displayed
for.""",
required=True
)
class IMenuItemDirective(IMenuItemsDirective, IMenuItemSubdirective):
"""Define one menu item"""
class ISubMenuItemSubdirective(IMenuItem):
"""Define a menu item that represents a a sub menu.
For a sub-menu menu item, the action is optional, this the item itself
might not represent a destination, but just an entry point to the sub menu.
"""
action = TextLine(
title=u"The relative url to use if the item is selected",
description=u"""
The url is relative to the object the menu is being displayed
for.""",
required=False
)
submenu = TextLine(
title=u"Sub-Menu Id",
description=u"The menu that will be used to provide the sub-entries.",
required=True,
)
class ISubMenuItemDirective(IMenuItemsDirective, ISubMenuItemSubdirective):
"""Define one menu item"""
class IAddMenuItemDirective(IMenuItem):
"""Define an add-menu item"""
for_ = GlobalInterface(
title=u"Interface",
description=u"The interface the menu items are defined for",
required=False
)
class_ = GlobalObject(
title=u"Class",
description=u"""
A class to be used as a factory for creating new objects""",
required=False
)
factory = Id(
title=u"Factory",
description=u"A factory id for creating new objects",
required = False,
)
view = TextLine(
title=u"Custom view name",
description=u"The name of a custom add view",
required = False,
)
menu = MenuField(
title=u"Menu name",
description=u"The (name of the) menu the items are defined for",
required=False,
)
layer = GlobalInterface(
title=u"The layer the custom view is declared for",
description=u"The default layer for which the custom view is "
u"applicable. By default it is applied to all layers.",
required=False
)
|