[Zope3-checkins] CVS: Zope3/src/zope/app/browser - undo.py:1.1.2.1 undo_log.pt:1.1.2.1 configure.zcml:1.1.2.3
Jim Fulton
jim@zope.com
Tue, 24 Dec 2002 18:58:29 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv1437/src/zope/app/browser
Modified Files:
Tag: NameGeddon-branch
configure.zcml
Added Files:
Tag: NameGeddon-branch
undo.py undo_log.pt
Log Message:
Moved undo view to browser tree and fixed some more zcml files
=== Added File Zope3/src/zope/app/browser/undo.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: undo.py,v 1.1.2.1 2002/12/24 23:57:58 jim Exp $
"""
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()
=== Added File Zope3/src/zope/app/browser/undo_log.pt ===
<!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>
=== Zope3/src/zope/app/browser/configure.zcml 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/browser/configure.zcml:1.1.2.2 Tue Dec 24 07:50:45 2002
+++ Zope3/src/zope/app/browser/configure.zcml Tue Dec 24 18:57:58 2002
@@ -4,14 +4,14 @@
<browser:defaultView
name="classBrowser.html"
- for = "Interface.Interface"
+ for = "zope.interface.Interface"
permission="zope.View"
template="IBrowser.pt"
factory="zope.app.browser.introspector.IntrospectorView"
/>
<browser:menuItem
- for = "Interface.Interface"
+ for = "zope.interface.Interface"
title="Introspector"
menu="zmi_views"
action="classBrowser.html"/>
@@ -25,14 +25,6 @@
factory="zope.app.browser.introspector.IntrospectorView"
/>
-
-</zopeConfigure>
-
-<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:browser='http://namespaces.zope.org/browser'
->
-
<browser:view
name="zope.app.rdb.GadflyDA"
for="zope.app.interfaces.container.IAdding"
@@ -77,5 +69,16 @@
<browser:page name="testForm.html" template="Browser/testSQL.pt" />
<browser:page name="test.html" template="Browser/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>
+
</zopeConfigure>