Commit 722f78e6 authored by Jim Fulton's avatar Jim Fulton

*** empty log message ***

parent a807e859
#!/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.
$Id: Session.py,v 1.1 1997/11/07 16:13:15 jim Exp $'''
import time, SimpleItem, AccessControl.Role, Persistence, Acquisition, Globals
from string import rfind
_addForm=Globals.HTMLFile('OFS/sessionAdd')
def addForm(realself, self, REQUEST, **ignored):
return _addForm(self, REQUEST,
selectedRoles=map(
lambda i:
('<OPTION VALUE="%s"%s>%s' %
(i, i=='manage' and ' SELECTED' or '', i))
, self.validRoles()),
aclEChecked=' CHECKED', aclAChecked='', aclPChecked=''
)
def add(self, id, title, acl_type='A',acl_roles=[], REQUEST=None):
'Add a session'
i=Session()
i._init(id, title, REQUEST)
i._setRoles(acl_type,acl_roles)
self._setObject(id,i)
return self.manage_main(self,REQUEST)
class Session(Persistence.Persistent,
AccessControl.Role.RoleManager,
SimpleItem.Item,
Acquisition.Explicit):
'''Model sessions as drop-in objects
'''
meta_type='Session'
icon='OFS/session.gif'
def _init(self, id, title, REQUEST):
self.id=id
self.title=title
cookie=REQUEST['PATH_INFO']
l=rfind(cookie,'/')
if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id)
manage=Globals.HTMLFile('OFS/sessionEdit')
index_html=Globals.HTMLFile('OFS/session')
def manage_edit(self, title, acl_type='A',acl_roles=[], REQUEST=None):
'Modify a session'
self._setRoles(acl_type,acl_roles)
self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST)
def enter(self, REQUEST, RESPONSE):
'Begin working in a session'
RESPONSE.setCookie(
Globals.SessionNameName, self.cookie,
expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=self.cookie
return self.index_html(self, REQUEST)
def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session'
RESPONSE.setCookie(
Globals.SessionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=''
return self.index_html(self, REQUEST)
def save(self, remark, REQUEST):
'Make session changes permanent'
Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.index_html(self, REQUEST)
def discard(self, REQUEST):
'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.index_html(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.1 $'[11:-2]
##############################################################################
#
# $Log: Session.py,v $
# Revision 1.1 1997/11/07 16:13:15 jim
# *** empty log message ***
#
#
<html> <head>
<title><!--#var title_or_id--></title>
</head>
<body>
<!--#if Principia-Session-->
<!--#if expr="_vars['Principia-Session'] != cookie"-->
<h2>Another session is active!</h2>
You cannot start working in this session while another session,
<strong><!--#var Principia-Session--></strong> is active.
Leave <strong><!--#var Principia-Session--></strong> first and then
you may work in this session.
<!--#else-->
<h2>Active <!--#var title_or_id--> Session Operations</h2>
<form action=leave>
You <strong>are</strong> currently working in the
<!--#var Principia-Session--> session. To
<strong>quit</strong> working in this session click on this button:
<input type=submit value="Quit Working in <!--#var Principia-Session-->">
</form>
<!--#/if-->
<!--#else-->
<h2>Inactive <!--#var title_or_id--> Session Operations</h2>
<form action=enter>
You <strong>are not</strong> currently working in the
<!--#var title_and_id-->
session. To <strong>start</strong> working in this session click
on this button:
<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>
#!/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.
$Id: Session.py,v 1.1 1997/11/07 16:13:15 jim Exp $'''
import time, SimpleItem, AccessControl.Role, Persistence, Acquisition, Globals
from string import rfind
_addForm=Globals.HTMLFile('OFS/sessionAdd')
def addForm(realself, self, REQUEST, **ignored):
return _addForm(self, REQUEST,
selectedRoles=map(
lambda i:
('<OPTION VALUE="%s"%s>%s' %
(i, i=='manage' and ' SELECTED' or '', i))
, self.validRoles()),
aclEChecked=' CHECKED', aclAChecked='', aclPChecked=''
)
def add(self, id, title, acl_type='A',acl_roles=[], REQUEST=None):
'Add a session'
i=Session()
i._init(id, title, REQUEST)
i._setRoles(acl_type,acl_roles)
self._setObject(id,i)
return self.manage_main(self,REQUEST)
class Session(Persistence.Persistent,
AccessControl.Role.RoleManager,
SimpleItem.Item,
Acquisition.Explicit):
'''Model sessions as drop-in objects
'''
meta_type='Session'
icon='OFS/session.gif'
def _init(self, id, title, REQUEST):
self.id=id
self.title=title
cookie=REQUEST['PATH_INFO']
l=rfind(cookie,'/')
if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id)
manage=Globals.HTMLFile('OFS/sessionEdit')
index_html=Globals.HTMLFile('OFS/session')
def manage_edit(self, title, acl_type='A',acl_roles=[], REQUEST=None):
'Modify a session'
self._setRoles(acl_type,acl_roles)
self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST)
def enter(self, REQUEST, RESPONSE):
'Begin working in a session'
RESPONSE.setCookie(
Globals.SessionNameName, self.cookie,
expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=self.cookie
return self.index_html(self, REQUEST)
def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session'
RESPONSE.setCookie(
Globals.SessionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=''
return self.index_html(self, REQUEST)
def save(self, remark, REQUEST):
'Make session changes permanent'
Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.index_html(self, REQUEST)
def discard(self, REQUEST):
'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.index_html(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.1 $'[11:-2]
##############################################################################
#
# $Log: Session.py,v $
# Revision 1.1 1997/11/07 16:13:15 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.
$Id: Version.py,v 1.1 1997/11/07 16:13:15 jim Exp $'''
import time, SimpleItem, AccessControl.Role, Persistence, Acquisition, Globals
from string import rfind
_addForm=Globals.HTMLFile('OFS/sessionAdd')
def addForm(realself, self, REQUEST, **ignored):
return _addForm(self, REQUEST,
selectedRoles=map(
lambda i:
('<OPTION VALUE="%s"%s>%s' %
(i, i=='manage' and ' SELECTED' or '', i))
, self.validRoles()),
aclEChecked=' CHECKED', aclAChecked='', aclPChecked=''
)
def add(self, id, title, acl_type='A',acl_roles=[], REQUEST=None):
'Add a session'
i=Session()
i._init(id, title, REQUEST)
i._setRoles(acl_type,acl_roles)
self._setObject(id,i)
return self.manage_main(self,REQUEST)
class Session(Persistence.Persistent,
AccessControl.Role.RoleManager,
SimpleItem.Item,
Acquisition.Explicit):
'''Model sessions as drop-in objects
'''
meta_type='Session'
icon='OFS/session.gif'
def _init(self, id, title, REQUEST):
self.id=id
self.title=title
cookie=REQUEST['PATH_INFO']
l=rfind(cookie,'/')
if l >= 0: cookie=cookie[:l]
self.cookie="%s/%s" % (cookie, id)
manage=Globals.HTMLFile('OFS/sessionEdit')
index_html=Globals.HTMLFile('OFS/session')
def manage_edit(self, title, acl_type='A',acl_roles=[], REQUEST=None):
'Modify a session'
self._setRoles(acl_type,acl_roles)
self.title=title
if REQUEST is not None: return self.manage_editedDialog(REQUEST)
def enter(self, REQUEST, RESPONSE):
'Begin working in a session'
RESPONSE.setCookie(
Globals.SessionNameName, self.cookie,
expires="Mon, 27-Dec-99 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=self.cookie
return self.index_html(self, REQUEST)
def leave(self, REQUEST, RESPONSE):
'Temporarily stop working in a session'
RESPONSE.setCookie(
Globals.SessionNameName,'No longer active',
expires="Mon, 27-Aug-84 23:59:59 GMT",
path=REQUEST['SCRIPT_NAME'],
)
REQUEST[Globals.SessionNameName]=''
return self.index_html(self, REQUEST)
def save(self, remark, REQUEST):
'Make session changes permanent'
Globals.SessionBase[self.cookie].commit(remark)
if REQUEST is not None: return self.index_html(self, REQUEST)
def discard(self, REQUEST):
'Discard changes made during the session'
Globals.SessionBase[self.cookie].abort()
if REQUEST is not None: return self.index_html(self, REQUEST)
def nonempty(self): return Globals.SessionBase[self.cookie].nonempty()
__version__='$Revision: 1.1 $'[11:-2]
##############################################################################
#
# $Log: Version.py,v $
# Revision 1.1 1997/11/07 16:13:15 jim
# *** empty log message ***
#
#
<html> <head>
<title><!--#var title_or_id--></title>
</head>
<body>
<!--#if Principia-Session-->
<!--#if expr="_vars['Principia-Session'] != cookie"-->
<h2>Another session is active!</h2>
You cannot start working in this session while another session,
<strong><!--#var Principia-Session--></strong> is active.
Leave <strong><!--#var Principia-Session--></strong> first and then
you may work in this session.
<!--#else-->
<h2>Active <!--#var title_or_id--> Session Operations</h2>
<form action=leave>
You <strong>are</strong> currently working in the
<!--#var Principia-Session--> session. To
<strong>quit</strong> working in this session click on this button:
<input type=submit value="Quit Working in <!--#var Principia-Session-->">
</form>
<!--#/if-->
<!--#else-->
<h2>Inactive <!--#var title_or_id--> Session Operations</h2>
<form action=enter>
You <strong>are not</strong> currently working in the
<!--#var title_and_id-->
session. To <strong>start</strong> working in this session click
on this button:
<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><!--#var title_or_id--></title>
</head>
<body>
<!--#if Principia-Session-->
<!--#if expr="_vars['Principia-Session'] != cookie"-->
<h2>Another session is active!</h2>
You cannot start working in this session while another session,
<strong><!--#var Principia-Session--></strong> is active.
Leave <strong><!--#var Principia-Session--></strong> first and then
you may work in this session.
<!--#else-->
<h2>Active <!--#var title_or_id--> Session Operations</h2>
<form action=leave>
You <strong>are</strong> currently working in the
<!--#var Principia-Session--> session. To
<strong>quit</strong> working in this session click on this button:
<input type=submit value="Quit Working in <!--#var Principia-Session-->">
</form>
<!--#/if-->
<!--#else-->
<h2>Inactive <!--#var title_or_id--> Session Operations</h2>
<form action=enter>
You <strong>are not</strong> currently working in the
<!--#var title_and_id-->
session. To <strong>start</strong> working in this session click
on this button:
<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>
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