From ad6da68adf45d6343314ab633b1f75460f35f34d Mon Sep 17 00:00:00 2001 From: Thomas Hackl <hackl@data-quest.de> Date: Fri, 9 Sep 2022 12:19:02 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20"Fehlender=20globaler=20Schalter=20f?= =?UTF-8?q?=C3=BCr=20das=20Abschalten=20der=20Courseware=20(veranstaltungs?= =?UTF-8?q?unabh=C3=A4ngig)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #648 Merge request studip/studip!995 --- lib/classes/JsonApi/RouteMap.php | 12 ++++-- lib/navigation/AdminNavigation.php | 18 +++++--- lib/navigation/ContentsNavigation.php | 62 +++++++++++++-------------- lib/navigation/StartNavigation.php | 6 ++- 4 files changed, 56 insertions(+), 42 deletions(-) diff --git a/lib/classes/JsonApi/RouteMap.php b/lib/classes/JsonApi/RouteMap.php index 89ddeb56687..84d3c575104 100644 --- a/lib/classes/JsonApi/RouteMap.php +++ b/lib/classes/JsonApi/RouteMap.php @@ -118,7 +118,11 @@ class RouteMap $this->addAuthenticatedConsultationRoutes($group); $this->addAuthenticatedContactsRoutes($group); $this->addAuthenticatedCoursesRoutes($group); - $this->addAuthenticatedCoursewareRoutes($group); + + if (PluginManager::getInstance()->getPlugin('CoursewareModule')) { + $this->addAuthenticatedCoursewareRoutes($group); + } + $this->addAuthenticatedEventsRoutes($group); $this->addAuthenticatedFeedbackRoutes($group); $this->addAuthenticatedFilesRoutes($group); @@ -144,8 +148,10 @@ class RouteMap $group->get('/studip/properties', Routes\Studip\PropertiesIndex::class); - $group->get('/public/courseware/{link_id}/courseware-structural-elements/{id}', Routes\Courseware\PublicStructuralElementsShow::class); - $group->get('/public/courseware/{link_id}/courseware-structural-elements', Routes\Courseware\PublicStructuralElementsIndex::class); + if (PluginManager::getInstance()->getPlugin('CoursewareModule')) { + $group->get('/public/courseware/{link_id}/courseware-structural-elements/{id}', Routes\Courseware\PublicStructuralElementsShow::class); + $group->get('/public/courseware/{link_id}/courseware-structural-elements', Routes\Courseware\PublicStructuralElementsIndex::class); + } } private function getAuthenticator(): callable diff --git a/lib/navigation/AdminNavigation.php b/lib/navigation/AdminNavigation.php index c208ffd9e38..2bb24189e00 100644 --- a/lib/navigation/AdminNavigation.php +++ b/lib/navigation/AdminNavigation.php @@ -132,13 +132,17 @@ class AdminNavigation extends Navigation if (Config::get()->BANNER_ADS_ENABLE) { $navigation->addSubNavigation('banner', new Navigation(_('Werbebanner'), 'dispatch.php/admin/banner')); } - $navigation->addSubNavigation( - 'courseware', - new Navigation( - _('Courseware'), - 'dispatch.php/admin/courseware/index' - ) - ); + + if (PluginManager::getInstance()->getPlugin('CoursewareModule')) { + $navigation->addSubNavigation( + 'courseware', + new Navigation( + _('Courseware'), + 'dispatch.php/admin/courseware/index' + ) + ); + } + if (Config::get()->OERCAMPUS_ENABLED) { $navigation->addSubNavigation( 'oer', diff --git a/lib/navigation/ContentsNavigation.php b/lib/navigation/ContentsNavigation.php index 4e01acaadfd..32cefa56fd9 100644 --- a/lib/navigation/ContentsNavigation.php +++ b/lib/navigation/ContentsNavigation.php @@ -42,38 +42,38 @@ class ContentsNavigation extends Navigation $this->addSubNavigation('overview', $overview); + if (PluginManager::getInstance()->getPlugin('CoursewareModule')) { + $courseware = new Navigation(_('Courseware')); + $courseware->setDescription(_('Erstellen und Sammeln von Lernmaterialien')); + $courseware->setImage(Icon::create('courseware')); + + $courseware->addSubNavigation( + 'overview', + new Navigation(_('Übersicht'), 'dispatch.php/contents/courseware/index') + ); + $courseware->addSubNavigation( + 'courseware', + new Navigation(_('Persönliche Lernmaterialien'), 'dispatch.php/contents/courseware/courseware') + ); + $courseware->addSubNavigation( + 'courseware_manager', + new Navigation(_('Verwaltung persönlicher Lernmaterialien'), 'dispatch.php/contents/courseware/courseware_manager') + ); + $courseware->addSubNavigation( + 'releases', + new Navigation(_('Freigaben'), 'dispatch.php/contents/courseware/releases') + ); + $courseware->addSubNavigation( + 'bookmarks', + new Navigation(_('Lesezeichen'), 'dispatch.php/contents/courseware/bookmarks') + ); + $courseware->addSubNavigation( + 'courses_overview', + new Navigation(_('Meine Veranstaltungen'), 'dispatch.php/contents/courseware/courses_overview') + ); - $courseware = new Navigation(_('Courseware')); - $courseware->setDescription(_('Erstellen und Sammeln von Lernmaterialien')); - $courseware->setImage(Icon::create('courseware')); - - $courseware->addSubNavigation( - 'overview', - new Navigation(_('Übersicht'), 'dispatch.php/contents/courseware/index') - ); - $courseware->addSubNavigation( - 'courseware', - new Navigation(_('Persönliche Lernmaterialien'), 'dispatch.php/contents/courseware/courseware') - ); - $courseware->addSubNavigation( - 'courseware_manager', - new Navigation(_('Verwaltung persönlicher Lernmaterialien'), 'dispatch.php/contents/courseware/courseware_manager') - ); - $courseware->addSubNavigation( - 'releases', - new Navigation(_('Freigaben'), 'dispatch.php/contents/courseware/releases') - ); - $courseware->addSubNavigation( - 'bookmarks', - new Navigation(_('Lesezeichen'), 'dispatch.php/contents/courseware/bookmarks') - ); - $courseware->addSubNavigation( - 'courses_overview', - new Navigation(_('Meine Veranstaltungen'), 'dispatch.php/contents/courseware/courses_overview') - ); - - $this->addSubNavigation('courseware', $courseware); - + $this->addSubNavigation('courseware', $courseware); + } $files = new Navigation(_('Dateien')); $files->setDescription(_('Überblick über alle Dokumente')); diff --git a/lib/navigation/StartNavigation.php b/lib/navigation/StartNavigation.php index 973f7055680..e5779a50b41 100644 --- a/lib/navigation/StartNavigation.php +++ b/lib/navigation/StartNavigation.php @@ -234,7 +234,11 @@ class StartNavigation extends Navigation // contents $navigation = new Navigation(_('Mein Arbeitsplatz'), 'dispatch.php/contents/overview'); - $navigation->addSubNavigation('courseware', new Navigation(_('Courseware'), 'dispatch.php/contents/courseware')); + + if (PluginManager::getInstance()->getPlugin('CoursewareModule')) { + $navigation->addSubNavigation('courseware', + new Navigation(_('Courseware'), 'dispatch.php/contents/courseware')); + } $navigation->addSubNavigation('files', new Navigation(_('Dateien'), 'dispatch.php/files/overview')); if (Config::get()->VOTE_ENABLE) { -- GitLab