Commit 9f53addc authored by Hanno Schlichting's avatar Hanno Schlichting

Add back ZMI copy/cut/paste/rename actions.

parent 6aa45223
...@@ -230,7 +230,7 @@ class CopyContainer(Base): ...@@ -230,7 +230,7 @@ class CopyContainer(Base):
notify(ObjectClonedEvent(ob)) notify(ObjectClonedEvent(ob))
if REQUEST is not None: if REQUEST is not None:
return self.manage_main(self, REQUEST) return self.manage_main(self, REQUEST, cb_dataValid=1)
elif op == 1: elif op == 1:
# Move operation # Move operation
...@@ -298,7 +298,7 @@ class CopyContainer(Base): ...@@ -298,7 +298,7 @@ class CopyContainer(Base):
path='%s' % cookie_path(REQUEST), path='%s' % cookie_path(REQUEST),
expires='Wed, 31-Dec-97 23:59:59 GMT') expires='Wed, 31-Dec-97 23:59:59 GMT')
REQUEST['__cp'] = None REQUEST['__cp'] = None
return self.manage_main(self, REQUEST) return self.manage_main(self, REQUEST, cb_dataValid=0)
return result return result
...@@ -407,6 +407,30 @@ class CopyContainer(Base): ...@@ -407,6 +407,30 @@ class CopyContainer(Base):
return ob return ob
def cb_dataValid(self):
# Return true if clipboard data seems valid.
try:
_cb_decode(self.REQUEST['__cp'])
except Exception:
return 0
return 1
def cb_dataItems(self):
# List of objects in the clip board
try:
cp = _cb_decode(self.REQUEST['__cp'])
except Exception:
return []
oblist = []
app = self.getPhysicalRoot()
for mdata in cp[1]:
m = loadMoniker(mdata)
oblist.append(m.bind(app))
return oblist
validClipData = cb_dataValid
def _verifyObjectPaste(self, object, validate_src=1): def _verifyObjectPaste(self, object, validate_src=1):
# Verify whether the current user is allowed to paste the # Verify whether the current user is allowed to paste the
# passed object into self. This is determined by checking # passed object into self. This is determined by checking
......
...@@ -109,6 +109,20 @@ ...@@ -109,6 +109,20 @@
<td align="left" valign="top" width="16"></td> <td align="left" valign="top" width="16"></td>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="form-element"> <div class="form-element">
<dtml-unless dontAllowCopyAndPaste>
<input class="form-element" type="submit" name="manage_renameForm:method"
value="Rename" />
<dtml-if "_.SecurityCheckPermission('Delete objects',this())">
<input class="form-element" type="submit" name="manage_cutObjects:method"
value="Cut" />
</dtml-if>
<input class="form-element" type="submit" name="manage_copyObjects:method"
value="Copy" />
<dtml-if cb_dataValid>
<input class="form-element" type="submit" name="manage_pasteObjects:method"
value="Paste" />
</dtml-if>
</dtml-unless>
<dtml-if "_.SecurityCheckPermission('Delete objects',this())"> <dtml-if "_.SecurityCheckPermission('Delete objects',this())">
<input class="form-element" type="submit" name="manage_delObjects:method" <input class="form-element" type="submit" name="manage_delObjects:method"
value="Delete" /> value="Delete" />
...@@ -126,6 +140,14 @@ ...@@ -126,6 +140,14 @@
There are currently no items in <em>&dtml-title_or_id;</em> There are currently no items in <em>&dtml-title_or_id;</em>
<br /><br /> <br /><br />
</div> </div>
<dtml-unless dontAllowCopyAndPaste>
<dtml-if cb_dataValid>
<div class="form-element">
<input class="form-element" type="submit" name="manage_pasteObjects:method"
value="Paste" />
</div>
</dtml-if>
</dtml-unless>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -609,6 +609,14 @@ class ICopyContainer(Interface): ...@@ -609,6 +609,14 @@ class ICopyContainer(Interface):
"""Clone an object, creating a new object with the given id. """Clone an object, creating a new object with the given id.
""" """
def cb_dataValid():
"""Return true if clipboard data seems valid.
"""
def cb_dataItems():
"""List of objects in the clip board.
"""
def _verifyObjectPaste(object, validate_src=1): def _verifyObjectPaste(object, validate_src=1):
"""Verify whether the current user is allowed to paste the passed """Verify whether the current user is allowed to paste the passed
object into self. This is determined by checking to see if the object into self. This is determined by checking to see if the
......
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