From 2952a67d5f9ad2aa3ec9dd663c965ebcfc47a87e Mon Sep 17 00:00:00 2001 From: uhensler <urs.hensler@frentix.com> Date: Fri, 21 Feb 2020 13:13:06 +0100 Subject: [PATCH] OO-4241: Enable course element "participant folder" in learning path courses --- .../course/nodes/pf/PFAssessmentHandler.java | 40 ++++++++++ .../nodes/pf/PFLearningPathNodeHandler.java | 80 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 src/main/java/org/olat/course/nodes/pf/PFAssessmentHandler.java create mode 100644 src/main/java/org/olat/course/nodes/pf/PFLearningPathNodeHandler.java diff --git a/src/main/java/org/olat/course/nodes/pf/PFAssessmentHandler.java b/src/main/java/org/olat/course/nodes/pf/PFAssessmentHandler.java new file mode 100644 index 00000000000..12603748db7 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/pf/PFAssessmentHandler.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.pf; + +import org.olat.course.learningpath.LearningPathOnlyAssessmentHandler; +import org.olat.course.nodes.PFCourseNode; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 21.02.2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class PFAssessmentHandler extends LearningPathOnlyAssessmentHandler { + + @Override + public String acceptCourseNodeType() { + return PFCourseNode.TYPE; + } + +} diff --git a/src/main/java/org/olat/course/nodes/pf/PFLearningPathNodeHandler.java b/src/main/java/org/olat/course/nodes/pf/PFLearningPathNodeHandler.java new file mode 100644 index 00000000000..6b7608165b6 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/pf/PFLearningPathNodeHandler.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.pf; + +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.PFCourseNode; +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 PFLearningPathNodeHandler implements LearningPathNodeHandler { + + private static final LearningPathEditConfigs EDIT_CONFIGS = LearningPathEditConfigs.builder() + .enableNodeVisited() + .enableConfirmed() + .build(); + + @Override + public String acceptCourseNodeType() { + return PFCourseNode.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