use of org.olat.ims.lti.LTIContext 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;
}
use of org.olat.ims.lti.LTIContext 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);
}
use of org.olat.ims.lti.LTIContext 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);
}
use of org.olat.ims.lti.LTIContext 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 + "/");
}
use of org.olat.ims.lti.LTIContext 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;
}
Aggregations