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
4290b8a3
Commit
4290b8a3
authored
Sep 10, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added SimpleItem mix-in and new title/id methods.
parent
172bed30
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
49 deletions
+112
-49
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+6
-3
lib/python/OFS/Document.py
lib/python/OFS/Document.py
+3
-8
lib/python/OFS/Folder.py
lib/python/OFS/Folder.py
+5
-3
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+17
-9
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+76
-0
lib/python/OFS/main.dtml
lib/python/OFS/main.dtml
+5
-26
No files found.
lib/python/OFS/Application.py
View file @
4290b8a3
...
...
@@ -11,8 +11,8 @@
__doc__
=
'''Application support
$Id: Application.py,v 1.
9 1997/09/09 14:21:07 brian
Exp $'''
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
$Id: Application.py,v 1.
10 1997/09/10 18:42:35 jim
Exp $'''
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
regex
...
...
@@ -48,7 +48,7 @@ class Application(Folder.Folder):
raise
'Redirect'
,
(
"%s/%s"
%
(
PARENT_URL
,
destination
))
__allow_groups__
=
UserFolder
()
def
open_bobobase
():
# Open the application database
...
...
@@ -145,6 +145,9 @@ if __name__ == "__main__": main()
##############################################################################
#
# $Log: Application.py,v $
# Revision 1.10 1997/09/10 18:42:35 jim
# Added SimpleItem mix-in and new title/id methods.
#
# Revision 1.9 1997/09/09 14:21:07 brian
# Fixed Image editing
#
...
...
lib/python/OFS/Document.py
View file @
4290b8a3
"""Document object"""
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
from
Globals
import
HTML
from
Globals
import
HTMLFile
from
string
import
join
,
split
,
strip
,
rfind
from
AccessControl.Role
import
RoleManager
import
regex
import
SimpleItem
class
Document
(
HTML
,
RoleManager
):
class
Document
(
HTML
,
RoleManager
,
SimpleItem
.
Item_w__name__
):
"""A Document object"""
meta_type
=
'Document'
title
=
''
icon
=
'OFS/Document_icon.gif'
__state_names__
=
HTML
.
__state_names__
+
(
'title'
,
'__roles__'
)
...
...
lib/python/OFS/Folder.py
View file @
4290b8a3
"""Folder object
$Id: Folder.py,v 1.
8 1997/08/29 18:39:31 brian
Exp $"""
$Id: Folder.py,v 1.
9 1997/09/10 18:42:36 jim
Exp $"""
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
...
...
@@ -12,6 +12,7 @@ from Image import ImageHandler
from
Document
import
DocumentHandler
from
AccessControl.User
import
UserFolderHandler
from
AccessControl.Role
import
RoleManager
import
SimpleItem
class
FolderHandler
:
"""Folder object handler"""
...
...
@@ -55,7 +56,8 @@ class FolderHandler:
class
Folder
(
ObjectManager
,
RoleManager
,
DocumentHandler
,
ImageHandler
,
FolderHandler
,
UserFolderHandler
):
ImageHandler
,
FolderHandler
,
UserFolderHandler
,
SimpleItem
.
Item
):
"""Folder object"""
meta_type
=
'Folder'
id
=
'folder'
...
...
lib/python/OFS/Image.py
View file @
4290b8a3
"""Image object"""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
from
Persistence
import
Persistent
from
Globals
import
HTMLFile
from
Globals
import
MessageDialog
from
AccessControl.Role
import
RoleManager
import
SimpleItem
class
Image
(
Persistent
,
RoleManager
):
class
Image
(
Persistent
,
RoleManager
,
SimpleItem
.
Item_w__name__
):
"""Image object"""
meta_type
=
'Image'
title
=
''
icon
=
'OFS/Image_icon.gif'
manage_editForm
=
HTMLFile
(
'OFS/imageEdit'
)
manage
=
manage_main
=
manage_editForm
manage_options
=
()
def
manage_edit
(
self
,
file
,
title
,
content_type
=
''
,
acl_type
=
'A'
,
acl_roles
=
[]):
def
manage_edit
(
self
,
file
,
title
,
content_type
=
''
,
acl_type
=
'A'
,
acl_roles
=
[],
REQUEST
=
None
):
""" """
try
:
headers
=
file
.
headers
except
:
headers
=
None
...
...
@@ -28,11 +27,20 @@ class Image(Persistent,RoleManager):
self
.
content_type
=
content_type
self
.
data
=
file
elif
file
:
data
=
file
.
read
()
self
.
content_type
=
headers
[
'content-type'
]
self
.
data
=
data
try
:
data
=
file
.
read
()
content_type
=
headers
[
'content-type'
]
if
data
:
self
.
data
=
data
self
.
content_type
=
content_type
except
:
pass
self
.
title
=
title
self
.
_setRoles
(
acl_type
,
acl_roles
)
return
MessageDialog
(
title
=
'Changed %s'
%
self
.
__name__
,
message
=
'%s has been updated'
%
self
.
__name__
,
action
=
REQUEST
[
'URL2'
]
+
'/manage_main'
,
target
=
'manage_main'
)
def
_init
(
self
,
id
,
file
,
content_type
=
''
):
try
:
headers
=
file
.
headers
...
...
lib/python/OFS/SimpleItem.py
0 → 100644
View file @
4290b8a3
#!/bin/env python
##############################################################################
#
# Copyright
#
# Copyright 1997 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
'''This module implements a simple item mix-in for objects that have a
very simple (e.g. one-screen) management interface, like documents,
Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
$Id: SimpleItem.py,v 1.1 1997/09/10 18:42:36 jim Exp $'''
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
class
Item
:
# Name, relative to SOFTWARE_URL of icon used to display item
# in folder listings.
icon
=
'App/arrow.jpg'
# Meta type used for selecting all objects of a given type.
meta_type
=
'simple item'
# Default title.
title
=
''
# Empty manage_options signals that this object has a
# single-screen management interface.
manage_options
=
()
# Utility that returns the title if it is not blank and the id
# otherwise.
def
title_or_id
(
self
):
return
self
.
title
or
self
.
id
# Utility that returns the title if it is not blank and the id
# otherwise. If the title is not blank, then the id is included
# in parens.
def
title_and_id
(
self
):
t
=
self
.
title
return
t
and
(
"%s (%s)"
%
(
t
,
self
.
id
))
or
self
.
id
# Handy way to talk to ourselves in document templates.
def
this
(
self
):
return
self
class
Item_w__name__
(
Item
):
# Utility that returns the title if it is not blank and the id
# otherwise.
def
title_or_id
(
self
):
return
self
.
title
or
self
.
__name__
# Utility that returns the title if it is not blank and the id
# otherwise. If the title is not blank, then the id is included
# in parens.
def
title_and_id
(
self
):
t
=
self
.
title
return
t
and
(
"%s (%s)"
%
(
t
,
self
.
__name__
))
or
self
.
__name__
##############################################################################
#
# $Log: SimpleItem.py,v $
# Revision 1.1 1997/09/10 18:42:36 jim
# Added SimpleItem mix-in and new title/id methods.
#
#
lib/python/OFS/main.dtml
View file @
4290b8a3
<HTML>
<HEAD>
<TITLE>
<!--#if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
</TITLE>
</HEAD>
<HTML><HEAD><TITLE><!--#var title_or_id--></TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<H2>
<!--#if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
</H2>
<H2><!--#var title_or_id--></H2>
<P>
<!--#if parentObject-->
...
...
@@ -23,11 +8,7 @@
<A HREF="<!--#var URL2-->/manage" target="_top">
<IMG SRC="<!--#var SOFTWARE_URL-->/OFS/UpFolder_icon.gif" BORDER=0>
</A>
Return to <!--#if title-->
<!--#var title-->
<!--#else title-->
<!--#var id-->
<!--#/if title-->
Return to <!--#var title_or_id-->
<BR>
<!--#/in parentObject-->
<!--#/if parentObject-->
...
...
@@ -44,9 +25,7 @@
<!--#/if sequence-var-manage_options-->>
<IMG SRC="<!--#var SOFTWARE_URL-->/<!--#var icon-->" BORDER="0">
</A>
<A HREF="<!--#var URL1-->/<!--#var id-->"><!--#if title-->
<!--#var title--> (<!--#var id-->)<!--#else title-->
<!--#var id--><!--#/if title--></A><BR>
<A HREF="<!--#var URL1-->/<!--#var id-->"><!--#var title_and_id--></A><BR>
<!--#/in objectValues-->
<!--#/if objectValues-->
...
...
@@ -76,7 +55,7 @@ To delete items, select one or more items and click "Delete".
<FORM ACTION="<!--#var PARENT_URL-->/manage_delObjects" METHOD="GET">
<SELECT NAME="ids:list" MULTIPLE SIZE="4">
<!--#in objectValues-->
<OPTION VALUE="<!--#var id-->"><!--#var title-->
<OPTION VALUE="<!--#var id-->"><!--#var title
_and_id
-->
<!--#/in objectValues-->
</SELECT><BR>
<INPUT TYPE="SUBMIT" VALUE="Delete">
...
...
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