Dateimanagement: anderes colspan bei Bilder berücksichtigen
[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="[% IF file_type == 'image' %]8[% ELSE %]6[% END %]">[% 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          <div class="overlay_div">
69           <img id="thumb_[% file.id %]" class="thumbnail"
70                data-file-id="[% file.id %]" data-file-version="[% file.version %]"
71                src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]"
72                alt="[% file.file_name %]">
73           <img id="enlarged_thumb_[% file.id %][% IF file.version %]_[% file.version %][% END %]" class="overlay_img" style="display:none;"
74                data-file-id="[% file.id %]" data-file-version="[% file.version %]">
75          </div>
76         [%- ELSE %]
77          -
78         [%- END %]
79        </td>
80       [%- END %]
81      </tr>
82     [%- END # FOREACH file %]
83    </tbody>
84   </table>
85
86   <div>
87    [%- IF edit_attachments %]
88     [%- IF source.can_import %]
89      [% L.button_tag("kivi.File.unimport(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "');",source.chk_title) %]
90     [%- ELSE %]
91      [%- IF source.can_delete %]
92       [% L.button_tag("kivi.File.delete("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.chk_title) %]
93      [%- END %]
94     [%- END %]
95    [%- END %]
96    [%- IF source.can_rename %]
97     [%- can_rename = 1 %]
98     [% L.button_tag("kivi.File.rename(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.rename_title ) %]
99    [%- END %]
100    [%- IF source.can_import %]
101     [% L.button_tag("kivi.File.import("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.name _ "','" _ source.path _"');",  source.import_title ) %]
102    [%- END %]
103    [%- IF source.can_upload %]
104     [% L.button_tag("kivi.File.upload(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.upload_title _ "'," _ is_global _ ");", source.upload_title ) %]
105     <span class="upload_drop_zone"
106           data-object-type="[% object_type %]"
107           data-object-id="[% object_id %]"
108           data-file-type="[% file_type %]"
109           data-is-global="[% is_global %]"
110           data-maxsize="[% INSTANCE_CONF.get_doc_max_filesize %]">
111       [% 'Drag and drop files here' | $T8 %]
112     </span>
113    [%- END %]
114   </div>
115  [%- END # FOREACH source %]
116  <div></div>
117  <div>
118   [% L.button_tag("kivi.File.update(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "'," _ is_global _ ");", LxERP.t8('Update')) %]
119  </div>
120 </div>
121
122 [%- IF ! json %]
123  </div>
124  [%- UNLESS is_global %]
125   [%- IF can_rename %]
126    [% INCLUDE 'file/rename_dialog.html' -%]
127   [%- END %]
128  [%- END %]
129 [%- END %]
130
131 <script>
132   $(function() {
133     kivi.File.list_div_id = "[% file_type %]_list_[% object_type %]";
134     kivi.File.init();
135   });
136 </script>