Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2e87b1a6
Commit
2e87b1a6
authored
Dec 09, 2013
by
polesye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BLD-543: Fix bug with reordering in Studio.
parent
d5bff2e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
41 deletions
+74
-41
common/lib/xmodule/xmodule/css/lti/lti.scss
+0
-1
common/lib/xmodule/xmodule/lti_module.py
+33
-12
lms/templates/lti.html
+2
-28
lms/templates/lti_form.html
+39
-0
No files found.
common/lib/xmodule/xmodule/css/lti/lti.scss
View file @
2e87b1a6
...
@@ -30,6 +30,5 @@ div.lti {
...
@@ -30,6 +30,5 @@ div.lti {
height
:
800px
;
height
:
800px
;
display
:
block
;
display
:
block
;
border
:
0px
;
border
:
0px
;
overflow-x
:
hidden
;
}
}
}
}
common/lib/xmodule/xmodule/lti_module.py
View file @
2e87b1a6
...
@@ -180,12 +180,6 @@ class LTIModule(LTIFields, XModule):
...
@@ -180,12 +180,6 @@ class LTIModule(LTIFields, XModule):
Otherwise error message from LTI provider is generated.
Otherwise error message from LTI provider is generated.
"""
"""
js
=
{
'js'
:
[
resource_string
(
__name__
,
'js/src/lti/01_lti.js'
),
resource_string
(
__name__
,
'js/src/lti/02_main.js'
)
]
}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/lti/lti.scss'
)]}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/lti/lti.scss'
)]}
js_module_name
=
"LTI"
js_module_name
=
"LTI"
...
@@ -253,12 +247,11 @@ class LTIModule(LTIFields, XModule):
...
@@ -253,12 +247,11 @@ class LTIModule(LTIFields, XModule):
client_secret
,
client_secret
,
)
)
def
get_
html
(
self
):
def
get_
context
(
self
):
"""
"""
Re
nders parameters to template
.
Re
turns a context
.
"""
"""
return
{
context
=
{
'input_fields'
:
self
.
get_input_fields
(),
'input_fields'
:
self
.
get_input_fields
(),
# These parameters do not participate in OAuth signing.
# These parameters do not participate in OAuth signing.
...
@@ -267,10 +260,37 @@ class LTIModule(LTIFields, XModule):
...
@@ -267,10 +260,37 @@ class LTIModule(LTIFields, XModule):
'element_class'
:
self
.
category
,
'element_class'
:
self
.
category
,
'open_in_a_new_page'
:
self
.
open_in_a_new_page
,
'open_in_a_new_page'
:
self
.
open_in_a_new_page
,
'display_name'
:
self
.
display_name
,
'display_name'
:
self
.
display_name
,
'
ajax_url'
:
self
.
system
.
ajax_url
,
'
form_url'
:
self
.
get_form_path
()
,
}
}
return
self
.
system
.
render_template
(
'lti.html'
,
context
)
def
get_form_path
(
self
):
return
self
.
runtime
.
handler_url
(
self
,
'preview_handler'
)
.
rstrip
(
'/?'
)
def
get_html
(
self
):
"""
Renders parameters to template.
"""
return
self
.
system
.
render_template
(
'lti.html'
,
self
.
get_context
())
def
get_form
(
self
):
"""
Renders parameters to form template.
"""
return
self
.
system
.
render_template
(
'lti_form.html'
,
self
.
get_context
())
@XBlock.handler
def
preview_handler
(
self
,
request
,
dispatch
):
"""
Ajax handler.
Args:
dispatch: string request slug
Returns:
json string
"""
return
Response
(
self
.
get_form
(),
content_type
=
'text/html'
)
def
handle_ajax
(
self
,
dispatch
,
__
):
def
handle_ajax
(
self
,
dispatch
,
__
):
"""
"""
...
@@ -614,3 +634,4 @@ class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescri
...
@@ -614,3 +634,4 @@ class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescri
"""
"""
module_class
=
LTIModule
module_class
=
LTIModule
grade_handler
=
module_attr
(
'grade_handler'
)
grade_handler
=
module_attr
(
'grade_handler'
)
preview_handler
=
module_attr
(
'preview_handler'
)
lms/templates/lti.html
View file @
2e87b1a6
...
@@ -4,40 +4,15 @@
...
@@ -4,40 +4,15 @@
<div
<div
id=
"${element_id}"
id=
"${element_id}"
class=
"${element_class}"
class=
"${element_class}"
data-open_in_a_new_page=
"${json.dumps(open_in_a_new_page)}"
data-ajax_url=
"${ajax_url}"
>
>
## This form will be hidden.
## If open_in_a_new_page is false then, once available on the client, the
## LTI module JavaScript will trigger a "submit" on the form, and the
## result will be rendered to the below iFrame.
## If open_in_a_new_page is true, then link will be shown, and by clicking
## on it, LTI will pop up in new window.
<form
action=
"${launch_url}"
name=
"ltiLaunchForm-${element_id}"
class=
"ltiLaunchForm"
method=
"post"
target=
${"_blank"
if
open_in_a_new_page
else
"
ltiLaunchFrame-
{
0
}".
format
(
element_id
)}
encType=
"application/x-www-form-urlencoded"
>
% for param_name, param_value in input_fields.items():
<input
name=
"${param_name}"
value=
"${param_value}"
/>
%endfor
<input
type=
"submit"
value=
"Press to Launch"
/>
</form>
% if launch_url and launch_url != 'http://www.example.com':
% if launch_url and launch_url != 'http://www.example.com':
% if open_in_a_new_page:
% if open_in_a_new_page:
<div
class=
"wrapper-lti-link"
>
<div
class=
"wrapper-lti-link"
>
<h3
class=
"title"
>
<h3
class=
"title"
>
${display_name} (${_('External resource')})
${display_name} (${_('External resource')})
</h3>
</h3>
<p
class=
"lti-link external"
><a
href=
"#"
class=
'link_lti_new_window
'
>
<p
class=
"lti-link external"
><a
target=
"_blank"
class=
'link_lti_new_window'
href=
"${form_url}"
class=
'
'
>
${_('View resource in a new window')}
${_('View resource in a new window')}
<i
class=
"icon-external-link"
></i>
<i
class=
"icon-external-link"
></i>
</a></p>
</a></p>
...
@@ -45,9 +20,8 @@
...
@@ -45,9 +20,8 @@
% else:
% else:
## The result of the form submit will be rendered here.
## The result of the form submit will be rendered here.
<iframe
<iframe
name=
"ltiLaunchFrame-${element_id}"
class=
"ltiLaunchFrame"
class=
"ltiLaunchFrame"
src=
""
src=
"
${form_url}
"
></iframe>
></iframe>
% endif
% endif
% else:
% else:
...
...
lms/templates/lti_form.html
0 → 100644
View file @
2e87b1a6
<
%!
import
json
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<!DOCTYPE HTML>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
LTI
</title>
</head>
<body>
## This form will be hidden.
## If open_in_a_new_page is false then, once available on the client, the
## LTI module JavaScript will trigger a "submit" on the form, and the
## result will be rendered to the below iFrame.
## If open_in_a_new_page is true, then link will be shown, and by clicking
## on it, LTI will pop up in new window.
<form
id=
"lti-${element_id}"
action=
"${launch_url}"
method=
"post"
encType=
"application/x-www-form-urlencoded"
style=
"display:none;"
>
% for param_name, param_value in input_fields.items():
<input
name=
"${param_name}"
value=
"${param_value}"
/>
%endfor
<input
type=
"submit"
value=
"Press to Launch"
/>
</form>
<script
type=
"text/javascript"
>
(
function
(
d
)
{
var
element
=
d
.
getElementById
(
"lti-${element_id}"
);
if
(
element
)
{
element
.
submit
();
}
}(
document
));
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment