Skip to content

Commit 2a1ec31

Browse files
committed
refs #800, fix urls for cw block
1 parent 9fff694 commit 2a1ec31

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

controllers/redirect.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Opencast\Models\OCSeminarEpisodes;
4+
use Opencast\Models\OCSeminarSeries;
5+
use Opencast\Models\OCEndpoints;
6+
7+
class RedirectController extends OpencastController
8+
{
9+
public function perform_action($action, $episode_id)
10+
{
11+
$video = OCSeminarEpisodes::findOneByEpisode_id($episode_id);
12+
13+
if ($action !== 'video' && empty($video)) {
14+
$this->render_nothing();
15+
return;
16+
}
17+
18+
$series = OCSeminarSeries::findOneBySeries_id($video->series_id);
19+
$endpoint = OCEndpoints::findOneBySQL("config_id = ? AND service_type = 'search'", [$series->config_id]);
20+
21+
$url = parse_url($endpoint['service_url']);
22+
23+
$play_url = $url['scheme'] . '://'. $url['host']
24+
. ($url['port'] ? ':' . $url['port'] : '') . "/play/{$episode_id}";
25+
26+
$this->redirect($play_url);
27+
}
28+
}

lib/BlockTypes/OpencastBlock.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
"episode_id": {
99
"type": "string"
1010
},
11-
"url": {
12-
"type": "string"
13-
},
1411
"title": {
1512
"type": "string"
1613
}
1714
},
18-
"required": ["series_id", "episode_id", "url"],
15+
"required": ["series_id", "episode_id"],
1916
"additionalProperties": false
2017
}

src/courseware-plugin-opencast-video.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ export default {
141141
const attributes = { payload: {
142142
series_id : this.currentSeries,
143143
episode_id: this.currentEpisode,
144-
url : this.currentUrl,
145144
title : this.currentTitle
146145
} };
147146
const container = this.$store.getters["courseware-containers/related"]({
@@ -158,7 +157,7 @@ export default {
158157
initCurrentData() {
159158
this.currentSeries = get(this.block, "attributes.payload.series_id", "");
160159
this.currentEpisode = get(this.block, "attributes.payload.episode_id", "");
161-
this.currentUrl = get(this.block, "attributes.payload.url", "");
160+
this.currentUrl = STUDIP.ABSOLUTE_URI_STUDIP + 'plugins.php/opencast/redirect/perform/video/' + this.currentEpisode;
162161
this.currentTitle = get(this.block, "attributes.payload.title", "");
163162
164163
if (this.currentTitle) {
@@ -203,7 +202,7 @@ export default {
203202
for (let id in this.episodes) {
204203
if (this.episodes[id].id == this.currentEpisode) {
205204
this.currentSeries = this.episodes[id].series_id;
206-
this.currentUrl = this.episodes[id].url;
205+
this.currentUrl = STUDIP.ABSOLUTE_URI_STUDIP + 'plugins.php/opencast/redirect/perform/video/' + this.currentEpisode;;
207206
this.currentVisible = this.episodes[id].visible;
208207
if (!this.titleFromBackend) {
209208
this.currentTitle = this.episodes[id].name;

0 commit comments

Comments
 (0)