Commit 27943ba6 authored by Jim Fulton's avatar Jim Fulton

Changed Image View tab to include tabs.

Added getSize and getContentType.
parent 888f1f78
"""Image object"""
__version__='$Revision: 1.32 $'[11:-2]
__version__='$Revision: 1.33 $'[11:-2]
import Globals
from Globals import HTMLFile, MessageDialog
......@@ -26,25 +26,17 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
manage_uploadForm=HTMLFile('imageUpload',globals(),Kind='File',kind='file')
manage=manage_main=manage_editForm
manage_options=({'label':'Edit', 'action':'manage_main',
'target':'manage_main',
},
{'label':'Upload', 'action':'manage_uploadForm',
'target':'manage_main',
},
{'label':'View', 'action':'index_html',
'target':'manage_main',
},
{'label':'Security', 'action':'manage_access',
'target':'manage_main',
},
manage_options=({'label':'Edit', 'action':'manage_main'},
{'label':'Upload', 'action':'manage_uploadForm'},
{'label':'View', 'action':'view_image_or_file'},
{'label':'Security', 'action':'manage_access'},
)
__ac_permissions__=(
('View management screens', ['manage','manage_tabs','manage_uploadForm']),
('Change permissions', ['manage_access']),
('Change/upload data', ['manage_edit','manage_upload','PUT']),
('View', ['index_html',]),
('View', ['index_html', 'view_image_or_file', 'getSize', 'getContentType']),
('Shared permission', ['',]),
)
......@@ -77,6 +69,8 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
RESPONSE['content-type'] =self.content_type
return self.data
def view_image_or_file(self, RESPONSE): return self.index_html(RESPONSE)
def manage_edit(self,title,content_type,REQUEST=None):
""" """
self.title=title
......@@ -113,6 +107,17 @@ class File(Persistent,Implicit,RoleManager,Item_w__name__):
if type: self.content_type=type
except KeyError: pass
def getSize(self):
"""Get the size of a file or image
"""
return len(self.data)
def getContentType(self):
"""Get the content type of a file or image
"""
return self.content_type
def size(self): return len(self.data)
def __str__(self): return str(self.data)
def __len__(self): return 1
......@@ -129,6 +134,7 @@ class Image(File):
icon ='p_/image'
manage_editForm =HTMLFile('imageEdit',globals(),Kind='Image',kind='image')
view_image_or_file =HTMLFile('imageView',globals())
manage_uploadForm=HTMLFile('imageUpload',globals(),Kind='Image',
kind='image')
manage=manage_main=manage_editForm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment