aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-06-26 21:48:13 +0200
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-06-27 09:33:33 +0200
commit68c2b3ee29d91b20ab19064360a1d2743c7b3beb (patch)
tree69a5705cf0e754001c52c845e241b9934232df5f /lib
parentd8eca53d6a105ae1378f7195fde2b3050a424e94 (diff)
change position of copy link action, fixes #494
Closes #494 Merge request studip/studip!4298
Diffstat (limited to 'lib')
-rw-r--r--lib/filesystem/StandardFile.php24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 4f7c616..4b3576b 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -253,7 +253,16 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
['data-dialog' => ''],
'file-display-info'
);
- if ($this->isEditable($GLOBALS['user']->id)) {
+ if ($this->isDownloadable() && User::findCurrent()) {
+ $actionMenu->addLink(
+ $this->fileref->getDownloadURL('force_download'),
+ _('Link kopieren'),
+ Icon::create('clipboard'),
+ ['class' => 'copyable-link'],
+ 'link-to-clipboard'
+ );
+ }
+ if ($this->isEditable()) {
$actionMenu->addLink(
URLHelper::getURL('dispatch.php/file/edit/' . $this->fileref->id),
_('Datei bearbeiten'),
@@ -269,7 +278,7 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
'file-update'
);
}
- if ($this->isWritable($GLOBALS['user']->id)) {
+ if ($this->isWritable()) {
$actionMenu->addLink(
URLHelper::getURL('dispatch.php/file/choose_destination/move/' . $this->fileref->id),
_('Datei verschieben'),
@@ -278,7 +287,7 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
'file-move'
);
}
- if ($this->isDownloadable($GLOBALS['user']->id) && $GLOBALS['user']->id !== 'nobody') {
+ if ($this->isDownloadable() && User::findCurrent()) {
$actionMenu->addLink(
URLHelper::getURL('dispatch.php/file/choose_destination/copy/' . $this->fileref->id),
_('Datei kopieren'),
@@ -286,16 +295,9 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
['data-dialog' => 'size=auto'],
'file-copy'
);
- $actionMenu->addLink(
- $this->fileref->getDownloadURL('force_download'),
- _('Link kopieren'),
- Icon::create('clipboard'),
- ['class' => 'copyable-link'],
- 'link-to-clipboard'
- );
}
if (
- $this->isEditable($GLOBALS['user']->id)
+ $this->isEditable()
&& Config::get()->OERCAMPUS_ENABLED
&& $GLOBALS['perm']->have_perm(Config::get()->OER_PUBLIC_STATUS)
&& in_array($this->fileref->folder->range_type, ['course', 'user'])