Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
6662981a
Commit
6662981a
authored
Jan 02, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made undo available only in folders
parent
a9afbf36
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
164 deletions
+123
-164
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+1
-4
lib/python/Products/OFSP/DraftFolder.py
lib/python/Products/OFSP/DraftFolder.py
+40
-54
lib/python/Products/OFSP/Session.py
lib/python/Products/OFSP/Session.py
+41
-53
lib/python/Products/OFSP/Version.py
lib/python/Products/OFSP/Version.py
+41
-53
No files found.
lib/python/OFS/Image.py
View file @
6662981a
"""Image object"""
"""Image object"""
__version__
=
'$Revision: 1.2
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
,
MessageDialog
from
Globals
import
HTMLFile
,
MessageDialog
from
AccessControl.Role
import
RoleManager
from
AccessControl.Role
import
RoleManager
...
@@ -30,9 +30,6 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
...
@@ -30,9 +30,6 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
{
'label'
:
'Security'
,
'action'
:
'manage_access'
,
{
'label'
:
'Security'
,
'action'
:
'manage_access'
,
'target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
},
{
'label'
:
'Undo'
,
'action'
:
'manage_UndoForm'
,
'target'
:
'manage_main'
,
},
)
)
__ac_permissions__
=
(
__ac_permissions__
=
(
...
...
lib/python/Products/OFSP/DraftFolder.py
View file @
6662981a
...
@@ -14,63 +14,52 @@ Provide an area where people can work without others seeing their changes.
...
@@ -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
A Draft folder is a surrogate for a folder. It get
\
'
s subobjects by
gettingthem from a session copy of a base folder.
gettingthem from a session copy of a base folder.
$Id: DraftFolder.py,v 1.
8 1997/12/31 19:27:10 jim
Exp $'''
$Id: DraftFolder.py,v 1.
9 1998/01/02 17:41:19 brian
Exp $'''
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
import
time
,
OFS
.
SimpleItem
,
AccessControl
.
Role
import
Persistence
,
Acquisition
,
Globals
import
Globals
,
Session
,
time
import
AccessControl.User
,
Session
from
AccessControl.Role
import
RoleManager
from
string
import
rfind
from
AccessControl.User
import
UserFolder
from
App.Management
import
Management
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
Globals
import
HTMLFile
from
string
import
rfind
addForm
=
HTMLFile
(
'draftFolderAdd'
,
globals
())
addForm
=
HTMLFile
(
'draftFolderAdd'
,
globals
())
def
add
(
self
,
id
,
baseid
,
title
=
''
,
REQUEST
=
None
):
def
add
(
self
,
id
,
baseid
,
title
=
''
,
REQUEST
=
None
):
"""Add a new Folder object"""
""" """
i
=
DraftFolder
()
self
.
_setObject
(
id
,
DraftFolder
(
id
,
baseid
,
title
,
self
,
REQUEST
))
i
.
_init
(
id
,
baseid
,
title
,
self
,
REQUEST
)
if
REQUEST
:
return
self
.
manage_main
(
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
,
):
class
DraftFolder
(
Persistent
,
Implicit
,
RoleManager
,
Management
,
Item
):
""" """
meta_type
=
'Draft Folder'
meta_type
=
'Draft Folder'
icon
=
'misc_/OFSP/DraftFolderIcon'
icon
=
'misc_/OFSP/DraftFolderIcon'
isPrincipiaFolderish
=
1
isPrincipiaFolderish
=
1
manage_options
=
(
manage_options
=
(
{
'
icon'
:
icon
,
'label'
:
'Contents
'
,
{
'
label'
:
'Contents'
,
'action'
:
'manage_main
'
,
'
action'
:
'manage_main'
,
'
target'
:
'manage_main'
},
'target'
:
'manage_main'
},
{
'
icon'
:
'OFS/Properties_icon.gif'
,
'label'
:
'Properties
'
,
{
'
label'
:
'Properties'
,
'action'
:
'manage_propertiesForm
'
,
'
action'
:
'manage_propertiesForm'
,
'
target'
:
'manage_main'
},
'target'
:
'manage_main'
},
{
'
icon'
:
''
,
'label'
:
'Security
'
,
{
'
label'
:
'Security'
,
'action'
:
'manage_access
'
,
'
action'
:
'manage_access'
,
'
target'
:
'manage_main'
},
'target'
:
'manage_main'
},
{
'
icon'
:
'App/undo_icon.gif'
,
'label'
:
'Undo
'
,
{
'
label'
:
'Undo'
,
'action'
:
'manage_UndoForm
'
,
'
action'
:
'manage_UndoForm'
,
'
target'
:
'manage_main'
},
'target'
:
'manage_main'
},
{
'
icon'
:
'OFS/DraftFolderControl.gif'
,
'label'
:
'
Supervise'
,
{
'
label'
:
'Supervise'
,
'action'
:
'manage_
Supervise'
,
'
action'
:
'manage_Supervise'
,
'
target'
:
'manage_main'
},
'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
hasattr
(
parent
,
'aq_self'
):
parent
=
parent
.
aq_self
if
not
hasattr
(
parent
,
baseid
):
if
not
hasattr
(
parent
,
baseid
):
raise
'Input Error'
,
(
raise
'Input Error'
,
(
...
@@ -86,22 +75,19 @@ class DraftFolder(Persistence.Persistent,
...
@@ -86,22 +75,19 @@ class DraftFolder(Persistence.Persistent,
if
l
>=
0
:
cookie
=
cookie
[:
l
]
if
l
>=
0
:
cookie
=
cookie
[:
l
]
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
self
.
cookie_name
=
"%s-Draft-Folder-%s"
%
(
id
,
baseid
)
self
.
cookie_name
=
"%s-Draft-Folder-%s"
%
(
id
,
baseid
)
self
.
__allow_groups__
=
Supervisor
()
self
.
__allow_groups__
=
Supervisor
()
self
.
__allow_groups__
.
_init
()
def
title_and_id
(
self
):
def
title_and_id
(
self
):
r
=
DraftFolder
.
inheritedAttribute
(
'title_and_id'
)(
self
)
r
=
DraftFolder
.
inheritedAttribute
(
'title_and_id'
)(
self
)
r
=
'%s *'
%
r
r
=
'%s *'
%
r
try
:
base
=
getattr
(
self
.
aq_parent
,
self
.
baseid
)
try
:
base
=
getattr
(
self
.
aq_parent
,
self
.
baseid
)
except
:
base
=
None
except
:
base
=
None
if
base
is
not
None
:
if
base
is
not
None
:
r
=
"%s Draft Folder: %s"
%
(
base
.
title_or_id
(),
r
)
r
=
"%s Draft Folder: %s"
%
(
base
.
title_or_id
(),
r
)
return
r
return
r
def
_base
(
self
,
cookie
):
def
_base
(
self
,
cookie
):
# Check for base object
# Check for base object
if
hasattr
(
self
,
'aq_parent'
):
parent
=
self
.
aq_parent
if
hasattr
(
self
,
'aq_parent'
):
parent
=
self
.
aq_parent
else
:
parent
=
None
else
:
parent
=
None
...
@@ -114,7 +100,6 @@ class DraftFolder(Persistence.Persistent,
...
@@ -114,7 +100,6 @@ class DraftFolder(Persistence.Persistent,
does not exist.'''
does not exist.'''
%
self
.
cookie
%
self
.
cookie
)
)
base
=
getattr
(
parent
,
baseid
)
base
=
getattr
(
parent
,
baseid
)
pd
=
Globals
.
SessionBase
[
cookie
]
pd
=
Globals
.
SessionBase
[
cookie
]
...
@@ -123,15 +108,12 @@ class DraftFolder(Persistence.Persistent,
...
@@ -123,15 +108,12 @@ class DraftFolder(Persistence.Persistent,
base
=
base
.
aq_parent
base
=
base
.
aq_parent
if
hasattr
(
base
,
'_p_oid'
):
oids
.
append
(
base
.
_p_oid
)
if
hasattr
(
base
,
'_p_oid'
):
oids
.
append
(
base
.
_p_oid
)
else
:
break
else
:
break
while
oids
:
while
oids
:
oid
=
oids
[
-
1
]
oid
=
oids
[
-
1
]
del
oids
[
-
1
]
del
oids
[
-
1
]
base
=
pd
.
jar
[
oid
].
__of__
(
base
)
base
=
pd
.
jar
[
oid
].
__of__
(
base
)
base
.
manage_options
=
hack
return
base
return
base
def
__bobo_traverse__
(
self
,
REQUEST
,
name
):
def
__bobo_traverse__
(
self
,
REQUEST
,
name
):
cookie_name
=
self
.
cookie_name
cookie_name
=
self
.
cookie_name
cookie
=
''
cookie
=
''
...
@@ -198,11 +180,12 @@ class DraftFolder(Persistence.Persistent,
...
@@ -198,11 +180,12 @@ class DraftFolder(Persistence.Persistent,
except
:
return
()
except
:
return
()
class
Supervisor
(
AccessControl
.
User
.
UserFolder
,
Session
.
Session
):
class
Supervisor
(
UserFolder
,
Session
):
manage
=
manage_main
=
HTMLFile
(
'DraftFolderSupervisor'
,
globals
())
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):
...
@@ -210,6 +193,9 @@ class Supervisor(AccessControl.User.UserFolder, Session.Session):
##############################################################################
##############################################################################
#
#
# $Log: DraftFolder.py,v $
# $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
# Revision 1.8 1997/12/31 19:27:10 jim
# *** empty log message ***
# *** empty log message ***
#
#
...
...
lib/python/Products/OFSP/Session.py
View file @
6662981a
#!/bin/env python
"""Session object"""
##############################################################################
#
# 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.
__version__
=
'$Revision: 1.13 $'
[
11
:
-
2
]
import
Globals
,
time
$Id: Session.py,v 1.12 1997/12/31 20:34:05 brian Exp $'''
from
AccessControl.Role
import
RoleManager
from
Globals
import
MessageDialog
import
time
,
OFS
.
SimpleItem
,
AccessControl
.
Role
from
Persistence
import
Persistent
import
Persistence
,
Acquisition
,
Globals
from
Acquisition
import
Implicit
from
OFS.SimpleItem
import
Item
from
string
import
rfind
from
string
import
rfind
addForm
=
Globals
.
HTMLFile
(
'sessionAdd'
,
globals
())
addForm
=
Globals
.
HTMLFile
(
'sessionAdd'
,
globals
())
def
add
(
self
,
id
,
title
,
REQUEST
=
None
):
def
add
(
self
,
id
,
title
,
REQUEST
=
None
):
'Add a session'
""" """
i
=
Session
()
self
.
_setObject
(
id
,
Session
(
id
,
title
,
REQUEST
))
i
.
_init
(
id
,
title
,
REQUEST
)
self
.
_setObject
(
id
,
i
)
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
class
Session
(
Persistence
.
Persistent
,
class
Session
(
Persistent
,
Implicit
,
RoleManager
,
Item
):
AccessControl
.
Role
.
RoleManager
,
""" """
OFS
.
SimpleItem
.
Item
,
Acquisition
.
Implicit
):
'''Model sessions as drop-in objects
'''
meta_type
=
'Session'
meta_type
=
'Session'
icon
=
'misc_/OFSP/session'
icon
=
'misc_/OFSP/session'
manage_options
=
({
'
icon'
:
''
,
'label'
:
'Join/Leave
'
,
manage_options
=
({
'
label'
:
'Join/Leave'
,
'action'
:
'manage_main
'
,
'
action'
:
'manage_main'
,
'
target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
},
{
'
icon'
:
''
,
'label'
:
'Properties
'
,
{
'
label'
:
'Properties'
,
'action'
:
'manage_editForm
'
,
'
action'
:
'manage_propertiesForm'
,
'
target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
},
{
'icon'
:
''
,
'label'
:
'Security'
,
{
'label'
:
'Security'
,
'action'
:
'manage_access'
,
'action'
:
'manage_access'
,
'target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
{
'icon'
:
''
,
'label'
:
'Undo'
,
'action'
:
'manage_UndoForm'
,
'target'
:
'manage_main'
,
},
},
)
)
__ac_permissions__
=
(
__ac_permissions__
=
(
(
'View management screens'
,
[
'manage'
,
'manage_tabs'
,
'index_html'
]),
(
'View management screens'
,
[
'manage'
,
'manage_tabs'
,
'manage_editForm'
,
'index_html'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Edit session'
,
[
'manage_edit'
]),
(
'Edit session'
,
[
'manage_edit'
]),
(
'Join/leave session'
,
[
'enter'
,
'leave'
,
'leave_another'
]),
(
'Join/leave session'
,
[
'enter'
,
'leave'
,
'leave_another'
]),
...
@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
...
@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
__ac_types__
=
((
'Full Access'
,
map
(
lambda
x
:
x
[
0
],
__ac_permissions__
)),
__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
.
id
=
id
self
.
title
=
title
self
.
title
=
title
cookie
=
REQUEST
[
'PATH_INFO'
]
cookie
=
REQUEST
[
'PATH_INFO'
]
...
@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
...
@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
manage
=
manage_main
=
Globals
.
HTMLFile
(
'session'
,
globals
())
manage
=
manage_main
=
Globals
.
HTMLFile
(
'session'
,
globals
())
manage_
properties
=
Globals
.
HTMLFile
(
'sessionEdit'
,
globals
())
manage_
editForm
=
Globals
.
HTMLFile
(
'sessionEdit'
,
globals
())
def
title_and_id
(
self
):
def
title_and_id
(
self
):
r
=
Session
.
inheritedAttribute
(
'title_and_id'
)(
self
)
r
=
Session
.
inheritedAttribute
(
'title_and_id'
)(
self
)
...
@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
...
@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
return
r
return
r
def
manage_edit
(
self
,
title
,
REQUEST
=
None
):
def
manage_edit
(
self
,
title
,
REQUEST
=
None
):
'Modify a session'
""" """
self
.
title
=
title
self
.
title
=
title
if
REQUEST
is
not
None
:
return
self
.
manage_editedDialog
(
REQUEST
)
if
REQUEST
:
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
action
=
'manage_main'
)
def
enter
(
self
,
REQUEST
,
RESPONSE
):
def
enter
(
self
,
REQUEST
,
RESPONSE
):
'Begin working in a session'
"""Begin working in a session"""
RESPONSE
.
setCookie
(
RESPONSE
.
setCookie
(
Globals
.
SessionNameName
,
self
.
cookie
,
Globals
.
SessionNameName
,
self
.
cookie
,
#expires="Mon, 27-Dec-99 23:59:59 GMT",
#expires="Mon, 27-Dec-99 23:59:59 GMT",
...
@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
...
@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
def
leave
(
self
,
REQUEST
,
RESPONSE
):
def
leave
(
self
,
REQUEST
,
RESPONSE
):
'Temporarily stop working in a session'
"""Temporarily stop working in a session"""
RESPONSE
.
setCookie
(
RESPONSE
.
setCookie
(
Globals
.
SessionNameName
,
'No longer active'
,
Globals
.
SessionNameName
,
'No longer active'
,
expires
=
"Mon, 27-Aug-84 23:59:59 GMT"
,
expires
=
"Mon, 27-Aug-84 23:59:59 GMT"
,
...
@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
...
@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
def
leave_another
(
self
,
REQUEST
,
RESPONSE
):
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
)
return
self
.
leave
(
REQUEST
,
RESPONSE
)
def
save
(
self
,
remark
,
REQUEST
=
None
):
def
save
(
self
,
remark
,
REQUEST
=
None
):
'Make session changes permanent'
"""Make session changes permanent"""
Globals
.
SessionBase
[
self
.
cookie
].
commit
(
remark
)
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
):
def
discard
(
self
,
REQUEST
=
None
):
'Discard changes made during the session'
'Discard changes made during the session'
Globals
.
SessionBase
[
self
.
cookie
].
abort
()
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
()
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]
...
@@ -128,6 +113,9 @@ __version__='$Revision: 1.12 $'[11:-2]
##############################################################################
##############################################################################
#
#
# $Log: Session.py,v $
# $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
# Revision 1.12 1997/12/31 20:34:05 brian
# Fix bad ref to SimpleItem caused by moving
# Fix bad ref to SimpleItem caused by moving
#
#
...
...
lib/python/Products/OFSP/Version.py
View file @
6662981a
#!/bin/env python
"""Session object"""
##############################################################################
#
# 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.
__version__
=
'$Revision: 1.13 $'
[
11
:
-
2
]
import
Globals
,
time
$Id: Version.py,v 1.12 1997/12/31 20:34:05 brian Exp $'''
from
AccessControl.Role
import
RoleManager
from
Globals
import
MessageDialog
import
time
,
OFS
.
SimpleItem
,
AccessControl
.
Role
from
Persistence
import
Persistent
import
Persistence
,
Acquisition
,
Globals
from
Acquisition
import
Implicit
from
OFS.SimpleItem
import
Item
from
string
import
rfind
from
string
import
rfind
addForm
=
Globals
.
HTMLFile
(
'sessionAdd'
,
globals
())
addForm
=
Globals
.
HTMLFile
(
'sessionAdd'
,
globals
())
def
add
(
self
,
id
,
title
,
REQUEST
=
None
):
def
add
(
self
,
id
,
title
,
REQUEST
=
None
):
'Add a session'
""" """
i
=
Session
()
self
.
_setObject
(
id
,
Session
(
id
,
title
,
REQUEST
))
i
.
_init
(
id
,
title
,
REQUEST
)
self
.
_setObject
(
id
,
i
)
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
class
Session
(
Persistence
.
Persistent
,
class
Session
(
Persistent
,
Implicit
,
RoleManager
,
Item
):
AccessControl
.
Role
.
RoleManager
,
""" """
OFS
.
SimpleItem
.
Item
,
Acquisition
.
Implicit
):
'''Model sessions as drop-in objects
'''
meta_type
=
'Session'
meta_type
=
'Session'
icon
=
'misc_/OFSP/session'
icon
=
'misc_/OFSP/session'
manage_options
=
({
'
icon'
:
''
,
'label'
:
'Join/Leave
'
,
manage_options
=
({
'
label'
:
'Join/Leave'
,
'action'
:
'manage_main
'
,
'
action'
:
'manage_main'
,
'
target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
},
{
'
icon'
:
''
,
'label'
:
'Properties
'
,
{
'
label'
:
'Properties'
,
'action'
:
'manage_editForm
'
,
'
action'
:
'manage_propertiesForm'
,
'
target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
},
{
'icon'
:
''
,
'label'
:
'Security'
,
{
'label'
:
'Security'
,
'action'
:
'manage_access'
,
'action'
:
'manage_access'
,
'target'
:
'manage_main'
,
'target'
:
'manage_main'
,
},
{
'icon'
:
''
,
'label'
:
'Undo'
,
'action'
:
'manage_UndoForm'
,
'target'
:
'manage_main'
,
},
},
)
)
__ac_permissions__
=
(
__ac_permissions__
=
(
(
'View management screens'
,
[
'manage'
,
'manage_tabs'
,
'index_html'
]),
(
'View management screens'
,
[
'manage'
,
'manage_tabs'
,
'manage_editForm'
,
'index_html'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Edit session'
,
[
'manage_edit'
]),
(
'Edit session'
,
[
'manage_edit'
]),
(
'Join/leave session'
,
[
'enter'
,
'leave'
,
'leave_another'
]),
(
'Join/leave session'
,
[
'enter'
,
'leave'
,
'leave_another'
]),
...
@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
...
@@ -64,7 +47,7 @@ class Session(Persistence.Persistent,
__ac_types__
=
((
'Full Access'
,
map
(
lambda
x
:
x
[
0
],
__ac_permissions__
)),
__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
.
id
=
id
self
.
title
=
title
self
.
title
=
title
cookie
=
REQUEST
[
'PATH_INFO'
]
cookie
=
REQUEST
[
'PATH_INFO'
]
...
@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
...
@@ -73,7 +56,7 @@ class Session(Persistence.Persistent,
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
self
.
cookie
=
"%s/%s"
%
(
cookie
,
id
)
manage
=
manage_main
=
Globals
.
HTMLFile
(
'session'
,
globals
())
manage
=
manage_main
=
Globals
.
HTMLFile
(
'session'
,
globals
())
manage_
properties
=
Globals
.
HTMLFile
(
'sessionEdit'
,
globals
())
manage_
editForm
=
Globals
.
HTMLFile
(
'sessionEdit'
,
globals
())
def
title_and_id
(
self
):
def
title_and_id
(
self
):
r
=
Session
.
inheritedAttribute
(
'title_and_id'
)(
self
)
r
=
Session
.
inheritedAttribute
(
'title_and_id'
)(
self
)
...
@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
...
@@ -81,12 +64,15 @@ class Session(Persistence.Persistent,
return
r
return
r
def
manage_edit
(
self
,
title
,
REQUEST
=
None
):
def
manage_edit
(
self
,
title
,
REQUEST
=
None
):
'Modify a session'
""" """
self
.
title
=
title
self
.
title
=
title
if
REQUEST
is
not
None
:
return
self
.
manage_editedDialog
(
REQUEST
)
if
REQUEST
:
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
action
=
'manage_main'
)
def
enter
(
self
,
REQUEST
,
RESPONSE
):
def
enter
(
self
,
REQUEST
,
RESPONSE
):
'Begin working in a session'
"""Begin working in a session"""
RESPONSE
.
setCookie
(
RESPONSE
.
setCookie
(
Globals
.
SessionNameName
,
self
.
cookie
,
Globals
.
SessionNameName
,
self
.
cookie
,
#expires="Mon, 27-Dec-99 23:59:59 GMT",
#expires="Mon, 27-Dec-99 23:59:59 GMT",
...
@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
...
@@ -95,7 +81,7 @@ class Session(Persistence.Persistent,
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
def
leave
(
self
,
REQUEST
,
RESPONSE
):
def
leave
(
self
,
REQUEST
,
RESPONSE
):
'Temporarily stop working in a session'
"""Temporarily stop working in a session"""
RESPONSE
.
setCookie
(
RESPONSE
.
setCookie
(
Globals
.
SessionNameName
,
'No longer active'
,
Globals
.
SessionNameName
,
'No longer active'
,
expires
=
"Mon, 27-Aug-84 23:59:59 GMT"
,
expires
=
"Mon, 27-Aug-84 23:59:59 GMT"
,
...
@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
...
@@ -104,23 +90,22 @@ class Session(Persistence.Persistent,
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
return
RESPONSE
.
redirect
(
REQUEST
[
'URL1'
]
+
'/manage_main'
)
def
leave_another
(
self
,
REQUEST
,
RESPONSE
):
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
)
return
self
.
leave
(
REQUEST
,
RESPONSE
)
def
save
(
self
,
remark
,
REQUEST
=
None
):
def
save
(
self
,
remark
,
REQUEST
=
None
):
'Make session changes permanent'
"""Make session changes permanent"""
Globals
.
SessionBase
[
self
.
cookie
].
commit
(
remark
)
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
):
def
discard
(
self
,
REQUEST
=
None
):
'Discard changes made during the session'
'Discard changes made during the session'
Globals
.
SessionBase
[
self
.
cookie
].
abort
()
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
()
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]
...
@@ -128,6 +113,9 @@ __version__='$Revision: 1.12 $'[11:-2]
##############################################################################
##############################################################################
#
#
# $Log: Version.py,v $
# $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
# Revision 1.12 1997/12/31 20:34:05 brian
# Fix bad ref to SimpleItem caused by moving
# Fix bad ref to SimpleItem caused by moving
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment