mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3670 Add a parameter to chose max file size to be displayed as a preview icon
This commit is contained in:
@@ -64,6 +64,7 @@ SetupWebPage::AddModule(
|
||||
'allowed_classes' => array('Ticket'), // List of classes for which to manage "Attachments"
|
||||
'position' => 'relations', // Where to display the attachments: relations | properties
|
||||
'preview_max_width' => 290,
|
||||
'icon_preview_max_size' => 500000, // Maximum size for attachment preview to be displayed as an icon. In bits
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -506,12 +506,14 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
|
||||
$sAttachmentThumbUrl = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($sFileName);
|
||||
$sIconClass = '';
|
||||
$iMaxWidth = MetaModel::GetModuleSetting('itop-attachments', 'preview_max_width', 290);
|
||||
$iMaxSizeForPreview = MetaModel::GetModuleSetting('itop-attachments', 'icon_preview_max_size', self::MAX_SIZE_FOR_PREVIEW);
|
||||
|
||||
$sPreviewNotAvailable = Dict::S('Attachments:PreviewNotAvailable');
|
||||
$sPreviewMarkup = $sPreviewNotAvailable;
|
||||
if ($oDoc->IsPreviewAvailable())
|
||||
{
|
||||
$sIconClass = ' preview';
|
||||
if ($oDoc->GetSize() <= self::MAX_SIZE_FOR_PREVIEW)
|
||||
if ($oDoc->GetSize() <= $iMaxSizeForPreview)
|
||||
{
|
||||
$sAttachmentThumbUrl = $sDocDownloadUrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user