source: WAeUP_SRP/trunk/skins/cps_custom/widget_image_render.pt @ 6987

Last change on this file since 6987 was 2342, checked in by joachim, 17 years ago

rename No Zodb Image Widget to Application Image Widget

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