Skip to content

Commit

Permalink
make fileEdit and imageEdit look more alike
Browse files Browse the repository at this point in the history
  • Loading branch information
jhinghaus authored and dwt committed Jun 5, 2018
1 parent 9b5d4c3 commit f71376e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 90 deletions.
132 changes: 51 additions & 81 deletions src/OFS/dtml/fileEdit.dtml
@@ -1,123 +1,93 @@
<dtml-var manage_page_header>
<dtml-var manage_tabs>

<main>

<p class="form-help">
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>
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
file. You may also edit the file content directly if the content is a
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 "REQUEST.URL1" html_quote>" method="post" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td align="left" valign="top">
<div class="form-optional">
<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post" enctype="multipart/form-data" class="zmi-file zmi-metadata">

<div class="form-group row">
<label for="title" class="form-label col-sm-3 col-md-2">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" value="<dtml-if
</label>
<input id="title" class="form-control col-sm-9 col-md-6" type="text" name="title" value="<dtml-if
title>&dtml-title;</dtml-if>">
</td>
</tr>
</div>

<tr>
<td align="left" valign="top">
<div class="form-label">
<div class="form-group row">
<label for="contenttype" class="form-label col-sm-3 col-md-2">
Content Type
</div>
</td>
<td align="left" valign="top">
<input type="text" name="content_type:required" size="40" value="<dtml-if
</label>
<input id="contenttype" class="form-control col-sm-9 col-md-6" type="text" name="content_type:required" value="<dtml-if
content_type>&dtml-content_type;</dtml-if>">
</td>
</tr>
</div>

<tr>
<td align="left" valign="top">
<div class="form-optional">
<div class="form-group row">
<label for="precondition" class="form-label col-sm-3 col-md-2">
Precondition
</div>
</td>
<td align="left" valign="top">
<input type="text" name="precondition" size="40" value="<dtml-if
</label>
<input id="precondition" class="form-control col-sm-9 col-md-6" type="text" name="precondition" value="<dtml-if
precondition>&dtml-precondition;</dtml-if>">
</td>
</tr>
</div>

<dtml-let ct=getContentType>
<dtml-if "(ct.startswith('text') or ct.endswith('javascript'))
<dtml-if "(ct.startswith('text') or ct.endswith('javascript'))
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%;"
<div class="form-group">
<textarea id="content" class="form-control zmi-file zmi-code col-sm-12" name="filedata:text" wrap="off" style="width: 100%;"
rows="20"><dtml-var __str__ html_quote></textarea>
</div>
</td>
</tr>
</div>

<dtml-else>
<tr>
<td align="left" valign="top">
<div class="form-label">
<div class="form-group row">
<label for="size" class="form-label col-sm-3 col-md-2">
File Size
</div>
</td>
<td align="left" valign="top">
<div class="form-text">
</label>
<div class="form-text col-sm-9 col-md-6">
<dtml-var size thousands_commas> bytes
</div>
</td>
</tr>
</div>
</dtml-if>
</dtml-let>

<tr>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<div class="controls">
<dtml-if wl_isLocked>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="manage_edit:method"
<input class="btn btn-primary" type="submit" name="manage_edit:method"
value="Save Changes">
</dtml-if>
</div>
</td>
</tr>
</div>

<tr>
<td align="left" valign="top">
<br />
<div class="form-label">
File Data
</div>
</td>
<td align="left" valign="top">
<br />
<input type="file" name="file" size="25" />
</td>
</tr>
</form>

<tr>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post" enctype="multipart/form-data" class="zmi-file zmi-upload mt-5">
<div class="form-group row">
<label for="file-data" class="form-label col-sm-3 col-md-2">
File Data
</label>
<div class="col-sm-9 col-md-6">
<input id="file-data" class="form-control-file" type="file" name="file" />
</div>
</div>

<div class="controls">
<dtml-if wl_isLocked>
<em>Locked</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="manage_upload:method"
<input class="btn btn-primary" type="submit" name="manage_upload:method"
value="Upload">
</dtml-if>
</div>
</td>
</tr>

</table>
</div>
</form>

<dtml-var manage_page_footer>
</main>

<dtml-var manage_page_footer>
18 changes: 9 additions & 9 deletions src/OFS/dtml/imageEdit.dtml
Expand Up @@ -12,22 +12,22 @@
<form action="&dtml-URL1;/manage_edit" method="post" enctype="multipart/form-data" class="zmi-image zmi-metadata">

<div class="form-group row">
<label for="title" class="col-sm-2">Title</label>
<div class="col-sm-10">
<label for="title" class="col-sm-3 col-md-2">Title</label>
<div class="col-sm-9 col-md-6">
<input id="title" class="form-control" type="text" name="title" value="<dtml-if title>&dtml-title;</dtml-if>">
</div>
</div>

<div class="form-group row">
<label for="content-type" class="col-sm-2">Content Type</label>
<div class="col-sm-10">
<label for="content-type" class="col-sm-3 col-md-2">Content Type</label>
<div class="col-sm-9 col-md-6">
<input id="content-type" class="form-control" type="text" name="content_type:required" value="<dtml-if content_type>&dtml-content_type;</dtml-if>">
</div>
</div>

<div class="form-group row">
<label for="preview" class="col-sm-2">Preview</label>
<figure id="preview" class="figure col-sm-10">
<label for="preview" class="col-sm-3 col-md-2">Preview</label>
<figure id="preview" class="figure col-sm-9 col-md-6">
<dtml-if "_.same_type(height, 1) and height and height > 250">
<dtml-var "tag(scale=250.0 / height, css_class='img-thumbnail', id='preview')">
<dtml-elif "_.same_type(height, 's') and height and _.int(height) > 250">
Expand All @@ -48,11 +48,11 @@
</div>
</form>

<form action="&dtml-URL1;/manage_upload" method="post" enctype="multipart/form-data" class="image upload mt-5">
<form action="&dtml-URL1;/manage_upload" method="post" enctype="multipart/form-data" class="zmi-image zmi-upload mt-5">

<div class="form-group row">
<label for="file-data" class="col-sm-2">File Data</label>
<div class="col-sm-10">
<label for="file-data" class="col-sm-3 col-md-2">File Data</label>
<div class="col-sm-9 col-md-6">
<input id="file-data" class="form-control-file" type="file" name="file" />
</div>
</div>
Expand Down

0 comments on commit f71376e

Please sign in to comment.