[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - __init__.py:1.1.2.1 adapter.py:1.1.2.1 adapter_search.pt:1.1.2.1 adapterconfigsummary.pt:1.1.2.1 add_adapter_config.pt:1.1.2.1 add_cache.pt:1.1.2.1 add_module.pt:1.1.2.1 add_service_1.pt:1.1.2.1 add_service_2.pt:1.1.2.1 addconnectionconfig.pt:1.1.2.1 addrole.pt:1.1.2.1 addservicemanager.py:1.1.2.1 auth.pt:1.1.2.1 auth.py:1.1.2.1 cache.py:1.1.2.1 caches.pt:1.1.2.1 changeconfigurations.pt:1.1.2.1 changeconfigurations.py:1.1.2.1 componentconfigedit.pt:1.1.2.1 componentconfigitemedit.pt:1.1.2.1 componentconfigsummary.pt:1.1.2.1 componentconfigurl.py:1.1.2.1 configurationstatuswidget.py:1.1.2.1 configure.zcml:1.1.2.1 connection.py:1.1.2.1 connections.pt:1.1.2.1 edit_module.pt:1.1.2.1 editconfiguration.pt:1.1.2.1 error.pt:1.1.2.1 error.py:1.1.2.1 errorentry.pt:1.1.2.1 event.py:1.1.2.1 eventcontrol.pt:1.1.2.1 field.py:1.1.2.1 hub.py:1.1.2.1 hubcontrol.pt:1.1.2.1 module.py:1.1.2.1 namecomponentconfigurable.pt:1.1.2.1 namecomponentc!
onfigurableview.py:1.1.2.1 nameconfigurable.pt:1.1.2.1 nameconfigurableview.py:1.1.2.1 package.py:1.1.2.1 packages_contents.pt:1.1.2.1 pageconfigsummary.pt:1.1.2.1 role.py:1.1.2.1 service.py:1.1.2.1 services.pt:1.1.2.1 texttbentry.pt:1.1.2.1 view.py:1.1.2.1 view_search.pt:1.1.2.1 viewconfigsummary.pt:1.1.2.1 viewpackage_contents.pt:1.1.2.1 zpt.py:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 14:31:18 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/browser/services
Added Files:
Tag: NameGeddon-branch
__init__.py adapter.py adapter_search.pt
adapterconfigsummary.pt add_adapter_config.pt add_cache.pt
add_module.pt add_service_1.pt add_service_2.pt
addconnectionconfig.pt addrole.pt addservicemanager.py auth.pt
auth.py cache.py caches.pt changeconfigurations.pt
changeconfigurations.py componentconfigedit.pt
componentconfigitemedit.pt componentconfigsummary.pt
componentconfigurl.py configurationstatuswidget.py
configure.zcml connection.py connections.pt edit_module.pt
editconfiguration.pt error.pt error.py errorentry.pt event.py
eventcontrol.pt field.py hub.py hubcontrol.pt module.py
namecomponentconfigurable.pt namecomponentconfigurableview.py
nameconfigurable.pt nameconfigurableview.py package.py
packages_contents.pt pageconfigsummary.pt role.py service.py
services.pt texttbentry.pt view.py view_search.pt
viewconfigsummary.pt viewpackage_contents.pt zpt.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/browser/services/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/browser/services/adapter.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Views for local adapter configuration.
AdapterSeviceView -- it's a bit different from other services, as it
has a lot of things in it, so we provide a search interface:
search page
browsing page
AdapterConfigurationAdd
$Id: adapter.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
import md5
from zope.app.form.utility \
import setUpWidgets, getWidgetsData, getWidgetsDataForContent, fieldNames
from zope.publisher.browser import BrowserView
from zope.app.interfaces.services.interfaces \
import IAdapterConfiguration, IAdapterConfigurationInfo
from zope.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.app.interfaces.services.configuration import IConfiguration
from zope.app.services.adapter import AdapterConfiguration
from zope.app.component.interfacefield import InterfaceField
from zope.interface import Interface
from zope.component import getView
from zope.proxy.context.context import ContextWrapper
class IAdapterSearch(Interface):
forInterface = InterfaceField(title=u"For interface",
required=False,
)
providedInterface = InterfaceField(title=u"Provided interface",
required=False,
)
class AdapterServiceView(BrowserView):
def __init__(self, *args):
super(AdapterServiceView, self).__init__(*args)
setUpWidgets(self, IAdapterSearch)
def configInfo(self):
forInterface = self.forInterface.getData()
providedInterface = self.providedInterface.getData()
result = []
for (forInterface, providedInterface, registry
) in self.context.getRegisteredMatching(forInterface,
providedInterface):
forInterface = (
forInterface.__module__ +"."+ forInterface.__name__)
providedInterface = (
providedInterface.__module__ +"."+ providedInterface.__name__)
registry = ContextWrapper(registry, self.context)
view = getView(registry, "ChangeConfigurations", self.request)
prefix = md5.new('%s %s' %
(forInterface, providedInterface)).hexdigest()
view.setPrefix(prefix)
view.update()
result.append(
{'forInterface': forInterface,
'providedInterface': providedInterface,
'view': view,
})
return result
class AdapterConfigurationAdd(BrowserView):
def __init__(self, *args):
super(AdapterConfigurationAdd, self).__init__(*args)
setUpWidgets(self, IAdapterConfiguration)
def refresh(self):
if "FINISH" in self.request:
data = getWidgetsData(self, IAdapterConfigurationInfo)
configuration = AdapterConfiguration(**data)
publish(self.context.context, ObjectCreatedEvent(configuration))
configuration = self.context.add(configuration)
getWidgetsDataForContent(self, IConfiguration, configuration)
self.request.response.redirect(self.context.nextURL())
return False
return True
def getWidgets(self):
return ([getattr(self, name)
for name in fieldNames(IAdapterConfigurationInfo)]
+
[getattr(self, name)
for name in fieldNames(IConfiguration)]
)
=== Added File Zope3/src/zope/app/browser/services/adapter_search.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title></title></head>
<body>
<div metal:fill-slot="body">
<form action="." method="GET"
tal:attributes="action request/URL"
>
<table>
<tr tal:content="structure view/forInterface/row" />
<tr tal:content="structure view/providedInterface/row" />
<tr>
<td></td>
<td>
<input type="submit" value="Refresh">
<input type="submit" value="Search" name="SEARCH">
</td>
</tr>
</table>
</form>
<form action="." method="POST"
tal:attributes="action request/URL"
tal:condition="request/SEARCH|nothing"
>
<table>
<tr>
<th>For/<br>Provided</th>
<th>Configuration</th>
</tr>
<tr tal:repeat="config view/configInfo">
<td> <span tal:content="config/forInterface" />/<br>
<span tal:content="config/providedInterface" />
</td>
<td tal:content="structure config/view" />
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" value="Update" name="UPDATE_SUBMIT">
</td>
</tr>
</table>
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/adapterconfigsummary.pt ===
<span tal:replace="context/factoryName" />
=== Added File Zope3/src/zope/app/browser/services/add_adapter_config.pt ===
<html metal:use-macro="views/standard_macros/dialog">
<head><title></title></head>
<body>
<div metal:fill-slot="body">
<form action="." method="post"
tal:attributes="action request/URL"
tal:condition="view/refresh"
>
<table>
<tr tal:repeat="widget view/getWidgets"
tal:content="structure widget/row">
<td>Label</td>
<td>Roles</td>
</tr>
</table>
<input type="submit" value="Refresh" />
<input type="submit" name="FINISH" value="Finish" />
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/add_cache.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a cache configuration</title></head>
<body>
<div metal:fill-slot="body">
<form action="finish.html" method="post">
<table>
<tr>
<td>Cache Name</td>
<td><input type="text" name="cache_name" /></td>
</tr>
<tr>
<td>Component</td>
<td><select name="component_path">
<option tal:repeat="path view/components"
tal:attributes="value path"
tal:content="path">path</option>
</select>
</td>
</tr>
<tr>
<td>Status</td>
<td tal:content="structure view/status"><input type="text"></td>
</tr>
<tr>
<td>Title</td>
<td tal:content="structure view/title"><input type="text"></td>
</tr>
<tr>
<td>Description</td>
<td tal:content="structure view/description"><textarea></textarea></td>
</tr>
</table>
<input type="submit" />
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/add_module.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a module</title></head>
<body>
<div metal:fill-slot="body">
<p>Enter the absolute module name and source code.</p>
<form action="action.html">
<input name="name">
<textarea name="source:text" cols="65" rows="25"></textarea>
<input type="submit" value="Add module"/>
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/add_service_1.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a service component</title></head>
<body>
<div metal:fill-slot="body">
<form action="step2.html">
<table>
<tr>
<td>Service Type</td>
<td>
<select name="service_type">
<option tal:repeat="service view/services"
tal:attributes="value service"
tal:content="service">service</option>
</select>
</td>
</tr>
<tr>
<td>Title</td>
<td tal:content="structure view/title"><input type="text"></td>
</tr>
<tr>
<td>Description</td>
<td tal:content="structure view/description"><textarea></textarea></td>
</tr>
</table>
<input type=submit value="Next"/>
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/add_service_2.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Contact Information</title></head>
<body>
<div metal:fill-slot="body">
<form action="finish.html" method="post">
<input type="hidden" name="service_type" value=""
tal:attributes="value request/service_type" />
<table>
<tr>
<td>Service Type</td>
<td tal:content="request/service_type">Roles</td>
</tr>
<tr>
<td>Component</td>
<td><select name="component_path">
<option tal:repeat="path view/components"
tal:attributes="value path"
tal:content="path">path</option>
</select>
</td>
</tr>
<tr>
<td>Status</td>
<td tal:content="structure view/status"><input type="text"></td>
</tr>
<tr>
<td>Title</td>
<td tal:content="structure view/title"><input type="text"></td>
</tr>
<tr>
<td>Description</td>
<td tal:content="structure view/description"><textarea></textarea></td>
</tr>
</table>
<input type="submit" value="Finish" />
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/addconnectionconfig.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a connection configuration</title></head>
<body>
<div metal:fill-slot="body">
<form action="finish.html" method="post">
<table>
<tr>
<td>Connection Name</td>
<td><input type="text" name="connection_name" /></td>
</tr>
<tr>
<td>Component</td>
<td><select name="component_path">
<option tal:repeat="path view/components"
tal:attributes="value path"
tal:content="path">path</option>
</select>
</td>
</tr>
<tr>
<td>Permission</td>
<td tal:content="structure view/permission"><input type="text"></td>
</tr>
<tr>
<td>Status</td>
<td tal:content="structure view/status"><input type="text"></td>
</tr>
<tr>
<td>Title</td>
<td tal:content="structure view/title"><input type="text"></td>
</tr>
<tr>
<td>Description</td>
<td tal:content="structure view/description"><textarea></textarea></td>
</tr>
</table>
<input type="submit" />
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/addrole.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add Role</title></head>
<body>
<div metal:fill-slot="body">
Enter the information about the role.
<form action="action.html" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr><td>Id</td>
<td><input type="text" name="id" size="40" value="" /> </td>
</tr>
<tr><td>Title</td>
<td><input type="text" name="title" size="60" value="" /> </td>
</tr>
<tr><td>Descrption</td>
<td><textarea name="description" rows="10" cols="60"></textarea></td>
</tr>
</table>
<input type="submit" name="submit" value=" Create Role " />
</form></div></body></html>
=== Added File Zope3/src/zope/app/browser/services/addservicemanager.py ===
##############################################################################
#
# 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: addservicemanager.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.app.services.service import ServiceManager
class AddServiceManager(BrowserView):
def addServiceManager(self):
sm = ServiceManager()
if self.context.hasServiceManager():
raise ValueError(
'This folder already contains a service manager')
self.context.setServiceManager(sm)
self.request.response.redirect("++etc++Services/")
=== Added File Zope3/src/zope/app/browser/services/auth.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title>Add User</title>
</head>
<body>
<div metal:fill-slot="body">
<form action="." method="post" enctype="multipart/form-data">
<table>
<tbody>
<tr>
<th>Id:</th>
<td>
<input type="text" name="id" size="40" value="">
</td>
</tr>
<tr>
<th>Title:</th>
<td>
<input type="text" name="title" size="40" value="">
</td>
</tr>
<tr>
<th>Description:</th>
<td>
<input type="text" name="description" size="40" value="">
</td>
</tr>
<tr>
<th>Login:</th>
<td>
<input type="text" name="login" size="40" value="">
</td>
</tr>
<tr>
<th>Password:</th>
<td>
<input type="password" name="password" size="40" value="">
</td>
</tr>
<tr>
<th>Roles:</th>
<td>
<select name="roles:list">
<option value="Manager">Manager</option>
</select>
</td>
</tr>
</tbody>
</table>
<input type="submit" name="action.html:method" value="Add" />
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/auth.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Connection Management GUI
$Id: auth.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.app.services.auth import User
class AddUser(BrowserView):
def action(self, id, title, description, login, password, roles):
user = User(id, title, description, login, password)
self.context.setObject(id, user)
return self.request.response.redirect(self.request.URL[-2])
"""Connection Management GUI
$Id: auth.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.component import getService
from zope.publisher.browser import BrowserView
class EditUser(BrowserView):
def action(self, title, description, login, password, roles):
user = self.context
user.setTitle(title)
user.setDescription(description)
user.setLogin(login)
if password != "DEFAULT":
user.setPassword(password)
user.setRoles(roles)
return self.request.response.redirect(self.request.URL[-1])
def getAvailableRoles(self):
service = getService(self.context, "Roles")
return service.getRoles()
=== Added File Zope3/src/zope/app/browser/services/cache.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Cache configuration adding view
$Id: cache.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
from zope.component import getServiceManager
from zope.publisher.browser import BrowserView
from zope.app.form.utility import setUpWidgets, getWidgetsDataForContent
from zope.app.interfaces.services.cache \
import ICacheConfiguration
from zope.app.services.cache \
import CacheConfiguration
from zope.app.interfaces.cache.cache import ICache
class AddCacheConfiguration(BrowserView):
def __init__(self, *args):
super(AddCacheConfiguration, self).__init__(*args)
setUpWidgets(self, ICacheConfiguration)
def components(self):
service = getServiceManager(self.context.context)
paths = [info['path'] for info in service.queryComponent(type=ICache)]
paths.sort()
return paths
def action(self, cache_name, component_path):
if not cache_name:
raise ValueError, 'You must specify a cache name'
cd = CacheConfiguration(cache_name, component_path)
cd = self.context.add(cd)
getWidgetsDataForContent(self, ICacheConfiguration, content=cd)
self.request.response.redirect(self.context.nextURL())
=== Added File Zope3/src/zope/app/browser/services/caches.pt ===
<html metal:use-macro="views/standard_macros/page">
<body metal:fill-slot="body">
<div metal:use-macro="view/indexMacros/macros/body">
<h2 metal:fill-slot="heading">Caches configured in this cache service.</h2>
<p metal:fill-slot="empty_text">No caches have been configured</p>
<div metal:fill-slot="extra_top">
<p>For each cache, the cache name is given and all of the
components registered to provide the cache are shown. You
may select the component to provide the cache or disable the
cache.
</p>
<p>Select a cache name or a component name to visit the cache
or component.
</p>
</div>
<p metal:fill-slot="help_text">To configure a cache, add a database
adapter component to a <em>package</em> in <a
href="../../../Packages">Packages</a> or to the <a
href="../../../Packages/default">default package</a>. After the component
is added, add a cache configuration that configures the component to
provide a cache.
</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/changeconfigurations.pt ===
<table width="100%">
<tr tal:define="message view/message" tal:condition="message">
<td></td>
<td colspan="2"><em tal:content="message">xxxx</em></td>
</tr>
<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="."
tal:attributes="href string:${view/configBase}/${configuration/id}"
tal:content="configuration/id"
>foo/bar</a></td>
<td tal:content="structure configuration/summary">
Configuration summary
</td>
</tr>
<tr>
<td><input type="radio" name="Roles" value="disable"
tal:attributes="
name view/name;
checked view/inactive;
"
/></td>
<td><em>Disable</em></td>
</tr>
</table>
=== Added File Zope3/src/zope/app/browser/services/changeconfigurations.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""
$Id: changeconfigurations.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component import getView, getServiceManager
from zope.proxy.introspection import removeAllProxies
class ChangeConfigurations(BrowserView):
_prefix = 'configurations'
name = _prefix + ".active"
message = ''
configBase = ''
def setPrefix(self, prefix):
self._prefix = prefix
self.name = prefix + ".active"
def applyUpdates(self):
message = ''
if 'submit_update' in self.request.form:
active = self.request.form.get(self.name)
if active == "disable":
active = self.context.active()
if active is not None:
self.context.deactivate(active)
message = "Disabled"
else:
for info in self.context.info():
if info['id'] == active:
if not info['active']:
self.context.activate(info['configuration'])
message = "Updated"
return message
def update(self):
message = self.applyUpdates()
self.configBase = str(getView(getServiceManager(self.context),
'absolute_url', self.request)
) + '/Packages'
configurations = self.context.info()
# This is OK because configurations is just a list of dicts
configurations = removeAllProxies(configurations)
inactive = 1
for info in configurations:
if info['active']:
inactive = None
else:
info['active'] = None
info['summary'] = getView(info['configuration'],
'ConfigurationSummary',
self.request)
self.inactive = inactive
self.configurations = configurations
self.message = message
=== Added File Zope3/src/zope/app/browser/services/componentconfigedit.pt ===
<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>
<tr>
<td>Permission</td>
<td>
<span tal:replace="view/permission">Zope.Foo</span>
</td>
</table>
</div>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/componentconfigitemedit.pt ===
<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>
=== Added File Zope3/src/zope/app/browser/services/componentconfigsummary.pt ===
<span tal:replace="context/title" />
<a href='.'
tal:attributes="href view/componentURL"
tal:content="view/componentPath">foo/bar</a>
=== Added File Zope3/src/zope/app/browser/services/componentconfigurl.py ===
##############################################################################
#
# 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: componentconfigurl.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.component import getView
from Zope.App.Traversing import traverse, locationAsUnicode
from zope.proxy.introspection 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__
=== Added File Zope3/src/zope/app/browser/services/configurationstatuswidget.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Configuration Browser Views
XXX longer description goes here.
$Id: configurationstatuswidget.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
from zope.app.browser.form.widget import BrowserWidget
from zope.app.interfaces.services.configuration \
import Active, Registered, Unregistered
class ConfigurationStatusWidget(BrowserWidget):
def __call__(self):
checked = self._showData() or Unregistered
result = [
('<label><input type="radio" name="%s" value="%s"%s> %s</label>'
% (self.name, v, (v == checked and ' checked' or ''), v)
)
for v in (Unregistered, Registered, Active)
]
return ' '.join(result)
=== Added File Zope3/src/zope/app/browser/services/configure.zcml === (753/853 lines abridged)
<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
xmlns:browser='http://namespaces.zope.org/browser'
package="Zope.App.OFS.Services.ErrorReportingService"
>
<browser:defaultView
name="main.html"
for="zope.app.interfaces.services.error.IErrorReportingService" />
<browser:view
for="zope.app.interfaces.services.error.IErrorReportingService"
permission="Zope.Public"
factory="zope.app.browser.services.error.EditErrorLog">
<browser:page name="main.html" template="Views/Browser/main.pt" />
<browser:page name="edit.html" attribute="updateProperties" />
<browser:page name="showEntry.html" template="Views/Browser/showEntry.pt"/>
<browser:page name="showTextTBEntry.html" template="Views/Browser/showTextTBEntry.pt"/>
</browser:view>
</zopeConfigure>
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
package="Zope.App.OFS.Services.CachingService">
<!-- CachingService -->
<browser:defaultView
for="zope.app.services.cache.ILocalCachingService"
name="index.html" />
<browser:menuItems
menu="zmi_views"
for="zope.app.services.cache.ILocalCachingService">
<browser:menuItem title="Caches" action="index.html"/>
</browser:menuItems>
<browser:view
for="zope.app.services.cache.ILocalCachingService"
name="index.html"
template="Views/Browser/Caches.pt"
class="zope.app.browser.services.namecomponentconfigurableview.NameComponentConfigurableView"
permission="Zope.ManageServices" />
<browser:menuItem
menu="add_component"
for="zope.app.interfaces.container.IAdding"
action="CachingService"
[-=- -=- -=- 753 lines omitted -=- -=- -=-]
>
<page name="index.html" template="Browser/add_module.pt" />
<page name="action.html" attribute="action" />
</view>
<menuItem menu="add_component" for="zope.app.interfaces.container.IAdding"
action="Module" title="Module" />
<!-- View Package -->
<defaultView for="zope.app.interfaces.services.servicemanager.interfaces.IViewPackage" name="contents.html" />
<view
for="zope.app.interfaces.services.servicemanager.interfaces.IViewPackage"
permission="Zope.ManageServices"
factory="zope.app.browser.services.package.ViewPackageContents">
<page name="contents.html"
attribute="index"
/>
<page name="add.html"
attribute="add"
/>
<page name="removeObjects.html"
attribute="removeObjects"
/>
</view>
<form:edit
schema=".interfaces.IViewPackageInfo."
name="DefaultConfiguration.html"
permission="Zope.ManageServices"
label="Default configuration parameters"
/>
<menuItems menu="zmi_views" for="zope.app.interfaces.services.servicemanager.interfaces.IViewPackage">
<menuItem title="Contents"
action="@@contents.html"/>
<menuItem title="Default Configuration"
action="@@DefaultConfiguration.html"/>
</menuItems>
<menuItem menu="add_component" for="zope.app.interfaces.container.IAdding"
action="Zope.App.OFS.Services.ServiceManager.viewpackage.ViewPackage"
title="View Sub-Package" />
</zope:zopeConfigure>
=== Added File Zope3/src/zope/app/browser/services/connection.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Connection configuration adding view
$Id: connection.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
from zope.component import getServiceManager
from zope.publisher.browser import BrowserView
from zope.app.form.utility import setUpWidgets, getWidgetsDataForContent
from zope.app.interfaces.services.connection \
import IConnectionConfiguration
from zope.app.services.connection \
import ConnectionConfiguration
from zope.app.interfaces.rdb import IZopeDatabaseAdapter
class AddConnectionConfiguration(BrowserView):
def __init__(self, *args):
super(AddConnectionConfiguration, self).__init__(*args)
setUpWidgets(self, IConnectionConfiguration)
def components(self):
service = getServiceManager(self.context.context)
paths = [info['path']
for info in service.queryComponent(type=IZopeDatabaseAdapter)]
paths.sort()
return paths
def action(self, connection_name, component_path=None):
if not connection_name:
raise ValueError('You must specify a connection name')
if not component_path:
raise ValueError('You must specify a component path')
cd = ConnectionConfiguration(connection_name, component_path)
cd = self.context.add(cd)
getWidgetsDataForContent(self, IConnectionConfiguration, content=cd)
self.request.response.redirect(self.context.nextURL())
=== Added File Zope3/src/zope/app/browser/services/connections.pt ===
<html metal:use-macro="views/standard_macros/page">
<body metal:fill-slot="body">
<div metal:use-macro="view/indexMacros/macros/body">
<h2 metal:fill-slot="heading">Connections configured in this connection service.</h2>
<p metal:fill-slot="empty_text">No connections have been configured</p>
<div metal:fill-slot="extra_top">
<p>For each connection, the connection name is given and all of the
components registered to provide the connection are shown. You
may select the component to provide the connection or disable the
connection.
</p>
<p>Select a connection name or a component name to visit the connection
or component.
</p>
</div>
<p metal:fill-slot="help_text">To configure a connection, add a database
adapter component to a <em>package</em> in <a
href="../../../Packages">Packages</a> or to the <a
href="../../../Packages/default">default package</a>. After the component
is added, add a connection configuration that configures the component to
provide a connection.
</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/edit_module.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add a module</title></head>
<body>
<div metal:fill-slot="body">
<p>Enter the absolute module name and source code.</p>
<form action="edit.html">
<span tal:replace="view/update"></span>
<p>Module: <span tal:content="context/name">Module Name</span></p>
<textarea name="source:text" cols="65" rows="25"
tal:content="context/source"
></textarea>
<input type="submit" value="Edit"/>
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/editconfiguration.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title>View Service Configuration</title>
</head>
<body>
<div metal:fill-slot="body">
<form action="."
tal:define="info view/action"
tal:attributes="action request/URL">
<div tal:condition="info" tal:content="info" />
<table align=center width=100% cellspacing=0 cellpadding=0>
<tr tal:repeat="config view/configInfo">
<td valign=top>
<input type=checkbox name='keys:list'
value='2'
tal:attributes="value config/key"/>
</td>
<td>
<table border=1 width=100%>
<tr><td tal:content="structure config/view">
Edit Adapter Directives
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
<td>
<input type=submit name='refresh_submit' value="Refresh">
<input type=submit name='UPDATE_SUBMIT' value="Update">
<input type=submit name='add_submit' value="Add">
<input type=submit name='remove_submit' value="Remove">
<input type=submit name='top_submit' value="Top">
<input type=submit name='up_submit' value="Up">
<input type=submit name='down_submit' value="Down">
<input type=submit name='bottom_submit' value="Bottom">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/error.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title>View Error Log Report</title>
</head>
<body>
<div metal:fill-slot="body">
<p class="form-help">
This page lists the exceptions that have occurred in this site
recently. You can configure how many exceptions should be kept
and whether the exceptions should be copied to Zope's event log
file(s).
</p>
<form action="edit.html" method="post">
<br>
<table tal:define="props context/getProperties">
<tr>
<td align="left" valign="top">
<div class="form-label">
Number of exceptions to keep
</div>
</td>
<td align="left" valign="top">
<input type="text" name="keep_entries" size="40"
tal:attributes="value props/keep_entries" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Copy exceptions to the event log
</div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="copy_to_zlog"
tal:attributes="checked props/copy_to_zlog;" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Ignored exception types
</div>
</td>
<td align="left" valign="top">
<textarea name="ignored_exceptions:lines" cols="40" rows="3"
tal:content="python: '\n'.join(props['ignored_exceptions'])"></textarea>
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value=" Save Changes " />
</div>
</td>
</tr>
</table>
<h3>Exception Log (most recent first)</h3>
<div tal:define="entries context/getLogEntries">
<em tal:condition="not:entries">
No exceptions logged.
</em>
<table tal:condition="entries">
<tr>
<th align="left">Time</th>
<th align="left">User</th>
<th align="left">Exception</th>
</tr>
<tr tal:repeat="entry entries">
<td valign="top" nowrap="nowrap">
<span tal:content="entry/time">Time</span>
</td>
<td>
<span tal:content="entry/username">joe</span>
</td>
<td valign="top">
<a href="showEntry" tal:attributes="href string:showEntry.html?id=${entry/id}"
>
<span tal:content="entry/type">AttributeError</span>:
<span tal:define="value entry/value"
tal:content="python: len(value) < 70 and value or value[:70] + '...'">
Application object has no attribute "zzope"</span>
</a>
</td>
</tr>
</table>
</div>
</form>
<p>
<form action="main.html" method="GET">
<input type="submit" name="submit" value=" Refresh " />
</form>
</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/error.py ===
##############################################################################
#
# 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.
#
##############################################################################
""" Define view component for event service control.
$Id: error.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component.contextdependent import ContextDependent
from zope.app.services.errorr import IErrorReportingService
from zope.pagetemplate.pagetemplatefile import PageTemplateFile
from zope.proxy.introspection import removeAllProxies
class EditErrorLog(BrowserView):
__used_for__ = IErrorReportingService
def updateProperties(self, keep_entries, copy_to_zlog=None, ignored_exceptions=None):
errorLog = self.context
if copy_to_zlog is None:
copy_to_zlog = 0
errorLog.setProperties(keep_entries, copy_to_zlog, ignored_exceptions)
return self.request.response.redirect('main.html')
=== Added File Zope3/src/zope/app/browser/services/errorentry.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<title>View Error Log Report</title>
</head>
<body>
<div metal:fill-slot="body">
<h1>Header</h1>
<h3>Exception traceback</h3>
<hr>
<div tal:define="entry python:context.getLogEntryById(request.get('id'))">
<em tal:condition="not:entry">
The specified log entry was not found. It may have expired.
</em>
<div tal:condition="entry">
<table>
<tr>
<th align="left" valign="top">Time</th>
<td tal:content="entry/time">Time</td>
</tr>
<tr>
<th align="left" valign="top">User</th>
<td tal:content="entry/username">joe</td>
</tr>
<tr>
<th align="left" valign="top">Request URL</th>
<td tal:content="entry/url">http://zeomega.com</td>
</tr>
<tr>
<th align="left" valign="top">Exception Type</th>
<td tal:content="entry/type">AttributeError</td>
</tr>
<tr>
<th align="left" valign="top">Exception Value</th>
<td tal:content="entry/value">zzope</td>
</tr>
</table>
<div tal:condition="entry/tb_html" tal:content="structure entry/tb_html">
Traceback (HTML)
</div>
<pre tal:condition="not:entry/tb_html" tal:content="entry/tb_text">
Traceback (text)
</pre>
<p tal:condition="entry/tb_text"><a href="" tal:attributes="href
string:showTextTBEntry.html?id=${entry/id}">Display
traceback as text</a></p>
<div tal:condition="entry/req_html">
<h3>REQUEST</h3>
<hr>
<div tal:replace="structure entry/req_html"></div>
</div>
</div>
<p>
<form action="main.html" method="GET">
<input type="submit" name="submit" value=" Return to log " />
</form>
</p>
</div>
</div>
</html>
=== Added File Zope3/src/zope/app/browser/services/event.py ===
##############################################################################
#
# 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.
#
##############################################################################
""" Define view component for event service control.
$Id: event.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component.contextdependent import ContextDependent
from zope.interfaces.event import IEventService
from Zope.App.PageTemplate import ViewPageTemplateFile
from zope.proxy.introspection import removeAllProxies
class Control(BrowserView):
__used_for__ = IEventService
def index( self, toggleSubscribeOnBind=0):
if toggleSubscribeOnBind:
cntx=removeAllProxies(self.context)
cntx.subscribeOnBind=not cntx.subscribeOnBind
return self.__control()
__control=ViewPageTemplateFile("control.pt")
=== Added File Zope3/src/zope/app/browser/services/eventcontrol.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
<!--
.ContentListing {
width: 100%;
}
.ContentIcon {
width: 20px;
}
.ContentTitle {
text-align: left;
}
-->
</style>
</head>
<body>
<div metal:fill-slot="body">
<p>Subscribe on bind: <span tal:condition="context/subscribeOnBind">ON (this
event service will try to subscribe to the nearest parent local event service
whenever it is bound into service by its service manager; <strong>it will
receive events from its parent</strong> if it is bound now)</span><span
tal:condition="not:context/subscribeOnBind">OFF (this
event service will <em>not</em> try to subscribe to the nearest parent
local event service whenever it is bound into service by its service manager;
<strong>it will <em>not</em> receive events from its parent</strong> if it is
bound now)</span></p>
<form method="post">
<input type="submit" value="Toggle" name="toggleSubscribeOnBind" />
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/field.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""A widget for ComponentLocation field.
$Id: field.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
from zope.app.browser.form.widget import BrowserWidget
from zope.component import getServiceManager
class ComponentLocationWidget(BrowserWidget):
def _convert(self, value):
return value or None
def __call__(self):
selected = self._showData()
service_manager = getServiceManager(self.context.context)
info = service_manager.queryComponent(self.context.type)
result = []
result.append('<select name="%s">' % self.name)
result.append('<option></option>')
for item in info:
item = item['path']
if item == selected:
result.append('<option selected>%s</option>' % item)
else:
result.append('<option>%s</option>' % item)
result.append('</select>')
return "\n".join(result)
=== Added File Zope3/src/zope/app/browser/services/hub.py ===
##############################################################################
#
# 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.
#
##############################################################################
""" Define view component for object hub.
$Id: hub.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component.contextdependent import ContextDependent
from zope.app.interfaces.services.hub import IObjectHub
from Zope.App.PageTemplate import ViewPageTemplateFile
from zope.proxy.introspection import removeAllProxies
class Control(BrowserView):
__used_for__ = IObjectHub
def index( self ):
return self.__control()
__control=ViewPageTemplateFile("control.pt")
=== Added File Zope3/src/zope/app/browser/services/hubcontrol.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
<!--
.ContentListing {
width: 100%;
}
.ContentIcon {
width: 20px;
}
.ContentTitle {
text-align: left;
}
-->
</style>
</head>
<body>
<div metal:fill-slot="body">
This is an object hub.
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/module.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Handle form to create module
$Id: module.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.app.services.module import Manager
class AddModule(BrowserView):
def action(self, name, source):
mgr = Manager()
mgr = self.context.add(mgr)
mgr.new(name, source)
self.request.response.redirect(self.context.nextURL())
"""Handle form to edit module
$Id: module.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.app.services.module import Manager
class EditModule(BrowserView):
def update(self):
if "source" in self.request:
self.context.update(self.request["source"])
return u"The source was updated."
else:
return u""
=== Added File Zope3/src/zope/app/browser/services/namecomponentconfigurable.pt ===
<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>
=== Added File Zope3/src/zope/app/browser/services/namecomponentconfigurableview.py ===
##############################################################################
#
# 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 INameComponentConfigurable view mixin
$Id: namecomponentconfigurableview.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from Zope.App.Traversing import traverse
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.browser.services.nameconfigurableview \
import NameConfigurableView
from zope.component import getView
class NameComponentConfigurableView(NameConfigurableView):
indexMacros = index = ViewPageTemplateFile('NameComponentConfigurable.pt')
def _getItem(self, name, view, cfg):
item_dict = NameConfigurableView._getItem(self, name, view, cfg)
if cfg is not None:
ob = traverse(cfg, cfg.componentPath)
url = str(getView(ob, 'absolute_url', self.request))
else:
url = None
item_dict['url'] = url
return item_dict
=== Added File Zope3/src/zope/app/browser/services/nameconfigurable.pt ===
<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
registrations are shown. You may select the
registration to provide the fruit or disable the fruit.
</p>
</div>
<form action="." method="post" tal:attributes="action request/URL">
<table width="100%">
<tr tal:repeat="registry registries">
<td valign="top" align="right">
<span
tal:content="registry/name"
tal:condition="registry/active"
>Orange</span>
<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.
These instructions may not apply, depending what kind of fruit you have.
</p>
</div>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/nameconfigurableview.py ===
##############################################################################
#
# 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: nameconfigurableview.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component import getView
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
items.append(self._getItem(name, view, cfg))
return items
def _getItem(self, name, view, cfg):
# hook for subclasses. returns a dict to append to an item
return {"name": name,
"active": cfg is not None,
"inactive": cfg is None,
"view": view,
}
=== Added File Zope3/src/zope/app/browser/services/package.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""
Revision information: $Id: package.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.app.browser.container.contents import Contents
from zope.app.interfaces.services.service \
import IServiceManager
from zope.app.services.zpt import ZPTTemplate
from zope.publisher.browser import BrowserView
from Zope.App.PageTemplate import ViewPageTemplateFile
from zope.app.interfaces.container import IContainer
from zope.component import queryView, getView
class ViewPackageContents(Contents):
__used_for__ = IServiceManager
index = ViewPageTemplateFile('viewpackage_contents.pt')
def add(self, name):
self.context.setObject(name, ZPTTemplate())
self.request.response.redirect('.')
"""
Revision information: $Id: package.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.app.browser.container.contents import Contents
from zope.app.interfaces.services.service \
import IServiceManager
from zope.app.services.package import Package
from zope.publisher.browser import BrowserView
from Zope.App.PageTemplate import ViewPageTemplateFile
from zope.app.interfaces.container import IContainer
from zope.component import queryView, getView
class PackagesContents(Contents):
__used_for__ = IServiceManager
index = ViewPageTemplateFile('packages_contents.pt')
def addPackage(self, name):
self.context.setObject(name, Package())
self.request.response.redirect('.')
=== Added File Zope3/src/zope/app/browser/services/packages_contents.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
</style>
</head>
<body>
<div metal:fill-slot="body">
<form action="." method="get"
tal:define="container_contents view/listContentInfo"
>
<p>Package Contents</p>
<div metal:use-macro="view/contentsMacros/macros/contents_table" />
<br />
<input type="text" name="name" />
<input type="submit" name="@@addPackage.html:method" value="Add"
i18nXXX:attributes="value string:menu_add_button" />
<input type="submit" name="@@removeObjects.html:method" value="Delete"
i18nXXX:attributes="value string:menu_delete_button" />
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/pageconfigsummary.pt ===
<span tal:replace="context/factoryName" />
<span tal:replace="context/template" />
=== Added File Zope3/src/zope/app/browser/services/role.py ===
from zope.publisher.browser import BrowserView
from zope.app.services.role import Role
from zope.app.services.role import ILocalRoleService
class Add(BrowserView):
"Provide a user interface for adding a contact"
__used_for__ = ILocalRoleService
def action(self, id, title, description):
"Add a contact"
role = Role(id, title, description)
self.context.setObject(id, role)
self.request.response.redirect('.')
""" Define view component for service manager contents.
$Id: role.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.app.browser.container.contents import Contents
class Contents(Contents):
pass
=== Added File Zope3/src/zope/app/browser/services/service.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Adding components for components and configuration
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.app.browser.container.adding import Adding as ContentAdding
class ComponentAdding(ContentAdding):
"""Adding component for components
"""
menu_id = "add_component"
def action(self, type_name, id):
if not id:
# Generate an id from the type name
id = type_name
if id in self.context:
i=2
while ("%s-%s" % (id, i)) in self.context:
i=i+1
id = "%s-%s" % (id, i)
return super(ComponentAdding, self).action(type_name, id)
class ConfigurationAdding(ContentAdding):
"""Adding component for configuration
"""
menu_id = "add_configuration"
"""
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
from zope.component import getView, getAdapter
from zope.proxy.context.context import ContextWrapper
from zope.app.interfaces.container import IZopeContainer
class EditConfiguration(BrowserView):
"""Adding component for service containers
"""
menu_id = "add_component"
def __init__(self, context, request):
self.request = request
self.context = context
def action(self):
"""Perform actions depending on user input.
"""
if 'add_submit' in self.request:
self.request.response.redirect('+')
return ''
if 'keys' in self.request:
k = self.request['keys']
else:
k = []
msg = 'You must select at least one item to use this action'
if 'remove_submit' in self.request:
if not k: return msg
self.remove_objects(k)
elif 'top_submit' in self.request:
if not k: return msg
self.context.moveTop(k)
elif 'bottom_submit' in self.request:
if not k: return msg
self.context.moveBottom(k)
elif 'up_submit' in self.request:
if not k: return msg
self.context.moveUp(k)
elif 'down_submit' in self.request:
if not k: return msg
self.context.moveDown(k)
return ''
def remove_objects(self, key_list):
"""Remove the directives from the container.
"""
container = getAdapter(self.context, IZopeContainer)
for item in key_list:
del container[item]
def configInfo(self):
"""Render View for each direcitves.
"""
r = []
for name, directive in self.context.items():
d = ContextWrapper(directive, self.context, name = name)
view = getView(d, 'ItemEdit', self.request)
view.setPrefix('config'+str(name))
r.append({'key': name, 'view': view})
return r
__doc__ = EditConfiguration.__doc__ + __doc__
"""XXX short summary goes here.
XXX longer description goes here.
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
from zope.component import getServiceManager
from zope.publisher.browser import BrowserView
from zope.app.services.service \
import ServiceConfiguration
from zope.app.interfaces.services.configuration import IConfiguration
from zope.app.form.utility import setUpWidgets, getWidgetsDataForContent
class AddServiceConfiguration(BrowserView):
def __init__(self, *args):
super(AddServiceConfiguration, self).__init__(*args)
setUpWidgets(self, IConfiguration)
def services(self):
service = getServiceManager(self.context.context)
definitions = service.getServiceDefinitions()
names = [name for (name, interface) in definitions]
names.sort()
return names
def components(self):
service_type = self.request['service_type']
service = getServiceManager(self.context.context)
type = service.getInterfaceFor(service_type)
paths = [info['path']
for info in service.queryComponent(type=type)
]
paths.sort()
return paths
def action(self, service_type, component_path):
sd = ServiceConfiguration(service_type, component_path)
sd = self.context.add(sd)
getWidgetsDataForContent(self, IConfiguration, sd)
self.request.response.redirect(self.context.nextURL())
=== Added File Zope3/src/zope/app/browser/services/services.pt ===
<html metal:use-macro="views/standard_macros/page">
<body metal:fill-slot="body">
<div metal:use-macro="view/indexMacros/macros/body">
<h2 metal:fill-slot="heading">Services configured in this service manager.</h2>
<p metal:fill-slot="empty_text">No services have been configured</p>
<div metal:fill-slot="extra_top">
<p>For each service, the service name is given and all of the
components registered to provide the service are shown. You
may select the component to provide the service or disable the
service.
</p>
<p>Select a service name or a component name to visit the service
or component.
</p>
</div>
<p metal:fill-slot="help_text">To configure a service, add a service
component to a <em>package</em> in <a href="Packages">Packages</a> or to
the <a href="Packages/default">default package</a>. After the component is
added, add a service configuration that configures the
component to provide a service.
</p>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/texttbentry.pt ===
<html>
<div tal:define="entry python:context.getLogEntryById(request.get('id'))">
<pre tal:content="entry/tb_text">
Traceback (text)
</pre>
</div>
</html>
=== Added File Zope3/src/zope/app/browser/services/view.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""Views for local view configuration.
ViewSeviceView -- it's a bit different from other services, as it
has a lot of things in it, so we provide a search interface:
search page
browsing page
ViewConfigrationAdd
$Id: view.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
__metaclass__ = type
import md5
from zope.app.form.utility \
import setUpWidgets, getWidgetsData, getWidgetsDataForContent, fieldNames
from zope.publisher.browser import BrowserView
from zope.app.interfaces.services.interfaces \
import IViewConfiguration, IViewConfigurationInfo
from zope.app.interfaces.services.interfaces \
import IPageConfiguration, IPageConfigurationInfo
from zope.event import publish
from zope.app.event.objectevent import ObjectCreatedEvent
from zope.app.interfaces.services.configuration import IConfiguration
from zope.app.services.view import ViewConfiguration, PageConfiguration
from zope.app.component.interfacefield import InterfaceField
from zope.interface import Interface
from zope.component import getView
from zope.proxy.context.context import ContextWrapper
from zope.schema import TextLine, BytesLine
from zope.component.interfaces import IPresentation
class IViewSearch(Interface):
forInterface = InterfaceField(title=u"For interface",
required=False,
)
presentationType = InterfaceField(title=u"Provided interface",
required=False,
type=IPresentation
)
viewName = TextLine(title=u'View name',
required=False,
)
layer = BytesLine(title=u'Layer',
required=False,
)
class ViewServiceView(BrowserView):
def __init__(self, *args):
super(ViewServiceView, self).__init__(*args)
setUpWidgets(self, IViewSearch)
def configInfo(self):
input_for = self.forInterface.getData()
input_type = self.presentationType.getData()
input_name = self.viewName.getData()
input_layer = self.layer.getData()
result = []
for info in self.context.getRegisteredMatching(
input_for, input_type, input_name, input_layer):
forInterface, presentationType, registry, layer, viewName = info
forInterface = (
forInterface.__module__ +"."+ forInterface.__name__)
presentationType = (
presentationType.__module__ +"."+ presentationType.__name__)
registry = ContextWrapper(registry, self.context)
view = getView(registry, "ChangeConfigurations", self.request)
prefix = md5.new('%s %s' %
(forInterface, presentationType)).hexdigest()
view.setPrefix(prefix)
view.update()
if input_name is not None:
viewName = None
if input_layer is not None:
layer = None
result.append(
{'forInterface': forInterface,
'presentationType': presentationType,
'view': view,
'viewName': viewName,
'layer': layer,
})
return result
=== Added File Zope3/src/zope/app/browser/services/view_search.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title></title></head>
<body>
<div metal:fill-slot="body">
<form action="." method="GET"
tal:attributes="action request/URL"
>
<table>
<tr tal:content="structure view/forInterface/row" />
<tr tal:content="structure view/presentationType/row" />
<tr>
<td></td>
<td>
<input type="submit" value="Refresh">
<input type="submit" value="Search" name="SEARCH">
</td>
</tr>
</table>
</form>
<form action="." method="POST"
tal:attributes="action request/URL"
tal:condition="request/SEARCH|nothing"
>
<table
tal:define="layer not:request/field.layer|nothing;
viewName not:request/field.viewName|nothing;
"
>
<tr>
<th>For/<br>Provided</th>
<th tal:condition="layer">Layer</th>
<th tal:condition="viewName">View name</th>
<th>Configuration</th>
</tr>
<tr tal:repeat="config view/configInfo">
<td> <span tal:content="config/forInterface" />/<br>
<span tal:content="config/presentationType" />
</td>
<td tal:condition="layer"
tal:content="config/layer">Layer</td>
<td tal:condition="viewName"
tal:content="config/viewName">View name</td>
<td tal:content="structure config/view" />
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" value="Update" name="UPDATE_SUBMIT">
</td>
</tr>
</table>
</form>
</div></body></html>
=== Added File Zope3/src/zope/app/browser/services/viewconfigsummary.pt ===
<span tal:replace="context/factoryName" />
=== Added File Zope3/src/zope/app/browser/services/viewpackage_contents.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
</style>
</head>
<body>
<div metal:fill-slot="body">
<form action="." method="get"
tal:define="container_contents view/listContentInfo"
>
<p>View Package Contents</p>
<div metal:use-macro="view/contentsMacros/macros/contents_table" />
<br />
<input type="text" name="name" />
<input type="submit" name="@@add.html:method" value="Add"
i18nXXX:attributes="value string:menu_add_button" />
<input type="submit" name="@@removeObjects.html:method" value="Delete"
i18nXXX:attributes="value string:menu_delete_button" />
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/services/zpt.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""XXX short summary goes here.
XXX longer description goes here.
$Id: zpt.py,v 1.1.2.1 2002/12/23 19:31:12 jim Exp $
"""
from zope.publisher.browser import BrowserView
__metaclass__ = type
class Source(BrowserView):
def __call__(self):
self.request.response.setHeader('content-type',
self.context.contentType)
return self.context.source