Commit 2b73e694 authored by 's avatar

Fixed some copy/paste bugs

parent 841db065
"""Copy interface"""
__version__='$Revision: 1.2 $'[11:-2]
__version__='$Revision: 1.3 $'[11:-2]
import Globals, Moniker, rPickle
from cPickle import loads, dumps
......@@ -16,11 +16,18 @@ class CopyContainer:
# Interface for containerish objects which allow
# objects to be copied into them.
pasteDialog=Globals.HTMLFile('OFS/pasteDialog')
def _getMoniker(self):
# Ask an object to return a moniker for itself.
return Moniker.Moniker(self)
pasteDialog=Globals.HTMLFile('OFS/pasteDialog')
def validClipData(self):
# Return true if clipboard data is valid.
try: moniker=rPickle.loads(unquote(self.REQUEST['clip_data']))
except: return 0
v=self.REQUEST['validClipData']=moniker.assert()
return v
def pasteFromClipboard(self,clip_id='',clip_data='',REQUEST=None):
""" """
......@@ -78,8 +85,8 @@ class CopySource:
except: return eNotSupported
REQUEST['RESPONSE'].setCookie('clip_data',
quote(dumps(moniker)),
path='/',
expires='Friday, 31-Dec-99 23:59:59 GMT')
path='%s' % REQUEST['SCRIPT_NAME'])
......
......@@ -8,7 +8,7 @@ Object monikers
"""
__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]
import Globals
......@@ -28,8 +28,14 @@ class Moniker:
try: self.aqp=Moniker(obj.aq_parent, 0)
except: self.aqp=None
def assert(self):
# Return true if the named object exists
if self.jar is None: jar=Globals.Bobobase._jar
else: jar=Globals.SessionBase[self.jar].jar
return jar.has_key(self.oid)
def bind(self):
# Return the real object named by this moniker
if self.jar is None: jar=Globals.Bobobase._jar
else: jar=Globals.SessionBase[self.jar].jar
obj=jar[self.oid]
......
......@@ -57,20 +57,20 @@ click on the item's title and id.
<TD></TD>
<TD>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Copy">
<!--#if clip_data-->
<!--#if validClipData-->
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Paste">
<!--#/if clip_data-->
<!--#/if validClipData-->
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Delete">
</TD>
</TR>
</TABLE>
</FORM>
<!--#else objectValues-->
<!--#if clip_data-->
<!--#if validClipData-->
<FORM ACTION="manage_delObjects" METHOD="POST">
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Paste">
</FORM>
<!--#/if clip_data-->
<!--#/if validClipData-->
<!--#/if objectValues-->
<TABLE>
......
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