use of org.olat.modules.scorm.ScormAPIandDisplayController in project OpenOLAT by OpenOLAT.
the class VarForm method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == chooseCPButton || source == changeCPButton) {
// those must be links
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue
// only if the config is valid
RepositoryEntry re = getScormCPReference(config, false);
if (re == null) {
// we cannot preview it, because the repository entry
// had been deleted between the time when it was
// chosen here, and now
showError("error.cprepoentrymissing");
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
// configure some display options
boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
previewController.showNavButtons(showNavButtons);
DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewController.setDeliveryOptions(deliveryOptions);
previewController.activate();
}
}
}
use of org.olat.modules.scorm.ScormAPIandDisplayController in project openolat by klemens.
the class VarForm method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == chooseCPButton || source == changeCPButton) {
// those must be links
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ScormCPFileResource.TYPE_NAME, translate("command.choosecp"));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate("command.importcp"));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue
// only if the config is valid
RepositoryEntry re = getScormCPReference(config, false);
if (re == null) {
// we cannot preview it, because the repository entry
// had been deleted between the time when it was
// chosen here, and now
showError("error.cprepoentrymissing");
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
boolean showMenu = config.getBooleanSafe(CONFIG_SHOWMENU, true);
boolean fullWindow = config.getBooleanSafe(CONFIG_FULLWINDOW, true);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapScormRepositoryEntry(re));
ScormAPIandDisplayController previewController = ScormMainManager.getInstance().createScormAPIandDisplayController(ureq, getWindowControl(), showMenu, null, cpRoot, null, course.getResourceableId().toString(), ScormConstants.SCORM_MODE_BROWSE, ScormConstants.SCORM_MODE_NOCREDIT, true, null, true, fullWindow, false, null);
// configure some display options
boolean showNavButtons = config.getBooleanSafe(ScormEditController.CONFIG_SHOWNAVBUTTONS, true);
previewController.showNavButtons(showNavButtons);
DeliveryOptions deliveryOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewController.setDeliveryOptions(deliveryOptions);
previewController.activate();
}
}
}
Aggregations