[2217] | 1 | <tal:block define="mode options/mode; |
---|
| 2 | id here/getWidgetId; |
---|
| 3 | fields here/fields; |
---|
| 4 | current_filename options/current_filename; |
---|
| 5 | empty_file options/empty_file; |
---|
| 6 | session_file options/session_file; |
---|
| 7 | mimetype options/mimetype; |
---|
| 8 | size options/size; |
---|
| 9 | content_url options/content_url; |
---|
| 10 | last_modified options/last_modified; |
---|
| 11 | image_width options/width; |
---|
| 12 | image_height options/height; |
---|
| 13 | image_tag options/image_tag; |
---|
| 14 | "> |
---|
| 15 | <span tal:condition="python:0"> |
---|
| 16 | <img tal:condition="python: mode == 'view' and not empty_file" |
---|
| 17 | tal:replace="structure image_tag" /> |
---|
| 18 | </span> |
---|
| 19 | <span tal:condition="python: mode == 'view' and not empty_file"> |
---|
| 20 | <a href="" target="_new" |
---|
| 21 | tal:attributes="href content_url" |
---|
| 22 | tal:content="current_filename" > |
---|
| 23 | </a> |
---|
| 24 | </span> |
---|
| 25 | |
---|
| 26 | <tal:block condition="python: mode == 'edit'"> |
---|
| 27 | |
---|
| 28 | <metal:block use-macro="here/widget_file_render/macros/file_size_max_view" /> |
---|
| 29 | |
---|
| 30 | <metal:block define-macro="image_title_edit"> |
---|
| 31 | <span tal:condition="python:0"> |
---|
| 32 | <metal:block use-macro="here/widget_file_render/macros/file_title_edit"> |
---|
| 33 | </metal:block> |
---|
| 34 | </span> |
---|
| 35 | </metal:block> |
---|
| 36 | |
---|
| 37 | <img tal:condition="python: 0 and not empty_file and not session_file" |
---|
| 38 | tal:replace="structure image_tag" /> |
---|
| 39 | |
---|
| 40 | <metal:block define-macro="image_edit"> |
---|
| 41 | <tal:block define="allow_resize here/allow_resize|nothing"> |
---|
| 42 | <metal:block use-macro="here/widget_file_render/macros/file_edit"> |
---|
| 43 | <metal:block fill-slot="edit_file_action"> |
---|
| 44 | <metal:block define-slot="edit_file_action" /> |
---|
| 45 | </metal:block> |
---|
| 46 | <metal:block fill-slot="change_file"> |
---|
| 47 | <input type="radio" class="noborder" name="." value="change" |
---|
| 48 | tal:attributes="name radio_name; |
---|
| 49 | id string:${radio_name}_change" /> |
---|
| 50 | <label i18n:translate="cpsschemas_label_file_change" |
---|
| 51 | tal:attributes="for string:${radio_name}_change">Change</label> |
---|
| 52 | <input type="file" name="." size="24" |
---|
| 53 | tal:attributes="name name; |
---|
| 54 | onclick string:document.getElementById('${radio_name}_change').checked='checked'" /> |
---|
| 55 | <tal:block condition="python:1"> |
---|
| 56 | <input type="hidden" value="img_auto_size" |
---|
| 57 | tal:attributes="name string:${name}_resize" /> |
---|
| 58 | </tal:block> |
---|
| 59 | <tal:block condition="python:0 and allow_resize"> |
---|
| 60 | <label i18n:translate="cpsschemas_image_resize" |
---|
| 61 | tal:attributes="for string:${radio_name}_change">resize</label> |
---|
| 62 | <select tal:attributes="name string:${name}_resize; |
---|
| 63 | onchange string:document.getElementById('${radio_name}_change').checked='checked';" |
---|
| 64 | tal:define="wid_size python:(here.display_width, here.display_height); |
---|
| 65 | sizes python:[s for s in here.getImgSizes() if not wid_size[0] or s['size'] < wid_size]"> |
---|
| 66 | <option tal:repeat="op sizes" |
---|
| 67 | tal:attributes="value op/id; |
---|
| 68 | selected python: op['size'] and (op['size'][0]==image_width |
---|
| 69 | or op['size'][1]==image_height)" |
---|
| 70 | i18n:translate="" |
---|
| 71 | ><span tal:replace="op/id" /> <span tal:condition="op/size" |
---|
| 72 | i18n:name="dim" |
---|
| 73 | tal:replace="python:'(%sx%s)' % op['size']"> |
---|
| 74 | 640x480</span></option> |
---|
| 75 | </select> |
---|
| 76 | </tal:block> |
---|
| 77 | </metal:block> |
---|
| 78 | </metal:block> |
---|
| 79 | </tal:block> |
---|
| 80 | </metal:block> |
---|
| 81 | |
---|
| 82 | </tal:block> |
---|
| 83 | </tal:block> |
---|