From 2e26c4403ff038670eb0105b0bb008c845ef46e8 Mon Sep 17 00:00:00 2001 From: uhensler <urs.hensler@frentix.com> Date: Fri, 8 Nov 2019 16:42:54 +0100 Subject: [PATCH] OO-4241: Enable Edubase course node in learning path --- .../ui/_i18n/LocalStrings_de.properties | 2 +- .../olat/course/nodes/EdubaseCourseNode.java | 2 +- .../edubase/EdubaseAssessmentHandler.java | 40 +++++++++++ .../EdubaseLearningPathNodeHandler.java | 69 +++++++++++++++++++ 4 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/olat/course/nodes/edubase/EdubaseAssessmentHandler.java create mode 100644 src/main/java/org/olat/course/nodes/edubase/EdubaseLearningPathNodeHandler.java diff --git a/src/main/java/org/olat/course/learningpath/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/learningpath/ui/_i18n/LocalStrings_de.properties index 7b6f2692b3c..259db7b7bbe 100644 --- a/src/main/java/org/olat/course/learningpath/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/learningpath/ui/_i18n/LocalStrings_de.properties @@ -1,6 +1,6 @@ access.provider.name=Lernpfad config.duration=Zeitvorgabe (Minuten) -congig.obligation=Pflicht +config.obligation=Pflicht config.obligation.mandatory=Obligatorisch config.obligation.optional=Freiwillig config.score.cut=Punkteminimum diff --git a/src/main/java/org/olat/course/nodes/EdubaseCourseNode.java b/src/main/java/org/olat/course/nodes/EdubaseCourseNode.java index f4be76997ed..d43cf38862e 100644 --- a/src/main/java/org/olat/course/nodes/EdubaseCourseNode.java +++ b/src/main/java/org/olat/course/nodes/EdubaseCourseNode.java @@ -54,7 +54,7 @@ public class EdubaseCourseNode extends AbstractAccessableCourseNode { private static final long serialVersionUID = -2370512428049915735L; - private static final String TYPE = "edubase"; + public static final String TYPE = "edubase"; public static final int CURRENT_VERSION = 1; public static final String CONFIG_DESCRIPTION_ENABLED = "descriptionEnabled"; diff --git a/src/main/java/org/olat/course/nodes/edubase/EdubaseAssessmentHandler.java b/src/main/java/org/olat/course/nodes/edubase/EdubaseAssessmentHandler.java new file mode 100644 index 00000000000..87981810862 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/edubase/EdubaseAssessmentHandler.java @@ -0,0 +1,40 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.course.nodes.edubase; + +import org.olat.course.learningpath.LearningPathOnlyAssessmentHandler; +import org.olat.course.nodes.EdubaseCourseNode; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 8 Sep 2019<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class EdubaseAssessmentHandler extends LearningPathOnlyAssessmentHandler { + + @Override + public String acceptCourseNodeType() { + return EdubaseCourseNode.TYPE; + } + +} diff --git a/src/main/java/org/olat/course/nodes/edubase/EdubaseLearningPathNodeHandler.java b/src/main/java/org/olat/course/nodes/edubase/EdubaseLearningPathNodeHandler.java new file mode 100644 index 00000000000..20854e3546b --- /dev/null +++ b/src/main/java/org/olat/course/nodes/edubase/EdubaseLearningPathNodeHandler.java @@ -0,0 +1,69 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.course.nodes.edubase; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.WindowControl; +import org.olat.course.learningpath.LearningPathConfigs; +import org.olat.course.learningpath.LearningPathNodeHandler; +import org.olat.course.learningpath.model.ModuleLearningPathConfigs; +import org.olat.course.learningpath.ui.LearningPathNodeConfigController; +import org.olat.course.learningpath.ui.LearningPathNodeConfigController.LearningPathControllerConfig; +import org.olat.course.nodes.CourseNode; +import org.olat.course.nodes.EdubaseCourseNode; +import org.olat.repository.RepositoryEntry; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 7 Nov 2019<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class EdubaseLearningPathNodeHandler implements LearningPathNodeHandler { + + @Override + public String acceptCourseNodeType() { + return EdubaseCourseNode.TYPE; + } + + @Override + public boolean isSupported() { + return true; + } + + @Override + public LearningPathConfigs getConfigs(CourseNode courseNode) { + return new ModuleLearningPathConfigs(courseNode.getModuleConfiguration(), true); + } + + @Override + public Controller createConfigEditController(UserRequest ureq, WindowControl wControl, RepositoryEntry courseEntry, + CourseNode courseNode) { + LearningPathControllerConfig ctrlConfig = LearningPathNodeConfigController.builder() + .enableNodeVisited() + .enableConfirmed() + .build(); + return new LearningPathNodeConfigController(ureq, wControl, courseEntry, courseNode.getModuleConfiguration(), ctrlConfig); + } + +} -- GitLab