Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix courseware block #1076

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions courseware/vueapp/components/CoursewareVideoTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
</tbody>
</table>
</div>

<LtiAuth v-if="simple_config_list"
:simple_config_list="simple_config_list"
/>
</div>
</template>

Expand Down
37 changes: 27 additions & 10 deletions courseware/vueapp/courseware-plugin-opencast-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<div>
<span v-if="!currentVideoId" v-text="$gettext('Es wurde bisher kein Video ausgewählt')"></span>
<span v-else-if="!currentEpisodeURL" v-text="$gettext('Dieses Video hat keinen Veröffentlichungs-URL-Link')"></span>
<span v-else-if="!isCurrentVideoLTIAuthenticated" v-text="$gettext('Es ist ein Verbindungsfehler zum Opencast Server aufgetreten. Das ausgewählte Video kann zurzeit nicht angezeigt werden.')"></span>
<iframe v-else :src="currentEpisodeURL"
<span v-else-if="isCurrentVideoLTIChecked && !isCurrentVideoLTIAuthenticated" v-text="$gettext('Es ist ein Verbindungsfehler zum Opencast Server aufgetreten. Das ausgewählte Video kann zurzeit nicht angezeigt werden.')"></span>
<iframe v-else-if="isCurrentVideoLTIChecked" :src="currentEpisodeURL"
class="oc_cw_iframe"
allowfullscreen
></iframe>
Expand All @@ -25,6 +25,10 @@
Korrigieren sie die Sichtbarkeitseinstellungen im Opencast-Reiter.
</translate>
</div>

<LtiAuth v-if="simple_config_list"
:simple_config_list="simple_config_list"
/>
</div>
</template>
<template v-if="canEdit" #edit>
Expand Down Expand Up @@ -61,13 +65,15 @@
const get = window._.get.bind(window._);
import axios from 'axios';
import { mapActions, mapGetters } from 'vuex';
import LtiAuth from "./components/LtiAuth.vue";
import CoursewareSearchBar from './components/CoursewareSearchBar.vue';
import CoursewareVideoTable from './components/CoursewareVideoTable.vue';

export default {
name: "courseware-plugin-opencast-video",

components: {
LtiAuth,
CoursewareSearchBar,
CoursewareVideoTable,
},
Expand Down Expand Up @@ -105,7 +111,7 @@ export default {
lastPage: 0,
items: 0
},
videos: {},
videos: [],
loadingVideos : false,
currentVideoId : null,
currentEpisodeURL : null,
Expand All @@ -130,15 +136,22 @@ export default {
);
},

currentVideo() {
return this.videos.find(video => video.token === this.currentVideoId);
},

isCurrentVideoLTIChecked() {
if (!this.currentVideo) {
return false;
}
return this.isLTIAuthenticated[this.currentVideo.config_id] !== undefined;
},

isCurrentVideoLTIAuthenticated() {
if (this.videos.length > 0) {
let currentVideo = this.videos.find(video => video.token === this.currentVideoId);
if (!currentVideo) {
return false;
}
return this.isLTIAuthenticated[currentVideo.config_id];
if (!this.currentVideo) {
return false;
}
return false;
return this.isLTIAuthenticated[this.currentVideo.config_id] === true;
}
},

Expand Down Expand Up @@ -256,7 +269,11 @@ export default {
}).then((response) => {
if (response.status == 200 && response.data.user_id !== undefined) {
this.$set(this.isLTIAuthenticated, server.id, true);
} else {
this.$set(this.isLTIAuthenticated, server.id, false);
}
}).catch(() => {
this.$set(this.isLTIAuthenticated, server.id, false);
});
},
},
Expand Down
Loading