From: Bernd Bleßmann Date: Tue, 6 Apr 2021 10:47:05 +0000 (+0200) Subject: Dateimanagement: größere Vorschaubilder: Versionen berücksichtigen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~389 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2e28a7559f4acfed9df042d0a582a67bbcfc27e4;p=kivitendo-erp.git Dateimanagement: größere Vorschaubilder: Versionen berücksichtigen --- diff --git a/SL/Controller/File.pm b/SL/Controller/File.pm index fdfded276..95030a4a8 100644 --- a/SL/Controller/File.pm +++ b/SL/Controller/File.pm @@ -317,10 +317,16 @@ sub action_download { sub action_ajax_get_thumbnail { my ($self) = @_; - my $file = SL::File->get(id => $::form->{file_id}); + my $id = $::form->{file_id}; + my $version = $::form->{file_version}; + my $file = SL::File->get(id => $id); + + $file->version($version) if $version; + my $thumbnail = _create_thumbnail($file, $::form->{size}); - my $overlay_selector = '#enlarged_thumb_' . $::form->{file_id}; + my $overlay_selector = '#enlarged_thumb_' . $id; + $overlay_selector .= '_' . $version if $version; $self->js ->attr($overlay_selector, 'src', 'data:' . $thumbnail->{thumbnail_img_content_type} . ';base64,' . MIME::Base64::encode_base64($thumbnail->{thumbnail_img_content})) ->data($overlay_selector, 'is-overlay-loaded', '1') diff --git a/js/kivi.File.js b/js/kivi.File.js index 8645a09c5..6b4ea462c 100644 --- a/js/kivi.File.js +++ b/js/kivi.File.js @@ -303,7 +303,9 @@ namespace('kivi.File', function(ns) { ns.add_enlarged_thumbnail = function(e) { var file_id = $(e.target).data('file-id'); + var file_version = $(e.target).data('file-version'); var overlay_img_id = 'enlarged_thumb_' + file_id; + if (file_version) { overlay_img_id = overlay_img_id + '_' + file_version }; var overlay_img = $('#' + overlay_img_id); if (overlay_img.data('is-overlay-shown') == 1) return; @@ -317,7 +319,7 @@ namespace('kivi.File', function(ns) { var data = { action: 'File/ajax_get_thumbnail', file_id: file_id, - file_version: $(e.target).data('file-version'), + file_version: file_version, size: 512 }; diff --git a/templates/webpages/file/list.html b/templates/webpages/file/list.html index fe90f4c37..24da21179 100644 --- a/templates/webpages/file/list.html +++ b/templates/webpages/file/list.html @@ -70,7 +70,7 @@ data-file-id="[% file.id %]" data-file-version="[% file.version %]" src="data:[% HTML.escape(file.thumbnail.thumbnail_img_content_type) %];base64,[% file.thumbnail.thumbnail_img_content.encode_base64 %]" alt="[% file.file_name %]"> - + [%- ELSE %] -