Skip to content
Snippets Groups Projects
Commit 289ed4ed authored by srosse's avatar srosse
Browse files

OO-1914: if the SCORM resource in a course element is missing, show a message...

OO-1914: if the SCORM resource in a course element is missing, show a message instead of a red screen.
parent e1e0a86a
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,8 @@ import org.olat.core.gui.control.Event; ...@@ -41,6 +41,8 @@ import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.generic.iframe.DeliveryOptions; import org.olat.core.gui.control.generic.iframe.DeliveryOptions;
import org.olat.core.gui.control.generic.messages.MessageController;
import org.olat.core.gui.control.generic.messages.MessageUIFactory;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
...@@ -208,7 +210,9 @@ public class ScormRunController extends BasicController implements ScormAPICallb ...@@ -208,7 +210,9 @@ public class ScormRunController extends BasicController implements ScormAPICallb
} }
} else if (source == chooseScormRunMode) { } else if (source == chooseScormRunMode) {
doLaunch(ureq, true); doLaunch(ureq, true);
scormDispC.activate(); if(scormDispC != null) {
scormDispC.activate();
}
} }
} }
...@@ -244,6 +248,13 @@ public class ScormRunController extends BasicController implements ScormAPICallb ...@@ -244,6 +248,13 @@ public class ScormRunController extends BasicController implements ScormAPICallb
startPage.contextPut("isassessable", Boolean.valueOf(isAssessable)); startPage.contextPut("isassessable", Boolean.valueOf(isAssessable));
main.setContent(startPage); main.setContent(startPage);
} }
private void doSetMissingResourcesWarning(UserRequest ureq) {
String text = translate("error.cprepoentrymissing.user");
MessageController missingCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, text);
listenTo(missingCtrl);
main.setContent(missingCtrl.getInitialComponent());
}
private void doLaunch(UserRequest ureq, boolean doActivate) { private void doLaunch(UserRequest ureq, boolean doActivate) {
ureq.getUserSession().getSingleUserEventCenter() ureq.getUserSession().getSingleUserEventCenter()
...@@ -254,16 +265,21 @@ public class ScormRunController extends BasicController implements ScormAPICallb ...@@ -254,16 +265,21 @@ public class ScormRunController extends BasicController implements ScormAPICallb
// instance // instance
// of this controller. // of this controller.
// need to be strict when launching -> "true" // need to be strict when launching -> "true"
RepositoryEntry re = ScormEditController.getScormCPReference(config, true); RepositoryEntry re = ScormEditController.getScormCPReference(config, false);
if (re == null) if (re == null) {
throw new AssertException("configurationkey 'CONFIG_KEY_REPOSITORY_SOFTKEY' of BB CP was missing"); doSetMissingResourcesWarning(ureq);
return;
}
cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource()); cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
addLoggingResourceable(LoggingResourceable.wrapScormRepositoryEntry(re)); addLoggingResourceable(LoggingResourceable.wrapScormRepositoryEntry(re));
// should always exist because references cannot be deleted as long // should always exist because references cannot be deleted as long
// as // as
// nodes reference them // nodes reference them
if (cpRoot == null) if (cpRoot == null) {
throw new AssertException("file of repository entry " + re.getKey() + " was missing"); doSetMissingResourcesWarning(ureq);
logError("File of repository entry " + re.getKey() + " was missing", null);
return;
}
} }
// else cpRoot is already set (save some db access if the user opens / // else cpRoot is already set (save some db access if the user opens /
// closes / reopens the cp from the same CPRuncontroller instance) // closes / reopens the cp from the same CPRuncontroller instance)
......
...@@ -36,7 +36,8 @@ command.showscorm=Lernmodul starten ...@@ -36,7 +36,8 @@ command.showscorm=Lernmodul starten
condition.accessibility.title=Zugang condition.accessibility.title=Zugang
cutvalue.label=Notwendige Punktzahl f\u00FCr 'bestanden' cutvalue.label=Notwendige Punktzahl f\u00FCr 'bestanden'
cutvalue.validation=Geben Sie eine Ganzzahl ein cutvalue.validation=Geben Sie eine Ganzzahl ein
error.cprepoentrymissing=Der SCORM-Lerninhalt, den Sie anzeigen m\u00F6chten, wurde in der Zwischenzeit in der Ablage der Lernressourcen gel\u00F6scht error.cprepoentrymissing=Der SCORM-Lerninhalt, den Sie anzeigen m\u00F6chten, wurde in der Zwischenzeit in der Ablage der Lernressourcen gel\u00F6scht
error.cprepoentrymissing.user=Der SCORM-Lerninhalt den Sie anzeigen m\u00F6chten existiert nicht mehr. Bitte kontaktieren Sie ihren Kursbetreuer.
error.launch=SCORM-Lerninhalt konnte nicht gestartet werden. error.launch=SCORM-Lerninhalt konnte nicht gestartet werden.
error.noreference.long=F\u00FCr "{0}" muss in der Konfiguration ein SCORM-Lerninhalt im Tab "Lerninhalt" ausgew\u00E4hlt werden. error.noreference.long=F\u00FCr "{0}" muss in der Konfiguration ein SCORM-Lerninhalt im Tab "Lerninhalt" ausgew\u00E4hlt werden.
error.noreference.short=Es ist noch kein SCORM-Lerninhalt f\u00FCr "{0}" ausgew\u00E4hlt. error.noreference.short=Es ist noch kein SCORM-Lerninhalt f\u00FCr "{0}" ausgew\u00E4hlt.
......
...@@ -43,6 +43,7 @@ condition.accessibility.title=Access ...@@ -43,6 +43,7 @@ condition.accessibility.title=Access
cutvalue.label=Score needed to pass cutvalue.label=Score needed to pass
cutvalue.validation=Please enter an integer cutvalue.validation=Please enter an integer
error.cprepoentrymissing=This SCORM learning content was deleted in the meantime within the storage folder of learning resources. error.cprepoentrymissing=This SCORM learning content was deleted in the meantime within the storage folder of learning resources.
error.cprepoentrymissing.user=The SCORM learning content you were trying to access doesn't exist anymore. Please contact your course coach.
error.launch=Unable to start SCORM learning content. error.launch=Unable to start SCORM learning content.
error.noreference.long=For "{0}" you have to select a SCORM learning content in the tab "Learning content" within the configuration section. error.noreference.long=For "{0}" you have to select a SCORM learning content in the tab "Learning content" within the configuration section.
error.noreference.short=No SCORM learning content selected for "{0}" yet. error.noreference.short=No SCORM learning content selected for "{0}" yet.
......
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