Commit 59106bb1 authored by Stefan H. Holek's avatar Stefan H. Holek

Merged r9837:9838, r9840:9844, r10062:10063, and r10074:10075 from the Five trunk.

parent 9e315e28
Five Changes
============
* There is now a standard standard_macros. Five page templates can use
context/@@standard_macros/view to get the default site layout.
* The addform and editform directive now supports the widget zcml subdirective,
that previously was ignored.
* Five now supports the vocabulary zcml directive.
Five 0.3 (2005-03-11)
---------------------
......
<html metal:use-macro="here/five_template/macros/master">
<html metal:use-macro="context/@@standard_macros/page">
<body>
<div metal:fill-slot="main">
<div metal:fill-slot="body">
<div metal:define-macro="addform">
......
......@@ -143,7 +143,9 @@ class Macros:
raise KeyError, key
class StandardMacros(BrowserView, Macros):
pass
macro_pages = ('five_template',
'widget_macros',
'form_macros',)
class EditView(BrowserView):
"""Simple edit-view base class
......
......@@ -42,6 +42,7 @@ from security import getSecurityInfo, protectClass, protectName,\
initializeClass
from pagetemplatefile import ZopeTwoPageTemplateFile
import ExtensionClass
def page(_context, name, permission, for_,
layer='default', template=None, class_=None,
......@@ -444,13 +445,18 @@ def EditViewFactory(name, schema, label, permission, layer,
class_.generated_form = ZopeTwoPageTemplateFile(default_template)
# Not the prettiest solution, but it works...
class_.__init__ = EditView.__init__
s.provideView(for_, name, IBrowserRequest, class_, layer)
class EditFormDirective(BaseFormDirective):
class FiveFormDirective(BaseFormDirective):
def _processWidgets(self):
if self._widgets:
customWidgetsObject = makeClass('CustomWidgetsMixin', (ExtensionClass.Base,), self._widgets)
self.bases = self.bases + (customWidgetsObject,)
class EditFormDirective(FiveFormDirective):
view = EditView
default_template = 'edit.pt'
......@@ -494,7 +500,7 @@ def AddViewFactory(name, schema, label, permission, layer,
s.provideView(for_, name, IBrowserRequest, class_, layer)
class AddFormDirective(BaseFormDirective):
class AddFormDirective(FiveFormDirective):
view = AddView
default_template = 'add.pt'
......
......@@ -44,6 +44,14 @@
permission="zope.Public"
/>
<browser:page
for="*"
name="standard_macros"
permission="zope2.View"
class=".browser.StandardMacros"
allowed_interface="zope.interface.common.mapping.IItemMapping"
/>
<view
for="*"
factory=".browser.AbsoluteURL"
......
<tal:tag condition="view/update"/>
<html metal:use-macro="here/five_template/macros/master">
<body metal:fill-slot="main">
<div>
<html metal:use-macro="context/@@standard_macros/page">
<body metal:fill-slot="body">
<div metal:define-macro="body">
......@@ -60,8 +59,6 @@
</form>
</div>
</div>
</body>
......
<html metal:define-macro="master">
<html metal:define-macro="page">
<head>
<metal:block define-slot="css_slot">
</metal:block>
</head>
<body>
<metal:block define-slot="main">
<metal:block define-slot="body">
</metal:block>
</body>
</html>
......@@ -81,6 +81,12 @@
</meta:complexDirective>
<meta:directive
name="vocabulary"
schema="zope.app.schema.metadirectives.IVocabularyDirective"
handler="zope.app.schema.metaconfigure.vocabulary"
/>
</meta:directives>
<meta:directives namespace="http://namespaces.zope.org/browser">
......
......@@ -309,7 +309,22 @@
name="edit.html"
permission="zope2.Public"
/>
<!-- With a widget override -->
<browser:editform
schema=".interfaces.IFieldSimpleContent"
for=".interfaces.IFieldSimpleContent"
name="widgetoverride.html"
permission="zope2.Public"
>
<widget
field="description"
class="zope.app.form.browser.TextAreaWidget"
/>
</browser:editform>
<five:traversable class=".helpers.FiveTraversableFolder" />
<browser:addform
......@@ -318,6 +333,20 @@
name="addsimplecontent.html"
permission="zope2.Public"
/>
<browser:addform
schema=".interfaces.IFieldSimpleContent"
content_factory=".simplecontent.FieldSimpleContent"
name="addwidgetoverride.html"
permission="zope2.Public">
<widget
field="description"
class="zope.app.form.browser.TextAreaWidget"
/>
</browser:addform>
<!-- stuff that we'll override in overrides.zcml -->
......@@ -430,9 +459,20 @@
for="zope.app.container.interfaces.IObjectRemovedEvent"
/>
<!-- Testing the vocabulary directive -->
<vocabulary
name="aVocabulary"
factory="zope.schema.tests.test_vocabulary.SampleVocabulary"
/>
<!-- testing that products meta.zcml statements are picked up. -->
<five:parrot
class=".metaconfigure.NorwegianBlue"
name="Polly"
/>
<!-- as new style classes are ignored, zope.app.form.browser
can be imported -->
<include package="zope.app.form.browser"/>
</configure>
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
<meta:directives namespace="http://namespaces.zope.org/five">
<meta:directive
name="parrot"
schema=".metaconfigure.IParrotDirective"
handler=".metaconfigure.parrot"
/>
</meta:directives>
</configure>
##############################################################################
#
# Copyright (c) 2005 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.
#
##############################################################################
"""Parrot directive and support classes
$Id: metaconfigure.py 5287 2004-06-25 11:42:27Z philikon $
"""
from zope.interface import Interface
from zope.configuration.fields import GlobalObject
from zope.schema import TextLine
class IParrotDirective(Interface):
"""State that a class implements something.
"""
class_ = GlobalObject(
title=u"Class",
required=True
)
name = TextLine(
title=u"Name",
description=u"The parrots name.",
required=True
)
def parrot(_context, class_, name):
parrot = class_()
parrot.pineForFjords()
class NorwegianBlue(object):
def pineForFjords(self):
return "This parrot is no more!"
......@@ -3,6 +3,7 @@
<redefinePermission from="zope2.Public" to="zope.Public" />
<include file="meta.zcml" />
<include file="configure.zcml" />
<includeOverrides file="overrides.zcml" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment