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
Hide 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
$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
...
...
@@ -71,7 +71,8 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
(
'View management screens'
,
(
'manage'
,
'manage_menu'
,
'manage_main'
,
'manage_copyright'
,
'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_findResult'
,
'manage_findOpt'
)),
(
'Access contents information'
,
...
...
lib/python/OFS/Moniker.py
View file @
da476c61
"""
Object monikers
"""Object monikers
An object moniker is an intelligent reference to a
persistent object. A moniker can be turned back into
...
...
@@ -7,30 +6,25 @@ Object monikers
and aquisition relationships via a simple interface.
"""
__version__
=
'$Revision: 1.4 $'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5 $'
[
11
:
-
2
]
import
Globals
class
Moniker
:
""" """
def
__init__
(
self
,
ob
j
=
None
,
op
=
0
):
if
ob
j
is
None
:
return
pd
=
[]
ob
=
obj
def
__init__
(
self
,
ob
=
None
):
if
ob
is
None
:
return
self
.
jar
=
ob
.
_p_jar
.
name
self
.
ids
=
[]
while
1
:
if
not
hasattr
(
ob
,
'_p_oid'
):
break
pd
.
append
(
ob
.
_p_oid
)
self
.
ids
.
append
(
ob
.
_p_oid
)
if
not
hasattr
(
ob
,
'aq_parent'
):
break
ob
=
ob
.
aq_parent
pd
.
reverse
()
self
.
pd
=
pd
self
.
jr
=
obj
.
_p_jar
.
name
self
.
op
=
op
self
.
ids
.
reverse
()
def
id
(
self
):
return
absattr
(
self
.
bind
().
id
)
...
...
@@ -40,33 +34,43 @@ class Moniker:
def
assert
(
self
):
# Return true if the named object exists
if
self
.
jr
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
jr
].
jar
for
n
in
self
.
pd
:
if
self
.
j
a
r
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
j
a
r
].
jar
for
n
in
self
.
ids
:
if
not
jar
.
has_key
(
n
):
return
0
return
1
def
bind
(
self
):
# Return the real object named by this moniker
if
self
.
jr
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
jr
].
jar
if
self
.
j
a
r
is
None
:
jar
=
Globals
.
Bobobase
.
_jar
else
:
jar
=
Globals
.
SessionBase
[
self
.
j
a
r
].
jar
ob
=
None
for
n
in
self
.
pd
:
for
n
in
self
.
ids
:
o
=
jar
[
n
]
if
ob
is
not
None
:
o
=
o
.
__of__
(
ob
)
ob
=
o
return
ob
def
exact
(
self
,
o
ther
):
def
exact
(
self
,
o
b
):
# Check against another moniker to see if it
# refers to the exact same object in the exact
# 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
):
if
callable
(
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
$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
App.FactoryDispatcher
...
...
@@ -106,15 +106,29 @@ class ObjectManager(
return
()
def
_setObject
(
self
,
id
,
object
,
roles
=
None
,
user
=
None
):
self
.
_checkId
(
id
)
setattr
(
self
,
id
,
object
)
try
:
t
=
object
.
meta_type
except
:
t
=
None
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
):
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
))
def
objectIds
(
self
,
spec
=
None
):
...
...
@@ -284,80 +298,33 @@ class ObjectManager(
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
=
[],
submit
=
'Delete'
,
clip_id
=
''
,
clip_data
=
''
,
REQUEST
=
None
):
def
manage_delObjects
(
self
,
ids
=
[],
REQUEST
=
None
):
"""Delete a subordinate object
The objects specified in 'ids' get deleted.
"""
if
type
(
ids
)
is
type
(
''
):
ids
=
[
ids
]
if
submit
==
'Delete'
:
if
not
ids
:
return
MessageDialog
(
title
=
'No items specified'
,
message
=
'No items were specified!'
,
action
=
'./manage_main'
,)
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
for
n
in
ids
:
if
n
in
p
:
return
MessageDialog
(
title
=
'Not Deletable'
,
message
=
'<EM>%s</EM> cannot be deleted.'
%
n
,
action
=
'./manage_main'
,)
while
ids
:
id
=
ids
[
-
1
]
if
not
hasattr
(
self
,
id
)
or
not
self
.
__dict__
.
has_key
(
id
):
raise
'BadRequest'
,
'%s does not exist'
%
ids
[
-
1
]
self
.
_delObject
(
id
)
del
ids
[
-
1
]
if
REQUEST
is
not
None
:
if
not
ids
:
return
MessageDialog
(
title
=
'No items specified'
,
message
=
'No items were specified!'
,
action
=
'./manage_main'
,)
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
for
n
in
ids
:
if
n
in
p
:
return
MessageDialog
(
title
=
'Not Deletable'
,
message
=
'<EM>%s</EM> cannot be deleted.'
%
n
,
action
=
'./manage_main'
,)
while
ids
:
id
=
ids
[
-
1
]
if
not
hasattr
(
self
,
id
)
or
not
self
.
__dict__
.
has_key
(
id
):
raise
'BadRequest'
,
'%s does not exist'
%
ids
[
-
1
]
self
.
_delObject
(
id
)
del
ids
[
-
1
]
if
REQUEST
is
not
None
:
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'
):
self
.
_checkId
(
id
)
...
...
@@ -538,6 +505,9 @@ class ObjectManager(
##############################################################################
#
# $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
# - Revamped folder security:
#
...
...
lib/python/OFS/main.dtml
View file @
da476c61
...
...
@@ -12,10 +12,10 @@
<FORM ACTION="." METHOD="POST">
<!--#if objectItems-->
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
2
>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
"2"
>
<!--#in objectItems sort-->
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP"
WIDTH="16"
>
<INPUT TYPE="CHECKBOX" NAME="ids:list" VALUE="<!--#var sequence-key-->">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
...
...
@@ -42,28 +42,31 @@
</TD>
</TR>
<!--#/in-->
<TR>
<TD></TD>
</TABLE>
<TD COLSPAN="2">
<INPUT TYPE="SUBMIT" NAME="manage_cutObject:method" VALUE="Cut">
<INPUT TYPE="SUBMIT" NAME="manage_copyObject:method" VALUE="Copy">
<!--#if validClipData-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject:method" VALUE="Paste">
<!--#/if validClipData-->
<INPUT TYPE="SUBMIT" NAME="manage_delObjects:method" VALUE="Delete">
</TD>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=2>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="16"></TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="SUBMIT" NAME="manage_renameForm:method" VALUE="Rename">
<INPUT TYPE="SUBMIT" NAME="manage_cutObjects:method" VALUE="Cut">
<INPUT TYPE="SUBMIT" NAME="manage_copyObjects:method" VALUE="Copy">
<!--#if cb_dataValid-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObjects:method" VALUE="Paste">
<!--#/if-->
<INPUT TYPE="SUBMIT" NAME="manage_delObjects:method" VALUE="Delete">
</TD>
</TR>
</TABLE>
<!--#else-->
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
2
>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING=
"2"
>
<TR>
<TD>
There are currently no items in <EM><!--#var title_or_id--></EM>
<P>
<!--#if
validClipData
-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject:method" VALUE="Paste">
<!--#/if
validClipData
-->
<!--#if
cb_dataValid
-->
<INPUT TYPE="SUBMIT" NAME="manage_pasteObject
s
:method" VALUE="Paste">
<!--#/if-->
</TD>
</TABLE>
<!--#/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