Commit 6aa45223 authored by Hanno Schlichting's avatar Hanno Schlichting

Add back rename form.

parent a6dfb8ec
......@@ -31,6 +31,7 @@ from AccessControl.Permissions import delete_objects
from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from App.special_dtml import DTMLFile
from ExtensionClass import Base
from six.moves.urllib.parse import quote, unquote
from zExceptions import Unauthorized, BadRequest, ResourceLockedError
......@@ -114,6 +115,7 @@ class CopyContainer(Base):
resp = REQUEST['RESPONSE']
resp.setCookie('__cp', cp, path='%s' % cookie_path(REQUEST))
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
security.declareProtected(view_management_screens, 'manage_copyObjects')
......@@ -139,6 +141,7 @@ class CopyContainer(Base):
resp = REQUEST['RESPONSE']
resp.setCookie('__cp', cp, path='%s' % cookie_path(REQUEST))
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
def _get_id(self, id):
......@@ -226,6 +229,9 @@ class CopyContainer(Base):
notify(ObjectClonedEvent(ob))
if REQUEST is not None:
return self.manage_main(self, REQUEST)
elif op == 1:
# Move operation
for ob in oblist:
......@@ -292,9 +298,13 @@ class CopyContainer(Base):
path='%s' % cookie_path(REQUEST),
expires='Wed, 31-Dec-97 23:59:59 GMT')
REQUEST['__cp'] = None
return self.manage_main(self, REQUEST)
return result
security.declareProtected(view_management_screens, 'manage_renameForm')
manage_renameForm = DTMLFile('dtml/renameForm', globals())
security.declareProtected(view_management_screens, 'manage_renameObjects')
def manage_renameObjects(self, ids=[], new_ids=[], REQUEST=None):
"""Rename several sub-objects"""
......@@ -303,6 +313,8 @@ class CopyContainer(Base):
for i in range(len(ids)):
if ids[i] != new_ids[i]:
self.manage_renameObject(ids[i], new_ids[i], REQUEST)
if REQUEST is not None:
return self.manage_main(self, REQUEST)
security.declareProtected(view_management_screens, 'manage_renameObject')
def manage_renameObject(self, id, new_id, REQUEST=None):
......@@ -356,6 +368,9 @@ class CopyContainer(Base):
ob._postCopy(self, op=1)
if REQUEST is not None:
return self.manage_main(self, REQUEST)
security.declarePublic('manage_clone')
def manage_clone(self, ob, id, REQUEST=None):
"""Clone an object, creating a new object with the given id.
......
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Rename Items',
)">
<dtml-if expr="REQUEST.has_key('ids')">
<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
<table border="0">
<dtml-in expr="manage_CopyContainerAllItems(REQUEST)">
<tr>
<td align="left" valign="bottom" width="16"></td>
<td align="left" valign="bottom">
<div class="form-text">
&dtml-id;
</div>
</td>
<td align="left" valign="bottom">
<dtml-if cb_isMoveable>
<span class="form-text">to:</span>
<input type="hidden" name="ids:list" value="&dtml-id;" />
<input type="text" name="new_ids:list" size="<dtml-var "_.max(40,_.len(getId())+4)">" value="&dtml-id;" />
<dtml-else>
<span class="form-text">
may not be renamed.
</span>
</dtml-if>
</td>
</tr>
</dtml-in>
<tr>
<td></td>
<td colspan="2">
<div class="form-element">
<input class="form-element" type="hidden" name=":default_method"
value="manage_renameObjects" />
<input class="form-element" type="submit" name="manage_renameObjects:method"
value=" Ok " />
<input class="form-element" type="submit" name="manage_main:method"
value="Cancel" />
</div>
</td>
</tr>
</table>
</form>
<dtml-else>
<form action="manage_main" method="get">
<p align="center">
<br /><br />
<span class="form-text">
You must select an item to rename.
</span>
<br /><br />
<input class="form-element" type="submit" name="submit" value=" Ok " />
</p>
</form>
</dtml-if>
<dtml-var manage_page_footer>
......@@ -597,6 +597,8 @@ class ICopyContainer(Interface):
argument.
"""
manage_renameForm = Attribute("""Rename management view""")
def manage_renameObjects(ids=[], new_ids=[], REQUEST=None):
"""Rename several sub-objects"""
......
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