Commit dfa721ab authored by Jim Fulton's avatar Jim Fulton

Fixed permission problems and split join and save views

parent 96c8bda2
......@@ -84,7 +84,7 @@
##############################################################################
"""Version object"""
__version__='$Revision: 1.34 $'[11:-2]
__version__='$Revision: 1.35 $'[11:-2]
import Globals, time
from AccessControl.Role import RoleManager
......@@ -110,7 +110,9 @@ class Version(Persistent,Implicit,RoleManager,Item):
""" """
meta_type='Version'
manage_options=({'label':'Join/Leave', 'action':'manage_main'},
manage_options=(
{'label':'Join/Leave', 'action':'manage_main'},
{'label':'Save/Discard', 'action':'manage_end'},
{'label':'Properties', 'action':'manage_editForm'},
{'label':'Security', 'action':'manage_access'},
)
......@@ -118,17 +120,22 @@ class Version(Persistent,Implicit,RoleManager,Item):
__ac_permissions__=(
('View management screens', ('manage','manage_editForm', '')),
('Change Versions', ('manage_edit',)),
('Join/leave Versions', ('enter','leave','leave_another')),
('Save/discard Version changes', ('save','discard')),
('Join/leave Versions',
('manage_main', 'enter','leave','leave_another')),
('Save/discard Version changes',
('manage_end', 'save','discard')),
)
cookie=''
index_html=None # Ugh.
def __init__(self, id, title, REQUEST):
self.id=id
self.title=title
manage=manage_main=Globals.HTMLFile('version', globals())
manage_main=Globals.HTMLFile('version', globals())
manage_end=Globals.HTMLFile('versionEnd', globals())
manage_editForm =Globals.HTMLFile('versionEdit', globals())
def title_and_id(self):
......@@ -208,7 +215,7 @@ class Version(Persistent,Implicit,RoleManager,Item):
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(REQUEST['URL1']+'/manage_main')
def discard(self, REQUEST=None):
def discard(self, remark='', REQUEST=None):
'Discard changes made during the version'
try: db=self._p_jar.db()
except:
......@@ -216,6 +223,7 @@ class Version(Persistent,Implicit,RoleManager,Item):
Globals.VersionBase[self.cookie].abort()
else:
# ZODB 3
get_transaction().note(remark)
db.abortVersion(self.cookie)
if REQUEST is not None:
......
......@@ -40,29 +40,6 @@
<input type=submit value="Start Working in <!--#var title_or_id-->">
</form>
<!--#endif-->
<!--#if nonempty-->
<hr>
<p><form action=save>
You can make work done in <!--#var title_and_id--> permanent by
entering a remark in the space below and then
clicking on the "Save" button.<br>
<textarea name=remark rows=10 cols=50></textarea><br>
<input type=submit value="Save">
</form>
<hr>
<p><form action=discard>
You can throw away work done in <!--#var title_and_id--> by
clicking on the "Discard" button.
<input type=submit value="Discard">
</form>
<!--#endif-->
</body> </html>
......
<HTML><HEAD><TITLE><dtml-var title_or_id></TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<dtml-var manage_tabs>
<h2>Save or discard work done in a sesssion</h2>
<dtml-if nonempty>
<form action="&dtml-URL1;">
To save work done in version
<dtml-var id><dtml-if Zope-Version><dtml-if "_vars['Zope-Version'] != cookie">
<strong>to version
<em><dtml-var Zope-Version></em></strong></dtml-if></dtml-if>,
click on the &quot;Save&quot; button. To discard work done in
version <dtml-var id>, click on the &quot;Discard&quot; button.
In either case, enter a comment to document the reason for
saving or discarding the version.<br>
<textarea name=remark rows=10 cols=50></textarea><br>
<input type=submit name="save:method" value="Save">
<input type=submit name="discard:method" value="Discard">
</form>
<dtml-else>
No unsaved work has been done in this version.
</dtml-if>
</body> </html>
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