Skip to content
Snippets Groups Projects
Commit 12f3845e authored by uhensler's avatar uhensler
Browse files

OO-4241: Enable course element "portfolio task" in learning path course

parent e084ef7d
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@
package org.olat.course.nodes;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
......@@ -44,6 +45,7 @@ import org.olat.core.util.Util;
import org.olat.core.util.ValidationStatus;
import org.olat.core.util.nodes.INode;
import org.olat.course.ICourse;
import org.olat.course.assessment.handler.AssessmentConfig.Mode;
import org.olat.course.condition.Condition;
import org.olat.course.condition.interpreter.ConditionInterpreter;
import org.olat.course.editor.ConditionAccessEditConfig;
......@@ -51,10 +53,13 @@ import org.olat.course.editor.CourseEditorEnv;
import org.olat.course.editor.NodeEditController;
import org.olat.course.editor.StatusDescription;
import org.olat.course.export.CourseEnvironmentMapper;
import org.olat.course.learningpath.ui.TabbableLeaningPathNodeConfigController;
import org.olat.course.nodes.portfolio.PortfolioAssessmentConfig;
import org.olat.course.nodes.portfolio.PortfolioCourseNodeConfiguration;
import org.olat.course.nodes.portfolio.PortfolioCourseNodeConfiguration.DeadlineType;
import org.olat.course.nodes.portfolio.PortfolioCourseNodeEditController;
import org.olat.course.nodes.portfolio.PortfolioCourseNodeRunController;
import org.olat.course.nodes.portfolio.PortfolioLearningPathNodeHandler;
import org.olat.course.run.navigation.NodeRunConstructionResult;
import org.olat.course.run.userview.CourseNodeSecurityCallback;
import org.olat.course.run.userview.NodeEvaluation;
......@@ -88,6 +93,7 @@ public class PortfolioCourseNode extends AbstractAccessableCourseNode {
public static final String EDIT_CONDITION_ID = "editportfolio";
@SuppressWarnings("deprecation")
private static final String PACKAGE_EP = Util.getPackageName(PortfolioCourseNodeRunController.class);
public static final String TYPE = "ep";
......@@ -264,14 +270,57 @@ public class PortfolioCourseNode extends AbstractAccessableCourseNode {
}
return sd;
}
@Override
public StatusDescription[] isConfigValid(CourseEditorEnv cev) {
oneClickStatusCache = null;
List<StatusDescription> statusDescs = isConfigValidWithTranslator(cev, PACKAGE_EP, getConditionExpressions());
statusDescs.addAll(validateInternalConfiguration());
oneClickStatusCache = StatusDescriptionHelper.sort(statusDescs);
return oneClickStatusCache;
}
private boolean isFullyAssessedScoreConfigError() {
boolean hasScore = Mode.none != new PortfolioAssessmentConfig(getModuleConfiguration()).getScoreMode();
boolean isScoreTrigger = CoreSpringFactory.getImpl(PortfolioLearningPathNodeHandler.class)
.getConfigs(this)
.isFullyAssessedOnScore(null, null)
.isEnabled();
return isScoreTrigger && !hasScore;
}
private List<StatusDescription> validateInternalConfiguration() {
List<StatusDescription> sdList = new ArrayList<>(1);
if (isFullyAssessedScoreConfigError()) {
addStatusErrorDescription("error.fully.assessed.score", "error.fully.assessed.score",
TabbableLeaningPathNodeConfigController.PANE_TAB_LEARNING_PATH, sdList);
}
if (isFullyAssessedPassedConfigError()) {
addStatusErrorDescription("error.fully.assessed.passed", "error.fully.assessed.passed",
TabbableLeaningPathNodeConfigController.PANE_TAB_LEARNING_PATH, sdList);
}
return sdList;
}
private boolean isFullyAssessedPassedConfigError() {
boolean hasPassed = Mode.none != new PortfolioAssessmentConfig(getModuleConfiguration()).getPassedMode();
boolean isPassedTrigger = CoreSpringFactory.getImpl(PortfolioLearningPathNodeHandler.class)
.getConfigs(this)
.isFullyAssessedOnPassed(null, null)
.isEnabled();
return isPassedTrigger && !hasPassed;
}
private void addStatusErrorDescription(String shortDescKey, String longDescKey, String pane,
List<StatusDescription> status) {
String[] params = new String[] { getShortTitle() };
StatusDescription sd = new StatusDescription(StatusDescription.ERROR, shortDescKey, longDescKey, params,
PACKAGE_EP);
sd.setDescriptionForUnit(getIdent());
sd.setActivateableViewIdentifier(pane);
status.add(sd);
}
@Override
public void calcAccessAndVisibility(ConditionInterpreter ci, NodeEvaluation nodeEval) {
......
......@@ -154,7 +154,7 @@ public class PortfolioCourseNodeEditController extends ActivateableTabbableDefau
private void updateHighscoreTab() {
Boolean sf = courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD,false);
myTabbedPane.setEnabled(5, sf);
myTabbedPane.setEnabled(myTabbedPane.indexOfTab(highScoreNodeConfigController.getInitialComponent()), sf);
}
@Override
......
/**
* <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.portfolio;
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.PortfolioCourseNode;
import org.olat.repository.RepositoryEntry;
import org.springframework.stereotype.Service;
/**
*
* Initial date: 10 Mar 2020<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
@Service
public class PortfolioLearningPathNodeHandler implements LearningPathNodeHandler {
private static final LearningPathEditConfigs EDIT_CONFIGS = LearningPathEditConfigs.builder()
.enableNodeVisited()
.enableConfirmed()
.enableScore()
.enablePassed()
.enableStatusDone()
.build();
@Override
public String acceptCourseNodeType() {
return PortfolioCourseNode.TYPE;
}
@Override
public boolean isSupported() {
return true;
}
@Override
public LearningPathConfigs getConfigs(CourseNode courseNode) {
return new ModuleLearningPathConfigs(courseNode.getModuleConfiguration(), false);
}
@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) {
//
}
}
......@@ -5,6 +5,8 @@ deadline.day=Tag(e)
deadline.month=Monat(e)
deadline.week=Woche(n)
edit.map=Editieren
error.fully.assessed.passed=$org.olat.course.learningpath.ui:\error.fully.assessed.passed
error.fully.assessed.score=$org.olat.course.learningpath.ui:\error.fully.assessed.score
error.noreference.long=F\u00FCr "{0}" muss in der Konfiguration eine Portfoliovorlage im Tab "Lerninhalt" ausgew\u00E4hlt werden.
error.noreference.short=Es ist noch keine Portfoliovorlage f\u00FCr "{0}" ausgew\u00E4hlt.
pane.tab.highscore=HighScore
......
......@@ -20,6 +20,8 @@ deadline.month=Month(s)
deadline.week=Week(s)
edit.map=Edit
preview.map=Preview
error.fully.assessed.passed=$org.olat.course.learningpath.ui:\error.fully.assessed.passed
error.fully.assessed.score=$org.olat.course.learningpath.ui:\error.fully.assessed.score
error.noreference.long=For "{0}" you have to select a portfolio template in the tab "Learning content" in your configuration first.
error.noreference.short=No portfolio template selected for "{0}"
explanation.text=Message for users
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment