[%- USE LxERP -%][% USE L %]
+[% USE T8 %]
+[% USE Base64 %]
+[% USE HTML %]
[%- IF ! json %]
<div id="[% file_type %]_list_[% object_type %]">
[%- END %]
[%- FOREACH source = SOURCES %]
<table style="width: 100%" >
<thead>
- <tr><th class="listheading" colspan="6">[% source.title %]</th></tr>
+ <tr><th class="listheading" colspan="[% IF file_type == 'image' %]8[% ELSE %]6[% END %]">[% source.title %]</th></tr>
<tr>
[%- SET checkname = source.chk_action %]
[%- IF is_global %]
</th>
<th class="listheading" width="30%"><b>[% LxERP.t8('Description') %]</b></th>
[%- ELSE %]
- <th class="listheading" width="40%"></th>
+ <th class="listheading" width="40%"><b>[% LxERP.t8('ImagePreview') %]</b></th>
[%- END %]
</tr>
</thead>
</td>
<td>[% file.description %]</td>
[%- ELSE %]
- <td></td>
+ <td align="left">
+ [%- IF file.thumbnail %]
+ <div class="overlay_div">
+ <img id="thumb_[% file.id %]" class="thumbnail"
+ data-file-id="[% file.id %]" data-file-version="[% file.version %]"
+ src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]"
+ alt="[% file.file_name %]">
+ <img id="enlarged_thumb_[% file.id %][% IF file.version %]_[% file.version %][% END %]" class="overlay_img" style="display:none;"
+ data-file-id="[% file.id %]" data-file-version="[% file.version %]">
+ </div>
+ [%- ELSE %]
+ -
+ [%- END %]
+ </td>
[%- END %]
</tr>
[%- END # FOREACH file %]
[%- can_rename = 1 %]
[% L.button_tag("kivi.File.rename(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");", source.rename_title ) %]
[%- END %]
- [%- IF source.can_upload %]
- [% L.button_tag("kivi.File.upload(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.upload_title _ "'," _ is_global _ ");", source.upload_title ) %]
- [%- END %]
[%- IF source.can_import %]
[% L.button_tag("kivi.File.import(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.name _ "','" _ source.path _"');", source.import_title ) %]
[%- END %]
+ [%- IF source.can_upload %]
+ [% L.button_tag("kivi.File.upload(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.upload_title _ "'," _ is_global _ ");", source.upload_title ) %]
+ <span class="upload_drop_zone"
+ data-object-type="[% object_type %]"
+ data-object-id="[% object_id %]"
+ data-file-type="[% file_type %]"
+ data-is-global="[% is_global %]"
+ data-maxsize="[% INSTANCE_CONF.get_doc_max_filesize %]">
+ [% 'Drag and drop files here' | $T8 %]
+ </span>
+ [%- END %]
</div>
[%- END # FOREACH source %]
<div></div>
[%- END %]
[%- END %]
[%- END %]
+
+<script>
+ $(function() {
+ kivi.File.list_div_id = "[% file_type %]_list_[% object_type %]";
+ kivi.File.init();
+ });
+</script>