| 1 | <tal:block define="mode options/mode; |
|---|
| 2 | id here/getWidgetId; |
|---|
| 3 | current_filename options/current_filename; |
|---|
| 4 | empty_file options/empty_file; |
|---|
| 5 | session_file options/session_file; |
|---|
| 6 | mimetype options/mimetype; |
|---|
| 7 | size options/size; |
|---|
| 8 | content_url options/content_url; |
|---|
| 9 | last_modified options/last_modified; |
|---|
| 10 | image_tag options/image_tag; |
|---|
| 11 | "> |
|---|
| 12 | <img tal:condition="python: mode == 'view' and not empty_file" |
|---|
| 13 | tal:replace="structure image_tag" /> |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | <tal:block condition="python: 0 and mode == 'view' and not empty_file"> |
|---|
| 17 | <metal:block define-macro="file_view"> |
|---|
| 18 | <a target="_blank" tal:condition="mimetype" |
|---|
| 19 | tal:attributes="href string:${content_url}?nocache=${last_modified}"> |
|---|
| 20 | <img tal:replace="structure python:here.getImgTag(mimetype.icon_path, |
|---|
| 21 | title=mimetype.name())" /></a> |
|---|
| 22 | <a class="strong" |
|---|
| 23 | tal:attributes="href string:${content_url}?nocache=${last_modified}"> |
|---|
| 24 | <tal:block replace="current_filename" /></a> |
|---|
| 25 | <span tal:condition="size" class="note" |
|---|
| 26 | tal:define="str_size python:here.getHumanReadableSize(size);"> |
|---|
| 27 | <tal:block content="str_size"/> |
|---|
| 28 | </span> |
|---|
| 29 | </metal:block> |
|---|
| 30 | </tal:block> |
|---|
| 31 | |
|---|
| 32 | <tal:block condition="python: mode == 'edit'"> |
|---|
| 33 | |
|---|
| 34 | <metal:block define-macro="file_size_max_view"> |
|---|
| 35 | <tal:block define="size_max python:here.size_max; |
|---|
| 36 | str_sizeMax python:here.getHumanReadableSize(size_max)" |
|---|
| 37 | condition="python:size_max > 0"> |
|---|
| 38 | |
|---|
| 39 | <p i18n:translate=""> |
|---|
| 40 | cpsschemas_size_max |
|---|
| 41 | <tal:block i18n:name="size_max" content="str_sizeMax"/> |
|---|
| 42 | </p> |
|---|
| 43 | </tal:block> |
|---|
| 44 | </metal:block> |
|---|
| 45 | |
|---|
| 46 | <metal:block define-macro="file_title_edit"> |
|---|
| 47 | <p tal:define="name here/getHtmlWidgetId; |
|---|
| 48 | title_name string:${name}_filename;"> |
|---|
| 49 | <span i18n:translate="cpsschemas_label_filename"> |
|---|
| 50 | Filename |
|---|
| 51 | </span> |
|---|
| 52 | <input style="margin-left: 5px" type="text" size="30" maxlength="80" |
|---|
| 53 | tal:attributes="name title_name; |
|---|
| 54 | value current_filename" /> |
|---|
| 55 | </p> |
|---|
| 56 | </metal:block> |
|---|
| 57 | |
|---|
| 58 | <metal:block define-macro="file_edit"> |
|---|
| 59 | |
|---|
| 60 | <ul class="fileChoice" |
|---|
| 61 | tal:define="name here/getHtmlWidgetId; |
|---|
| 62 | radio_name string:${name}_choice;"> |
|---|
| 63 | <li> |
|---|
| 64 | <metal:block define-slot="keep_file"> |
|---|
| 65 | <input type="radio" class="noborder" name="." value="keep" |
|---|
| 66 | checked="checked" |
|---|
| 67 | tal:attributes="name radio_name; |
|---|
| 68 | id string:${radio_name}_keep;"/> |
|---|
| 69 | <label i18n:translate="cpsschemas_label_file_none" |
|---|
| 70 | tal:condition="empty_file" |
|---|
| 71 | tal:attributes="for string:${radio_name}_keep">None</label> |
|---|
| 72 | <label i18n:translate="cpsschemas_label_file_keep" |
|---|
| 73 | tal:condition="not:empty_file" |
|---|
| 74 | tal:attributes="for string:${radio_name}_keep">Keep</label> |
|---|
| 75 | <a href="http://url..." target="_blank" |
|---|
| 76 | tal:condition="not:empty_file" |
|---|
| 77 | tal:omit-tag="session_file" |
|---|
| 78 | tal:attributes="href string:${content_url}?nocache=${last_modified}"> |
|---|
| 79 | <tal:block condition="mimetype" |
|---|
| 80 | replace="structure python:here.getImgTag(mimetype.icon_path, |
|---|
| 81 | title=mimetype.name())" /> |
|---|
| 82 | <tal:block replace="current_filename" /> |
|---|
| 83 | </a> |
|---|
| 84 | <tal:block condition="python:not empty_file and not session_file and modules['Products.CPSUtil.integration'].isProductPresent('Products.ExternalEditor')"> |
|---|
| 85 | <tal:block define="ds options/datastructure; |
|---|
| 86 | dm ds/getDataModel; |
|---|
| 87 | proxy dm/getProxy; |
|---|
| 88 | display_ee |
|---|
| 89 | here/display_external_editor|python:True; |
|---|
| 90 | portal here/portal_url/getPortalObject; |
|---|
| 91 | field_id python:here.fields[0]"> |
|---|
| 92 | <tal:block condition="python: proxy and display_ee"> |
|---|
| 93 | - |
|---|
| 94 | <a href="http://url..." |
|---|
| 95 | i18n:translate="cpsschemas_label_file_edit_online" |
|---|
| 96 | tal:attributes="href python:portal.getExternalEditorPath(proxy, id, field_id)"> |
|---|
| 97 | Edit file online |
|---|
| 98 | </a> |
|---|
| 99 | </tal:block> |
|---|
| 100 | </tal:block> |
|---|
| 101 | </tal:block> |
|---|
| 102 | </metal:block> |
|---|
| 103 | </li> |
|---|
| 104 | <metal:block define-slot="edit_file_action" /> |
|---|
| 105 | <li> |
|---|
| 106 | <metal:block define-slot="change_file"> |
|---|
| 107 | <input type="radio" class="noborder" name="." value="change" |
|---|
| 108 | tal:attributes="name radio_name; |
|---|
| 109 | id string:${radio_name}_change" /> |
|---|
| 110 | <label i18n:translate="cpsschemas_label_file_change" |
|---|
| 111 | tal:attributes="for string:${radio_name}_change">Change</label> |
|---|
| 112 | <input type="file" name="." size="24" |
|---|
| 113 | tal:attributes="name name; |
|---|
| 114 | onclick string:document.getElementById('${radio_name}_change').checked='checked'" /> |
|---|
| 115 | </metal:block> |
|---|
| 116 | </li> |
|---|
| 117 | <li tal:condition="python: not here.is_required and not empty_file"> |
|---|
| 118 | <metal:block define-slot="delete_file"> |
|---|
| 119 | <input type="radio" class="noborder" name="." value="delete" |
|---|
| 120 | tal:attributes="name radio_name; |
|---|
| 121 | id string:${radio_name}_delete" /> |
|---|
| 122 | <label i18n:translate="cpsschemas_label_file_delete" |
|---|
| 123 | tal:attributes="for string:${radio_name}_delete">Delete</label> |
|---|
| 124 | </metal:block> |
|---|
| 125 | </li> |
|---|
| 126 | </ul> |
|---|
| 127 | </metal:block> |
|---|
| 128 | |
|---|
| 129 | </tal:block> |
|---|
| 130 | |
|---|
| 131 | </tal:block> |
|---|