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
da476c61
Commit
da476c61
authored
Aug 14, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added multiple copy, paste, rename
parent
ee6c5127
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
474 additions
and
301 deletions
+474
-301
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+321
-190
lib/python/OFS/Folder.py
lib/python/OFS/Folder.py
+4
-3
lib/python/OFS/Moniker.py
lib/python/OFS/Moniker.py
+26
-22
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+40
-70
lib/python/OFS/main.dtml
lib/python/OFS/main.dtml
+19
-16
lib/python/OFS/renameForm.dtml
lib/python/OFS/renameForm.dtml
+64
-0
No files found.
lib/python/OFS/CopySupport.py
View file @
da476c61
This diff is collapsed.
Click to expand it.
lib/python/OFS/Folder.py
View file @
da476c61
"""Folder object
"""Folder object
$Id: Folder.py,v 1.5
0 1998/08/05 21:04:04
brian Exp $"""
$Id: Folder.py,v 1.5
1 1998/08/14 16:46:35
brian Exp $"""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
from
Globals
import
HTMLFile
...
@@ -71,7 +71,8 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
...
@@ -71,7 +71,8 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
(
'View management screens'
,
(
'View management screens'
,
(
'manage'
,
'manage_menu'
,
'manage_main'
,
'manage_copyright'
,
(
'manage'
,
'manage_menu'
,
'manage_main'
,
'manage_copyright'
,
'manage_tabs'
,
'manage_propertiesForm'
,
'manage_UndoForm'
,
'manage_tabs'
,
'manage_propertiesForm'
,
'manage_UndoForm'
,
'manage_copyObject'
,
'manage_pasteObject'
,
'manage_cutObjects'
,
'manage_copyObjects'
,
'manage_pasteObjects'
,
'manage_renameForm'
,
'manage_renameObject'
,
'manage_findFrame'
,
'manage_findForm'
,
'manage_findAdv'
,
'manage_findFrame'
,
'manage_findForm'
,
'manage_findAdv'
,
'manage_findResult'
,
'manage_findOpt'
)),
'manage_findResult'
,
'manage_findOpt'
)),
(
'Access contents information'
,
(
'Access contents information'
,
...
...
lib/python/OFS/Moniker.py
View file @
da476c61
"""
"""Object monikers
Object monikers
An object moniker is an intelligent reference to a
An object moniker is an intelligent reference to a
persistent object. A moniker can be turned back into
persistent object. A moniker can be turned back into
...
@@ -7,30 +6,25 @@ Object monikers
...
@@ -7,30 +6,25 @@ Object monikers
and aquisition relationships via a simple interface.
and aquisition relationships via a simple interface.
"""
"""
__version__
=
'$Revision: 1.5 $'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4 $'
[
11
:
-
2
]
import
Globals
import
Globals
class
Moniker
:
class
Moniker
:
""" """
""" """
def
__init__
(
self
,
ob
j
=
None
,
op
=
0
):
def
__init__
(
self
,
ob
=
None
):
if
ob
j
is
None
:
return
if
ob
is
None
:
return
pd
=
[]
self
.
jar
=
ob
.
_p_jar
.
name
ob
=
obj
self
.
ids
=
[]
while
1
:
while
1
:
if
not
hasattr
(
ob
,
'_p_oid'
):
if
not
hasattr
(
ob
,
'_p_oid'
):
break
break
pd
.
append
(
ob
.
_p_oid
)
self
.
ids
.
append
(
ob
.
_p_oid
)
if
not
hasattr
(
ob
,
'aq_parent'
):
if
not
hasattr
(
ob
,
'aq_parent'
):
break
break
ob
=
ob
.
aq_parent
ob
=
ob
.
aq_parent
pd
.
reverse
()
self
.
ids
.
reverse
()
self
.
pd
=
pd
self
.
jr
=
obj
.
_p_jar
.
name
self
.
op
=
op
def
id
(
self
):
def
id
(
self
):
return
absattr
(
self
.
bind
().
id
)
return
absattr
(
self
.
bind
().
id
)
...
@@ -40,33 +34,43 @@ class Moniker:
...
@@ -40,33 +34,43 @@ class Moniker:
def
assert
(
self
):
def
assert
(
self
):
# Return true if the named object exists
# Return true if the named object exists
if
self
.
jr
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
if
self
.
j
a
r
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
jr
].
jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
j
a
r
].
jar
for
n
in
self
.
pd
:
for
n
in
self
.
ids
:
if
not
jar
.
has_key
(
n
):
if
not
jar
.
has_key
(
n
):
return
0
return
0
return
1
return
1
def
bind
(
self
):
def
bind
(
self
):
# Return the real object named by this moniker
# Return the real object named by this moniker
if
self
.
jr
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
if
self
.
j
a
r
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
jr
].
jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
j
a
r
].
jar
ob
=
None
ob
=
None
for
n
in
self
.
pd
:
for
n
in
self
.
ids
:
o
=
jar
[
n
]
o
=
jar
[
n
]
if
ob
is
not
None
:
if
ob
is
not
None
:
o
=
o
.
__of__
(
ob
)
o
=
o
.
__of__
(
ob
)
ob
=
o
ob
=
o
return
ob
return
ob
def
exact
(
self
,
o
ther
):
def
exact
(
self
,
o
b
):
# Check against another moniker to see if it
# Check against another moniker to see if it
# refers to the exact same object in the exact
# refers to the exact same object in the exact
# same acquisition context.
# same acquisition context.
return
self
.
j
r
==
other
.
jr
and
self
.
pd
==
other
.
pd
return
self
.
j
ar
==
ob
.
jar
and
self
.
ids
==
ob
.
ids
def
absattr
(
attr
):
def
absattr
(
attr
):
if
callable
(
attr
):
return
attr
()
if
callable
(
attr
):
return
attr
()
return
attr
return
attr
##############################################################################
#
# $Log: Moniker.py,v $
# Revision 1.5 1998/08/14 16:46:36 brian
# Added multiple copy, paste, rename
#
lib/python/OFS/ObjectManager.py
View file @
da476c61
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.4
4 1998/08/03 13:32:00 jim
Exp $"""
$Id: ObjectManager.py,v 1.4
5 1998/08/14 16:46:36 brian
Exp $"""
__version__
=
'$Revision: 1.4
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
5
$'
[
11
:
-
2
]
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
,
Globals
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
,
Globals
import
App.FactoryDispatcher
import
App.FactoryDispatcher
...
@@ -106,15 +106,29 @@ class ObjectManager(
...
@@ -106,15 +106,29 @@ class ObjectManager(
return
()
return
()
def
_setObject
(
self
,
id
,
object
,
roles
=
None
,
user
=
None
):
def
_setObject
(
self
,
id
,
object
,
roles
=
None
,
user
=
None
):
self
.
_checkId
(
id
)
self
.
_checkId
(
id
)
setattr
(
self
,
id
,
object
)
setattr
(
self
,
id
,
object
)
try
:
t
=
object
.
meta_type
try
:
t
=
object
.
meta_type
except
:
t
=
None
except
:
t
=
None
self
.
_objects
=
self
.
_objects
+
({
'id'
:
id
,
'meta_type'
:
t
},)
self
.
_objects
=
self
.
_objects
+
({
'id'
:
id
,
'meta_type'
:
t
},)
# This is a nasty hack that provides a workaround for any
# existing customers with the acl_users/__allow_groups__
# bug. Basically when you add an object, we'll do the check
# an make the fix if necessary.
have
=
self
.
__dict__
.
has_key
if
have
(
'__allow_groups__'
)
and
(
not
have
(
'acl_users'
)):
delattr
(
self
,
'__allow_groups__'
)
def
_delObject
(
self
,
id
):
def
_delObject
(
self
,
id
):
delattr
(
self
,
id
)
delattr
(
self
,
id
)
if
id
==
'acl_users'
:
# Yikes - acl_users is referred to by two names and
# must be treated as a special case!
try
:
delattr
(
self
,
'__allow_groups__'
)
except
:
pass
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
def
objectIds
(
self
,
spec
=
None
):
def
objectIds
(
self
,
spec
=
None
):
...
@@ -284,55 +298,17 @@ class ObjectManager(
...
@@ -284,55 +298,17 @@ class ObjectManager(
manage_addProduct
=
App
.
FactoryDispatcher
.
ProductDispatcher
()
manage_addProduct
=
App
.
FactoryDispatcher
.
ProductDispatcher
()
def
manage_cutObject
(
self
,
ids
,
REQUEST
=
None
):
"""Put a reference to an object, with the given id, in the clip board
The object is marked for deletion on paste. This is essentially
the first step in a move.
"""
if
type
(
ids
)
is
not
type
(
''
):
if
len
(
ids
)
!=
1
:
return
MessageDialog
(
title
=
'Invalid Selection'
,
message
=
'Please select one and only one item to move'
,
action
=
'./manage_main'
,)
ids
=
ids
[
0
]
obj
=
getattr
(
self
,
ids
)
err
=
obj
.
cutToClipboard
(
REQUEST
)
return
err
or
self
.
manage_main
(
self
,
REQUEST
,
validClipData
=
1
)
def
manage_copyObject
(
self
,
ids
,
REQUEST
=
None
):
"""Put a reference to an object, with the given id, in the clip board
"""
if
type
(
ids
)
is
not
type
(
''
):
if
len
(
ids
)
!=
1
:
return
MessageDialog
(
title
=
'Invalid Selection'
,
message
=
'Please select one and only one item to move'
,
action
=
'./manage_main'
,)
ids
=
ids
[
0
]
obj
=
getattr
(
self
,
ids
)
err
=
obj
.
copyToClipboard
(
REQUEST
)
return
err
or
self
.
manage_main
(
self
,
REQUEST
,
validClipData
=
1
)
def
manage_pasteObject
(
self
,
clip_id
=
''
,
clip_data
=
''
,
REQUEST
=
None
):
"""Paste from the clip board into the current object."""
return
self
.
pasteFromClipboard
(
clip_id
,
clip_data
,
REQUEST
)
def
manage_delObjects
(
self
,
ids
=
[],
REQUEST
=
None
):
def
manage_delObjects
(
self
,
ids
=
[],
submit
=
'Delete'
,
clip_id
=
''
,
clip_data
=
''
,
REQUEST
=
None
):
"""Delete a subordinate object
"""Delete a subordinate object
The objects specified in 'ids' get deleted.
The objects specified in 'ids' get deleted.
"""
"""
if
type
(
ids
)
is
type
(
''
):
ids
=
[
ids
]
if
type
(
ids
)
is
type
(
''
):
ids
=
[
ids
]
if
submit
==
'Delete'
:
if
not
ids
:
if
not
ids
:
return
MessageDialog
(
title
=
'No items specified'
,
return
MessageDialog
(
title
=
'No items specified'
,
message
=
'No items were specified!'
,
message
=
'No items were specified!'
,
action
=
'./manage_main'
,)
action
=
'./manage_main'
,)
try
:
p
=
self
.
_reserved_names
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
except
:
p
=
()
for
n
in
ids
:
for
n
in
ids
:
...
@@ -349,15 +325,6 @@ class ObjectManager(
...
@@ -349,15 +325,6 @@ class ObjectManager(
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
elif
submit
==
'Cut'
:
return
self
.
manage_cutObject
(
id
,
REQURST
)
elif
submit
==
'Copy'
:
return
self
.
manage_copyObject
(
id
,
REQURST
)
elif
submit
==
'Paste'
:
return
self
.
pasteFromClipboard
(
clip_id
,
clip_data
,
REQUEST
)
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
self
.
_checkId
(
id
)
self
.
_checkId
(
id
)
...
@@ -538,6 +505,9 @@ class ObjectManager(
...
@@ -538,6 +505,9 @@ class ObjectManager(
##############################################################################
##############################################################################
#
#
# $Log: ObjectManager.py,v $
# $Log: ObjectManager.py,v $
# Revision 1.45 1998/08/14 16:46:36 brian
# Added multiple copy, paste, rename
#
# Revision 1.44 1998/08/03 13:32:00 jim
# Revision 1.44 1998/08/03 13:32:00 jim
# - Revamped folder security:
# - Revamped folder security:
#
#
...
...
lib/python/OFS/main.dtml
View file @
da476c61
...
@@ -12,10 +12,10 @@
...
@@ -12,10 +12,10 @@
<FORM ACTION="." METHOD="POST">
<FORM ACTION="." METHOD="POST">
<!--#if objectItems-->
<!--#if objectItems-->
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
2
>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
"2"
>
<!--#in objectItems sort-->
<!--#in objectItems sort-->
<TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP"
WIDTH="16"
>
<INPUT TYPE="CHECKBOX" NAME="ids:list" VALUE="<!--#var sequence-key-->">
<INPUT TYPE="CHECKBOX" NAME="ids:list" VALUE="<!--#var sequence-key-->">
</TD>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP">
...
@@ -42,28 +42,31 @@
...
@@ -42,28 +42,31 @@
</TD>
</TD>
</TR>
</TR>
<!--#/in-->
<!--#/in-->
<TR>
</TABLE>
<TD></TD>
<TD COLSPAN="2">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=2>
<INPUT TYPE="SUBMIT" NAME="manage_cutObject:method" VALUE="Cut">
<TR>
<INPUT TYPE="SUBMIT" NAME="manage_copyObject:method" VALUE="Copy">
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="16"></TD>
<!--#if validClipData-->
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject:method" VALUE="Paste">
<INPUT TYPE="SUBMIT" NAME="manage_renameForm:method" VALUE="Rename">
<!--#/if validClipData-->
<INPUT TYPE="SUBMIT" NAME="manage_cutObjects:method" VALUE="Cut">
<INPUT TYPE="SUBMIT" NAME="manage_delObjects:method" VALUE="Delete">
<INPUT TYPE="SUBMIT" NAME="manage_copyObjects:method" VALUE="Copy">
</TD>
<!--#if cb_dataValid-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObjects:method" VALUE="Paste">
<!--#/if-->
<INPUT TYPE="SUBMIT" NAME="manage_delObjects:method" VALUE="Delete">
</TD>
</TR>
</TR>
</TABLE>
</TABLE>
<!--#else-->
<!--#else-->
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
2
>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
"2"
>
<TR>
<TR>
<TD>
<TD>
There are currently no items in <EM><!--#var title_or_id--></EM>
There are currently no items in <EM><!--#var title_or_id--></EM>
<P>
<P>
<!--#if
validClipData
-->
<!--#if
cb_dataValid
-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject:method" VALUE="Paste">
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject
s
:method" VALUE="Paste">
<!--#/if
validClipData
-->
<!--#/if-->
</TD>
</TD>
</TABLE>
</TABLE>
<!--#/if-->
<!--#/if-->
...
...
lib/python/OFS/renameForm.dtml
0 → 100644
View file @
da476c61
<HTML>
<HEAD>
<TITLE>Rename Item</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#if expr="_.hasattr(REQUEST, 'ids') and REQUEST['ids']"-->
<!--#with expr="_.getattr(this(), REQUEST['ids'][0])"-->
<!--#if cb_isMoveable-->
<H2>Rename <!--#var meta_type--></H2>
<P>
<FORM ACTION="." METHOD="POST">
<TABLE CELLSPACING="0">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<IMG SRC="<!--#var SCRIPT_NAME-->/<!--#var icon-->" ALT="" BORDER="0">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<!--#var id-->
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<STRONG>to:</STRONG>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="new_id" SIZE="20">
</TD>
</TR>
<TR>
<TD></TD>
<TD>
<INPUT TYPE="HIDDEN" NAME="id" VALUE="<!--#var id-->">
<INPUT TYPE="submit" NAME="manage_renameObject:method" VALUE=" Ok ">
<INPUT TYPE="submit" NAME="manage_main:method" VALUE="Cancel">
</TD>
</TR>
</TABLE>
</FORM>
<!--#else-->
<FORM ACTION="manage_main" METHOD="GET">
<CENTER>
<BR><BR>
The item <EM><!--#var id--></EM> does not support this operation.
<P>
<INPUT TYPE="submit" NAME="submit" VALUE=" Ok ">
</CENTER>
</FORM>
<!--#/if-->
<!--#/with-->
<!--#else-->
<FORM ACTION="manage_main" METHOD="GET">
<CENTER>
<BR><BR>
You must select an item to rename.
<P>
<INPUT TYPE="submit" NAME="submit" VALUE=" Ok ">
</CENTER>
</FORM>
<!--#/if-->
</BODY>
</HTML>
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