Search in sources :

Example 6 with PostDataMapper

use of org.olat.ims.lti.ui.PostDataMapper in project openolat by klemens.

the class LTIRunController method doBasicLTI.

private void doBasicLTI(UserRequest ureq, VelocityContainer container) {
    String url = getUrl();
    container.contextPut("url", url == null ? "" : url);
    String oauth_consumer_key = (String) config.get(LTIConfigForm.CONFIGKEY_KEY);
    String oauth_secret = (String) config.get(LTIConfigForm.CONFIGKEY_PASS);
    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(getLocale(), getWindowControl().getWindowBackOffice().getWindow().getGuiTheme().getBaseURI());
    String backMapperUrl = registerCacheableMapper(ureq, sourcedId + "_talkback", talkbackMapper);
    String backMapperUri = serverUri + backMapperUrl + "/";
    Mapper outcomeMapper = new CourseNodeOutcomeMapper(getIdentity(), courseResource, courseNode.getIdent(), oauth_consumer_key, oauth_secret, sourcedId);
    String outcomeMapperUrl = registerCacheableMapper(ureq, sourcedId, outcomeMapper, LTIManager.EXPIRATION_TIME);
    String outcomeMapperUri = serverUri + outcomeMapperUrl + "/";
    boolean sendname = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDNAME, false);
    boolean sendmail = config.getBooleanSafe(LTIConfigForm.CONFIG_KEY_SENDEMAIL, false);
    String ltiRoles = getLTIRoles();
    String target = config.getStringValue(BasicLTICourseNode.CONFIG_DISPLAY);
    String width = config.getStringValue(BasicLTICourseNode.CONFIG_WIDTH);
    String height = config.getStringValue(BasicLTICourseNode.CONFIG_HEIGHT);
    String custom = (String) config.get(LTIConfigForm.CONFIG_KEY_CUSTOM);
    container.contextPut("height", height);
    container.contextPut("width", width);
    LTIContext context = new LTICourseNodeContext(courseEnv, courseNode, ltiRoles, sourcedId, backMapperUri, outcomeMapperUri, custom, target, width, height);
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, sendname, sendmail, true);
    Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, "true".equals(debug));
    String mapperUri = registerMapper(ureq, contentMapper);
    container.contextPut("mapperUri", mapperUri + "/");
}
Also used : TalkBackMapper(org.olat.ims.lti.ui.TalkBackMapper) Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) TalkBackMapper(org.olat.ims.lti.ui.TalkBackMapper) OLATResource(org.olat.resource.OLATResource) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper)

Aggregations

Mapper (org.olat.core.dispatcher.mapper.Mapper)6 LTIContext (org.olat.ims.lti.LTIContext)6 PostDataMapper (org.olat.ims.lti.ui.PostDataMapper)6 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 TalkBackMapper (org.olat.ims.lti.ui.TalkBackMapper)2 OLATResource (org.olat.resource.OLATResource)2