aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichaela Brückner <brueckner@data-quest.de>2022-11-24 10:00:25 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-11-24 10:00:25 +0000
commit1231022837beceedef376e4bb8084ff38fbc7d93 (patch)
tree6c66342eaf96dd0044d9417e23623ae1e96d8d38 /lib
parent2a5370c77b1e740ec6350b7c633c2b0ff1fbef93 (diff)
Resolve "Visuelle Kennzeichnung von barrierefreien Dateien in den Dateibereichen", closes #1540
Closes #1540 Merge request studip/studip!1027
Diffstat (limited to 'lib')
-rw-r--r--lib/filesystem/FileType.php6
-rw-r--r--lib/filesystem/FilesystemVueDataManager.php1
-rw-r--r--lib/filesystem/StandardFile.php4
-rw-r--r--lib/filesystem/UnknownFileType.php8
-rw-r--r--lib/models/FileRef.php9
-rw-r--r--lib/navigation/AdminNavigation.php8
6 files changed, 35 insertions, 1 deletions
diff --git a/lib/filesystem/FileType.php b/lib/filesystem/FileType.php
index 003ee85..5a53896 100644
--- a/lib/filesystem/FileType.php
+++ b/lib/filesystem/FileType.php
@@ -35,13 +35,17 @@ interface FileType
*/
public function getUserName();
+ /**
+ * Returns if a file is accessible or not.
+ * @return bool
+ */
+ public function getAccessibility(): bool;
/**
* @returns The User object representing the author.
*/
public function getUser();
-
/**
* Returns the size of the file in bytes. If this is null, the file doesn't exist
* physically - is probably only a weblink or a request for libraries.
diff --git a/lib/filesystem/FilesystemVueDataManager.php b/lib/filesystem/FilesystemVueDataManager.php
index 0714356..06ea273 100644
--- a/lib/filesystem/FilesystemVueDataManager.php
+++ b/lib/filesystem/FilesystemVueDataManager.php
@@ -44,6 +44,7 @@ class FilesystemVueDataManager
'actions' => $actionMenu ? (is_string($actionMenu) ? $actionMenu : $actionMenu->render()) : "",
'new' => isset($last_visitdate) && $file->getLastChangeDate() > $last_visitdate && $file->getUserId() !== $GLOBALS['user']->id,
'isEditable' => $file->isEditable(),
+ 'isAccessible' => $file->getAccessibility(),
];
}
diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php
index 5a4271a..c115410 100644
--- a/lib/filesystem/StandardFile.php
+++ b/lib/filesystem/StandardFile.php
@@ -174,6 +174,10 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface
return $this->fileref['author_name'];
}
+ public function getAccessibility(): bool
+ {
+ return (bool) $this->fileref['is_accessible'];
+ }
public function getUser()
{
diff --git a/lib/filesystem/UnknownFileType.php b/lib/filesystem/UnknownFileType.php
index effe751..15c2b92 100644
--- a/lib/filesystem/UnknownFileType.php
+++ b/lib/filesystem/UnknownFileType.php
@@ -284,4 +284,12 @@ class UnknownFileType implements FileType, ArrayAccess
{
return '';
}
+
+ /**
+ * @inheritDoc
+ */
+ public function getAccessibility() : bool
+ {
+ return false;
+ }
}
diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php
index 48c64dc..9cc2438 100644
--- a/lib/models/FileRef.php
+++ b/lib/models/FileRef.php
@@ -60,6 +60,7 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange
$config['additional_fields']['download_url']['set'] = 'setDownloadURL';
$config['additional_fields']['download_url']['get'] = 'getDownloadURL';
$config['additional_fields']['author_name']['get'] = 'getAuthorName';
+ $config['additional_fields']['is_accessible']['get'] = 'getAccessibility';
$config['additional_fields']['is_link']['get'] = 'isLink';
$config['additional_fields']['foldertype']['set'] = 'setFolderType';
$config['additional_fields']['foldertype']['get'] = 'getFolderType';
@@ -190,6 +191,14 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange
}
/**
+ * Returns true if the file is accessible
+ */
+ public function getAccessibility() : bool
+ {
+ return (bool) $this->file->is_accessible;
+ }
+
+ /**
* This method increments the download counter of the FileRef.
*
* @return int The number of rows of the file_refs table that have been altered.
diff --git a/lib/navigation/AdminNavigation.php b/lib/navigation/AdminNavigation.php
index 2bb2418..b45859c 100644
--- a/lib/navigation/AdminNavigation.php
+++ b/lib/navigation/AdminNavigation.php
@@ -153,6 +153,14 @@ class AdminNavigation extends Navigation
);
}
+ $navigation->addSubNavigation(
+ 'accessibility_info_text',
+ new Navigation(
+ _('Infotext zu barrierefreien Dateien'),
+ 'dispatch.php/admin/accessibility_info_text/index'
+ )
+ );
+
}
$this->addSubNavigation('locations', $navigation);