Search in sources :

Example 1 with PostDataMapper

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

the class EdubaseViewerController method createMapperUri.

private String createMapperUri(UserRequest ureq) {
    String launchUrl = edubaseManager.getLtiLaunchUrl(bookSection);
    String baseUrl = edubaseModule.getLtiBaseUrl();
    String oauthConsumerKey = edubaseModule.getOauthKey();
    String oauthSecret = edubaseModule.getOauthSecret();
    LTIContext context = new EdubaseContext(ureq.getUserSession().getIdentityEnvironment(), bookSection.getPageTo());
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, launchUrl, baseUrl, oauthConsumerKey, oauthSecret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    mapperUri = mapperUri + "/";
    return mapperUri;
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper)

Example 2 with PostDataMapper

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

the class Card2BrainRunController method runCard2Brain.

private void runCard2Brain(UserRequest ureq) {
    VelocityContainer container = createVelocityContainer("run");
    String url = String.format(card2BrainModule.getBaseUrl(), config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
    String oauth_consumer_key;
    String oauth_secret;
    if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
        oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
        oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
    } else {
        oauth_consumer_key = card2BrainModule.getEnterpriseKey();
        oauth_secret = card2BrainModule.getEnterpriseSecret();
    }
    LTIContext context = new Card2BrainContext();
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    container.contextPut("mapperUri", mapperUri + "/");
    JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
    container.put("js", js);
    main.setContent(container);
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 3 with PostDataMapper

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

the class Card2BrainRunController method runCard2Brain.

private void runCard2Brain(UserRequest ureq) {
    VelocityContainer container = createVelocityContainer("run");
    String url = String.format(card2BrainModule.getBaseUrl(), config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
    String oauth_consumer_key;
    String oauth_secret;
    if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
        oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
        oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
    } else {
        oauth_consumer_key = card2BrainModule.getEnterpriseKey();
        oauth_secret = card2BrainModule.getEnterpriseSecret();
    }
    LTIContext context = new Card2BrainContext();
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    container.contextPut("mapperUri", mapperUri + "/");
    JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
    container.put("js", js);
    main.setContent(container);
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 4 with PostDataMapper

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

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)

Example 5 with PostDataMapper

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

the class EdubaseViewerController method createMapperUri.

private String createMapperUri(UserRequest ureq) {
    String launchUrl = edubaseManager.getLtiLaunchUrl(bookSection);
    String baseUrl = edubaseModule.getLtiBaseUrl();
    String oauthConsumerKey = edubaseModule.getOauthKey();
    String oauthSecret = edubaseModule.getOauthSecret();
    LTIContext context = new EdubaseContext(ureq.getUserSession().getIdentityEnvironment(), bookSection.getPageTo());
    Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
    Mapper contentMapper = new PostDataMapper(unsignedProps, launchUrl, baseUrl, oauthConsumerKey, oauthSecret, false);
    String mapperUri = registerMapper(ureq, contentMapper);
    mapperUri = mapperUri + "/";
    return mapperUri;
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) 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