From 6812b3bf30d1db06d94b2c3ac0fc5e958aadb2cf Mon Sep 17 00:00:00 2001 From: uhensler <urs.hensler@frentix.com> Date: Fri, 21 Feb 2020 13:26:21 +0100 Subject: [PATCH] OO-4241: Enable course element "Vitero" in learning path courses --- .../olat/course/nodes/ViteroCourseNode.java | 2 +- .../nodes/vitero/ViteroAssessmentHandler.java | 40 ++++++++++ .../vitero/ViteroLearningPathNodeHandler.java | 80 +++++++++++++++++++ 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/olat/course/nodes/vitero/ViteroAssessmentHandler.java create mode 100644 src/main/java/org/olat/course/nodes/vitero/ViteroLearningPathNodeHandler.java diff --git a/src/main/java/org/olat/course/nodes/ViteroCourseNode.java b/src/main/java/org/olat/course/nodes/ViteroCourseNode.java index 95d037d2cf2..68dde2ab138 100644 --- a/src/main/java/org/olat/course/nodes/ViteroCourseNode.java +++ b/src/main/java/org/olat/course/nodes/ViteroCourseNode.java @@ -63,7 +63,7 @@ public class ViteroCourseNode extends AbstractAccessableCourseNode { private static final long serialVersionUID = 8680935159748506305L; - private static final String TYPE = "vitero"; + public static final String TYPE = "vitero"; // configuration public static final String CONF_VC_CONFIGURATION = "vc_configuration"; diff --git a/src/main/java/org/olat/course/nodes/vitero/ViteroAssessmentHandler.java b/src/main/java/org/olat/course/nodes/vitero/ViteroAssessmentHandler.java new file mode 100644 index 00000000000..b19a8f0ad7c --- /dev/null +++ b/src/main/java/org/olat/course/nodes/vitero/ViteroAssessmentHandler.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.vitero; + +import org.olat.course.learningpath.LearningPathOnlyAssessmentHandler; +import org.olat.course.nodes.ViteroCourseNode; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 21.02.2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class ViteroAssessmentHandler extends LearningPathOnlyAssessmentHandler { + + @Override + public String acceptCourseNodeType() { + return ViteroCourseNode.TYPE; + } + +} diff --git a/src/main/java/org/olat/course/nodes/vitero/ViteroLearningPathNodeHandler.java b/src/main/java/org/olat/course/nodes/vitero/ViteroLearningPathNodeHandler.java new file mode 100644 index 00000000000..bad78a24617 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/vitero/ViteroLearningPathNodeHandler.java @@ -0,0 +1,80 @@ +/** + * <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.vitero; + +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.LearningPathEditConfigs; +import org.olat.course.learningpath.LearningPathNodeHandler; +import org.olat.course.learningpath.model.ModuleLearningPathConfigs; +import org.olat.course.learningpath.ui.LearningPathNodeConfigController; +import org.olat.course.nodes.CourseNode; +import org.olat.course.nodes.ViteroCourseNode; +import org.olat.repository.RepositoryEntry; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 21.02.2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class ViteroLearningPathNodeHandler implements LearningPathNodeHandler { + + private static final LearningPathEditConfigs EDIT_CONFIGS = LearningPathEditConfigs.builder() + .enableNodeVisited() + .enableConfirmed() + .build(); + + @Override + public String acceptCourseNodeType() { + return ViteroCourseNode.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) { + return new LearningPathNodeConfigController(ureq, wControl, courseEntry, courseNode, EDIT_CONFIGS); + } + + @Override + public LearningPathEditConfigs getEditConfigs() { + return EDIT_CONFIGS; + } + + @Override + public void onMigrated(CourseNode courseNode) { + // + } + +} -- GitLab