Revision a6e0a7f4
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/File.pm | ||
---|---|---|
404 | 404 |
|
405 | 405 |
sub _do_list { |
406 | 406 |
my ($self, $json) = @_; |
407 |
|
|
407 | 408 |
my @files; |
409 |
my @object_types = ($self->object_type); |
|
408 | 410 |
if ( $self->file_type eq 'document' ) { |
409 |
my @object_types; |
|
410 |
push @object_types, $self->object_type; |
|
411 | 411 |
push @object_types, qw(dunning1 dunning2 dunning3 dunning_invoice dunning_orig_invoice) if $self->object_type eq 'invoice'; # hardcoded object types? |
412 |
@files = SL::File->get_all_versions(object_id => $self->object_id, |
|
413 |
object_type => \@object_types, |
|
414 |
file_type => $self->file_type, |
|
415 |
); |
|
416 |
|
|
417 |
} |
|
418 |
elsif ( $self->file_type eq 'attachment' || $self->file_type eq 'image' ) { |
|
419 |
@files = SL::File->get_all(object_id => $self->object_id, |
|
420 |
object_type => $self->object_type, |
|
421 |
file_type => $self->file_type, |
|
422 |
); |
|
423 | 412 |
} |
413 |
@files = SL::File->get_all_versions(object_id => $self->object_id, |
|
414 |
object_type => \@object_types, |
|
415 |
file_type => $self->file_type, |
|
416 |
); |
|
417 |
|
|
424 | 418 |
$self->files(\@files); |
425 | 419 |
|
426 |
$_->{thumbnail} = _create_thumbnail($_) for @files; |
|
420 |
$_->{thumbnail} = _create_thumbnail($_) for @files; |
|
421 |
$_->{version_count} = SL::File->get_version_count(id => $_->id) for @files; |
|
427 | 422 |
|
428 | 423 |
if($self->object_type eq 'shop_image'){ |
429 | 424 |
$self->js |
js/kivi.File.js | ||
---|---|---|
409 | 409 |
}); |
410 | 410 |
}; |
411 | 411 |
|
412 |
ns.toggle_versions = function(file_id) { |
|
413 |
if ($('#version_toggle_' + file_id).data('versions_expanded')) { |
|
414 |
$('.version_row_' + file_id).hide(); |
|
415 |
$('#version_toggle_' + file_id).data('versions_expanded', 0); |
|
416 |
$('#version_toggle_' + file_id).html("⏷ "); |
|
417 |
} else { |
|
418 |
$('.version_row_' + file_id).show(); |
|
419 |
$('#version_toggle_' + file_id).data('versions_expanded', 1); |
|
420 |
$('#version_toggle_' + file_id).html("⏶ "); |
|
421 |
} |
|
422 |
}; |
|
423 |
|
|
412 | 424 |
}); |
templates/webpages/file/list.html | ||
---|---|---|
29 | 29 |
<th class="listheading" width="3%">[% L.checkbox_tag(checkname _ '_checkall') %]</th> |
30 | 30 |
<th class="listheading" width="7%">[% source.chkall_title %]</th> |
31 | 31 |
[%- END %] |
32 |
<th class="listheading" width="2%"><b>[% LxERP.t8('Version') %]</b></th> |
|
32 | 33 |
<th class="listheading" width="15%"><b>[% LxERP.t8('Date') %]</b></th> |
33 | 34 |
<th class="listheading" width="20%"><b>[% source.file_title %]</b></th> |
34 | 35 |
[%- IF file_type == 'image' %] |
... | ... | |
45 | 46 |
|
46 | 47 |
<tbody> |
47 | 48 |
[%- FOREACH file = source.files %] |
48 |
<tr class="listrow[% loop.count % 2 %]"> |
|
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 %] |
|
49 | 57 |
[%- IF edit_attachments %] |
50 | 58 |
<td>[%- L.checkbox_tag(checkname _ '[]', 'value'=file.id _ '_' _ file.version, 'class'=checkname) %]</td> |
51 | 59 |
<td></td> |
52 | 60 |
[%- END %] |
53 |
<td>[% file.mtime_as_timestamp_s %][% L.hidden_tag("version[]", file.version) %]</td> |
|
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> |
|
54 | 67 |
<td> |
55 | 68 |
<a href="controller.pl?action=File/download&id=[% file.id %][%- IF file.version %]&version=[%- file.version %][%- END %]"> |
56 | 69 |
<span id="[% "filename_" _ file.id %][%- IF file.version %]_[% file.version %][%- END %]">[% file.file_name %]</span> |
Auch abrufbar als: Unified diff
Dateimanagement: erst nur letzte Version anzeigen / alle Versionen ausklappbar.
Und auch alle Versionen von Anhängen und Bildern anzeigen. Vorher wurde
hier nur die letzte Version gezeigt.