diff --git a/src/main/java/org/olat/course/nodes/dialog/DialogAssessmentHandler.java b/src/main/java/org/olat/course/nodes/dialog/DialogAssessmentHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..4703f04cd6645ba0af8102d12913597d56c16fd1 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/dialog/DialogAssessmentHandler.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.dialog; + +import org.olat.course.learningpath.LearningPathOnlyAssessmentHandler; +import org.olat.course.nodes.DialogCourseNode; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 3 Feb 2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class DialogAssessmentHandler extends LearningPathOnlyAssessmentHandler { + + @Override + public String acceptCourseNodeType() { + return DialogCourseNode.TYPE; + } + +} diff --git a/src/main/java/org/olat/course/nodes/dialog/DialogLearningPathNodeHandler.java b/src/main/java/org/olat/course/nodes/dialog/DialogLearningPathNodeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..d2896a5a6bc2c2b9a99a2dd1d2b667c1ae3b0c43 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/dialog/DialogLearningPathNodeHandler.java @@ -0,0 +1,83 @@ +/** + * <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.dialog; + +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.DialogCourseNode; +import org.olat.repository.RepositoryEntry; +import org.springframework.stereotype.Service; + +/** + * + * Initial date: 2 Feb 2020<br> + * @author uhensler, urs.hensler@frentix.com, http://www.frentix.com + * + */ +@Service +public class DialogLearningPathNodeHandler implements LearningPathNodeHandler { + + private static final LearningPathEditConfigs NODE_TYPE_CONFIG= LearningPathEditConfigs.builder() + .enableNodeVisited() + .enableConfirmed() + .build(); + + @Override + public String acceptCourseNodeType() { + return DialogCourseNode.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, NODE_TYPE_CONFIG); + } + + @Override + public LearningPathEditConfigs getEditConfigs() { + return NODE_TYPE_CONFIG; + } + + @Override + public void onMigrated(CourseNode courseNode) { + if (courseNode instanceof DialogCourseNode) { + DialogCourseNode dialogNode = (DialogCourseNode)courseNode; + dialogNode.removeCustomPreconditions(); + } + } + +}