source: WAeUP_SRP/trunk/skins/waeup_custom/widget_image_render.pt @ 811

Last change on this file since 811 was 808, checked in by joachim, 18 years ago

add automatic resizing

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
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    <span tal:condition="python:0">
24      <metal:block use-macro="here/widget_file_render/macros/file_title_edit">
25      </metal:block>
26    </span>
27    </metal:block>
28
29    <img tal:condition="python: 0 and not empty_file and not session_file"
30      tal:replace="structure image_tag" />
31
32    <metal:block define-macro="image_edit">
33      <tal:block define="allow_resize here/allow_resize|nothing">
34      <metal:block use-macro="here/widget_file_render/macros/file_edit">
35        <metal:block fill-slot="edit_file_action">
36          <metal:block define-slot="edit_file_action" />
37        </metal:block>
38        <metal:block fill-slot="change_file">
39          <input type="radio" class="noborder"  name="." value="change"
40                 tal:attributes="name radio_name;
41                                 id string:${radio_name}_change" />
42          <label i18n:translate="cpsschemas_label_file_change"
43                 tal:attributes="for string:${radio_name}_change">Change</label>
44          <input type="file" name="." size="24"
45                 tal:attributes="name name;
46            onclick string:document.getElementById('${radio_name}_change').checked='checked'" />
47          <tal:block condition="python:1">
48            <input type="hidden" value="img_auto_size"
49                   tal:attributes="name string:${name}_resize" />
50          </tal:block>
51          <tal:block condition="python:0 and allow_resize">
52            <label i18n:translate="cpsschemas_image_resize"
53                   tal:attributes="for string:${radio_name}_change">resize</label>
54            <select tal:attributes="name string:${name}_resize;
55              onchange string:document.getElementById('${radio_name}_change').checked='checked';"
56              tal:define="wid_size python:(here.display_width, here.display_height);
57              sizes python:[s for s in here.getImgSizes() if not wid_size[0] or s['size'] < wid_size]">
58              <option tal:repeat="op sizes"
59                tal:attributes="value op/id;
60                selected python: op['size'] and (op['size'][0]==image_width
61                                               or op['size'][1]==image_height)"
62                i18n:translate=""
63                ><span tal:replace="op/id" /> <span tal:condition="op/size"
64                  i18n:name="dim"
65                  tal:replace="python:'(%sx%s)' % op['size']">
66                  640x480</span></option>
67            </select>
68          </tal:block>
69        </metal:block>
70      </metal:block>
71      </tal:block>
72    </metal:block>
73
74  </tal:block>
75</tal:block>
Note: See TracBrowser for help on using the repository browser.