forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
074c5bd
commit 81c0ec3
Showing
7 changed files
with
28 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ def __init__(self, xblock, html_data): | |
self.xblock = xblock | ||
|
||
def _replace_mathjax_link(self): | ||
# FIXME: version shouldn't be hardcoded | ||
mathjax_pattern = re.compile(r'src="https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js[^"]*"') | ||
return mathjax_pattern.sub('src="/static/mathjax/MathJax.js"', self.html_data) | ||
|
||
|
@@ -34,6 +35,7 @@ def _replace_iframe(self, soup): | |
|
||
def _add_js_bridge(self, soup): | ||
script_tag = soup.new_tag('script') | ||
# FIXME: this script should be loaded from a file | ||
script_tag.string = """ | ||
// JS bridge script | ||
function sendMessageToiOS(message) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,15 @@ | |
|
||
User = get_user_model() | ||
|
||
OFFLINE_SUPPORTED_XBLOCKS = ['html', 'problem'] | ||
OFFLINE_SUPPORTED_XBLOCKS = ['html', 'problem'] # FIXME: move this to settings | ||
|
||
|
||
def is_offline_supported(xblock): | ||
return xblock.location.block_type in OFFLINE_SUPPORTED_XBLOCKS | ||
|
||
|
||
def is_modified(xblock): | ||
file_path = f'{base_storage_path(xblock)}content_html.zip' | ||
file_path = f'{base_storage_path(xblock)}content_html.zip' # FIXME: change filename, and change to os.path.join | ||
|
||
try: | ||
last_modified = default_storage.get_created_time(file_path) | ||
|
@@ -33,7 +33,7 @@ def is_modified(xblock): | |
|
||
|
||
def generate_request_with_service_user(): | ||
user = User.objects.get(email='[email protected]') | ||
user = User.objects.get(email='[email protected]') # FIXME: Change this to a valid user | ||
request = HttpRequest() | ||
request.user = user | ||
# Set up the session | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ def update_info_api(self, html_data=None): | |
self.remove_old_files(base_path) | ||
|
||
# Replace MathJax URL | ||
# FIXME: version shouldn't be hardcoded | ||
mathjax_pattern = re.compile(r'src="https://cdn.jsdelivr.net/npm/[email protected]/MathJax.js[^"]*"') | ||
data = mathjax_pattern.sub(self._replace_mathjax_link, html_data) | ||
|
||
|
@@ -72,6 +73,7 @@ def _replace_iframe(self, soup): | |
|
||
def _add_js_bridge(self, soup): | ||
script_tag = soup.new_tag('script') | ||
# FIXME: this script should be loaded from a file | ||
script_tag.string = """ | ||
// Function to send messages to iOS | ||
function sendMessageToiOS(message) { | ||
|
@@ -209,7 +211,7 @@ def student_view_data(self): | |
html_data = default_storage.url(file_path) | ||
|
||
if not html_data.startswith('http'): | ||
html_data = f'{settings.LMS_ROOT_URL}{html_data}' | ||
html_data = f'{settings.LMS_ROOT_URL}{html_data}' # FIXME: use os.path.join | ||
|
||
last_modified = default_storage.get_created_time(file_path) | ||
size = default_storage.size(file_path) | ||
|