-
{{title}}
-
-
+ {% if cmi5_xblock.has_score %}
+
({{ cmi5_xblock.lesson_score}}/{{ cmi5_xblock.weight | floatformat:1 }} {% trans "points" %})
+ {% endif %}
{% if index_page_url %}
-
{% trans "Available Assignables:" %}
+
+
{% for au_url in au_urls %}
-
-
- {% trans "AU No." %} {{ forloop.counter }}
-
- ({%trans "Launch: "%} {{au_url.launch_method}})
+ {{au_url.title}}
-
{% endfor %}
-
-
+
+ {% if cmi5_xblock.au_has_any_window %}
+
+ {% endif %}
{% elif message %}
{{ message }}
{% endif %}
diff --git a/openedx_cmi5_xblock/static/html/studio.html b/openedx_cmi5_xblock/static/html/studio.html
index 90ac2da..e3f0471 100644
--- a/openedx_cmi5_xblock/static/html/studio.html
+++ b/openedx_cmi5_xblock/static/html/studio.html
@@ -107,4 +107,3 @@
-v
diff --git a/openedx_cmi5_xblock/static/js/src/openedx_cmi5_xblock.js b/openedx_cmi5_xblock/static/js/src/openedx_cmi5_xblock.js
index 22c3c66..92275bb 100644
--- a/openedx_cmi5_xblock/static/js/src/openedx_cmi5_xblock.js
+++ b/openedx_cmi5_xblock/static/js/src/openedx_cmi5_xblock.js
@@ -13,15 +13,18 @@ function CMI5XBlock(runtime, element) {
$('ol a').click(function(event) {
event.preventDefault();
var href = $(this).attr('href');
- var liText = $(this).closest('li').text().trim();
- updateIframeSrc(href, liText);
+ var launchMethod = $(this).data("launch-method");
+ updateIframeSrc(href, launchMethod);
});
- function updateIframeSrc(href, liText) {
- if (liText.includes('AnyWindow')) {
+ function updateIframeSrc(href, launchMethod) {
+ // TODO: Uncomment the code below when we have figured out a workaround of limitations imposed by
+ // browsers while loading iframe from different domain than host
+ launchMethod = 'OwnWindow';
+ if (launchMethod === 'AnyWindow') {
$('.cmi5-embedded').attr('src', href);
- } else if (liText.includes('OwnWindow')) {
+ } else {
window.open(href, '_blank');
}
}
diff --git a/openedx_cmi5_xblock/utils/utility.py b/openedx_cmi5_xblock/utils/utility.py
index f0fdf2f..003a20d 100644
--- a/openedx_cmi5_xblock/utils/utility.py
+++ b/openedx_cmi5_xblock/utils/utility.py
@@ -4,6 +4,7 @@
import logging
import requests
+from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from requests.auth import HTTPBasicAuth
from webob import Response
@@ -21,8 +22,8 @@ def is_url(path):
try:
validator = URLValidator()
validator(path)
- except Exception as err:
- logger.error("Invalid URL (%s): %s", path, err)
+ except ValidationError as err:
+ logger.debug("Invalid URL (%s): %s", path, err)
return False
return True