Skip to content
Snippets Groups Projects
Commit fb62e705 authored by gnaegi's avatar gnaegi
Browse files

OO-824 open LTI tool in new real window and not in iframe that is opened in new window

parent 4b56a772
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,6 @@ import java.util.Map;
import org.imsglobal.basiclti.BasicLTIUtil;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory;
import org.olat.core.dispatcher.mapper.Mapper;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
......@@ -40,12 +39,9 @@ import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.gui.control.creator.ControllerCreator;
import org.olat.core.gui.control.generic.popup.PopupBrowserWindow;
import org.olat.core.helpers.Settings;
import org.olat.core.id.Roles;
import org.olat.core.id.User;
......@@ -279,7 +275,12 @@ public class LTIRunController extends BasicController {
* @param ureq
*/
private void doRun(UserRequest ureq) {
run = createVelocityContainer("run");
if (newWindow) {
// Use other container for popup opening. Rest of code is the same
run = createVelocityContainer("runPopup");
} else {
run = createVelocityContainer("run");
}
// push title and learning objectives, only visible on intro page
run.contextPut("menuTitle", courseNode.getShortTitle());
run.contextPut("displayTitle", courseNode.getLongTitle());
......@@ -290,10 +291,6 @@ public class LTIRunController extends BasicController {
startPage.contextPut("displayTitle", courseNode.getLongTitle());
startButton = LinkFactory.createButton("start", startPage, this);
if(newWindow) {
startButton.setTarget("_help");
}
Boolean assessable = config.getBooleanEntry(BasicLTICourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
if(assessable != null && assessable.booleanValue()) {
......@@ -322,21 +319,9 @@ public class LTIRunController extends BasicController {
public void event(UserRequest ureq, Component source, Event event) {
if(source == startButton) {
courseNode.incrementUserAttempts(userCourseEnv);
if(newWindow) {
//wrap the content controller into a full header layout
ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, new ControllerCreator() {
@Override
public Controller createController(UserRequest lureq, WindowControl lwControl) {
return new LTIPopedController(lureq, lwControl);
}
});
//open in new browser window
PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
pbw.open(ureq);
} else {
doBasicLTI(ureq, run);
mainPanel.setContent(run);
}
// container is "run" or "runPopup" depending in configuration
doBasicLTI(ureq, run);
mainPanel.setContent(run);
} else if (source == acceptLink) {
storeDataExchangeAcceptance();
doRun(ureq);
......@@ -377,6 +362,7 @@ public class LTIRunController extends BasicController {
String debug = (String) config.get(LTIConfigForm.CONFIG_KEY_DEBUG);
String serverUri = Settings.createServerURI();
String sourcedId = courseEnv.getCourseResourceableId() + "_" + courseNode.getIdent() + "_" + getIdentity().getKey();
container.contextPut("sourcedId", sourcedId);
OLATResource courseResource = courseEnv.getCourseGroupManager().getCourseResource();
Mapper talkbackMapper = new TalkBackMapper();
......
<div class="b_iframe_wrapper">
<script type="text/javascript">
/* <![CDATA[ */
window.open("$mapperUri", "_win_$sourcedId", "location=yes#if($width!='auto'),width=${width}#end #if($height!='auto'),height=${height}#{end}");
/* ]]> */
</script>
</div>
<p>
$r.translate("popup.info")
</p>
<p>
<a href="$mapperUri" target="_win_$sourcedId">$r.translate("popup.link")</a>
</p>
......@@ -47,6 +47,8 @@ roles.lti.administrator=Administrator
roles.lti.teachingAssistant=Assistent Lehrperson
roles.lti.contentDeveloper=Inhaltersteller
roles.lti.mentor=Mentor
popup.info=Dieser Lerninhalt öffnet sich in einem separatem Fenster. Wählen Sie den untenstehenden Link wenn sich das Fenster nicht automatisch geöffnet hat.
popup.link=Erneut öffnen
preview=Vorschau
start=LTI-Lerninhalt anzeigen
score.title=$org.olat.course.nodes.scorm\:score.title
......
......@@ -75,6 +75,9 @@ roles.lti.mentor=Mentor\t\t
roles.lti.teachingAssistant=Teaching assistant
roles.title.lti=LTI roles
roles.title.oo=OpenOLAT roles
popup.info=This learning content is opened in a new window. Please click the link below if the new window does not open automatically.
Dieser Lerninhalt öffnet sich in einem separatem Fenster. Wählen Sie den untenstehenden Link wenn sich das Fenster nicht automatisch geöffnet hat.
popup.link=Open content again
scaleFactor=Scaling factor
score.noscoreinfoyet=No score information is available for this LTI modules as you never launched the module.
score.title=$org.olat.course.nodes.scorm\:score.title
......
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