Commit 68502d12 authored by Brian Lloyd's avatar Brian Lloyd

Added image preview on Image edit form; Added Web form editing for File

object content if the content is a text type and under 64K; updated help
files.
parent d61a7c04
......@@ -84,7 +84,7 @@
##############################################################################
"""Image object"""
__version__='$Revision: 1.131 $'[11:-2]
__version__='$Revision: 1.132 $'[11:-2]
import Globals, string, struct
from OFS.content_types import guess_content_type
......@@ -443,7 +443,8 @@ class File(Persistent, Implicit, PropertyManager,
self.ZCacheable_invalidate()
self.http__refreshEtag()
def manage_edit(self, title, content_type, precondition='', REQUEST=None):
def manage_edit(self, title, content_type, precondition='',
filedata=None, REQUEST=None):
"""
Changes the title and content type attributes of the File or Image.
"""
......@@ -454,7 +455,10 @@ class File(Persistent, Implicit, PropertyManager,
self.content_type=str(content_type)
if precondition: self.precondition=str(precondition)
elif self.precondition: del self.precondition
self.ZCacheable_invalidate()
if filedata is not None:
self.update_data(filedata, content_type, len(filedata))
else:
self.ZCacheable_invalidate()
if REQUEST:
message="Saved changes."
return self.manage_main(self,REQUEST,manage_tabs_message=message)
......
......@@ -3,10 +3,11 @@
<p class="form-help">
You can update the data for this <dtml-var kind> using the form below.
You can update the data for this file object using the form below.
Select a data file from your local computer by clicking the <em>browse</em>
button and click <em>upload</em> to update the contents of the <dtml-var
kind>.
button and click <em>upload</em> to update the contents of the
file. You may also edit the file content directly if the content is a
text type and small enough to be edited in a text area.
</p>
<form action="<dtml-var URL1>" method="post" enctype="multipart/form-data">
......@@ -47,6 +48,19 @@ kind>.
</td>
</tr>
<dtml-if "this().getContentType()[:4] == 'text' and this().get_size() < 65536">
<tr>
<td align="left" valign="top" colspan="2">
<div style="width: 100%;">
<textarea name="filedata:text" wrap="off" style="width: 100%;"<dtml-if
dtpref_cols> cols="<dtml-var dtpref_cols>"<dtml-else
> cols="50"</dtml-if><dtml-if dtpref_rows> rows="<dtml-var
dtpref_rows>"<dtml-else> rows="20"</dtml-if>><dtml-var
__str__></textarea>
</div>
</td>
</tr>
<dtml-else>
<tr>
<td align="left" valign="top">
<div class="form-label">
......@@ -59,7 +73,6 @@ kind>.
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
......@@ -72,6 +85,7 @@ kind>.
</div>
</td>
</tr>
</dtml-if>
<tr>
<td></td>
......
......@@ -36,6 +36,21 @@ kind>.
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Preview
</div>
</td>
<td align="left" valign="top">
<dtml-if "height < 250">
<dtml-var tag>
<dtml-else>
<dtml-var "tag(scale=250.0 / height)">
</dtml-if>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
......
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