Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-officemix
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
OpenEdx
xblock-officemix
Commits
bb2b7ef2
Commit
bb2b7ef2
authored
Nov 26, 2014
by
Kurt Berglund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL escape parameters we send to HTML templates.
parent
8733e3fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
officemix/officemix.py
+5
-4
No files found.
officemix/officemix.py
View file @
bb2b7ef2
...
@@ -8,6 +8,7 @@ inserts it within the XBlock.
...
@@ -8,6 +8,7 @@ inserts it within the XBlock.
"""
"""
import
cgi
import
decimal
import
decimal
import
pkg_resources
import
pkg_resources
import
requests
import
requests
...
@@ -50,7 +51,7 @@ class OfficeMixXBlock(XBlock):
...
@@ -50,7 +51,7 @@ class OfficeMixXBlock(XBlock):
display_name
=
self
.
display_name
or
''
display_name
=
self
.
display_name
or
''
html_str
=
self
.
resource_string
(
"static/html/officemix_edit.html"
)
html_str
=
self
.
resource_string
(
"static/html/officemix_edit.html"
)
frag
=
Fragment
(
html_str
.
format
(
href
=
href
,
display_name
=
display_name
))
frag
=
Fragment
(
html_str
.
format
(
href
=
cgi
.
escape
(
href
),
display_name
=
cgi
.
escape
(
display_name
)
))
js_str
=
self
.
resource_string
(
"/static/js/officemix_edit.js"
)
js_str
=
self
.
resource_string
(
"/static/js/officemix_edit.js"
)
frag
.
add_javascript
(
js_str
)
frag
.
add_javascript
(
js_str
)
...
@@ -78,7 +79,7 @@ class OfficeMixXBlock(XBlock):
...
@@ -78,7 +79,7 @@ class OfficeMixXBlock(XBlock):
html_str
=
self
.
resource_string
(
"static/html/officemix.html"
)
html_str
=
self
.
resource_string
(
"static/html/officemix.html"
)
except
Exception
as
ex
:
except
Exception
as
ex
:
html_str
=
self
.
resource_string
(
"static/html/embed_error.html"
)
html_str
=
self
.
resource_string
(
"static/html/embed_error.html"
)
frag
=
Fragment
(
html_str
.
format
(
self
=
self
,
exception
=
ex
))
frag
=
Fragment
(
html_str
.
format
(
self
=
self
,
exception
=
cgi
.
escape
(
str
(
ex
))
))
return
frag
return
frag
# Grab and round the aspect ratio
# Grab and round the aspect ratio
...
@@ -88,11 +89,11 @@ class OfficeMixXBlock(XBlock):
...
@@ -88,11 +89,11 @@ class OfficeMixXBlock(XBlock):
frag
=
Fragment
(
html_str
.
format
(
frag
=
Fragment
(
html_str
.
format
(
self
=
self
,
self
=
self
,
embed_code
=
embed_code
,
embed_code
=
embed_code
,
display_name
=
display_name
))
display_name
=
cgi
.
escape
(
display_name
)
))
# And construct the CSS
# And construct the CSS
css_str
=
self
.
resource_string
(
"static/css/officemix.css"
)
css_str
=
self
.
resource_string
(
"static/css/officemix.css"
)
css_str
=
string
.
replace
(
unicode
(
css_str
),
"{aspect_ratio}"
,
unicode
(
round
(
ratio
,
2
)))
css_str
=
string
.
replace
(
unicode
(
css_str
),
"{aspect_ratio}"
,
cgi
.
escape
(
unicode
(
round
(
ratio
,
2
)
)))
frag
.
add_css
(
css_str
)
frag
.
add_css
(
css_str
)
return
frag
return
frag
...
...
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