Dateimanagement: Thumbnails erzeugen und anzeigen
[kivitendo-erp.git] / templates / webpages / file / list.html
1 [%- USE LxERP -%][% USE L %]
2 [% USE T8 %]
3 [% USE Base64 %]
4 [% USE HTML %]
5 [%- IF ! json %]
6  <div id="[% file_type %]_list_[% object_type %]">
7 [%- END %]
8 <div class="listtop">[% title %]</div>
9
10 <div style="padding-bottom: 15px">
11  [%- SET can_rename = 0 %]
12  [%- FOREACH source = SOURCES %]
13   <table style="width: 100%" >
14    <thead>
15     <tr><th class="listheading" colspan="6">[% source.title %]</th></tr>
16     <tr>
17      [%- SET checkname = source.chk_action %]
18      [%- IF is_global %]
19       [%- SET checkname = object_type _ '_' _ source.chk_action %]
20      [%- END %]
21      [%- IF edit_attachments %]
22       <script type="text/javascript">
23        <!--
24         $(function() {
25          $('#[% checkname %]_checkall').checkall('INPUT[name="[% checkname %][]"]');
26         });
27        -->
28       </script>
29       <th class="listheading" width="3%">[% L.checkbox_tag(checkname _ '_checkall') %]</th>
30       <th class="listheading" width="7%">[% source.chkall_title %]</th>
31      [%- END %]
32      <th class="listheading" width="15%"><b>[%  LxERP.t8('Date') %]</b></th>
33      <th class="listheading" width="20%"><b>[%  source.file_title %]</b></th>
34      [%- IF file_type == 'image' %]
35       <th class="listheading" width="15%"><b>[%  LxERP.t8('Title') %]</b></th>
36       <th class="listheading" width="10%">
37        <b>[%  LxERP.t8('ImagePreview') %]</b>
38       </th>
39       <th class="listheading" width="30%"><b>[%  LxERP.t8('Description') %]</b></th>
40      [%- ELSE %]
41       <th class="listheading" width="40%"><b>[%  LxERP.t8('ImagePreview') %]</b></th>
42      [%- END %]
43     </tr>
44    </thead>
45
46    <tbody>
47     [%- FOREACH file = source.files %]
48      <tr class="listrow[% loop.count % 2 %]">
49       [%- IF edit_attachments %]
50        <td>[%- L.checkbox_tag(checkname _ '[]', 'value'=file.id _ '_' _ file.version, 'class'=checkname) %]</td>
51        <td></td>
52       [%- END %]
53       <td>[% file.mtime_as_timestamp_s %][% L.hidden_tag("version[]", file.version) %]</td>
54       <td>
55        <a href="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]">
56         <span id="[% "filename_" _ file.id %][%- IF file.version %]_[% file.version %][%- END %]">[% file.file_name %]</span>
57        </a>
58       </td>
59       [%- IF file_type == 'image' %]
60        <td>[% file.title %]</td>
61        <td>
62         <img src="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]" alt="[% file.title %]" width="64px">
63        </td>
64        <td>[% file.description %]</td>
65       [%- ELSE %]
66        <td align="left">
67         [%- IF file.thumbnail %]
68          <a href="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]">
69           <img src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]" alt="[% file.file_name %]">
70          </a>
71         [%- ELSE %]
72          -
73         [%- END %]
74        </td>
75       [%- END %]
76      </tr>
77     [%- END # FOREACH file %]
78    </tbody>
79   </table>
80
81   <div>
82    [%- IF edit_attachments %]
83     [%- IF source.can_import %]
84      [% L.button_tag("kivi.File.unimport(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "');",source.chk_title) %]
85     [%- ELSE %]
86      [%- IF source.can_delete %]
87       [% L.button_tag("kivi.File.delete("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.chk_title) %]
88      [%- END %]
89     [%- END %]
90    [%- END %]
91    [%- IF source.can_rename %]
92     [%- can_rename = 1 %]
93     [% L.button_tag("kivi.File.rename(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.rename_title ) %]
94    [%- END %]
95    [%- IF source.can_import %]
96     [% L.button_tag("kivi.File.import("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.name _ "','" _ source.path _"');",  source.import_title ) %]
97    [%- END %]
98    [%- IF source.can_upload %]
99     [% L.button_tag("kivi.File.upload(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.upload_title _ "'," _ is_global _ ");", source.upload_title ) %]
100     <span class="upload_drop_zone"
101           data-object-type="[% object_type %]"
102           data-object-id="[% object_id %]"
103           data-file-type="[% file_type %]"
104           data-is-global="[% is_global %]"
105           data-maxsize="[% INSTANCE_CONF.get_doc_max_filesize %]">
106       [% 'Drag and drop files here' | $T8 %]
107     </span>
108    [%- END %]
109   </div>
110  [%- END # FOREACH source %]
111  <div></div>
112  <div>
113   [% L.button_tag("kivi.File.update(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "'," _ is_global _ ");", LxERP.t8('Update')) %]
114  </div>
115 </div>
116
117 [%- IF ! json %]
118  </div>
119  [%- UNLESS is_global %]
120   [%- IF can_rename %]
121    [% INCLUDE 'file/rename_dialog.html' -%]
122   [%- END %]
123  [%- END %]
124 [%- END %]
125
126 <script>
127   $(function() {
128     kivi.File.list_div_id = "[% file_type %]_list_[% object_type %]";
129     kivi.File.init();
130   });
131 </script>