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
e0f4d5e7
Commit
e0f4d5e7
authored
Nov 10, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to support separate Image and File objects.
parent
aa2ca37e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
25 deletions
+71
-25
lib/python/OFS/Folder.py
lib/python/OFS/Folder.py
+4
-3
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+49
-9
lib/python/OFS/__init__.py
lib/python/OFS/__init__.py
+6
-2
lib/python/OFS/imageAdd.dtml
lib/python/OFS/imageAdd.dtml
+8
-7
lib/python/OFS/imageEdit.dtml
lib/python/OFS/imageEdit.dtml
+4
-4
No files found.
lib/python/OFS/Folder.py
View file @
e0f4d5e7
"""Folder object
"""Folder object
$Id: Folder.py,v 1.1
6 1997/11/10 14:53:13
jim Exp $"""
$Id: Folder.py,v 1.1
7 1997/11/10 16:30:47
jim Exp $"""
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
from
Globals
import
HTMLFile
...
@@ -146,7 +146,8 @@ class PUTer:
...
@@ -146,7 +146,8 @@ class PUTer:
return
self
.
_parent
.
manage_addDocument
(
name
,
''
,
BODY
,
return
self
.
_parent
.
manage_addDocument
(
name
,
''
,
BODY
,
REQUEST
=
REQUEST
)
REQUEST
=
REQUEST
)
i
=
Image
.
Image
()
if
lower
(
type
)[:
6
]
==
'image/'
:
i
=
Image
.
Image
()
else
:
i
=
Image
.
File
()
i
.
_init
(
name
,
BODY
,
type
)
i
.
_init
(
name
,
BODY
,
type
)
i
.
title
=
''
i
.
title
=
''
i
.
_setRoles
(
'A'
,[])
i
.
_setRoles
(
'A'
,[])
...
...
lib/python/OFS/Image.py
View file @
e0f4d5e7
"""Image object"""
"""Image object"""
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
from
Persistence
import
Persistent
from
Persistence
import
Persistent
from
Globals
import
HTMLFile
from
Globals
import
HTMLFile
...
@@ -9,13 +9,13 @@ from AccessControl.Role import RoleManager
...
@@ -9,13 +9,13 @@ from AccessControl.Role import RoleManager
import
SimpleItem
import
SimpleItem
import
Acquisition
import
Acquisition
class
Imag
e
(
Persistent
,
RoleManager
,
SimpleItem
.
Item_w__name__
,
class
Fil
e
(
Persistent
,
RoleManager
,
SimpleItem
.
Item_w__name__
,
Acquisition
.
Implicit
):
Acquisition
.
Implicit
):
"""Image object"""
"""Image object"""
meta_type
=
'
Imag
e'
meta_type
=
'
Fil
e'
icon
=
'OFS/
Imag
e_icon.gif'
icon
=
'OFS/
Fil
e_icon.gif'
manage_editForm
=
HTMLFile
(
'OFS/imageEdit'
)
manage_editForm
=
HTMLFile
(
'OFS/imageEdit'
,
Kind
=
'File'
,
kind
=
'file'
)
manage
=
manage_main
=
manage_editForm
manage
=
manage_main
=
manage_editForm
def
manage_edit
(
self
,
title
,
content_type
,
def
manage_edit
(
self
,
title
,
content_type
,
...
@@ -56,8 +56,7 @@ class Image(Persistent,RoleManager,SimpleItem.Item_w__name__,
...
@@ -56,8 +56,7 @@ class Image(Persistent,RoleManager,SimpleItem.Item_w__name__,
RESPONSE
[
'content-type'
]
=
self
.
content_type
RESPONSE
[
'content-type'
]
=
self
.
content_type
return
self
.
data
return
self
.
data
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
data
return
'<IMG SRC="%s" ALT="%s">'
%
(
self
.
__name__
,
self
.
title_or_id
())
def
__len__
(
self
):
def
__len__
(
self
):
# This is bogus and needed because of the way Python tests truth.
# This is bogus and needed because of the way Python tests truth.
...
@@ -72,12 +71,23 @@ class Image(Persistent,RoleManager,SimpleItem.Item_w__name__,
...
@@ -72,12 +71,23 @@ class Image(Persistent,RoleManager,SimpleItem.Item_w__name__,
if
type
:
self
.
content_type
=
type
if
type
:
self
.
content_type
=
type
except
KeyError
:
pass
except
KeyError
:
pass
class
Image
(
File
):
meta_type
=
'Image'
icon
=
'OFS/Image_icon.gif'
manage
=
manage_editForm
=
HTMLFile
(
'OFS/imageEdit'
,
Kind
=
'Image'
,
kind
=
'image'
)
def
__str__
(
self
):
return
'<IMG SRC="%s" ALT="%s">'
%
(
self
.
__name__
,
self
.
title_or_id
())
class
ImageHandler
:
class
ImageHandler
:
"""Image object handler mixin"""
"""Image object handler mixin"""
#meta_types=({'name':'Image', 'action':'manage_addImageForm'},)
#meta_types=({'name':'Image', 'action':'manage_addImageForm'},)
manage_addImageForm
=
HTMLFile
(
'OFS/imageAdd'
)
manage_addFileForm
=
HTMLFile
(
'OFS/imageAdd'
,
Kind
=
'File'
,
kind
=
'file'
)
manage_addImageForm
=
HTMLFile
(
'OFS/imageAdd'
,
Kind
=
'Image'
,
kind
=
'image'
)
def
manage_addImage
(
self
,
id
,
file
,
title
=
''
,
acl_type
=
'A'
,
acl_roles
=
[],
def
manage_addImage
(
self
,
id
,
file
,
title
=
''
,
acl_type
=
'A'
,
acl_roles
=
[],
REQUEST
=
None
):
REQUEST
=
None
):
...
@@ -89,6 +99,16 @@ class ImageHandler:
...
@@ -89,6 +99,16 @@ class ImageHandler:
self
.
_setObject
(
id
,
i
)
self
.
_setObject
(
id
,
i
)
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
manage_addFile
(
self
,
id
,
file
,
title
=
''
,
acl_type
=
'A'
,
acl_roles
=
[],
REQUEST
=
None
):
"""Add a new Image object"""
i
=
File
()
i
.
_init
(
id
,
file
)
i
.
title
=
title
i
.
_setRoles
(
acl_type
,
acl_roles
)
self
.
_setObject
(
id
,
i
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
imageIds
(
self
):
def
imageIds
(
self
):
t
=
[]
t
=
[]
for
i
in
self
.
objectMap
():
for
i
in
self
.
objectMap
():
...
@@ -108,3 +128,23 @@ class ImageHandler:
...
@@ -108,3 +128,23 @@ class ImageHandler:
n
=
i
[
'id'
]
n
=
i
[
'id'
]
t
.
append
((
n
,
getattr
(
self
,
n
)))
t
.
append
((
n
,
getattr
(
self
,
n
)))
return
t
return
t
def
fileIds
(
self
):
t
=
[]
for
i
in
self
.
objectMap
():
if
i
[
'meta_type'
]
==
'File'
:
t
.
append
(
i
[
'id'
])
return
t
def
fileValues
(
self
):
t
=
[]
for
i
in
self
.
objectMap
():
if
i
[
'meta_type'
]
==
'File'
:
t
.
append
(
getattr
(
self
,
i
[
'id'
]))
return
t
def
fileItems
(
self
):
t
=
[]
for
i
in
self
.
objectMap
():
if
i
[
'meta_type'
]
==
'File'
:
n
=
i
[
'id'
]
t
.
append
((
n
,
getattr
(
self
,
n
)))
return
t
lib/python/OFS/__init__.py
View file @
e0f4d5e7
...
@@ -8,13 +8,14 @@
...
@@ -8,13 +8,14 @@
#
#
##############################################################################
##############################################################################
__doc__
=
'''OFS
__doc__
=
'''OFS
$Id: __init__.py,v 1.
1 1997/11/07 19:31:42
jim Exp $'''
$Id: __init__.py,v 1.
2 1997/11/10 16:32:54
jim Exp $'''
__version__
=
'$Revision: 1.
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
import
Session
import
Session
__
.
meta_types
=
(
__
.
meta_types
=
(
{
'name'
:
'Session'
,
'action'
:
'manage_addSessionForm'
},
{
'name'
:
'Session'
,
'action'
:
'manage_addSessionForm'
},
{
'name'
:
'File'
,
'action'
:
'manage_addFileForm'
},
{
'name'
:
'Image'
,
'action'
:
'manage_addImageForm'
},
{
'name'
:
'Image'
,
'action'
:
'manage_addImageForm'
},
{
'name'
:
'Folder'
,
'action'
:
'manage_addFolderForm'
},
{
'name'
:
'Folder'
,
'action'
:
'manage_addFolderForm'
},
{
'name'
:
'Document'
,
'action'
:
'manage_addDocumentForm'
},
{
'name'
:
'Document'
,
'action'
:
'manage_addDocumentForm'
},
...
@@ -31,6 +32,9 @@ __.methods={
...
@@ -31,6 +32,9 @@ __.methods={
##############################################################################
##############################################################################
#
#
# $Log: __init__.py,v $
# $Log: __init__.py,v $
# Revision 1.2 1997/11/10 16:32:54 jim
# Changed to support separate Image and File objects.
#
# Revision 1.1 1997/11/07 19:31:42 jim
# Revision 1.1 1997/11/07 19:31:42 jim
# *** empty log message ***
# *** empty log message ***
#
#
...
...
lib/python/OFS/imageAdd.dtml
View file @
e0f4d5e7
<HTML>
<HTML>
<HEAD>
<HEAD>
<TITLE>Add
Image
</TITLE>
<TITLE>Add
<!--#var Kind-->
</TITLE>
</HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>Add
Image
</H2>
<H2>Add
<!--#var Kind-->
</H2>
<P>
<P>
You can create a new image in the system using the form below.
You can create a new <!--#var kind--> in the system using the form below.
Select an image from your local computer by clicking the <I>Browse</I>
Select an <!--#var kind--> from your local computer by clicking the
button. The image file you select will be uploaded to the application.
<em>Browse</em> button. The <!--#var kind--> you select will be uploaded
to the application.
<FORM ACTION="manage_add
Image
" METHOD="POST"
<FORM ACTION="manage_add
<!--#var Kind-->
" METHOD="POST"
ENCTYPE="multipart/form-data" TARGET="manage_main">
ENCTYPE="multipart/form-data" TARGET="manage_main">
<TABLE CELLSPACING="2">
<TABLE CELLSPACING="2">
<TR>
<TR>
...
@@ -30,7 +31,7 @@
...
@@ -30,7 +31,7 @@
</TR>
</TR>
<TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP">
<STRONG>
Image
</STRONG>
<STRONG>
<!--#var Kind-->
</STRONG>
</TD>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="file" NAME="file" SIZE="25" VALUE="">
<INPUT TYPE="file" NAME="file" SIZE="25" VALUE="">
...
...
lib/python/OFS/imageEdit.dtml
View file @
e0f4d5e7
<HTML>
<HTML>
<HEAD>
<HEAD>
<TITLE>Edit
Image
</TITLE>
<TITLE>Edit
<!--#var Kind-->
</TITLE>
</HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>Edit
Image
</H2>
<H2>Edit
<!--#var Kind-->
</H2>
<H3>Edit
Image
Properties</H3>
<H3>Edit
<!--#var Kind-->
Properties</H3>
<FORM ACTION="manage_edit" METHOD="POST" TARGET="manage_main">
<FORM ACTION="manage_edit" METHOD="POST" TARGET="manage_main">
<TABLE CELLSPACING="2">
<TABLE CELLSPACING="2">
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<H3>Upload New Data</H3>
<H3>Upload New Data</H3>
You can update data in the
image
using the form below.
You can update data in the
<!--#var kind-->
using the form below.
Select a data file from your local computer by clicking the <EM>Browse</EM>
Select a data file from your local computer by clicking the <EM>Browse</EM>
button. The file you select will be uploaded to the application.
button. The file you select will be uploaded to the application.
...
...
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