Skip to content
Snippets Groups Projects
Commit 8b7cc2d9 authored by uhensler's avatar uhensler
Browse files

OO-2706: Use the correct toolbar in LTI course node preview

parent d7e6a4a7
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,7 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
@Override
public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel, ICourse course, UserCourseEnvironment euce) {
updateModuleConfigDefaults(false);
LTIEditController childTabCntrllr = new LTIEditController(getModuleConfiguration(), ureq, wControl, stackPanel, this, course, euce);
LTIEditController childTabCntrllr = new LTIEditController(getModuleConfiguration(), ureq, wControl, this, course, euce);
CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId());
return new NodeEditController(ureq, wControl, course.getEditorTreeModel(), course, chosenNode, euce, childTabCntrllr);
}
......@@ -267,7 +267,7 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
ModuleConfiguration config = getModuleConfiguration();
Float scaleFactor = (Float) config.get(CONFIG_KEY_SCALEVALUE);
if(scaleFactor == null || scaleFactor.floatValue() < 0.0000001f) {
return new Float(1.0f);
return 1.0f;
}
return 1.0f * scaleFactor.floatValue();//LTI 1.1 return between 0.0 - 1.0
}
......@@ -277,7 +277,7 @@ public class BasicLTICourseNode extends AbstractAccessableCourseNode implements
if (!hasScoreConfigured()) {
throw new OLATRuntimeException(MSCourseNode.class, "getMaxScore not defined when hasScore set to false", null);
}
return new Float(0.0f);
return 0.0f;
}
@Override
......
......@@ -25,12 +25,11 @@
package org.olat.course.nodes.basiclti;
import org.olat.core.commons.fullWebApp.LayoutMain3ColsController;
import org.olat.core.commons.fullWebApp.LayoutMain3ColsPreviewController;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.stack.BreadcrumbPanel;
import org.olat.core.gui.components.tabbedpane.TabbedPane;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
......@@ -77,10 +76,8 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
private BasicLTICourseNode courseNode;
private ConditionEditController accessibilityCondContr;
private TabbedPane myTabbedPane;
private Controller previewLayoutCtr;
private Link previewButton;
private Controller previewLtiCtr;
private final BreadcrumbPanel stackPanel;
private LayoutMain3ColsPreviewController previewLayoutCtr;
/**
* Constructor for tunneling editor controller
......@@ -91,13 +88,12 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
* @param course
*/
public LTIEditController(ModuleConfiguration config, UserRequest ureq, WindowControl wControl,
BreadcrumbPanel stackPanel, BasicLTICourseNode ltCourseNode, ICourse course, UserCourseEnvironment euce) {
BasicLTICourseNode ltCourseNode, ICourse course, UserCourseEnvironment euce) {
super(ureq, wControl);
this.config = config;
this.courseNode = ltCourseNode;
this.editCourseEnv = course.getCourseEnvironment();
this.stackPanel = stackPanel;
myContent = createVelocityContainer("edit");
previewButton = LinkFactory.createButtonSmall("command.preview", myContent, this);
......@@ -124,28 +120,24 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
}
/**config.set
/**
* @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)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == previewButton) { // those must be links
removeAsListenerAndDispose(previewLtiCtr);
previewLtiCtr = new LTIRunController(getWindowControl(), config, ureq, courseNode, editCourseEnv);
listenTo(previewLtiCtr);
// preview layout: only center column (col3) used
removeAsListenerAndDispose(previewLayoutCtr);
previewLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), previewLtiCtr);
if (source == previewButton) {
Controller runCtr = new LTIRunController(getWindowControl(), config, ureq, courseNode, editCourseEnv);
previewLayoutCtr = new LayoutMain3ColsPreviewController(ureq, getWindowControl(), null, runCtr.getInitialComponent(), null);
previewLayoutCtr.addDisposableChildController(runCtr);
previewLayoutCtr.activate();
listenTo(previewLayoutCtr);
this.stackPanel.pushController(translate("preview"), previewLayoutCtr);
}
}
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == accessibilityCondContr) {
if (event == Event.CHANGED_EVENT) {
......@@ -167,6 +159,8 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
if (event == Event.DONE_EVENT) {
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == previewLayoutCtr) {
removeAsListenerAndDispose(previewLayoutCtr);
}
}
......@@ -174,9 +168,11 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
Boolean sf = courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD,false);
myTabbedPane.setEnabled(4, sf);
}
/**
* @see org.olat.core.gui.control.generic.tabbable.TabbableDefaultController#addTabs(org.olat.core.gui.components.TabbedPane)
*/
@Override
public void addTabs(TabbedPane tabbedPane) {
myTabbedPane = tabbedPane;
tabbedPane.addTab(translate(PANE_TAB_ACCESSIBILITY), accessibilityCondContr.getWrappedDefaultAccessConditionVC(translate("condition.accessibility.title")));
......@@ -189,15 +185,17 @@ public class LTIEditController extends ActivateableTabbableDefaultController imp
*
* @see org.olat.core.gui.control.DefaultController#doDispose(boolean)
*/
@Override
protected void doDispose() {
//
//
}
@Override
public String[] getPaneKeys() {
return paneKeys;
}
@Override
public TabbedPane getTabbedPane() {
return myTabbedPane;
}
......
......@@ -83,14 +83,16 @@ public class LTIRunController extends BasicController {
private Link startButton;
private final StackedPanel mainPanel;
private VelocityContainer run, startPage, acceptPage;
private VelocityContainer run;
private VelocityContainer startPage;
private BasicLTICourseNode courseNode;
private ModuleConfiguration config;
private final CourseEnvironment courseEnv;
private UserCourseEnvironment userCourseEnv;
private SortedProperties userData = new SortedProperties();
private SortedProperties customUserData = new SortedProperties();
private Link acceptLink, back;
private Link acceptLink;
private Link back;
private boolean fullScreen;
private ChiefController thebaseChief;
......@@ -171,27 +173,27 @@ public class LTIRunController extends BasicController {
* not yet accepted or for other values
*/
private boolean checkHasDataExchangeAccepted(String hash) {
//
boolean dataAccepted = false;
CoursePropertyManager propMgr = this.userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
Property prop = propMgr.findCourseNodeProperty(this.courseNode, getIdentity(), null, PROP_NAME_DATA_EXCHANGE_ACCEPTED);
if (prop != null) {
// compare if value in property is the same as calculated today. If not, user as to accept again
String storedHash = prop.getStringValue();
if (storedHash != null && hash != null && storedHash.equals(hash)) {
return true;
dataAccepted = true;
} else {
// remove property, not valid anymore
propMgr.deleteProperty(prop);
}
}
return false;
return dataAccepted;
}
/**
* Helper to initialize the ask-for-data-exchange screen
*/
private void doAskDataExchange() {
acceptPage = createVelocityContainer("accept");
VelocityContainer acceptPage = createVelocityContainer("accept");
acceptPage.contextPut("userData", userData);
acceptPage.contextPut("customUserData", customUserData);
acceptLink = LinkFactory.createButton("accept", acceptPage, this);
......
......@@ -43,7 +43,7 @@ participant.roles=Teilnehmer
coach.roles=Betreuer
author.roles=Besitzer
roles.lti.learner=Lerner
roles.lti.instructor=Instruktur
roles.lti.instructor=Instruktor
roles.lti.administrator=Administrator
roles.lti.teachingAssistant=Assistent Lehrperson
roles.lti.contentDeveloper=Inhaltersteller
......
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