[Zope3-checkins] CVS: Zope3/src/zope/app/browser - __init__.py:1.2 absoluteurl.py:1.2 configure.zcml:1.2 gadflyda.py:1.2 introspector.pt:1.2 introspector.py:1.2 managementviewselector.py:1.2 menu.py:1.2 objectname.py:1.2 rdb.py:1.2 rdbadd.pt:1.2 rdbconnection.pt:1.2 rdbtestresults.pt:1.2 rdbtestsql.pt:1.2 undo.py:1.2 undo_log.pt:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:13:58 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/browser
Added Files:
__init__.py absoluteurl.py configure.zcml gadflyda.py
introspector.pt introspector.py managementviewselector.py
menu.py objectname.py rdb.py rdbadd.pt rdbconnection.pt
rdbtestresults.pt rdbtestsql.pt undo.py undo_log.pt
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/browser/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/__init__.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/browser/absoluteurl.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/absoluteurl.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,105 @@
+##############################################################################
+#
+# 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$
+"""
+from zope.publisher.browser import BrowserView
+from zope.proxy.context import getWrapperContainer, getInnerWrapperData
+from zope.component import getView
+
+class AbsoluteURL(BrowserView):
+
+ def __str__(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ container = getWrapperContainer(context)
+ if name is None or container is None:
+ raise TypeError, 'Not enough context information to get a URL'
+ if name == '.':
+ name = dict.get('side_effect_name', name)
+
+ return "%s/%s" % (getView(container, 'absolute_url', self.request),
+ name)
+
+ __call__ = __str__
+
+ def breadcrumbs(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ container = getWrapperContainer(context)
+ if name is None or container is None:
+ raise TypeError, 'Not enough context information to get a URL'
+
+ if name == '.':
+ # The name is meaningless. There is a side-efect name
+ # that we need to preserve in the urls (only)
+ name = dict.get('side_effect_name', name)
+ base = getView(container, 'absolute_url',
+ self.request).breadcrumbs()
+
+ # replace the last step in base with a step with the same
+ # name ans an augmented url
+ base = base[:-1] + ({
+ 'name': base[-1]['name'],
+ 'url': ("%s/%s" % (base[-1]['url'], name)),
+ }, )
+ return base
+
+ base = getView(container, 'absolute_url', self.request).breadcrumbs()
+ base += ({'name': name, 'url': ("%s/%s" % (base[-1]['url'], name))}, )
+ return base
+
+
+
+class SiteAbsoluteURL(BrowserView):
+
+ def __str__(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name:
+ if name == '.':
+ name = dict.get('side_effect_name', name)
+ container = getWrapperContainer(context)
+ return "%s/%s" % (getView(container, 'absolute_url', self.request),
+ name)
+
+ return self.request.getApplicationURL()
+
+ __call__ = __str__
+
+ def breadcrumbs(self):
+ context = self.context
+ dict = getInnerWrapperData(context)
+ name = dict and dict.get('name') or None
+ if name:
+ # The name is meaningless. There is a side-efect name
+ # that we need to preserve in the urls (only)
+ if name == '.':
+ name = dict.get('side_effect_name', name)
+ container = getWrapperContainer(context)
+ base = getView(container, 'absolute_url',
+ self.request).breadcrumbs()
+ # replace the last step in base with a step with the same
+ # name ans an augmented url
+ base = base[:-1] + (
+ {'name': base[-1]['name'],
+ 'url': ("%s/%s" % (base[-1]['url'], name))}, )
+ return base
+
+ return ({'name':'', 'url': self.request.getApplicationURL()}, )
=== Zope3/src/zope/app/browser/configure.zcml 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/configure.zcml Wed Dec 25 09:12:26 2002
@@ -0,0 +1,188 @@
+<zopeConfigure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
+
+<!-- Foundational setup -->
+
+ <!-- The default default view -->
+ <browser:defaultView name="index.html" />
+
+
+ <!-- Standard menus -->
+
+ <browser:menu
+ id="zmi_views"
+ title="Menu for displaying alternate representations of an object"
+ />
+
+ <browser:menu
+ id="zmi_actions"
+ title="Menu for displaying actions to be performed"
+ />
+
+ <browser:menu
+ id="add_content"
+ title="Menu of objects to be added to content folders"
+ />
+
+ <browser:menu
+ id="add_component"
+ title="Menu of objects to be added to service manager packages"
+ />
+
+ <browser:menu id="add_configuration"
+ title="Menu of addable configuration objects"
+ />
+
+
+ <!-- Management view selector -->
+ <!-- Get first accessable item from zmi_views menu -->
+ <browser:view
+ name="SelectedManagementView.html"
+ permission="zope.Public"
+ factory=".managementviewselector.ManagementViewSelector"
+ allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
+ allowed_attributes="__call__"
+ />
+
+ <!-- Menu access -->
+ <browser:view
+ name="view_get_menu"
+ permission="zope.Public"
+ factory=".menu.MenuAccessView"
+ allowed_interface="zope.app.interfaces.browser.menu.IMenuAccessView"
+ />
+
+<!-- includes -->
+
+<include package=".applicationcontrol" />
+<include package=".cache" />
+<include package=".component" />
+<include package=".container" />
+<include package=".content" />
+<include package=".dublincore" />
+<include package=".form" />
+<include package=".security" />
+<include package=".services" />
+<include package=".skins" />
+
+<!-- Introspection -->
+
+ <browser:defaultView
+ name="classBrowser.html"
+ for = "zope.interface.Interface"
+ permission="zope.View"
+ template="ibrowser.pt"
+ factory="zope.app.browser.introspector.IntrospectorView"
+ />
+
+ <browser:menuItem
+ for = "zope.interface.Interface"
+ title="Introspector"
+ menu="zmi_views"
+ action="classBrowser.html"
+ />
+
+
+ <browser:defaultView
+ name="interfaceBrowser.html"
+ for="zope.interface.interfaces.IInterface"
+ permission="zope.View"
+ template="ibrowser.pt"
+ factory="zope.app.browser.introspector.IntrospectorView"
+ />
+
+<!-- Gadfly DA -->
+
+ <browser:view
+ name="zope.app.rdb.GadflyDA"
+ for="zope.app.interfaces.container.IAdding"
+ factory="zope.app.browser.gadflyda.GadflyDAAddView"
+ permission="zope.ManageServices">
+
+ <browser:page name="+" attribute="add" />
+ <browser:page name="action.html" attribute="action" />
+
+ </browser:view>
+
+ <browser:menuItem menu="add_component"
+ for="zope.app.interfaces.container.IAdding"
+ title="Gadfly DA"
+ action="zope.app.rdb.GadflyDA"
+ description="A Gadfly Database Adapter"/>
+
+<!-- ZopeDatabaseAdapter default views -->
+
+ <browser:defaultView for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
+ name="editForm.html" />
+
+ <browser:menuItems menu="zmi_views"
+ for="zope.app.interfaces.rdb.IZopeDatabaseAdapter">
+ <browser:menuItem title="Edit" action="editForm.html"/>
+ <browser:menuItem title="Test" action="testForm.html"/>
+ </browser:menuItems>
+
+ <browser:view
+ for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
+ permission="zope.View"
+ factory="zope.app.browser.rdb.Connection">
+ <browser:page name="editForm.html"
+ template="connection.pt" />
+ <browser:page name="edit.html" attribute="edit" />
+ <browser:page name="connect.html" attribute="connect" />
+ <browser:page name="disconnect.html" attribute="disconnect" />
+
+ </browser:view>
+
+ <browser:view
+ for="zope.app.interfaces.rdb.IZopeDatabaseAdapter"
+ permission="zope.View"
+ factory="zope.app.browser.rdb.TestSQL">
+ <browser:page name="testForm.html" template="testsql.pt" />
+ <browser:page name="test.html" template="testresults.pt" />
+
+ </browser:view>
+
+<!-- Undo -->
+
+ <browser:view
+ permission="zope.ManageContent"
+ factory="zope.app.browser.undo.Undo" >
+
+ <browser:page name="undoForm.html" attribute="index" />
+ <browser:page name="undo.html" attribute="action" />
+ </browser:view>
+
+<!-- URLs and names -->
+
+<browser:view
+ name="absolute_url"
+ factory=".absoluteurl.AbsoluteURL"
+ permission="zope.Public"
+ allowed_interface="zope.app.interfaces.browser.absoluteurl.IAbsoluteURL"
+ />
+
+<browser:view
+ for="zope.app.interfaces.content.folder.IRootFolder"
+ name="absolute_url"
+ factory=".absoluteurl.SiteAbsoluteURL"
+ permission="zope.Public"
+ allowed_interface="zope.app.interfaces.browser.absoluteurl.IAbsoluteURL"
+ />
+
+<browser:view
+ name="object_name"
+ factory=".objectname.ObjectNameView"
+ permission="zope.Public"
+ allowed_interface="zope.app.interfaces.traversing.objectname.IObjectName"
+ />
+
+<browser:view
+ for="zope.app.interfaces.content.folder.IRootFolder"
+ name="object_name"
+ factory=".objectname.SiteObjectNameView"
+ permission="zope.Public"
+ allowed_interface="zope.app.interfaces.traversing.objectname.IObjectName"
+ />
+
+</zopeConfigure>
=== Zope3/src/zope/app/browser/gadflyda.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/gadflyda.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# 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.app.browser.rdb import AdapterAdd
+from zope.app.interfaces.container import IAdding
+
+
+class GadflyDAAddView(AdapterAdd):
+ """Provide a user interface for adding a Gadfly DA"""
+
+ # This needs to be overridden by the actual implementation
+ _adapter_factory_id = "GadflyDA"
=== Zope3/src/zope/app/browser/introspector.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/introspector.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,155 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+
+<style metal:fill-slot="style_slot">
+.preclass {
+ color : #000066;
+ font-family : monospace;
+ white-space : pre;
+ }
+th.introspector {
+ vertical-align: top;
+ }
+</style>
+</head>
+
+<body>
+<div metal:fill-slot="body">
+<tal:block
+ tal:define =
+ "global introspector view/getIntrospector;
+ global services view/getServicesFor">
+
+<div tal:condition="python:introspector.isInterface()">
+
+<table tal:define =
+ "global interfacedata introspector/getInterfaceDetails">
+ <tr>
+ <th colspan="2">Interface Browser</th>
+ </tr>
+ <tr>
+ <th class="introspector">Interface :</th>
+ <td tal:content="python:interfacedata[0]">Interface</td>
+ </tr>
+ <tr>
+ <th class="introspector">Bases :</th>
+ <td>
+ <div tal:repeat="interface python:interfacedata[1]">
+ <a href=""
+ tal:attributes="href
+ string: ++module++${repeat/interface/item}"
+ tal:content="repeat/interface/item">Interface</a>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th class="introspector">Description :</th>
+ <td>
+ <!-- the start of all of these preclass spans are carefully
+ spatially placed (in terms of whitespace), because they are
+ "pre" formatted (i.e., whitespace matters within the span) -->
+ <span class="preclass"
+ tal:content="python:interfacedata[2]">
+ Description</span>
+ </td>
+ </tr>
+ <tr>
+ <th class="introspector">Attributes :</th>
+ <td>
+ <div tal:repeat="attributes python:interfacedata[4]">
+ <tal:block tal:define="details repeat/attributes/item">
+ <strong tal:content="python:details[0]">
+ Atttribute Name</strong>
+ <div class="preclass">
+ <span
+ tal:content="python:details[1]">
+ Attribute Description</span></div>
+ </tal:block>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th class="introspector">Methods :</th>
+ <td>
+ <div tal:repeat="methods python:interfacedata[3]">
+ <tal:block tal:define="details repeat/methods/item">
+ <strong tal:content="python:details[0]">
+ Method Name</strong>
+ <strong tal:content="python:details[1]">
+ Signature</strong>
+ <div class="preclass">
+ <span
+ tal:content="python:details[2]">
+ Method Description</span></div>
+ </tal:block>
+ </div>
+ </td>
+ </tr>
+ <!-- this section is currently not available
+ <tr>
+ <th class="introspector">Services :</th>
+ <td>
+ <div tal:repeat="servicedic services">
+ <span tal:define="dic repeat/servicedic/item">
+ <a tal:content="python:dic.keys()[0]"/>
+ </span>
+ </div>
+ </td>
+ </tr>
+ -->
+</table>
+</div>
+
+<div tal:condition="python:introspector.isInterface()==0">
+
+<table>
+ <tr>
+ <th colspan="2">Class Browser</th>
+ </tr>
+ <tr>
+ <th class="introspector">Class :</th>
+ <td><span tal:content="introspector/getClass">Name</span></td>
+ </tr>
+ <tr>
+ <th class="introspector">Bases :</th>
+ <td>
+ <div tal:repeat="base introspector/getBaseClassNames">
+ <a href=""
+ tal:attributes="href
+ string: ++module++${repeat/base/item}"
+ tal:content="repeat/base/item">Base</a>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th class="introspector">Module :</th>
+ <td><span tal:content="introspector/getModule">Module</span></td>
+ </tr>
+ <tr>
+ <th>Description :</th>
+ <td>
+ <span class="preclass"
+ tal:content="introspector/getDocString">
+ Description</span>
+ </td>
+ </tr>
+ <tr>
+ <th class="introspector">Interface :</th>
+ <td>
+ <div tal:repeat="interface introspector/getInterfaceNames">
+ <a href=""
+ tal:attributes="href
+ string: ++module++${repeat/interface/item}"
+ tal:content="repeat/interface/item">Interface</a>
+ </div>
+ </td>
+ </tr>
+</table>
+</div>
+
+</tal:block>
+
+</div>
+</body>
+</html>
+
=== Zope3/src/zope/app/browser/introspector.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/introspector.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,64 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+from zope.publisher.browser import BrowserView
+from zope.app.interfaces.introspector import IIntrospector
+from zope.component import getAdapter
+# XXX only used for commented-out section below
+# from zope.component import getServiceManager, getServiceDefinitions, \
+# queryAdapter, getService
+from zope.component.exceptions import ComponentLookupError
+
+
+class IntrospectorView(BrowserView):
+
+ def getIntrospector(self):
+ introspector = getAdapter(self.context, IIntrospector)
+ introspector.setRequest(self.request)
+ return introspector
+
+ def getServicesFor(self):
+ services = []
+ #sm = getServiceManager(self.context)
+ #for stype, interface in sm.getServiceDefinitions():
+ # try:
+ # service = getService(self.context, stype)
+ # except ComponentLookupError:
+ # pass
+ # else:
+ # # XXX IConfigureFor appears to have disappeared at some point
+ # adapter = queryAdapter(service, IConfigureFor)
+ # if (adapter is not None
+ # and adapter.hasConfigurationFor(self.context)):
+ # search_result = service.getRegisteredMatching(
+ # self.context, None, [], self.context)
+ # directive_path = []
+ # if search_result:
+ # for eachitem in search_result:
+ # dir_list = eachitem['directives']
+ # component_path = eachitem['component_path']
+ # for item in dir_list:
+ # directives = item[2]
+ # if directives:
+ # if directives[0] is None:
+ # directives = directives[1:]
+ # for directive in directives:
+ # for component in component_path:
+ # if component['component'] == directive:
+ # directive_path.append(component['path'])
+ # services.append({
+ # 'type': stype,
+ # 'service': service,
+ # 'path': directive_path
+ # })
+ return services
=== Zope3/src/zope/app/browser/managementviewselector.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/managementviewselector.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# 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$
+"""
+
+__metaclass__ = type
+
+from zope.component import getService
+from zope.publisher.browser import BrowserView
+from zope.publisher.interfaces.browser import IBrowserPublisher
+
+class ManagementViewSelector(BrowserView):
+ """View that selects the first available management view
+ """
+
+ __implements__ = BrowserView.__implements__, IBrowserPublisher
+
+ def browserDefault(self, request):
+ return self, ()
+
+ def __call__(self):
+ context = self.context
+ request = self.request
+ browser_menu_service = getService(context, 'BrowserMenu')
+ item = browser_menu_service.getFirstMenuItem(
+ 'zmi_views', context, request)
+ if item:
+ request.response.redirect(item['action'])
+ return u''
+
+ request.response.redirect('.') # Redirect to content/
+ return u''
+
+
+__doc__ = ManagementViewSelector.__doc__ + __doc__
=== Zope3/src/zope/app/browser/menu.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/menu.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# 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.publisher.browser import BrowserView
+from zope.app.interfaces.browser.menu import IMenuAccessView
+from zope.component import getService
+
+class MenuAccessView(BrowserView):
+ __doc__ = IMenuAccessView.__doc__
+
+ __implements__ = BrowserView.__implements__, IMenuAccessView
+
+ def __getitem__(self, menu_id):
+ context = self.context
+ request = self.request
+ browser_menu_service = getService(context, 'BrowserMenu')
+ return browser_menu_service.getMenu(menu_id,
+ self.context,
+ self.request)
+
+
+__doc__ = MenuAccessView.__doc__ + __doc__
=== Zope3/src/zope/app/browser/objectname.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/objectname.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# 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$
+"""
+from zope.publisher.interfaces.browser import IBrowserView
+from zope.proxy.context import getInnerWrapperData
+from zope.app.traversing.objectname \
+ import IObjectName, ObjectName, SiteObjectName
+
+class ObjectNameView(ObjectName):
+
+ __implements__ = IBrowserView, IObjectName
+
+ def __init__(self, context, request):
+ self.context = context
+
+
+class SiteObjectNameView(SiteObjectName):
+
+ __implements__ = IBrowserView, IObjectName
+
+ def __init__(self, context, request):
+ pass
=== Zope3/src/zope/app/browser/rdb.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/browser/rdb.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Zope database adapter views
+
+$Id$
+"""
+from zope.component import getFactory
+from zope.proxy.introspection import removeAllProxies
+from zope.publisher.browser import BrowserView
+
+from zope.app.interfaces.container import IAdding
+from zope.app.interfaces.rdb import IZopeDatabaseAdapter
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.rdb import queryForResults
+
+
+class TestSQL(BrowserView):
+
+ __used_for__ = IZopeDatabaseAdapter
+
+ def getTestResults(self):
+ sql = self.request.form['sql']
+ adapter = removeAllProxies(self.context)
+ result = queryForResults(adapter(), sql)
+ return result
+
+
+class Connection(BrowserView):
+
+ __used_for__ = IZopeDatabaseAdapter
+
+ def edit(self, dsn):
+ self.context.setDSN(dsn)
+ return self.request.response.redirect(self.request.URL[-1])
+
+ def connect(self):
+ self.context.connect()
+ return self.request.response.redirect(self.request.URL[-1])
+
+ def disconnect(self):
+ self.context.disconnect()
+ return self.request.response.redirect(self.request.URL[-1])
+
+
+class AdapterAdd(BrowserView):
+ """A base class for Zope database adapter adding views.
+
+ Subclasses need to override _adapter_factory_id.
+ """
+
+ __used_for__ = IAdding
+
+ # This needs to be overridden by the actual implementation
+ _adapter_factory_id = None
+
+ add = ViewPageTemplateFile('add.pt')
+
+ def action(self, dsn):
+ factory = getFactory(self, self._adapter_factory_id)
+ adapter = factory(dsn)
+ self.context.add(adapter)
+ self.request.response.redirect(self.context.nextURL())
=== Zope3/src/zope/app/browser/rdbadd.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/rdbadd.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,33 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+ <title>Add Relational Database Adapter</title>
+</head>
+<body>
+
+ <div metal:fill-slot="body">
+
+ <form action="action.html" method="post" enctype="multipart/form-data">
+
+ <table>
+ <tbody>
+
+ <tr>
+ <th>Connection URI:</th>
+ <td>
+ Template:
+ dbi://username:password@host:port/dbname;param1=value...<br />
+ <input type="text" name="dsn" size="40" value="dbi://dbname">
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <input type="submit" name="add" value="Add" />
+
+ </form>
+
+ </div>
+
+</body>
+</html>
=== Zope3/src/zope/app/browser/rdbconnection.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/rdbconnection.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,38 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+ <title>Add Relational Database Adapter</title>
+</head>
+<body>
+
+ <div metal:fill-slot="body">
+
+ <form action="." method="post" enctype="multipart/form-data">
+
+ <table>
+ <tbody>
+
+ <tr>
+ <th>Connection URI:</th>
+ <td>
+ Template:
+ dbi://username:password@host:port/dbname;param1=value...<br />
+ <input type="text" name="dsn" size="40" value=""
+ tal:attributes="value context/getDSN">
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <input type="submit" name="edit.html:method" value="Save Changes" />
+ <input type="submit" name="connect.html:method" value="Connect"
+ tal:condition="python: not context.isConnected()" />
+ <input type="submit" name="disconnect.html:method" value="Disconnect"
+ tal:condition="python: context.isConnected()" />
+
+ </form>
+
+ </div>
+
+</body>
+</html>
\ No newline at end of file
=== Zope3/src/zope/app/browser/rdbtestresults.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/rdbtestresults.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,32 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+ <title>Database Adapter - Test Connection</title>
+</head>
+<body>
+
+ <div metal:fill-slot="body">
+
+ <pre tal:content="request/form/sql" />
+
+ <table border="1"
+ tal:define="result view/getTestResults"
+ tal:condition="result">
+ <tbody>
+
+ <tr>
+ <th tal:repeat="field result/columns"
+ tal:content="field">Field Name</th>
+ </tr>
+
+ <tr tal:repeat="row result">
+ <td tal:repeat="field result/columns"
+ tal:content="python: getattr(row, field)">Value</td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ </div>
+
+</body>
+</html>
=== Zope3/src/zope/app/browser/rdbtestsql.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/rdbtestsql.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,35 @@
+<html metal:use-macro="views/standard_macros/page">
+<head>
+ <title>Database Adapter - Test Connection</title>
+</head>
+<body>
+
+ <div metal:fill-slot="body">
+
+ <form action="." method="post" enctype="multipart/form-data">
+
+ <p>Here you can enter an SQL statement, so you can test the
+ connection.</p>
+
+ <table>
+ <tbody>
+
+ <tr>
+ <th>Query</th>
+ <td>
+ <textarea name="sql" cols="60" rows="10"
+ >SELECT * FROM Table</textarea>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <input type="submit" name="test.html:method" value="Execute" />
+
+ </form>
+
+ </div>
+
+</body>
+</html>
=== Zope3/src/zope/app/browser/undo.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/undo.py Wed Dec 25 09:12:26 2002
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# 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$
+"""
+from zope.component import getUtility
+from zope.publisher.browser import BrowserView
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.interfaces.undo import IUndoManager
+
+
+class ZODBUndoManager:
+ """Implement the basic undo management api for a single ZODB database.
+ """
+
+ __implements__ = IUndoManager
+
+ def __init__(self, db):
+ self.__db = db
+
+ ############################################################
+ # Implementation methods for interface
+ # zope.app.interfaces.undo.IUndoManager.
+
+ def getUndoInfo(self):
+ '''See interface IUndoManager'''
+
+ return self.__db.undoInfo()
+
+ def undoTransaction(self, id_list):
+ '''See interface IUndoManager'''
+
+ for id in id_list:
+ self.__db.undo(id)
+
+ #
+ ############################################################
+
+
+class Undo(BrowserView):
+ """Undo View"""
+
+ def __init__(self, *args):
+ super(Undo, self).__init__(*args)
+ self.utility = getUtility(self.context, IUndoManager)
+
+ index = ViewPageTemplateFile('undo_log.pt')
+
+ def action (self, id_list, REQUEST=None):
+ """
+ processes undo form and redirects to form again (if possible)
+ """
+ self.utility.undoTransaction(id_list)
+
+ if REQUEST is not None:
+ REQUEST.response.redirect('index.html')
+
+ def getUndoInfo(self):
+ return self.utility.getUndoInfo()
=== Zope3/src/zope/app/browser/undo_log.pt 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:58 2002
+++ Zope3/src/zope/app/browser/undo_log.pt Wed Dec 25 09:12:26 2002
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html metal:use-macro="views/standard_macros/page">
+
+<head>
+<title>Undo Title</title>
+<link rel="stylesheet" type="text/css" href="/manage_page_style.css">
+</head>
+
+<body>
+<div metal:fill-slot="body">
+
+<form action="@@undo.html" method="post">
+
+<p class="form-help">
+This application's transactional feature allows you to easily undo changes
+made to the application's settings or data. You can revert the application
+to a "snapshot" of it's state at a previous point in time.
+</p>
+
+<p class="form-help">
+Select one or more transactions below and then click on the "Undo"
+button to undo those transactions. Note that even though a transaction
+is shown below, you may not be able to undo it if later transactions
+modified objects that were modified by a selected transaction.
+</p>
+
+
+
+<a name="t_list" />
+
+<table width="100%" cellspacing="0" cellpadding="2" border="0">
+
+ <span tal:define="global undoInfo view/getUndoInfo" />
+ <div tal:repeat="undoitem undoInfo">
+ <span tal:condition="repeat/undoitem/odd" ><span tal:define="global rowclass string:row-hilite"/> </span>
+ <span tal:condition="repeat/undoitem/even" ><span tal:define="global rowclass string:row-normal"/> </span>
+
+ <tr tal:attributes="class rowclass">
+ <td width="16" align="left" valign="top">
+ <input type=checkbox name="id_list:list" value="-1" tal:attributes="value undoitem/id"/>
+ </td>
+ <td align="left" valign="top">
+ <div class="list-item">
+
+ <span tal:content="undoitem/description"> description </span>
+ by
+ <strong><span tal:content="undoitem/user_name"> user_name </span></strong>
+
+ </div>
+ </td>
+<!--
+ <td align="right" valign="top" colspan="2" nowrap>
+ <div class="list-item" tal:content="undoitem/time">
+ blah date
+ </div>
+ </td>
+-->
+ </tr>
+
+
+<!--
+
+ <tr class="row-hilite">
+ <td width="16" align="left" valign="top">
+ <input type="checkbox" name="transaction_info:list"
+ value="QTBOekEwdWl6ZmNBQUFBQUV2M0RDdw==
+ 2002/03/17 00:23:17.7272 US/Eastern /test_area/chumphries/devis_internal_site/people/addDTMLMethod " />
+ </td>
+ <td align="left" valign="top">
+ <div class="list-item">
+ /test_area/chumphries/devis_internal_site/people/addDTMLMethod by <strong> chumphries</strong>
+ </div>
+ </td>
+ <td align="right" valign="top" colspan="2" nowrap>
+ <div class="list-item">
+ 2002-03-17 12:23:17 AM
+ </div>
+ </td>
+ </tr>
+
+ </div>
+
+ <tr class="row-normal">
+ <td width="16" align="left" valign="top">
+ <input type="checkbox" name="transaction_info:list"
+ value="QTBOeTQzWURnOVVBQUFBQUV2M0FkUQ==
+ 2002/03/16 23:51:27.6595 US/Eastern /test_area/chumphries/devis_internal_site/manage_renameObjects " />
+ </td>
+ <td align="left" valign="top">
+ <div class="list-item">
+ /test_area/chumphries/devis_internal_site/manage_renameObjects by <strong> chumphries</strong>
+ </div>
+ </td>
+ <td align="right" valign="top" colspan="2" nowrap>
+ <div class="list-item">
+ 2002-03-16 11:51:27 PM
+ </div>
+ </td>
+ </tr>
+
+-->
+
+
+</div>
+<tr><td><input type="submit" value="Undo"></td></tr>
+</table>
+</form>
+
+</div>
+</body>
+</html>
+