[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/Browser - ComponentConfigEdit.pt:1.2 ComponentConfigItemEdit.pt:1.2 ComponentConfigSummary.pt:1.2 ComponentConfigURL.py:1.2 NameConfigurable.pt:1.2 NameConfigurableView.py:1.2 ChangeConfigurations.pt:1.3 configure.zcml:1.4
Marius Gedminas
mgedmin@codeworks.lt
Thu, 12 Dec 2002 06:33:02 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/Browser
In directory cvs.zope.org:/tmp/cvs-serv21266/lib/python/Zope/App/OFS/Services/Browser
Modified Files:
ChangeConfigurations.pt configure.zcml
Added Files:
ComponentConfigEdit.pt ComponentConfigItemEdit.pt
ComponentConfigSummary.pt ComponentConfigURL.py
NameConfigurable.pt NameConfigurableView.py
Log Message:
Merge named-component-configuration-branch
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigEdit.pt 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigEdit.pt Thu Dec 12 06:32:31 2002
@@ -0,0 +1,30 @@
+<html metal:use-macro="views/standard_macros/page">
+ <body>
+ <div metal:fill-slot="body">
+
+ <div metal:use-macro="view/generated_form/macros/body">
+
+ <h3 metal:fill-slot="heading">
+ <span tal:replace="context/label">Service</span>
+ Configuration
+ </h3>
+
+ <table metal:fill-slot="extra_info">
+ <tr>
+ <td tal:content="context/label">Service type</td>
+ <td tal:content="context/name">Foo</td>
+ </tr>
+ <tr>
+ <td>Component Path</td>
+ <td>
+ <a href='.'
+ tal:attributes="href view/componentURL"
+ tal:content="view/componentPath">foo/bar</a>
+ </td>
+ </tr>
+ </table>
+
+ </div>
+ </div>
+ </body>
+</html>
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigItemEdit.pt 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigItemEdit.pt Thu Dec 12 06:32:31 2002
@@ -0,0 +1,23 @@
+<div metal:use-macro="view/generated_form/macros/formbody">
+
+ <h5 metal:fill-slot="heading">
+ <a href="configure/42"
+ tal:attributes="href views/absolute_url">
+ <span tal:replace="context/name">Foo</span>
+ <span tal:replace="context/label">Service</span>
+ </a>
+ </h5>
+
+ <table>
+ <tr metal:fill-slot="extra_top">
+ <td>Component Path</td>
+ <td>
+ <a href="."
+ tal:content="view/componentPath"
+ tal:attributes="href view/componentURL"
+ >Foo</a>
+ </td>
+ </tr>
+ </table>
+
+</div>
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigSummary.pt 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigSummary.pt Thu Dec 12 06:32:31 2002
@@ -0,0 +1,4 @@
+<span tal:replace="context/title" />
+<a href='.'
+ tal:attributes="href view/componentURL"
+ tal:content="view/componentPath">foo/bar</a>
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigURL.py 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/ComponentConfigURL.py Thu Dec 12 06:32:31 2002
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+from Zope.ComponentArchitecture import getView
+from Zope.App.Traversing import traverse, locationAsUnicode
+from Zope.Proxy.ProxyIntrospection import removeAllProxies
+
+__metaclass__ = type
+
+class ComponentConfigURL:
+ """View mixin that provides an absolute componentURL for
+ Component configurations
+ """
+
+ def componentPath(self):
+ return locationAsUnicode(self.context.componentPath)
+
+ def componentURL(self):
+ ob = traverse(self.context, self.context.componentPath)
+ return str(getView(ob, 'absolute_url', self.request))
+
+
+__doc__ = ComponentConfigURL.__doc__ + __doc__
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurable.pt 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurable.pt Thu Dec 12 06:32:31 2002
@@ -0,0 +1,64 @@
+<html metal:use-macro="views/standard_macros/page">
+<body metal:fill-slot="body">
+<div metal:define-macro="body">
+<div tal:define="registries view/update">
+
+ <h2 metal:define-slot="heading">Fruits configured in this fruits manager.</h2>
+
+ <div tal:condition="not:registries">
+ <p metal:define-slot="empty_text">No fruits have been configured</p>
+ </div>
+
+ <div tal:condition="registries">
+
+ <div metal:define-slot="extra_top">
+
+ <p>For each fruit, the fruit name is given and all of the components
+ registered to provide the fruit are shown. You may select the
+ component to provide the fruit or disable the fruit.
+ </p>
+
+ <p>Select a fruit name or a component name to visit the fruit or
+ component.
+ </p>
+
+ </div>
+
+ <form action="." method="post" tal:attributes="action request/URL">
+
+ <table width="100%">
+
+ <tr tal:repeat="registry registries">
+ <td valign="top" align="right">
+ <a href="#"
+ tal:content="registry/name"
+ tal:attributes="href registry/url"
+ tal:condition="registry/active"
+ >Orange</a>
+ <span tal:replace="registry/name"
+ tal:condition="registry/inactive" />
+ </td>
+ <td tal:content="structure registry/view">
+ </td>
+ </tr>
+
+ </table>
+
+ <input type=submit name="submit_update" value="Update"><br>
+
+ </form>
+
+ <div metal:define-slot="extra_bottom" />
+
+ </div>
+
+ <p metal:define-slot="help_text">To configure a fruit, add a fruit component
+ to a <em>package</em> in <a href="Packages">Packages</a> or to the <a
+ href="Packages/default">default package</a>. After the fruit is added, add
+ a fruit configuration that configures the component to provide a fruit.
+ </p>
+
+</div>
+</div>
+</body>
+</html>
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurableView.py 1.1 => 1.2 ===
--- /dev/null Thu Dec 12 06:33:01 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurableView.py Thu Dec 12 06:32:31 2002
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""Generic INameConfigurable view mixin
+
+$Id$
+"""
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.ComponentArchitecture import getView
+from Zope.App.Traversing import traverse
+from Zope.App.PageTemplate.ViewPageTemplateFile import ViewPageTemplateFile
+
+
+class NameConfigurableView(BrowserView):
+
+ indexMacros = index = ViewPageTemplateFile('NameConfigurable.pt')
+
+ def update(self):
+
+ names = list(self.context.listConfigurationNames())
+ names.sort()
+
+ items = []
+ for name in names:
+ registry = self.context.queryConfigurations(name)
+ view = getView(registry, "ChangeConfigurations", self.request)
+ view.setPrefix(name)
+ view.update()
+ cfg = registry.active()
+ active = cfg is not None
+ if active:
+ ob = traverse(cfg, cfg.componentPath)
+ url = str(getView(ob, 'absolute_url', self.request))
+ else:
+ url = None
+ items.append(
+ {"name": name,
+ "active": active,
+ "inactive": not active,
+ "view": view,
+ "url": url
+ })
+
+ return items
+
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/ChangeConfigurations.pt 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/ChangeConfigurations.pt:1.2 Sat Nov 30 13:35:55 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/ChangeConfigurations.pt Thu Dec 12 06:32:31 2002
@@ -1,18 +1,18 @@
<table width="100%">
<tr tal:define="message view/message" tal:condition="message">
<td></td>
- <td colspan="2"><em tal:content="message">xxxx</em></td>
+ <td colspan="2"><em tal:content="message">xxxx</em></td>
</tr>
- <tr tal:repeat="configuration view/configurations">
+ <tr tal:repeat="configuration view/configurations">
<td><input type="radio" name="Roles" value="0"
tal:attributes="
name view/name;
value configuration/id;
checked configuration/active;
- "
+ "
/>
</td>
- <td><a href="."
+ <td><a href="."
tal:attributes="href string:${view/configBase}/${configuration/id}"
tal:content="configuration/id"
>foo/bar</a></td>
=== Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml:1.3 Mon Dec 9 11:09:19 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml Thu Dec 12 06:32:31 2002
@@ -1,24 +1,84 @@
<zope:zopeConfigure
xmlns:zope='http://namespaces.zope.org/zope'
xmlns="http://namespaces.zope.org/browser"
+ xmlns:form="http://namespaces.zope.org/form"
package="Zope.App.OFS.Services"
>
-<view
- for=".ConfigurationInterfaces.IConfigurationStatus"
- name="edit"
- factory=".Browser.ConfigurationStatusWidget."
- allowed_interface="Zope.App.Forms.Views.Browser.IBrowserWidget."
- permission="Zope.ManageServices"
- />
-
-<view
- for=".ConfigurationInterfaces.IConfigurationRegistry"
- name="ChangeConfigurations"
- template="Browser/ChangeConfigurations.pt"
- class=".Browser.ChangeConfigurations."
- allowed_interface="Zope.App.Forms.Browser.IFormCollaborationView."
- permission="Zope.ManageServices"
- />
+<!-- IConfigurationStatus -->
+
+ <view
+ for=".ConfigurationInterfaces.IConfigurationStatus"
+ name="edit"
+ factory=".Browser.ConfigurationStatusWidget."
+ allowed_interface="Zope.App.Forms.Views.Browser.IBrowserWidget."
+ permission="Zope.ManageServices"
+ />
+
+<!-- IConfigurationRegistry -->
+
+ <view
+ for=".ConfigurationInterfaces.IConfigurationRegistry"
+ name="ChangeConfigurations"
+ template="Browser/ChangeConfigurations.pt"
+ class=".Browser.ChangeConfigurations."
+ allowed_interface="Zope.App.Forms.Browser.IFormCollaborationView."
+ permission="Zope.ManageServices"
+ />
+
+<!-- IConfiguration subclasses -->
+
+ <defaultView
+ for=".ConfigurationInterfaces.INamedComponentConfiguration."
+ name="index.html" />
+
+ <menuItems
+ menu="zmi_views"
+ for=".ConfigurationInterfaces.INamedComponentConfiguration.">
+ <menuItem title="Edit" action="index.html"/>
+ </menuItems>
+
+ <form:edit
+ for=".ConfigurationInterfaces.INamedComponentConfiguration."
+ name="index.html"
+ schema="Zope.App.OFS.Services.ConfigurationInterfaces.IConfiguration."
+ label="XXX Configuration"
+ permission="Zope.ManageServices"
+ template="Browser/ComponentConfigEdit.pt"
+ class=".Browser.ComponentConfigURL."
+ />
+
+ <form:edit
+ for=".ConfigurationInterfaces.INamedComponentConfiguration."
+ name="ItemEdit"
+ schema=
+ "Zope.App.OFS.Services.ConfigurationInterfaces.IConfigurationSummary."
+ template="Browser/ComponentConfigItemEdit.pt"
+ label="XXX not used but can't be omitted"
+ class=".Browser.ComponentConfigURL."
+ permission = "Zope.ManageServices"
+ />
+
+ <view
+ for=".ConfigurationInterfaces.IComponentConfiguration"
+ name="ConfigurationSummary"
+ template="Browser/ComponentConfigSummary.pt"
+ class=".Browser.ComponentConfigURL."
+ permission="Zope.ManageServices"
+ />
+
+<!-- INameConfigurable default view -->
+
+ <defaultView
+ for=".ConfigurationInterfaces.INameConfigurable"
+ name="index.html"
+ />
+
+ <view
+ for=".ConfigurationInterfaces.INameConfigurable."
+ factory=".Browser.NameConfigurableView."
+ permission="Zope.ManageServices">
+ <page name="index.html" attribute="index" />
+ </view>
</zope:zopeConfigure>