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 + "/");
}
Aggregations