From 3f47c32fda3f2543cb3f097f9115254341a4bc60 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 11 Feb 2025 10:36:59 +0800 Subject: [PATCH] * [task#136277,doing,2h] get downloadLink and previewLink. --- lib/zin/wg/history/v1.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/zin/wg/history/v1.php b/lib/zin/wg/history/v1.php index d713f51d3b..fa5a71ccaa 100644 --- a/lib/zin/wg/history/v1.php +++ b/lib/zin/wg/history/v1.php @@ -101,6 +101,22 @@ class history extends wg $className = $this->props->class->toStr(); if($panel && empty($className)) $className = 'canvas py-1 px-2 overflow-visible'; $className .= ' break-all'; + $fileListProps = array(); + $fileListProps['fileUrl'] = '#file?id={id}'; + $fileListProps['hoverItemActions'] = true; + + global $lang, $app; + $app->control->loadModel('file'); + + $previewLink = $downloadLink = ''; + $canDownload = common::hasPriv('file', 'download'); + if($canDownload) + { + $previewLink = helper::createLink('file', 'download', "fileID={id}&mouse=left"); + $downloadLink = helper::createLink('file', 'download', "fileID={id}"); + $downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&'; + $downloadLink .= session_name() . '=' . session_id(); + } return zui::historyPanel ( @@ -109,6 +125,7 @@ class history extends wg set::objectType($objectType), set::actions($actions), set::title($title), + set::fileListProps($fileListProps), $canEditComment ? set::editCommentUrl($editCommentUrl) : null, $canComment ? set::commentUrl($commentUrl) : null, set::commentBtn($canComment && !common::isTutorialMode() ? $commentBtn : false),