From cd6b59ec8a944f88c3763301c9edfb0f9955fa4f Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Wed, 21 Aug 2024 18:12:39 +0200 Subject: [PATCH 1/2] Pass data properly to paella --- templates/player.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/player.mustache b/templates/player.mustache index 60b5499..5ff60be 100644 --- a/templates/player.mustache +++ b/templates/player.mustache @@ -28,7 +28,7 @@ "playerid": "ocplayer_0", "configurl": "/filter/opencast/config.json", "modplayerpath": "/mod/opencast/player.html", - "data": "{"metadata":{"title": "Test video", "etc": "..."}" + "data": "{\"metadata\":{\"title\": \"Test video\", \"etc\": \"...\"}" } }} @@ -51,7 +51,7 @@ function init_{{playerid}}() { iframeWindow.MoodlePaellaPlayer.initPaella( '{{{configurl}}}', '{{{themeurl}}}', - JSON.parse('{{{data}}}') + {{{data}}} ); } } From 91bb076b43c893571967e95f4b103f3140f85dad Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Wed, 21 Aug 2024 18:21:03 +0200 Subject: [PATCH 2/2] Make CI happy --- classes/privacy/provider.php | 2 +- lang/en/filter_opencast.php | 4 ++-- tests/replacement_test.php | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index c1203e1..0172d72 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -38,7 +38,7 @@ class provider implements \core_privacy\local\metadata\null_provider { * * @return string */ - public static function get_reason() : string { + public static function get_reason(): string { return 'privacy:metadata'; } } diff --git a/lang/en/filter_opencast.php b/lang/en/filter_opencast.php index 50da383..bfb6591 100644 --- a/lang/en/filter_opencast.php +++ b/lang/en/filter_opencast.php @@ -26,7 +26,7 @@ $string['filtername'] = 'Opencast'; $string['pluginname'] = 'Opencast Filter'; $string['privacy:metadata'] = 'The Opencast filter plugin does not store any personal data.'; -$string['setting_episodeurl'] = 'URL templates for filtering'; -$string['setting_episodeurl_desc'] = 'URLs matching this template are replaced with the Opencast player. You must use the placeholder [EPISODEID] to indicate where the episode ID is contained in the URL e.g. http://stable.opencast.de/play/[EPISODEID]. If you want to filter for multiple URLs, enter each URL in a new line.'; $string['setting_configurl'] = 'URL to Paella config.json'; $string['setting_configurl_desc'] = 'URL of the config.json used by Paella Player. Can either be a absolute URL or a URL relative to the wwwroot.'; +$string['setting_episodeurl'] = 'URL templates for filtering'; +$string['setting_episodeurl_desc'] = 'URLs matching this template are replaced with the Opencast player. You must use the placeholder [EPISODEID] to indicate where the episode ID is contained in the URL e.g. http://stable.opencast.de/play/[EPISODEID]. If you want to filter for multiple URLs, enter each URL in a new line.'; diff --git a/tests/replacement_test.php b/tests/replacement_test.php index 19cd111..25c092a 100644 --- a/tests/replacement_test.php +++ b/tests/replacement_test.php @@ -36,7 +36,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @group filter_opencast */ -class replacement_test extends \advanced_testcase { +final class replacement_test extends \advanced_testcase { public function setUp(): void { $this->resetAfterTest(); @@ -52,7 +52,7 @@ public function setUp(): void { * @param string $input input for filter * @param string $output expected filter output. */ - public function test_replacement($input, $output) { + public function test_replacement($input, $output): void { $filter = new testable_filter(\context_system::instance(), []); $this->assertEquals($output, $filter->filter($input)); } @@ -60,24 +60,24 @@ public function test_replacement($input, $output) { /** * Provides test cases. */ - public function replacement_provider() { + public static function replacement_provider(): array { return [ [ '

hello

', - '

hello

' + '

hello

', ], [ '', - '' + '', ], [ '', - '' + '', ], [ 'begin end', - 'begin end' + 'begin end', ], [ 'and a link link look, a video!', 'and a link link -' +', ], [ 'and now two look, a video! .', 'and now two -.' +.', ], ]; }