Dateimanagement: erst nur letzte Version anzeigen / alle Versionen ausklappbar.
[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="2%"><b>[%  LxERP.t8('Version') %]</b></th>
33      <th class="listheading" width="15%"><b>[%  LxERP.t8('Date') %]</b></th>
34      <th class="listheading" width="20%"><b>[%  source.file_title %]</b></th>
35      [%- IF file_type == 'image' %]
36       <th class="listheading" width="15%"><b>[%  LxERP.t8('Title') %]</b></th>
37       <th class="listheading" width="10%">
38        <b>[%  LxERP.t8('ImagePreview') %]</b>
39       </th>
40       <th class="listheading" width="30%"><b>[%  LxERP.t8('Description') %]</b></th>
41      [%- ELSE %]
42       <th class="listheading" width="40%"><b>[%  LxERP.t8('ImagePreview') %]</b></th>
43      [%- END %]
44     </tr>
45    </thead>
46
47    <tbody>
48     [%- FOREACH file = source.files %]
49      [%- is_other_version = 1 IF last_id == file.id %]
50      [%- last_id = file.id %]
51      [%- IF !is_other_version %]
52       [%- row_cnt = row_cnt + 1 %]
53       <tr class="listrow[% row_cnt % 2 %]">
54      [%- ELSE %]
55       <tr class="[% 'version_row_' _ file.id %] listrow[% row_cnt % 2 %] hidden">
56      [%- END %]
57       [%- IF edit_attachments %]
58        <td>[%- L.checkbox_tag(checkname _ '[]', 'value'=file.id _ '_' _ file.version, 'class'=checkname) %]</td>
59        <td></td>
60       [%- END %]
61       <td align="right" [%- IF file.version_count > 1 && !is_other_version %] class="cursor-pointer" onclick="kivi.File.toggle_versions('[% file.id %]')"[%- END %]>
62        [%- IF file.version_count > 1 && !is_other_version %]<span id="[% 'version_toggle_' _ file.id %]">⏷ </span>[% END %]
63        [% file.version _ '/' _ file.version_count %]
64        [% L.hidden_tag("version[]", file.version) %]
65       </td>
66       <td>[% file.mtime_as_timestamp_s %]</td>
67       <td>
68        <a href="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]">
69         <span id="[% "filename_" _ file.id %][%- IF file.version %]_[% file.version %][%- END %]">[% file.file_name %]</span>
70        </a>
71       </td>
72       [%- IF file_type == 'image' %]
73        <td>[% file.title %]</td>
74        <td>
75         <img src="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]" alt="[% file.title %]" width="64px">
76        </td>
77        <td>[% file.description %]</td>
78       [%- ELSE %]
79        <td align="left">
80         [%- IF file.thumbnail %]
81          <div class="overlay_div">
82           <img id="thumb_[% file.id %]" class="thumbnail"
83                data-file-id="[% file.id %]" data-file-version="[% file.version %]"
84                src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]"
85                alt="[% file.file_name %]">
86           <img id="enlarged_thumb_[% file.id %][% IF file.version %]_[% file.version %][% END %]" class="overlay_img" style="display:none;"
87                data-file-id="[% file.id %]" data-file-version="[% file.version %]">
88          </div>
89         [%- ELSE %]
90          -
91         [%- END %]
92        </td>
93       [%- END %]
94      </tr>
95     [%- END # FOREACH file %]
96    </tbody>
97   </table>
98
99   <div>
100    [%- IF edit_attachments %]
101     [%- IF source.can_import %]
102      [% L.button_tag("kivi.File.unimport(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "');",source.chk_title) %]
103     [%- ELSE %]
104      [%- IF source.can_delete %]
105       [% L.button_tag("kivi.File.delete("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.chk_title) %]
106      [%- END %]
107     [%- END %]
108    [%- END %]
109    [%- IF source.can_rename %]
110     [%- can_rename = 1 %]
111     [% L.button_tag("kivi.File.rename(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ checkname _ "'," _ is_global _ ");",  source.rename_title ) %]
112    [%- END %]
113    [%- IF source.can_import %]
114     [% L.button_tag("kivi.File.import("   _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.name _ "','" _ source.path _"');",  source.import_title ) %]
115    [%- END %]
116    [%- IF source.can_upload %]
117     [% L.button_tag("kivi.File.upload(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "','" _ source.upload_title _ "'," _ is_global _ ");", source.upload_title ) %]
118     <span class="upload_drop_zone"
119           data-object-type="[% object_type %]"
120           data-object-id="[% object_id %]"
121           data-file-type="[% file_type %]"
122           data-is-global="[% is_global %]"
123           data-maxsize="[% INSTANCE_CONF.get_doc_max_filesize %]">
124       [% 'Drag and drop files here' | $T8 %]
125     </span>
126    [%- END %]
127   </div>
128  [%- END # FOREACH source %]
129  <div></div>
130  <div>
131   [% L.button_tag("kivi.File.update(" _ object_id _ ",'" _ object_type _ "','" _ file_type _ "'," _ is_global _ ");", LxERP.t8('Update')) %]
132  </div>
133 </div>
134
135 [%- IF ! json %]
136  </div>
137  [%- UNLESS is_global %]
138   [%- IF can_rename %]
139    [% INCLUDE 'file/rename_dialog.html' -%]
140   [%- END %]
141  [%- END %]
142 [%- END %]
143
144 <script>
145   $(function() {
146     kivi.File.list_div_id = "[% file_type %]_list_[% object_type %]";
147     kivi.File.init();
148   });
149 </script>