diff --git a/app/views/contents/courseware/courseware.php b/app/views/contents/courseware/courseware.php index 683f07e4748aab745a8ec4fb83622e115fa5bef5..338c6b2c7bdb4a030da04956326795bec3f3d4e5 100644 --- a/app/views/contents/courseware/courseware.php +++ b/app/views/contents/courseware/courseware.php @@ -5,7 +5,6 @@ entry-type="users" entry-id="<?= htmlReady($user_id) ?>" unit-id="<?= htmlReady($unit_id) ?>" - oer-enabled='<?= htmlReady($oer_enabled) ?>' licenses='<?= htmlReady($licenses) ?>' > </div> diff --git a/app/views/contents/courseware/shared_content_courseware.php b/app/views/contents/courseware/shared_content_courseware.php index f9590593b1518aa3991e709cadf076ad7820bf43..05ed3cc0fbfba74e10098c901fe22c730a3e8b78 100755 --- a/app/views/contents/courseware/shared_content_courseware.php +++ b/app/views/contents/courseware/shared_content_courseware.php @@ -3,7 +3,6 @@ entry-element-id="<?= $entry_element_id ?>" entry-type="sharedusers" entry-id="<?= $entry_element_id ?>" - oer-enabled='<?= $oer_enabled ?>' oer-title="<?= Config::get()->OER_TITLE ?>" licenses='<?= $licenses ?>' > diff --git a/app/views/course/courseware/courseware.php b/app/views/course/courseware/courseware.php index 1abb48a667fbf3e7d904b0c37d99d457b992db91..2dadc86a667ec66b19d73b344841cede8d019628 100644 --- a/app/views/course/courseware/courseware.php +++ b/app/views/course/courseware/courseware.php @@ -5,7 +5,6 @@ entry-type="courses" entry-id="<?= htmlReady(Context::getId()) ?>" unit-id="<?= htmlReady($unit_id) ?>" - oer-enabled='<?= htmlReady($oer_enabled) ?>' licenses='<?= htmlReady($licenses) ?>' > </div> diff --git a/lib/classes/JsonApi/Models/Studip.php b/lib/classes/JsonApi/Models/Studip.php index ce5fa1cfb9f44f0a17037fcf5e8b8b4ed9612296..1b5aed05124d82f19e38c48ea5a3f9c959110a20 100644 --- a/lib/classes/JsonApi/Models/Studip.php +++ b/lib/classes/JsonApi/Models/Studip.php @@ -13,6 +13,8 @@ class Studip { $properties = [ new StudipProperty('studip-version', 'Stud.IP-Version', $GLOBALS['SOFTWARE_VERSION']), + new StudipProperty('oer-campus-enabled', 'OERCAMPUS_ENABLED', \Config::get()->OERCAMPUS_ENABLED), + new StudipProperty('oer-enable-suggestions', 'OER_ENABLE_SUGGESTIONS', \Config::get()->OER_ENABLE_SUGGESTIONS), ]; $copyrightDialog = self::getConfigOption('COPYRIGHT_DIALOG_ON_UPLOAD'); diff --git a/resources/vue/components/courseware/CoursewareExportWidget.vue b/resources/vue/components/courseware/CoursewareExportWidget.vue index 89ecf1cbb8324524011c0b85b9bcc4a56721af5f..a6473ca4687460cef282fee60b1f4f69dfe31aae 100644 --- a/resources/vue/components/courseware/CoursewareExportWidget.vue +++ b/resources/vue/components/courseware/CoursewareExportWidget.vue @@ -40,7 +40,7 @@ export default { computed: { ...mapGetters({ context: 'context', - oerEnabled: 'oerEnabled', + oerCampusEnabled: 'oerCampusEnabled', userIsTeacher: 'userIsTeacher', }), canEdit() { @@ -64,7 +64,7 @@ export default { return this.canVisit; }, showOer() { - if (!this.oerEnabled) { + if (!this.oerCampusEnabled) { return false; } diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue index b24840e03895035975b142a0b2f06f7714ab56c4..427d58232ecb20a9ba9a465ee53cbc5ac435f113 100644 --- a/resources/vue/components/courseware/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue @@ -802,7 +802,8 @@ export default { showSuggestOerDialog: 'showSuggestOerDialog', showPublicLinkDialog: 'showStructuralElementPublicLinkDialog', showRemoveLockDialog: 'showStructuralElementRemoveLockDialog', - oerEnabled: 'oerEnabled', + oerCampusEnabled: 'oerCampusEnabled', + oerEnableSuggestions: 'oerEnableSuggestions', licenses: 'licenses', exportState: 'exportState', exportProgress: 'exportProgress', @@ -1042,9 +1043,9 @@ export default { { id: 5, label: this.$gettext('Lesezeichen setzen'), icon: 'star', emit: 'setBookmark' }, ]; - if (this.oerEnabled) { + if (this.oerEnableSuggestions) { menu.push( - { id: 6, label: this.$gettext('Lerninhalt für OER Campus vorschlagen'), icon: 'oer-campus', + { id: 6, label: this.$gettext('Seite für OER Campus vorschlagen'), icon: 'oer-campus', emit: 'showSuggest' } ); } diff --git a/resources/vue/courseware-index-app.js b/resources/vue/courseware-index-app.js index a31686bceb45b8afffda27219fc7d1aa2cb5d2b2..587cdb4bd6f0e8d8f703a06071dafe2b7727a9b4 100644 --- a/resources/vue/courseware-index-app.js +++ b/resources/vue/courseware-index-app.js @@ -24,7 +24,6 @@ const mountApp = async (STUDIP, createApp, element) => { let entry_id = null; let entry_type = null; let unit_id = null; - let oer_enabled = null; let licenses = null; let elem; @@ -46,9 +45,6 @@ const mountApp = async (STUDIP, createApp, element) => { unit_id = elem.attributes['unit-id'].value; } - if (elem.attributes['oer-enabled'] !== undefined) { - oer_enabled = elem.attributes['oer-enabled'].value; - } // we need a route for License SORM if (elem.attributes['licenses'] !== undefined) { licenses = JSON.parse(elem.attributes['licenses'].value); @@ -119,13 +115,22 @@ const mountApp = async (STUDIP, createApp, element) => { 'sem-classes', 'sem-types', 'terms-of-use', - 'user-data-field' + 'user-data-field', + 'studip-properties' ], httpClient, }), }, }); + axios.get( + STUDIP.URLHelper.getURL('jsonapi.php/v1/studip/properties', {}, true) + ).then(response => { + response.data.data.forEach(prop => { + store.dispatch('studip-properties/storeRecord', prop); + }); + }); + store.dispatch('setUrlHelper', STUDIP.URLHelper); store.dispatch('setUserId', STUDIP.USER_ID); await store.dispatch('users/loadById', {id: STUDIP.USER_ID}); @@ -144,7 +149,6 @@ const mountApp = async (STUDIP, createApp, element) => { store.dispatch('coursewareCurrentElement', elem_id); - store.dispatch('oerEnabled', oer_enabled); store.dispatch('licenses', licenses); store.dispatch('courseware-templates/loadAll'); store.dispatch('loadUserClipboards', STUDIP.USER_ID); diff --git a/resources/vue/store/courseware/courseware.module.js b/resources/vue/store/courseware/courseware.module.js index 0f56e3e7af87e3fa9d52c9c8a113a541f46f260f..89d7da82d7ecdd27f0f8f0ae571e2443bf610fb5 100644 --- a/resources/vue/store/courseware/courseware.module.js +++ b/resources/vue/store/courseware/courseware.module.js @@ -8,7 +8,6 @@ const getDefaultState = () => { context: {}, courseware: {}, currentElement: {}, - oerEnabled: null, licenses: null, // we need a route for License SORM httpClient: null, lastElement: null, @@ -103,9 +102,6 @@ const getters = { currentStructuralElementImageURL(state, getters) { return getters.currentStructuralElement?.relationships?.image?.meta?.['download-url']; }, - oerEnabled(state) { - return state.oerEnabled; - }, licenses(state) { return state.licenses; }, @@ -258,6 +254,13 @@ const getters = { }, progresses(state) { return state.progresses; + }, + + oerCampusEnabled(state, getters, rootState, rootGetters) { + return rootGetters['studip-properties/byId']({ id: 'oer-campus-enabled'}).attributes?.value; + }, + oerEnableSuggestions(state, getters, rootState, rootGetters) { + return getters.oerCampusEnabled && rootGetters['studip-properties/byId']({ id: 'oer-enable-suggestions'}).attributes?.value; } }; @@ -807,10 +810,6 @@ export const actions = { context.commit('coursewareContextSet', id); }, - oerEnabled(context, enabled) { - context.commit('oerEnabledSet', enabled); - }, - licenses(context, licenses) { context.commit('licensesSet', licenses); }, @@ -1420,10 +1419,6 @@ export const mutations = { state.context = data; }, - oerEnabledSet(state, data) { - state.oerEnabled = data; - }, - licensesSet(state, data) { state.licenses = data; },