2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">View macro for a File.</tal:comment>
|
|
|
|
<metal:view define-macro="view"
|
2011-10-11 10:32:23 -05:00
|
|
|
tal:define="info python: contextObj.getFileInfo(value);
|
|
|
|
empty not: info/size;
|
2010-08-05 11:23:17 -05:00
|
|
|
imageSrc string:${contextObj/absolute_url}/download?name=$name">
|
|
|
|
<tal:file condition="python: not empty and not widget['isImage']">
|
|
|
|
<a tal:attributes="href imageSrc"
|
2011-10-11 10:32:23 -05:00
|
|
|
tal:content="info/filename">
|
2010-08-05 11:23:17 -05:00
|
|
|
</a> -
|
2011-10-11 10:32:23 -05:00
|
|
|
<i class="discreet" tal:content="python:'%sKb' % (info['size'] / 1024)"></i>
|
2010-08-05 11:23:17 -05:00
|
|
|
</tal:file>
|
|
|
|
<tal:image condition="python: not empty and widget['isImage']">
|
|
|
|
<img tal:attributes="src python: imageSrc" />
|
|
|
|
</tal:image>
|
|
|
|
<tal:nothing tal:condition="empty">-</tal:nothing>
|
|
|
|
</metal:view>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Edit macro for an File.</tal:comment>
|
2011-10-11 10:32:23 -05:00
|
|
|
<metal:edit define-macro="edit"
|
|
|
|
tal:define="info python: contextObj.getFileInfo(value);
|
|
|
|
empty not: info/size;">
|
|
|
|
|
|
|
|
<tal:showFile condition="not: empty">
|
2011-11-25 11:01:20 -06:00
|
|
|
<metal:call use-macro="app/ui/widgets/file/macros/view"/><br/>
|
2011-10-11 10:32:23 -05:00
|
|
|
</tal:showFile>
|
|
|
|
<tal:editButtons condition="not: empty">
|
2010-08-05 11:23:17 -05:00
|
|
|
<tal:comment replace="nothing">Keep the file untouched.</tal:comment>
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="radio" value="nochange"
|
2011-10-11 10:32:23 -05:00
|
|
|
tal:attributes="checked python:test(info['size']!=0, 'checked', None);
|
2010-08-05 11:23:17 -05:00
|
|
|
name string:${name}_delete;
|
|
|
|
id string:${name}_nochange;
|
|
|
|
onclick string:document.getElementById('${name}_file').disabled=true;"/>
|
|
|
|
<label tal:attributes="for string:${name}_nochange"
|
2011-09-20 12:21:48 -05:00
|
|
|
i18n:translate="nochange_file" i18n:domain="plone">Keep the file unchanged</label>
|
2010-08-05 11:23:17 -05:00
|
|
|
<br/>
|
|
|
|
<tal:comment replace="nothing">Delete the file.</tal:comment>
|
|
|
|
<tal:delete condition="not: widget/required">
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="radio" value="delete"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:attributes="name string:${name}_delete;
|
|
|
|
id string:${name}_delete;
|
|
|
|
onclick string:document.getElementById('${name}_file').disabled=true;"/>
|
|
|
|
<label tal:attributes="for string:${name}_delete"
|
2011-09-20 12:21:48 -05:00
|
|
|
i18n:translate="delete_file" i18n:domain="plone">Delete the file</label>
|
2010-08-05 11:23:17 -05:00
|
|
|
<br/>
|
|
|
|
</tal:delete>
|
|
|
|
<tal:comment replace="nothing">Replace with a new file.</tal:comment>
|
2011-10-04 13:12:58 -05:00
|
|
|
<input type="radio" value=""
|
2011-10-11 10:32:23 -05:00
|
|
|
tal:attributes="checked python:test(info['size']==0, 'checked', None);
|
2010-08-05 11:23:17 -05:00
|
|
|
name string:${name}_delete;
|
|
|
|
id string:${name}_upload;
|
|
|
|
onclick string:document.getElementById('${name}_file').disabled=false"/>
|
|
|
|
<label tal:attributes="for string:${name}_upload;"
|
2011-09-20 12:21:48 -05:00
|
|
|
i18n:translate="upload_file" i18n:domain="plone">Replace it with a new file</label>
|
2010-08-05 11:23:17 -05:00
|
|
|
<br/>
|
2011-10-11 10:32:23 -05:00
|
|
|
</tal:editButtons>
|
|
|
|
<tal:comment replace="nothing">The upload field.</tal:comment>
|
|
|
|
<input type="file"
|
2010-08-05 11:23:17 -05:00
|
|
|
tal:attributes="name string:${name}_file;
|
2011-09-28 14:17:15 -05:00
|
|
|
id string:${name}_file;
|
|
|
|
size widget/width"/>
|
2011-10-11 10:32:23 -05:00
|
|
|
<script type="text/javascript"
|
|
|
|
tal:define="isDisabled python:test(empty, 'false', 'true')"
|
|
|
|
tal:content="string: document.getElementById('${name}_file').disabled=$isDisabled;">
|
|
|
|
</script>
|
2010-08-05 11:23:17 -05:00
|
|
|
</metal:edit>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Cell macro for an File.</tal:comment>
|
|
|
|
<metal:cell define-macro="cell">
|
2011-11-25 11:01:20 -06:00
|
|
|
<metal:call use-macro="app/ui/widgets/file/macros/view"/>
|
2010-08-05 11:23:17 -05:00
|
|
|
</metal:cell>
|
|
|
|
|
|
|
|
<tal:comment replace="nothing">Search macro for an File.</tal:comment>
|
|
|
|
<metal:search define-macro="search"></metal:search>
|