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 | <img tal:condition="python: mode == 'view' and not empty_file" |
---|
16 | tal:replace="structure image_tag" /> |
---|
17 | |
---|
18 | <tal:block condition="python: mode == 'edit'"> |
---|
19 | |
---|
20 | <metal:block use-macro="here/widget_file_render/macros/file_size_max_view" /> |
---|
21 | |
---|
22 | <metal:block define-macro="image_title_edit"> |
---|
23 | <metal:block use-macro="here/widget_file_render/macros/file_title_edit"> |
---|
24 | </metal:block> |
---|
25 | </metal:block> |
---|
26 | |
---|
27 | <img tal:condition="python: not empty_file and not session_file" |
---|
28 | tal:replace="structure image_tag" /> |
---|
29 | |
---|
30 | <metal:block define-macro="image_edit"> |
---|
31 | <tal:block define="allow_resize here/allow_resize|nothing"> |
---|
32 | <metal:block use-macro="here/widget_file_render/macros/file_edit"> |
---|
33 | <metal:block fill-slot="edit_file_action"> |
---|
34 | <metal:block define-slot="edit_file_action" /> |
---|
35 | </metal:block> |
---|
36 | <metal:block fill-slot="change_file"> |
---|
37 | <input type="radio" class="noborder" name="." value="change" |
---|
38 | tal:attributes="name radio_name; |
---|
39 | id string:${radio_name}_change" /> |
---|
40 | <label i18n:translate="cpsschemas_label_file_change" |
---|
41 | tal:attributes="for string:${radio_name}_change">Change</label> |
---|
42 | <input type="file" name="." size="24" |
---|
43 | tal:attributes="name name; |
---|
44 | onclick string:document.getElementById('${radio_name}_change').checked='checked'" /> |
---|
45 | <tal:block condition="allow_resize"> |
---|
46 | <label i18n:translate="cpsschemas_image_resize" |
---|
47 | tal:attributes="for string:${radio_name}_change">resize</label> |
---|
48 | <select tal:attributes="name string:${name}_resize; |
---|
49 | onchange string:document.getElementById('${radio_name}_change').checked='checked';" |
---|
50 | tal:define="wid_size python:(here.display_width, here.display_height); |
---|
51 | sizes python:[s for s in here.getImgSizes() if not wid_size[0] or s['size'] < wid_size]"> |
---|
52 | <option tal:repeat="op sizes" |
---|
53 | tal:attributes="value op/id; |
---|
54 | selected python: op['size'] and (op['size'][0]==image_width |
---|
55 | or op['size'][1]==image_height)" |
---|
56 | i18n:translate="" |
---|
57 | ><span tal:replace="op/id" /> <span tal:condition="op/size" |
---|
58 | i18n:name="dim" |
---|
59 | tal:replace="python:'(%sx%s)' % op['size']"> |
---|
60 | 640x480</span></option> |
---|
61 | </select> |
---|
62 | </tal:block> |
---|
63 | </metal:block> |
---|
64 | </metal:block> |
---|
65 | </tal:block> |
---|
66 | </metal:block> |
---|
67 | |
---|
68 | </tal:block> |
---|
69 | </tal:block> |
---|