From b611b1ee894e9c739c60b198bdb4b4d03a940f2f Mon Sep 17 00:00:00 2001 From: Rasmus Fuhse <fuhse@data-quest.de> Date: Thu, 25 Aug 2022 11:04:56 +0000 Subject: [PATCH] Resolve "Feststehende Bennenung "OER Campus"" Closes #1420 Merge request studip/studip!884 --- app/views/contents/courseware/courseware.php | 3 +- app/views/course/courseware/index.php | 3 +- app/views/file/add_files_window.php | 4 +- app/views/oer/embed/_link.php | 2 +- app/views/oer/endpoints/index.php | 2 +- app/views/oer/market/abo.php | 2 +- db/migrations/5.3.2_remove_oer_title.php | 46 +++++++++++++++++++ lib/models/OERMaterial.php | 7 ++- lib/navigation/AdminNavigation.php | 2 +- lib/navigation/OERNavigation.php | 6 +-- .../courseware/CoursewareActionWidget.vue | 2 +- .../courseware/CoursewareExportWidget.vue | 3 +- .../CoursewareStructuralElement.vue | 9 ++-- resources/vue/courseware-index-app.js | 6 --- resources/vue/mixins/courseware/export.js | 3 +- .../vue/store/courseware/courseware.module.js | 12 ----- 16 files changed, 67 insertions(+), 45 deletions(-) create mode 100644 db/migrations/5.3.2_remove_oer_title.php diff --git a/app/views/contents/courseware/courseware.php b/app/views/contents/courseware/courseware.php index b2f484744db..b50a9637014 100644 --- a/app/views/contents/courseware/courseware.php +++ b/app/views/contents/courseware/courseware.php @@ -1,9 +1,8 @@ -<div +<div id="courseware-index-app" entry-element-id="<?= $entry_element_id ?>" entry-type="users" entry-id="<?= $user_id ?>" oer-enabled='<?= $oer_enabled ?>' - oer-title="<?= Config::get()->OER_TITLE ?>" licenses='<?= $licenses ?>' > </div> diff --git a/app/views/course/courseware/index.php b/app/views/course/courseware/index.php index 8f372d26763..518f765a3c0 100644 --- a/app/views/course/courseware/index.php +++ b/app/views/course/courseware/index.php @@ -4,7 +4,6 @@ entry-type="courses" entry-id="<?= Context::getId() ?>" oer-enabled="<?= Config::get()->OERCAMPUS_ENABLED?>" - oer-title="<?= Config::get()->OER_TITLE ?>" licenses='<?= $licenses ?>' > -</div> \ No newline at end of file +</div> diff --git a/app/views/file/add_files_window.php b/app/views/file/add_files_window.php index cefd7a897e2..0973ed8e647 100644 --- a/app/views/file/add_files_window.php +++ b/app/views/file/add_files_window.php @@ -17,7 +17,7 @@ if ($folder_id) { <div class="files_source_selector" data-folder_id="<?= htmlReady($folder_id) ?>" <? if ($hidden) echo ' style="display: none;"'; ?>> <h2 class="dialog-subtitle"><?= _('Quelle auswählen') ?></h2> <div class="file_select_possibilities"> - <? if ($range instanceof Course && !$range->getSemClass()['studygroup_mode'] && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) + <? if ($range instanceof Course && !$range->getSemClass()['studygroup_mode'] && $GLOBALS['perm']->have_studip_perm('tutor', $range->id) && $GLOBALS['LIBRARY_CATALOGS'] && $show_library_functions && $library_search_description) : ?> <div> <a class="important-item" data-dialog="size=medium-43" @@ -66,7 +66,7 @@ if ($folder_id) { <a href="<?= $controller->link_for('oer/addfile/choose_file', array_merge($options, ['from_plugin' => ""])) ?>" data-dialog="size=800x800"> <?= Icon::create('oer-campus')->asImg(50) ?> - <?= htmlReady(Config::get()->OER_TITLE) ?> + <?= _('OER Campus') ?> </a> <? endif ?> <? foreach (PluginManager::getInstance()->getPlugins('FilesystemPlugin') as $plugin) : ?> diff --git a/app/views/oer/embed/_link.php b/app/views/oer/embed/_link.php index ff32f893817..684a388a1da 100644 --- a/app/views/oer/embed/_link.php +++ b/app/views/oer/embed/_link.php @@ -1,6 +1,6 @@ <div style="text-align: right;"> <a href="<?= URLHelper::getLink("dispatch.php/oer/market/details/{$id}") ?>" - title="<?= htmlReady(sprintf(_('Zum %s wechseln'), Config::get()->OER_TITLE)) ?>"> + title="<?= htmlReady(_('Zum OER Campus wechseln')) ?>"> <?= Icon::create('oer-campus')->asImg(['class' => 'text-bottom']) ?> <?= htmlReady($material['name']) ?> </a> diff --git a/app/views/oer/endpoints/index.php b/app/views/oer/endpoints/index.php index dfedc016078..794dfab1ceb 100644 --- a/app/views/oer/endpoints/index.php +++ b/app/views/oer/endpoints/index.php @@ -1,4 +1,4 @@ -<h1><?= htmlReady(Config::get()->OER_TITLE) ?></h1> +<h1><?= _('OER Campus') ?></h1> <h2><?= _('Version') ?></h2> <?= _('Stud.IP') ?>: <?= htmlReady($GLOBALS['SOFTWARE_VERSION']) ?> diff --git a/app/views/oer/market/abo.php b/app/views/oer/market/abo.php index 053873134ac..16dde466d34 100644 --- a/app/views/oer/market/abo.php +++ b/app/views/oer/market/abo.php @@ -5,7 +5,7 @@ <label> <input type="checkbox" name="abo" value="1"<?= $abo ? " checked" : "" ?>> - <?= sprintf(_('Ich möchte Nachrichten bekommen über neue Inhalte im %s'), Config::get()->OER_TITLE) ?> + <?= _('Ich möchte Nachrichten bekommen über neue Inhalte im OER Campus') ?> </label> <div data-dialog-button> diff --git a/db/migrations/5.3.2_remove_oer_title.php b/db/migrations/5.3.2_remove_oer_title.php new file mode 100644 index 00000000000..2df3e964870 --- /dev/null +++ b/db/migrations/5.3.2_remove_oer_title.php @@ -0,0 +1,46 @@ +<?php + + +class RemoveOerTitle extends Migration +{ + public function description() + { + return 'Removes the option OER_TITLE from the config'; + } + + + public function up() + { + DBManager::get()->exec( + "DELETE FROM `config_values` + WHERE `field` = 'OER_TITLE'" + ); + DBManager::get()->exec( + "DELETE FROM `config` + WHERE `field` = 'OER_TITLE'" + ); + } + + + public function down() + { + $query = "INSERT INTO `config` + SET `field` = :field, + `value` = :value, + `type` = :type, + `range` = :range, + `section` = :section, + `mkdate` = UNIX_TIMESTAMP(), + `chdate` = UNIX_TIMESTAMP(), + `description` = :description"; + $config_statement = DBManager::get()->prepare($query); + $config_statement->execute([ + ':field' => 'OER_TITLE', + ':value' => 'OER Campus', + ':type' => 'string', + ':range' => 'global', + ':section' => 'OERCampus', + ':description' => 'Name des OER Campus in Stud.IP', + ]); + } +} diff --git a/lib/models/OERMaterial.php b/lib/models/OERMaterial.php index 7612f70f985..9fb45d96bc3 100644 --- a/lib/models/OERMaterial.php +++ b/lib/models/OERMaterial.php @@ -593,7 +593,7 @@ class OERMaterial extends SimpleORMap $statement->execute([$GLOBALS['user']->id]); $usernames = $statement->fetchAll(PDO::FETCH_COLUMN, 0); $messsaging = new messaging(); - $subject = sprintf(_("Neues Material im %s"), Config::get()->OER_TITLE); + $subject = _("Neues Material im OER Campus"); if ($this->users[0]) { $user_name = $this->users[0]['external_contact'] ? $this->users[0]['oeruser']['name'] @@ -603,9 +603,8 @@ class OERMaterial extends SimpleORMap } $oldbase = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); $message = sprintf( - _('%1$s hat soeben neues Material auf dem %2$s zur verfügung gestellt. Viel Spaß! <br> %3$s'), + _('%1$s hat soeben neues Material auf dem OER Campus zur verfügung gestellt. Viel Spaß! <br> %2$s'), $user_name, - Config::get()->OER_TITLE, URLHelper::getURL("dispatch.php/oer/market/details/".$this->getId()) ); URLHelper::setBaseURL($oldbase); @@ -620,7 +619,7 @@ class OERMaterial extends SimpleORMap $subject, '', 'normal', - [Config::get()->OER_TITLE], + [_('OER Campus')], false ); } diff --git a/lib/navigation/AdminNavigation.php b/lib/navigation/AdminNavigation.php index 2081af91aa6..c208ffd9e38 100644 --- a/lib/navigation/AdminNavigation.php +++ b/lib/navigation/AdminNavigation.php @@ -143,7 +143,7 @@ class AdminNavigation extends Navigation $navigation->addSubNavigation( 'oer', new Navigation( - Config::get()->OER_TITLE, + _('OER Campus'), URLHelper::getURL("dispatch.php/oer/admin/hosts") ) ); diff --git a/lib/navigation/OERNavigation.php b/lib/navigation/OERNavigation.php index 2e116137c9f..3fc03d4275f 100644 --- a/lib/navigation/OERNavigation.php +++ b/lib/navigation/OERNavigation.php @@ -23,9 +23,9 @@ class OERNavigation extends Navigation */ public function __construct() { - parent::__construct(Config::get()->OER_TITLE); + parent::__construct(_('OER Campus')); - $this->setImage(Icon::create('oer-campus', Icon::ROLE_NAVIGATION, ["title" => Config::get()->OER_TITLE])); + $this->setImage(Icon::create('oer-campus', Icon::ROLE_NAVIGATION, ["title" => _('OER Campus')])); } /** @@ -37,7 +37,7 @@ class OERNavigation extends Navigation global $perm; parent::initSubNavigation(); - $navigation = new Navigation(Config::get()->OER_TITLE, 'dispatch.php/oer/market'); + $navigation = new Navigation(_('OER Campus'), 'dispatch.php/oer/market'); $this->addSubNavigation('market', $navigation); if ($perm->have_perm('autor')) { diff --git a/resources/vue/components/courseware/CoursewareActionWidget.vue b/resources/vue/components/courseware/CoursewareActionWidget.vue index cc1738d55a1..a32c7491d17 100644 --- a/resources/vue/components/courseware/CoursewareActionWidget.vue +++ b/resources/vue/components/courseware/CoursewareActionWidget.vue @@ -44,7 +44,7 @@ </li> <li v-if="!isOwner" class="cw-action-widget-oer"> <button @click="suggestOER"> - <translate>Material für %{oerTitle} vorschlagen</translate> + <translate>Material für den OER Campus vorschlagen</translate> </button> </li> <li v-if="!isRoot && canEdit" class="cw-action-widget-trash"> diff --git a/resources/vue/components/courseware/CoursewareExportWidget.vue b/resources/vue/components/courseware/CoursewareExportWidget.vue index 2c821b735cd..6dea7158198 100644 --- a/resources/vue/components/courseware/CoursewareExportWidget.vue +++ b/resources/vue/components/courseware/CoursewareExportWidget.vue @@ -14,7 +14,7 @@ </li> <li v-if="showOer" class="cw-export-widget-oer"> <button @click="oerElement"> - <translate>Seite auf %{oerTitle} veröffentlichen</translate> + <translate>Seite auf dem OER Campus veröffentlichen</translate> </button> </li> <li v-if="!showExportArchiv && !showExportPdf && !showOer"> @@ -41,7 +41,6 @@ export default { ...mapGetters({ context: 'context', oerEnabled: 'oerEnabled', - oerTitle: 'oerTitle', userIsTeacher: 'userIsTeacher', }), canEdit() { diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue index 1b2dfc473b5..208419e2b64 100644 --- a/resources/vue/components/courseware/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue @@ -528,7 +528,7 @@ > <template v-slot:dialogContent> <p><translate>Das folgende Courseware-Material wird %{ ownerName } - zur Veröffentlichung im %{ oerTitle } vorgeschlagen:</translate></p> + zur Veröffentlichung im OER Campus vorgeschlagen:</translate></p> <table class="cw-structural-element-info"> <tr> <td><translate>Titel</translate>:</td> @@ -724,7 +724,6 @@ export default { showSuggestOerDialog: 'showSuggestOerDialog', showLinkDialog: 'showStructuralElementLinkDialog', oerEnabled: 'oerEnabled', - oerTitle: 'oerTitle', licenses: 'licenses', exportState: 'exportState', exportProgress: 'exportProgress', @@ -741,7 +740,7 @@ export default { textOer() { return { - title: this.$gettextInterpolate('Seite auf %{ oerTitle } veröffentlichen', {oerTitle: this.oerTitle}), + title: this.$gettext('Seite auf dem OER Campus veröffentlichen'), confirm: this.$gettext('Veröffentlichen'), close: this.$gettext('Schließen'), }; @@ -749,7 +748,7 @@ export default { textSuggestOer() { return { - title: this.$gettextInterpolate('Material für %{ oerTitle } vorschlagen', {oerTitle: this.oerTitle}), + title: this.$gettext('Material für den OER Campus vorschlagen'), confirm: this.$gettext('Material vorschlagen'), close: this.$gettext('Schließen'), }; @@ -906,7 +905,7 @@ export default { let menu = [ { id: 4, label: this.$gettext('Informationen anzeigen'), icon: 'info', emit: 'showInfo' }, { id: 5, label: this.$gettext('Lesezeichen setzen'), icon: 'star', emit: 'setBookmark' }, - { id: 6, label: this.$gettextInterpolate('Material für %{ oerTitle } vorschlagen', {oerTitle: this.oerTitle}), icon: 'oer-campus', emit: 'showSuggest' }, + { id: 6, label: this.$gettext('Material für den OER Campus vorschlagen', icon: 'oer-campus', emit: 'showSuggest' }, ]; if (this.canEdit) { diff --git a/resources/vue/courseware-index-app.js b/resources/vue/courseware-index-app.js index c2e4a1e52d8..3d95d7dcd81 100644 --- a/resources/vue/courseware-index-app.js +++ b/resources/vue/courseware-index-app.js @@ -23,7 +23,6 @@ const mountApp = (STUDIP, createApp, element) => { let entry_id = null; let entry_type = null; let oer_enabled = null; - let oer_title = null; let licenses = null; let elem; @@ -44,10 +43,6 @@ const mountApp = (STUDIP, createApp, element) => { if (elem.attributes['oer-enabled'] !== undefined) { oer_enabled = elem.attributes['oer-enabled'].value; } - - if (elem.attributes['oer-title'] !== undefined) { - oer_title = elem.attributes['oer-title'].value; - } // we need a route for License SORM if (elem.attributes['licenses'] !== undefined) { licenses = JSON.parse(elem.attributes['licenses'].value); @@ -133,7 +128,6 @@ const mountApp = (STUDIP, createApp, element) => { store.dispatch('coursewareCurrentElement', elem_id); store.dispatch('oerEnabled', oer_enabled); - store.dispatch('oerTitle', oer_title); store.dispatch('licenses', licenses); const pluginManager = new PluginManager(); diff --git a/resources/vue/mixins/courseware/export.js b/resources/vue/mixins/courseware/export.js index f15c314ecb5..3e591f0010c 100644 --- a/resources/vue/mixins/courseware/export.js +++ b/resources/vue/mixins/courseware/export.js @@ -11,7 +11,6 @@ export default { containerById: 'courseware-containers/byId', folderById: 'folders/byId', filesById: 'files/byId', - oerTitle: 'oerTitle', structuralElementById: 'courseware-structural-elements/byId', }), }, @@ -187,7 +186,7 @@ export default { data: formData, headers: { "Content-Type": "multipart/form-data"} }).then( () => { - this.companionInfo({ info: this.$gettextInterpolate('Die Seite wurde an %{ oerTitle } gesendet.', {oerTitle: this.oerTitle}) }); + this.companionInfo({ info: this.$gettext('Die Seite wurde an den OER Campus gesendet.') }); }).catch(error => { this.companionError({ info: this.$gettext('Beim Veröffentlichen der Seite ist ein Fehler aufgetreten.') }); console.debug(error); diff --git a/resources/vue/store/courseware/courseware.module.js b/resources/vue/store/courseware/courseware.module.js index 49ac520a5d4..e627d374555 100644 --- a/resources/vue/store/courseware/courseware.module.js +++ b/resources/vue/store/courseware/courseware.module.js @@ -9,7 +9,6 @@ const getDefaultState = () => { courseware: {}, currentElement: {}, oerEnabled: null, - oerTitle: null, licenses: null, // we need a route for License SORM httpClient: null, lastElement: null, @@ -79,9 +78,6 @@ const getters = { oerEnabled(state) { return state.oerEnabled; }, - oerTitle(state) { - return state.oerTitle; - }, licenses(state) { return state.licenses; }, @@ -734,10 +730,6 @@ export const actions = { context.commit('oerEnabledSet', enabled); }, - oerTitle(context, title) { - context.commit('oerTitleSet', title); - }, - licenses(context, licenses) { context.commit('licensesSet', licenses); }, @@ -1245,10 +1237,6 @@ export const mutations = { state.oerEnabled = data; }, - oerTitleSet(state, data) { - state.oerTitle = data; - }, - licensesSet(state, data) { state.licenses = data; }, -- GitLab