Commit 500c9285 authored by Jim Fulton's avatar Jim Fulton

Added the ability to browse, compare, and revert to historical revisions for...

Added the ability to browse, compare, and revert to historical revisions for DTML methods and documents
parent 1dc79c3f
......@@ -84,8 +84,9 @@
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.44 $'[11:-2]
__version__='$Revision: 1.45 $'[11:-2]
import History
from Globals import HTML, HTMLFile, MessageDialog
from string import join,split,strip,rfind,atoi,lower
from SimpleItem import Item_w__name__, pretty_tb
......@@ -103,7 +104,9 @@ from AccessControl import getSecurityManager
class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
ElementWithTitle, Item_w__name__):
ElementWithTitle, Item_w__name__,
History.Historical,
):
"""DTML Method objects are DocumentTemplate.HTML objects that act
as methods of their containers."""
meta_type='DTML Method'
......@@ -127,6 +130,7 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
{'label':'Proxy', 'action':'manage_proxyForm',
'help':('OFSP','DTML-DocumentOrMethod_Proxy.dtml')},
)
+History.Historical.manage_options
+RoleManager.manage_options
+Item_w__name__.manage_options
)
......@@ -294,6 +298,14 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
return self.read()
def manage_historyCompare(self, rev1, rev2, REQUEST,
historyComparisonResults=''):
return DTMLMethod.inheritedAttribute('manage_historyCompare')(
self, rev1, rev2, REQUEST,
historyComparisonResults=History.html_diff(
rev1.read(), rev2.read()
))
import re
from string import find, strip
token = "[a-zA-Z0-9!#$%&'*+\-.\\\\^_`|~]+"
......@@ -322,8 +334,6 @@ def decapitate(html, RESPONSE=None):
RESPONSE.setHeader(hkey, join(header, ' '))
return html[spos + 1:]
default_dm_html="""<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<p>
......
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML lang="en">
<HEAD>
<TITLE>Change History</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<dtml-var manage_tabs>
<P>
<dtml-if manage_change_history>
<form action="&dtml-URL1;" method="POST">
<table>
<dtml-if first_transaction>
<tr><td colspan=2 align=center>
<dtml-with expr="_(next=first_transaction*2-last_transaction)">
<a href="&dtml-url;?first_transaction:int=&dtml.-next;&last_transaction:int=&dtml.first_transaction;&HistoryBatchSize:int=&dtml-.HistoryBatchSize;">
Later Revisions</a>
</dtml-with>
</td></tr>
</dtml-if>
<dtml-in manage_change_history mapping>
<tr>
<td valign="top">
<input type="checkbox" value="&dtml-key;" name="keys:list">
</td>
<td valign="top">
<a href="&dtml-absolute_url;/HistoricalRevisions/&dtml-key;/manage_workspace">
<dtml-var time fmt=Mon>
<dtml-var time fmt=day>
<dtml-var time fmt=Time>
<dtml-if user_name>&dtml-user_name;</dtml-if>
</a>
<br>&dtml-description;
<dtml-if revision><br>Revision: <em>&dtml-revision;</em></dtml-if>
</td>
</tr>
</dtml-in>
<dtml-if expr="_.len(manage_change_history) == HistoryBatchSize">
<tr><td colspan=2 align=center>
<dtml-with expr="_(last=last_transaction+HistoryBatchSize)">
<a href="manage_UndoForm?first_transaction:int=&dtml.-last_transaction;&last_transaction:int=&dtml.-last;&HistoryBatchSize:int=&dtml.-HistoryBatchSize;">
Earlier Revisions</a>
</dtml-with>
</td></tr>
</dtml-if>
<tr><td></td><td>
<input type="submit" name="manage_historyCopy:method"
value="Copy to present">
<input type="submit" name="manage_historicalComparison:method"
value="Compare">
</td></tr>
</table>
</form>
<dtml-else>
<dtml-if first_transaction>
<tr><td colspan=2 align=center>
<dtml-with expr="_(next=first_transaction*2-last_transaction)">
<a href="&dtml-url;?first_transaction:int=&dtml.-next;&last_transaction:int=&dtml.first_transaction;&HistoryBatchSize:int=&dtml-.HistoryBatchSize;">
Later Transactions</a>
</dtml-with>
</td></tr>
<dtml-else>
No change history is available for &dtml-id;
</dtml-if>
</dtml-if>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML lang="en">
<HEAD>
<TITLE>Historical Comparison for <dtml-var id></TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<dtml-var manage_tabs>
<table>
<tr><td>Changes to <dtml-var id> as of</td>
<td><dtml-var dt1></td></tr>
<tr><td>to get to <dtml-var id> as of</td>
<td><dtml-var dt2>.</td></tr>
</table>
<dtml-if historyComparisonResults>
<dtml-var historyComparisonResults>
<dtml-else>
This object doesn't provide comparison support.
</dtml-if>
</BODY>
</HTML>
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment