[Checkins] SVN: z3ext.layoutform/trunk/
Nikolay Kim
fafhrd at datacom.kz
Sun Dec 21 18:08:09 EST 2008
Log message for revision 94232:
Changed:
U z3ext.layoutform/trunk/CHANGES.txt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/buttons.py
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formdisp.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt
U z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.py
U z3ext.layoutform/trunk/src/z3ext/layoutform/configure.zcml
U z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
U z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py
-=-
Modified: z3ext.layoutform/trunk/CHANGES.txt
===================================================================
--- z3ext.layoutform/trunk/CHANGES.txt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/CHANGES.txt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -5,7 +5,7 @@
1.3.0 (Unreleased)
------------------
-- Added subforms concept based on new z3ext.layout pagelet manager api
+- Added subforms based on new z3ext.layout pagelet api
- Fixed 'formError' status message
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/buttons.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/buttons.py 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/buttons.py 2008-12-21 23:08:09 UTC (rev 94232)
@@ -21,7 +21,7 @@
from z3c.form import interfaces, widget, action, button
from z3ext.layoutform.interfaces import \
- IAddButton, ISaveButton, ICancelButton, ILayoutFormLayer
+ IAddAction, ISaveAction, ICancelAction, ILayoutFormLayer
class ButtonAction(button.ButtonAction):
@@ -33,20 +33,20 @@
class AddButtonAction(button.ButtonAction):
interface.implements(interfaces.IButtonAction)
- component.adapts(ILayoutFormLayer, IAddButton)
+ component.adapts(ILayoutFormLayer, IAddAction)
klass="z-form-addbutton"
class SaveButtonAction(button.ButtonAction):
interface.implements(interfaces.IButtonAction)
- component.adapts(ILayoutFormLayer, ISaveButton)
+ component.adapts(ILayoutFormLayer, ISaveAction)
klass="z-form-savebutton"
class CancelButtonAction(button.ButtonAction):
interface.implements(interfaces.IButtonAction)
- component.adapts(ILayoutFormLayer, ICancelButton)
+ component.adapts(ILayoutFormLayer, ICancelAction)
klass="z-form-cancelbutton"
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/configure.zcml 2008-12-21 23:08:09 UTC (rev 94232)
@@ -43,36 +43,31 @@
template="formadd.pt"
for="..interfaces.IPageletAddForm"
layer="..interfaces.ILayoutFormLayer"
- provides="..interfaces.IPageletFormView"
- permission="zope.Public" />
+ name="form" />
<z3ext:pagelet
template="formedit.pt"
for="..interfaces.IPageletEditForm"
layer="..interfaces.ILayoutFormLayer"
- provides="..interfaces.IPageletFormView"
- permission="zope.Public" />
+ type="form" />
<z3ext:pagelet
template="formdisp.pt"
for="..interfaces.IPageletDisplayForm"
layer="..interfaces.ILayoutFormLayer"
- provides="..interfaces.IPageletFormView"
- permission="zope.Public" />
+ type="form" />
<z3ext:pagelet
template="subform.pt"
for="z3c.form.interfaces.ISubForm"
layer="..interfaces.ILayoutFormLayer"
- provides="..interfaces.IPageletFormView"
- permission="zope.Public" />
+ type="form" />
<z3ext:pagelet
template="formgroup.pt"
for="z3c.form.group.Group"
layer="..interfaces.ILayoutFormLayer"
- provides="..interfaces.IPageletFormView"
- permission="zope.Public" />
+ type="form" />
<!-- Error View -->
<z3ext:pagelet
@@ -82,79 +77,72 @@
permission="zope.Public" />
<!-- form view -->
- <interface
- name="layoutform.form"
- type="z3ext.layout.interfaces.IPageletType"
+ <z3ext:pageletType
+ name="form.view"
interface="z3ext.layoutform.browser.interfaces.IForm" />
<z3ext:pagelet
for="..interfaces.IPageletForm"
template="formview.pt"
- provides="z3ext.layoutform.browser.interfaces.IForm"
layer="..interfaces.ILayoutFormLayer"
- permission="zope.Public" />
+ type="form.view" />
<!-- viewspace view -->
- <interface
- name="layoutform.viewspace"
- type="z3ext.layout.interfaces.IPageletType"
+ <z3ext:pageletType
+ name="form.viewspace"
interface="z3ext.layoutform.browser.interfaces.IViewspace" />
- <interface
- name="layoutform.viewspaceInfo"
- type="z3ext.layout.interfaces.IPageletType"
+ <z3ext:pageletType
+ name="form.viewspaceInfo"
interface="z3ext.layoutform.browser.interfaces.IExtraViewspaceInfo" />
<z3ext:pagelet
for="..interfaces.IPageletForm"
template="formviewspace.pt"
- provides="z3ext.layoutform.browser.interfaces.IViewspace"
layer="..interfaces.ILayoutFormLayer"
- permission="zope.Public" />
+ type="form.viewspace" />
<!-- form buttons -->
- <interface
- name="layoutform.buttons"
- type="z3ext.layout.interfaces.IPageletType"
+ <z3ext:pageletType
+ name="form.buttons"
interface="z3ext.layoutform.browser.interfaces.IFormButtons" />
<z3ext:pagelet
for="..interfaces.IPageletForm"
template="formbuttons.pt"
- provides="z3ext.layoutform.browser.interfaces.IFormButtons"
layer="..interfaces.ILayoutFormLayer"
- permission="zope.Public" />
+ type="form.buttons" />
<!-- widget view -->
- <interface
- name="layoutform.widget"
- type="z3ext.layout.interfaces.IPageletManagerType"
+ <z3ext:pageletType
+ name="form.widget"
interface="z3ext.layoutform.browser.interfaces.IWidget" />
<z3ext:pagelet
- for="z3c.form.interfaces.IWidget"
- manager="zope.schema.interfaces.IField z3c.form.interfaces.IForm"
- provides="z3ext.layoutform.browser.interfaces.IWidget"
+ for="z3c.form.interfaces.IWidget
+ zope.schema.interfaces.IField
+ z3c.form.interfaces.IForm"
template="widget.pt"
- permission="zope.Public" />
+ type="form.widget" />
- <adapter factory=".widget.getWidgetManager" />
+ <adapter
+ name="form.widget"
+ factory=".widget.getWidgetManager" />
<!-- display widget view -->
<z3ext:pagelet
- for="z3c.form.interfaces.IWidget"
- manager="zope.schema.interfaces.IField z3c.form.interfaces.IDisplayForm"
- provides="z3ext.layoutform.browser.interfaces.IWidget"
+ for="z3c.form.interfaces.IWidget
+ zope.schema.interfaces.IField
+ z3c.form.interfaces.IDisplayForm"
template="widgetDisplay.pt"
- permission="zope.Public" />
+ type="form.widget" />
<!-- add form buttons -->
<z3ext:pagelet
for="..interfaces.IPageletAddForm"
template="formaddbuttons.pt"
- provides="z3ext.layoutform.browser.interfaces.IFormButtons"
layer="..interfaces.ILayoutFormLayer"
- permission="zope.Public" />
+ type="form.buttons" />
<!-- styles -->
<z3ext:resourceinclude
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/form.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -1,6 +1,9 @@
<div class="z-form z-form-standard"
- tal:content="structure context/@@pagelet/layoutform.form">
+ tal:content="structure pagelet:form.view">
</div>
<tal:block tal:repeat="context context/forms"
tal:content="structure pagelet:form" />
+
+<tal:block tal:repeat="context context/views"
+ tal:content="structure context/render" />
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formadd.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -1,3 +1,9 @@
<div class="z-form z-form-add"
- tal:content="structure context/@@pagelet/layoutform.form">
+ tal:content="structure pagelet:form.view">
</div>
+
+<tal:block tal:repeat="context context/forms"
+ tal:content="structure pagelet:form" />
+
+<tal:block tal:repeat="context context/views"
+ tal:content="structure context/render" />
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formdisp.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formdisp.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formdisp.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -1,3 +1,3 @@
<div class="z-form-display"
- tal:content="structure context/@@pagelet/layoutform.form">
+ tal:content="structure pagelet:form.view">
</div>
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formedit.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -1,3 +1,9 @@
<div class="z-form z-form-edit"
- tal:content="structure context/@@pagelet/layoutform.form">
+ tal:content="structure pagelet:form.view">
</div>
+
+<tal:block tal:repeat="context context/forms"
+ tal:content="structure pagelet:form" />
+
+<tal:block tal:repeat="context context/views"
+ tal:content="structure context/render" />
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formgroup.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -7,6 +7,6 @@
<div class="z-form-fieldset">
<tal:block tal:repeat="context context/widgets/values"
- tal:content="structure pagelet:layoutform.widget" />
+ tal:content="structure pagelet:form.widget" />
</div>
</div>
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formview.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -6,6 +6,6 @@
action context/action;
name context/name;
id context/id">
- <tal:block tal:content="structure context/@@pagelet/layoutform.viewspace" />
- <tal:block tal:content="structure context/@@pagelet/layoutform.buttons" />
+ <tal:block tal:content="structure pagelet:form.viewspace" />
+ <tal:block tal:content="structure pagelet:form.buttons" />
</form>
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/formviewspace.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -3,17 +3,17 @@
<div class="z-form-description"
tal:condition="context/description" tal:content="context/description"></div>
-<tal:block tal:content="structure pagelet:layoutform.viewspaceInfo" />
+<tal:block tal:content="structure pagelet:form.viewspaceInfo" />
<div class="z-form-fieldset" tal:condition="context/widgets">
<tal:block tal:repeat="context context/widgets/values"
- tal:content="structure pagelet:layoutform.widget" />
+ tal:content="structure pagelet:form.widget" />
</div>
<tal:block tal:condition="context/groups|nothing"
- tal:repeat="form context/groups"
- tal:content="structure form/@@pagelet/form" />
+ tal:repeat="context context/groups"
+ tal:content="structure pagelet:form" />
<tal:block tal:condition="context/subforms|nothing"
- tal:repeat="form context/subforms"
- tal:content="structure form/@@pagelet/form" />
+ tal:repeat="context context/subforms"
+ tal:content="structure pagelet:form" />
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/subform.pt 2008-12-21 23:08:09 UTC (rev 94232)
@@ -6,6 +6,6 @@
<div class="z-form-fieldset">
<tal:block tal:repeat="context context/widgets/values"
- tal:content="structure pagelet:layoutform.widget" />
+ tal:content="structure pagelet:form.widget" />
</div>
</div>
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.py 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/browser/widget.py 2008-12-21 23:08:09 UTC (rev 94232)
@@ -17,10 +17,10 @@
"""
from zope import interface, component
from z3c.form.interfaces import IWidget
-from z3ext.layout.interfaces import IPageletManager
+from z3ext.layout.interfaces import IPageletContext
@component.adapter(IWidget)
- at interface.implementer(IPageletManager)
+ at interface.implementer(IPageletContext)
def getWidgetManager(widget):
return widget.field, widget.form
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/configure.zcml
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/configure.zcml 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/configure.zcml 2008-12-21 23:08:09 UTC (rev 94232)
@@ -1,21 +1,24 @@
<configure
xmlns="http://namespaces.zope.org/zope"
- xmlns:z3c="http://namespaces.zope.org/z3c"
- xmlns:i18n="http://namespaces.zope.org/i18n">
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:z3ext="http://namespaces.zope.org/z3ext">
- <includeDependencies package="z3ext.layoutform" />
+ <includeDependencies package="." />
<!-- form error status message -->
<adapter
name="formError"
factory=".error.FormErrorStatusMessage" />
- <!-- form -->
- <interface
+ <!-- pagelet types -->
+ <z3ext:pageletType
name="form"
- type="z3ext.layout.interfaces.IPageletType"
interface="z3ext.layoutform.interfaces.IPageletFormView" />
+ <z3ext:pageletType
+ name="form.subform"
+ interface="z3ext.layoutform.interfaces.IPageletSubform" />
+
<!-- browser views -->
<include package=".browser" />
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/form.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/form.py 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/form.py 2008-12-21 23:08:09 UTC (rev 94232)
@@ -35,19 +35,17 @@
__call__ = BrowserPagelet.__call__
def render(self):
- # render content template
- if self.template is None:
+ if self.template is not None:
+ return self.template()
+ else:
view = queryMultiAdapter((self, self.request), IPageletFormView)
if view is not None:
view.update()
return view.render()
- template = getMultiAdapter((self, self.request), IPageTemplate)
- return template(self)
+ raise LookupError("Can't find IPageletFormView view for this form.")
- return self.template()
-
class PageletForm(form.Form, PageletBaseForm):
interface.implements(IPageletForm)
@@ -57,6 +55,7 @@
forms = ()
groups = ()
subforms = ()
+ views = ()
render = PageletBaseForm.render
__call__ = PageletBaseForm.__call__
@@ -90,12 +89,13 @@
def _loadSubforms(self):
return [form for name, form in
- getAdapters((self.context, self.request, self), IPageletSubform)]
+ getAdapters((self.context, self, self.request), IPageletSubform)]
def updateForms(self):
forms = []
groups = []
subforms = []
+ views = []
for form in self._loadSubforms():
form.update()
if not form.isAvailable():
@@ -105,8 +105,10 @@
groups.append((form.weight, form.__name__, form))
elif ISubForm.providedBy(form):
subforms.append((form.weight, form.__name__, form))
+ elif IPageletForm.providedBy(form):
+ forms.append((form.weight, form.__name__, form))
else:
- forms.append((form.weight, form.__name__, form))
+ views.append((form.weight, form.__name__, form))
groups.sort()
self.groups = [form for weight, name, form in groups]
@@ -117,6 +119,9 @@
forms.sort()
self.forms = [form for weight, name, form in forms]
+ views.sort()
+ self.views = [view for weight, name, view in views]
+
def update(self):
self.updateWidgets()
self.updateActions()
@@ -137,8 +142,8 @@
self.actions.execute()
-class PageletDisplayForm(PageletForm, form.DisplayForm):
+class PageletDisplayForm(PageletBaseForm, form.DisplayForm):
interface.implements(IPageletDisplayForm)
- render = PageletForm.render
- __call__ = PageletForm.__call__
+ render = PageletBaseForm.render
+ __call__ = PageletBaseForm.__call__
Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py 2008-12-21 23:05:17 UTC (rev 94231)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py 2008-12-21 23:08:09 UTC (rev 94232)
@@ -38,6 +38,9 @@
render = PageletBaseForm.render
__call__ = PageletBaseForm.__call__
+ def __init__(self, context, parentForm, request):
+ super(PageletEditSubForm, self).__init__(context, request, parentForm)
+
@button.handler(ISaveAction)
def handleApply(self, action):
data, errors = self.extractData()
More information about the Checkins
mailing list