Commit 6662981a authored by 's avatar

Made undo available only in folders

parent a9afbf36
"""Image object"""
__version__='$Revision: 1.21 $'[11:-2]
__version__='$Revision: 1.22 $'[11:-2]
from Globals import HTMLFile, MessageDialog
from AccessControl.Role import RoleManager
......@@ -30,9 +30,6 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
{'label':'Security', 'action':'manage_access',
'target':'manage_main',
},
{'label':'Undo', 'action':'manage_UndoForm',
'target':'manage_main',
},
)
__ac_permissions__=(
......
......@@ -14,63 +14,52 @@ Provide an area where people can work without others seeing their changes.
A Draft folder is a surrogate for a folder. It get\'s subobjects by
gettingthem from a session copy of a base folder.
$Id: DraftFolder.py,v 1.8 1997/12/31 19:27:10 jim Exp $'''
__version__='$Revision: 1.8 $'[11:-2]
$Id: DraftFolder.py,v 1.9 1998/01/02 17:41:19 brian Exp $'''
__version__='$Revision: 1.9 $'[11:-2]
import time, OFS.SimpleItem, AccessControl.Role
import Persistence, Acquisition, Globals
import AccessControl.User, Session
from string import rfind
import Globals, Session, time
from AccessControl.Role import RoleManager
from AccessControl.User import UserFolder
from App.Management import Management
from Persistence import Persistent
from Acquisition import Implicit
from OFS.SimpleItem import Item
from Session import Session
from Globals import HTMLFile
from string import rfind
addForm=HTMLFile('draftFolderAdd', globals())
def add(self,id,baseid,title='',REQUEST=None):
"""Add a new Folder object"""
i=DraftFolder()
i._init(id, baseid, title, self,REQUEST)
self._setObject(id,i)
if REQUEST is not None: return self.manage_main(self,REQUEST)
def hack(self):
return ({'icon':icon, 'label':'Contents',
'action':'manage_main', 'target':'manage_main'},
{'icon':'OFS/Properties_icon.gif', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main'},
{'icon':'', 'label':'Security',
'action':'manage_access', 'target':'manage_main'},
{'icon':'App/undo_icon.gif', 'label':'Undo',
'action':'manage_UndoForm', 'target':'manage_main'},
{'icon':'OFS/DraftFolderControl.gif', 'label':'Supervise',
'action':'manage_Supervise', 'target':'manage_main'},
)
class DraftFolder(Persistence.Persistent,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item,
Acquisition.Implicit,
Management,
):
""" """
self._setObject(id, DraftFolder(id, baseid, title, self, REQUEST))
if REQUEST: return self.manage_main(self,REQUEST)
class DraftFolder(Persistent,Implicit,RoleManager,Management,Item):
""" """
meta_type='Draft Folder'
icon='misc_/OFSP/DraftFolderIcon'
isPrincipiaFolderish=1
manage_options=(
{'icon':icon, 'label':'Contents',
'action':'manage_main', 'target':'manage_main'},
{'icon':'OFS/Properties_icon.gif', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main'},
{'icon':'', 'label':'Security',
'action':'manage_access', 'target':'manage_main'},
{'icon':'App/undo_icon.gif', 'label':'Undo',
'action':'manage_UndoForm', 'target':'manage_main'},
{'icon':'OFS/DraftFolderControl.gif', 'label':'Supervise',
'action':'manage_Supervise', 'target':'manage_main'},
{'label':'Contents', 'action':'manage_main',
'target':'manage_main'},
{'label':'Properties', 'action':'manage_propertiesForm',
'target':'manage_main'},
{'label':'Security', 'action':'manage_access',
'target':'manage_main'},
{'label':'Undo', 'action':'manage_UndoForm',
'target':'manage_main'},
{'label':'Supervise', 'action':'manage_Supervise',
'target':'manage_main'},
)
def _init(self, id, baseid, title, parent, REQUEST):
def __init__(self, id, baseid, title, parent, REQUEST):
if hasattr(parent, 'aq_self'): parent=parent.aq_self
if not hasattr(parent, baseid):
raise 'Input Error', (
......@@ -86,22 +75,19 @@ class DraftFolder(Persistence.Persistent,
if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id)
self.cookie_name="%s-Draft-Folder-%s" % (id,baseid)
self.__allow_groups__=Supervisor()
self.__allow_groups__._init()
def title_and_id(self):
r=DraftFolder.inheritedAttribute('title_and_id')(self)
r='%s *' % r
try: base=getattr(self.aq_parent, self.baseid)
try: base=getattr(self.aq_parent, self.baseid)
except: base=None
if base is not None:
r="%s Draft Folder: %s" % (base.title_or_id(), r)
return r
def _base(self, cookie):
# Check for base object
if hasattr(self, 'aq_parent'): parent=self.aq_parent
else: parent=None
......@@ -114,7 +100,6 @@ class DraftFolder(Persistence.Persistent,
does not exist.'''
% self.cookie
)
base=getattr(parent, baseid)
pd=Globals.SessionBase[cookie]
......@@ -123,15 +108,12 @@ class DraftFolder(Persistence.Persistent,
base=base.aq_parent
if hasattr(base, '_p_oid'): oids.append(base._p_oid)
else: break
while oids:
oid=oids[-1]
del oids[-1]
base=pd.jar[oid].__of__(base)
base.manage_options=hack
return base
def __bobo_traverse__(self, REQUEST, name):
cookie_name=self.cookie_name
cookie=''
......@@ -198,11 +180,12 @@ class DraftFolder(Persistence.Persistent,
except: return ()
class Supervisor(AccessControl.User.UserFolder, Session.Session):
class Supervisor(UserFolder, Session):
manage=manage_main=HTMLFile('DraftFolderSupervisor', globals())
manage_options=() # This is a simple item
manage_options=()
def __init__(self):
UserFolder.__init__(self)
......@@ -210,6 +193,9 @@ class Supervisor(AccessControl.User.UserFolder, Session.Session):
##############################################################################
#
# $Log: DraftFolder.py,v $
# Revision 1.9 1998/01/02 17:41:19 brian
# Made undo available only in folders
#
# Revision 1.8 1997/12/31 19:27:10 jim
# *** empty log message ***
#
......
#!/bin/env python
##############################################################################
#
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
__doc__='''A drop-in object that represents a session.
"""Session object"""
__version__='$Revision: 1.13 $'[11:-2]
$Id: Session.py,v 1.12 1997/12/31 20:34:05 brian Exp $'''
import time, OFS.SimpleItem, AccessControl.Role
import Persistence, Acquisition, Globals
import Globals, time
from AccessControl.Role import RoleManager
from Globals import MessageDialog
from Persistence import Persistent
from Acquisition import Implicit
from OFS.SimpleItem import Item
from string import rfind
addForm=Globals.HTMLFile('sessionAdd', globals())
def add(self, id, title, REQUEST=None):
'Add a session'
i=Session()
i._init(id, title, REQUEST)
self._setObject(id,i)
""" """
self._setObject(id, Session(id,title,REQUEST))
return self.manage_main(self,REQUEST)
class Session(Persistence.Persistent,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item,
Acquisition.Implicit):
'''Model sessions as drop-in objects
'''
class Session(Persistent,Implicit,RoleManager,Item):
""" """
meta_type='Session'
icon='misc_/OFSP/session'
icon ='misc_/OFSP/session'
manage_options=({'icon':'', 'label':'Join/Leave',
'action':'manage_main', 'target':'manage_main',
manage_options=({'label':'Join/Leave', 'action':'manage_main',
'target':'manage_main',
},
{'icon':'', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main',
{'label':'Properties', 'action':'manage_editForm',
'target':'manage_main',
},
{'icon':'', 'label':'Security',
'action':'manage_access', 'target':'manage_main',
},
{'icon':'', 'label':'Undo',
'action':'manage_UndoForm','target':'manage_main',
{'label':'Security', 'action':'manage_access',
'target':'manage_main',
},
)
__ac_permissions__=(
('View management screens', ['manage','manage_tabs','index_html']),
('View management screens', ['manage','manage_tabs','manage_editForm',
'index_html']),
('Change permissions', ['manage_access']),
('Edit session', ['manage_edit']),
('Join/leave session', ['enter','leave','leave_another']),
......@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
__ac_types__=(('Full Access', map(lambda x: x[0], __ac_permissions__)),
)
def _init(self, id, title, REQUEST):
def __init__(self, id, title, REQUEST):
self.id=id
self.title=title
cookie=REQUEST['PATH_INFO']
......@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
self.cookie="%s/%s" % (cookie, id)
manage=manage_main=Globals.HTMLFile('session', globals())
manage_properties=Globals.HTMLFile('sessionEdit', globals())
manage_editForm =Globals.HTMLFile('sessionEdit', globals())
def title_and_id(self):
r=Session.inheritedAttribute('title_and_id')(self)
......@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
return r
def manage_edit(self, title, REQUEST=None):
'Modify a session'
self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST)
""" """
self.title=title
if REQUEST: return MessageDialog(
title ='Success!',
message='Your changes have been saved',
action ='manage_main')
def enter(self, REQUEST, RESPONSE):
'Begin working in a session'
"""Begin working in a session"""
RESPONSE.setCookie(
Globals.SessionNameName, self.cookie,
#expires="Mon, 27-Dec-99 23:59:59 GMT",
......@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session'
"""Temporarily stop working in a session"""
RESPONSE.setCookie(
Globals.SessionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT",
......@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
def leave_another(self, REQUEST, RESPONSE):
'Leave a session that may not be the current session'
"""Leave a session that may not be the current session"""
return self.leave(REQUEST, RESPONSE)
def save(self, remark, REQUEST=None):
'Make session changes permanent'
"""Make session changes permanent"""
Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.manage_main(self, REQUEST)
if REQUEST: return self.manage_main(self, REQUEST)
def discard(self, REQUEST=None):
'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.manage_main(self, REQUEST)
if REQUEST: return self.manage_main(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.12 $'[11:-2]
......@@ -128,6 +113,9 @@ __version__='$Revision: 1.12 $'[11:-2]
##############################################################################
#
# $Log: Session.py,v $
# Revision 1.13 1998/01/02 17:41:19 brian
# Made undo available only in folders
#
# Revision 1.12 1997/12/31 20:34:05 brian
# Fix bad ref to SimpleItem caused by moving
#
......
#!/bin/env python
##############################################################################
#
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
__doc__='''A drop-in object that represents a session.
"""Session object"""
__version__='$Revision: 1.13 $'[11:-2]
$Id: Version.py,v 1.12 1997/12/31 20:34:05 brian Exp $'''
import time, OFS.SimpleItem, AccessControl.Role
import Persistence, Acquisition, Globals
import Globals, time
from AccessControl.Role import RoleManager
from Globals import MessageDialog
from Persistence import Persistent
from Acquisition import Implicit
from OFS.SimpleItem import Item
from string import rfind
addForm=Globals.HTMLFile('sessionAdd', globals())
def add(self, id, title, REQUEST=None):
'Add a session'
i=Session()
i._init(id, title, REQUEST)
self._setObject(id,i)
""" """
self._setObject(id, Session(id,title,REQUEST))
return self.manage_main(self,REQUEST)
class Session(Persistence.Persistent,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item,
Acquisition.Implicit):
'''Model sessions as drop-in objects
'''
class Session(Persistent,Implicit,RoleManager,Item):
""" """
meta_type='Session'
icon='misc_/OFSP/session'
icon ='misc_/OFSP/session'
manage_options=({'icon':'', 'label':'Join/Leave',
'action':'manage_main', 'target':'manage_main',
manage_options=({'label':'Join/Leave', 'action':'manage_main',
'target':'manage_main',
},
{'icon':'', 'label':'Properties',
'action':'manage_propertiesForm', 'target':'manage_main',
{'label':'Properties', 'action':'manage_editForm',
'target':'manage_main',
},
{'icon':'', 'label':'Security',
'action':'manage_access', 'target':'manage_main',
},
{'icon':'', 'label':'Undo',
'action':'manage_UndoForm','target':'manage_main',
{'label':'Security', 'action':'manage_access',
'target':'manage_main',
},
)
__ac_permissions__=(
('View management screens', ['manage','manage_tabs','index_html']),
('View management screens', ['manage','manage_tabs','manage_editForm',
'index_html']),
('Change permissions', ['manage_access']),
('Edit session', ['manage_edit']),
('Join/leave session', ['enter','leave','leave_another']),
......@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
__ac_types__=(('Full Access', map(lambda x: x[0], __ac_permissions__)),
)
def _init(self, id, title, REQUEST):
def __init__(self, id, title, REQUEST):
self.id=id
self.title=title
cookie=REQUEST['PATH_INFO']
......@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
self.cookie="%s/%s" % (cookie, id)
manage=manage_main=Globals.HTMLFile('session', globals())
manage_properties=Globals.HTMLFile('sessionEdit', globals())
manage_editForm =Globals.HTMLFile('sessionEdit', globals())
def title_and_id(self):
r=Session.inheritedAttribute('title_and_id')(self)
......@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
return r
def manage_edit(self, title, REQUEST=None):
'Modify a session'
self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST)
""" """
self.title=title
if REQUEST: return MessageDialog(
title ='Success!',
message='Your changes have been saved',
action ='manage_main')
def enter(self, REQUEST, RESPONSE):
'Begin working in a session'
"""Begin working in a session"""
RESPONSE.setCookie(
Globals.SessionNameName, self.cookie,
#expires="Mon, 27-Dec-99 23:59:59 GMT",
......@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session'
"""Temporarily stop working in a session"""
RESPONSE.setCookie(
Globals.SessionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT",
......@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
return RESPONSE.redirect(REQUEST['URL1']+'/manage_main')
def leave_another(self, REQUEST, RESPONSE):
'Leave a session that may not be the current session'
"""Leave a session that may not be the current session"""
return self.leave(REQUEST, RESPONSE)
def save(self, remark, REQUEST=None):
'Make session changes permanent'
"""Make session changes permanent"""
Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.manage_main(self, REQUEST)
if REQUEST: return self.manage_main(self, REQUEST)
def discard(self, REQUEST=None):
'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.manage_main(self, REQUEST)
if REQUEST: return self.manage_main(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.12 $'[11:-2]
......@@ -128,6 +113,9 @@ __version__='$Revision: 1.12 $'[11:-2]
##############################################################################
#
# $Log: Version.py,v $
# Revision 1.13 1998/01/02 17:41:19 brian
# Made undo available only in folders
#
# Revision 1.12 1997/12/31 20:34:05 brian
# Fix bad ref to SimpleItem caused by moving
#
......
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