From 9dd9dcd5a6fb4295bc2f3fe1872741af1fe8be90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Gl=C3=B6ggler?= Date: Mon, 13 May 2024 15:56:55 +0200 Subject: [PATCH] fixes #937 --- app/controllers/redirect.php | 14 +++++++++----- app/views/redirect/perform.php | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/app/controllers/redirect.php b/app/controllers/redirect.php index 0f3716127..db934971c 100644 --- a/app/controllers/redirect.php +++ b/app/controllers/redirect.php @@ -36,10 +36,9 @@ public function perform_action($action, $token) } if (empty($video)) { - throw new Error(_('Das Video kann nicht gefunden werden'), 404); - } - if ($video->trashed) { - throw new Error(_('Das Video wurde zur Löschung markiert und kann daher nicht abgerufen werden'), 404); + $this->error = _('Das Video wurde nicht gefunden, ist defekt oder momentan (noch) nicht verfügbar.'); + } else if ($video->trashed) { + $this->error = _('Das Video wurde zur Löschung markiert und kann daher nicht abgerufen werden.'); } /* @@ -54,7 +53,7 @@ public function perform_action($action, $token) $customtool = $this->getLtiCustomTool($video, $action); $lti = LtiHelper::getLaunchData($video->config_id, $customtool, $video_share); if (empty($lti) || empty($customtool)) { - throw new Error('Could not load video!', 422); + $this->error = _('Das Video wurde nicht gefunden, ist defekt oder momentan (noch) nicht verfügbar.'); } // get correct endpoint for redirect type @@ -66,6 +65,11 @@ public function perform_action($action, $token) $this->launch_data = $ltilink['launch_data']; $this->launch_url = $ltilink['launch_url']; + + if (!empty($this->error)) { + $this->set_layout(null); + $this->assets_url = rtrim($this->plugin->getPluginUrl(), '/') . '/assets'; + } } /** diff --git a/app/views/redirect/perform.php b/app/views/redirect/perform.php index 21681ab2a..98038f734 100644 --- a/app/views/redirect/perform.php +++ b/app/views/redirect/perform.php @@ -1,3 +1,33 @@ +error)) : ?> + + + + + + +

+ +
+ error) ?> +

+ + +
@@ -11,4 +41,5 @@ jQuery(function ($) { $('#ltiLaunchForm').submit(); }); - \ No newline at end of file + + \ No newline at end of file