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