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
6aa45223
Commit
6aa45223
authored
Oct 30, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back rename form.
parent
a6dfb8ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
0 deletions
+79
-0
src/OFS/CopySupport.py
src/OFS/CopySupport.py
+15
-0
src/OFS/dtml/renameForm.dtml
src/OFS/dtml/renameForm.dtml
+62
-0
src/OFS/interfaces.py
src/OFS/interfaces.py
+2
-0
No files found.
src/OFS/CopySupport.py
View file @
6aa45223
...
...
@@ -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.
...
...
src/OFS/dtml/renameForm.dtml
0 → 100644
View file @
6aa45223
<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>
src/OFS/interfaces.py
View file @
6aa45223
...
...
@@ -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"""
...
...
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