Commit 68409f0c by Alexander Kryklia

Add default launch url for lti.

parent 871ad7d6
...@@ -16,9 +16,9 @@ window.LTI = (function () { ...@@ -16,9 +16,9 @@ window.LTI = (function () {
// If the Form's action attribute is set (i.e. we can perform a normal // If the Form's action attribute is set (i.e. we can perform a normal
// submit), then we submit the form and make the frame shown. // submit), then we submit the form and make the frame shown.
if (form.attr('action')) { if (form.attr('action') && form.attr('action') !== 'http://www.example.com') {
form.submit(); form.submit();
element.find('.lti').addClass('rendered') element.find('.lti').addClass('rendered');
} }
} }
......
...@@ -38,9 +38,12 @@ class LTIFields(object): ...@@ -38,9 +38,12 @@ class LTIFields(object):
vbid=put_book_id_here vbid=put_book_id_here
book_location=page/put_page_number_here book_location=page/put_page_number_here
Default non-empty url for `launch_url` is needed due to oauthlib demand (url scheme should be presented)::
https://github.com/idan/oauthlib/blob/master/oauthlib/oauth1/rfc5849/signature.py#L136
""" """
lti_id = String(help="Id of the tool", default='', scope=Scope.settings) lti_id = String(help="Id of the tool", default='', scope=Scope.settings)
launch_url = String(help="URL of the tool", default='', scope=Scope.settings) launch_url = String(help="URL of the tool", default='http://www.example.com', scope=Scope.settings)
custom_parameters = List(help="Custom parameters (vbid, book_location, etc..)", scope=Scope.settings) custom_parameters = List(help="Custom parameters (vbid, book_location, etc..)", scope=Scope.settings)
...@@ -213,7 +216,6 @@ class LTIModule(LTIFields, XModule): ...@@ -213,7 +216,6 @@ class LTIModule(LTIFields, XModule):
body.update(custom_parameters) body.update(custom_parameters)
headers = { headers = {
'Host': self.system.HOSTNAME,
# This is needed for body encoding: # This is needed for body encoding:
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} }
......
...@@ -75,6 +75,6 @@ class TestLTI(BaseTestXmodule): ...@@ -75,6 +75,6 @@ class TestLTI(BaseTestXmodule):
'input_fields': self.correct_headers, 'input_fields': self.correct_headers,
'element_class': self.item_module.location.category, 'element_class': self.item_module.location.category,
'element_id': self.item_module.location.html_id(), 'element_id': self.item_module.location.html_id(),
'launch_url': '', # default value 'launch_url': 'http://www.example.com', # default value
} }
self.assertDictEqual(generated_context, expected_context) self.assertDictEqual(generated_context, expected_context)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment