Index: /WAeUP_SRP/trunk/skins/waeup_custom/widget_image_render.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/widget_image_render.pt	(revision 792)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/widget_image_render.pt	(revision 793)
@@ -1,4 +1,5 @@
 <tal:block define="mode options/mode;
   id here/getWidgetId;
+  fields here/fields;
   current_filename options/current_filename;
   empty_file options/empty_file;
@@ -8,124 +9,61 @@
   content_url options/content_url;
   last_modified options/last_modified;
-  image_tag options/image_tag;    
+  image_width options/width;
+  image_height options/height;
+  image_tag options/image_tag;
   ">
   <img tal:condition="python: mode == 'view' and not empty_file"
     tal:replace="structure image_tag" />
 
-
-  <tal:block condition="python: 0 and mode == 'view' and not empty_file">
-    <metal:block define-macro="file_view">
-      <a target="_blank" tal:condition="mimetype"
-        tal:attributes="href string:${content_url}?nocache=${last_modified}">
-        <img tal:replace="structure python:here.getImgTag(mimetype.icon_path,
-          title=mimetype.name())" /></a>
-      <a class="strong"
-        tal:attributes="href string:${content_url}?nocache=${last_modified}">
-        <tal:block replace="current_filename" /></a>
-      <span tal:condition="size" class="note"
-        tal:define="str_size python:here.getHumanReadableSize(size);">
-        <tal:block content="str_size"/>
-      </span>
-    </metal:block>
-  </tal:block>
-
   <tal:block condition="python: mode == 'edit'">
 
-    <metal:block define-macro="file_size_max_view">
-      <tal:block define="size_max python:here.size_max;
-                         str_sizeMax python:here.getHumanReadableSize(size_max)"
-        condition="python:size_max > 0">
+    <metal:block use-macro="here/widget_file_render/macros/file_size_max_view" />
 
-        <p i18n:translate="">
-          cpsschemas_size_max
-          <tal:block i18n:name="size_max" content="str_sizeMax"/>
-        </p>
+    <metal:block define-macro="image_title_edit">
+      <metal:block use-macro="here/widget_file_render/macros/file_title_edit">
+      </metal:block>
+    </metal:block>
+
+    <img tal:condition="python: not empty_file and not session_file"
+      tal:replace="structure image_tag" />
+
+    <metal:block define-macro="image_edit">
+      <tal:block define="allow_resize here/allow_resize|nothing">
+      <metal:block use-macro="here/widget_file_render/macros/file_edit">
+        <metal:block fill-slot="edit_file_action">
+          <metal:block define-slot="edit_file_action" />
+        </metal:block>
+        <metal:block fill-slot="change_file">
+          <input type="radio" class="noborder"  name="." value="change"
+                 tal:attributes="name radio_name;
+                                 id string:${radio_name}_change" />
+          <label i18n:translate="cpsschemas_label_file_change"
+                 tal:attributes="for string:${radio_name}_change">Change</label>
+          <input type="file" name="." size="24"
+                 tal:attributes="name name;
+            onclick string:document.getElementById('${radio_name}_change').checked='checked'" />
+          <tal:block condition="allow_resize">
+            <label i18n:translate="cpsschemas_image_resize"
+                   tal:attributes="for string:${radio_name}_change">resize</label>
+            <select tal:attributes="name string:${name}_resize;
+              onchange string:document.getElementById('${radio_name}_change').checked='checked';"
+              tal:define="wid_size python:(here.display_width, here.display_height);
+              sizes python:[s for s in here.getImgSizes() if not wid_size[0] or s['size'] < wid_size]">
+              <option tal:repeat="op sizes"
+                tal:attributes="value op/id;
+                selected python: op['size'] and (op['size'][0]==image_width
+                                               or op['size'][1]==image_height)"
+                i18n:translate=""
+                ><span tal:replace="op/id" /> <span tal:condition="op/size"
+                  i18n:name="dim"
+                  tal:replace="python:'(%sx%s)' % op['size']">
+                  640x480</span></option>
+            </select>
+          </tal:block>
+        </metal:block>
+      </metal:block>
       </tal:block>
     </metal:block>
 
-    <metal:block define-macro="file_title_edit">
-      <p tal:define="name here/getHtmlWidgetId;
-                     title_name string:${name}_filename;">
-        <span i18n:translate="cpsschemas_label_filename">
-          Filename
-        </span>
-        <input style="margin-left: 5px" type="text" size="30" maxlength="80"
-               tal:attributes="name title_name;
-                               value current_filename" />
-      </p>
-    </metal:block>
-
-    <metal:block define-macro="file_edit">
-
-      <ul class="fileChoice"
-          tal:define="name here/getHtmlWidgetId;
-                      radio_name string:${name}_choice;">
-        <li>
-          <metal:block define-slot="keep_file">
-            <input type="radio" class="noborder" name="." value="keep"
-                   checked="checked"
-                   tal:attributes="name radio_name;
-                                   id string:${radio_name}_keep;"/>
-            <label i18n:translate="cpsschemas_label_file_none"
-                   tal:condition="empty_file"
-                   tal:attributes="for string:${radio_name}_keep">None</label>
-            <label i18n:translate="cpsschemas_label_file_keep"
-                   tal:condition="not:empty_file"
-                   tal:attributes="for string:${radio_name}_keep">Keep</label>
-            <a href="http://url..." target="_blank"
-               tal:condition="not:empty_file"
-               tal:omit-tag="session_file"
-               tal:attributes="href string:${content_url}?nocache=${last_modified}">
-              <tal:block condition="mimetype"
-                replace="structure python:here.getImgTag(mimetype.icon_path,
-                  title=mimetype.name())" />
-              <tal:block replace="current_filename" />
-            </a>
-            <tal:block condition="python:not empty_file and not session_file and modules['Products.CPSUtil.integration'].isProductPresent('Products.ExternalEditor')">
-              <tal:block define="ds options/datastructure;
-                                 dm ds/getDataModel;
-                                 proxy dm/getProxy;
-                                 display_ee
-                                   here/display_external_editor|python:True;
-                                 portal here/portal_url/getPortalObject;
-                                 field_id python:here.fields[0]">
-              <tal:block condition="python: proxy and display_ee">
-                -
-                <a href="http://url..."
-                   i18n:translate="cpsschemas_label_file_edit_online"
-                   tal:attributes="href python:portal.getExternalEditorPath(proxy, id, field_id)">
-                  Edit file online
-                </a>
-              </tal:block>
-              </tal:block>
-            </tal:block>
-          </metal:block>
-        </li>
-        <metal:block define-slot="edit_file_action" />
-        <li>
-          <metal:block define-slot="change_file">
-            <input type="radio" class="noborder"  name="." value="change"
-                   tal:attributes="name radio_name;
-                                   id string:${radio_name}_change" />
-            <label i18n:translate="cpsschemas_label_file_change"
-                   tal:attributes="for string:${radio_name}_change">Change</label>
-            <input type="file" name="." size="24"
-                   tal:attributes="name name;
-              onclick string:document.getElementById('${radio_name}_change').checked='checked'" />
-          </metal:block>
-        </li>
-        <li tal:condition="python: not here.is_required and not empty_file">
-          <metal:block define-slot="delete_file">
-            <input type="radio" class="noborder" name="." value="delete"
-                   tal:attributes="name radio_name;
-                                   id string:${radio_name}_delete" />
-            <label i18n:translate="cpsschemas_label_file_delete"
-                   tal:attributes="for string:${radio_name}_delete">Delete</label>
-          </metal:block>
-        </li>
-      </ul>
-    </metal:block>
-
   </tal:block>
-
 </tal:block>
