[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/utilities -
content.py:1.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Aug 18 15:56:10 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/interfaces/utilities
In directory cvs.zope.org:/tmp/cvs-serv26491/interfaces/utilities
Modified Files:
content.py
Log Message:
Beefed up the Content Component Definition component, by supporting
flexible menu entries, which is very nice.
I consider my work on schema-driven Content Components done now and
encourage people to try it out. I think this functionality addresses an
audience that we have not dealt with much before, i.e. people that stand
somewhere between scripter and TTW developers.
=== Zope3/src/zope/app/interfaces/utilities/content.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/interfaces/utilities/content.py:1.2 Fri Aug 15 20:43:34 2003
+++ Zope3/src/zope/app/interfaces/utilities/content.py Mon Aug 18 14:55:34 2003
@@ -15,9 +15,54 @@
$Id$
"""
-from zope.interface import Interface, Attribute
-from zope.schema import TextLine
+from zope.app.interfaces.container import IAdding
from zope.app.component.interfacefield import InterfaceField
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.interfaces.publisher.browser import IBrowserMenuItem
+from zope.interface import Interface, Attribute
+from zope.schema import TextLine, Bool
+
+
+class IContentComponentMenuItem(IBrowserMenuItem):
+ """This is a schema that specifies the information needed to create a menu
+ item for the Content Component.
+
+ This reflects mainly the IBrowserMenuItem interface, except that the
+ interface's default is set to IAdding, which should be the usual case. I
+ also had to add a menuId field that specifies the menu (obviously).
+
+ If the 'create' attribute is set to True, then the necessary components
+ will be created locally.
+ """
+
+ interface = InterfaceField(
+ title=_("Interface"),
+ description=_("Specifies the interface this menu item is for."),
+ default=IAdding,
+ required=True)
+
+ menuId = TextLine(
+ title=_("Menu Id"),
+ description=_("Specifies the menu this menu item will be added to."),
+ default=u"add_content",
+ required=True)
+
+ create = Bool(
+ title=_("Create Menu"),
+ description=_("If set to True, the system will create a local Browser "
+ "Menu Service and local Browser Menu for you. If this "
+ "option is set to False, the system will try to find "
+ "the next local browser menu service that has a menu "
+ "with the specifed id. If no menu was found or the menu "
+ "is a global menu, then an error is created."),
+ default=True,
+ required=True)
+
+ def createMenuItem():
+ """Create a menu item from the information in this object."""
+
+ def removeMenuItem():
+ """Remove the specified menu item."""
class IContentComponentDefinition(Interface):
@@ -25,13 +70,26 @@
content components including their security declarations."""
name = TextLine(
- title=u"Name of Content Component Type",
- description=u"""This is the name of the document type.""",
+ title=_("Name of Content Component Type"),
+ description=_("This is the name of the document type."),
required=True)
schema = InterfaceField(
- title=u"Schema",
- description=u"Specifies the schema that characterizes the document.",
+ title=_("Schema"),
+ description=_("Specifies the schema that characterizes the document."),
+ required=True)
+
+ copySchema = Bool(
+ title=_("Copy Schema"),
+ description=_("If this field is set to True, a copied version of the "
+ "schema will be used in the Content Component "
+ "instance. This has the advantage that an existing "
+ "Content Component's schema is set in stone and can "
+ "never change, even when a mutable schema evolves. If "
+ "the value is False, then the Content Component's "
+ "can change (which is desirable in some cases - i.e. "
+ "during development.)"),
+ default=True,
required=True)
permissions = Attribute(
@@ -43,11 +101,11 @@
"""Interface describing a Content Component Instance"""
__name__ = TextLine(
- title=u"Name of Content Component Type",
- description=u"""This is the name of the document type.""",
+ title=_("Name of Content Component Type"),
+ description=_("This is the name of the document type."),
required=True)
__schema__ = InterfaceField(
- title=u"Schema",
- description=u"Specifies the schema that characterizes the document.",
+ title=_("Schema"),
+ description=_("Specifies the schema that characterizes the document."),
required=True)
More information about the Zope3-Checkins
mailing list