MDL-46397 mod_scorm : binding cmi values with scoid

This commit is contained in:
Nobelium 2014-07-28 05:37:21 +00:00
parent ec36fafc0f
commit bf4f65fbb6
9 changed files with 497 additions and 401 deletions

View file

@ -27,6 +27,8 @@ mod_scorm_activate_item = null;
mod_scorm_parse_toc_tree = null;
scorm_layout_widget = null;
window.scorm_current_node = null;
function underscore(str) {
str = String(str).replace(/.N/g,".");
return str.replace(/\./g,"__");
@ -48,7 +50,6 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
}
scoes_nav = Y.JSON.parse(scoes_nav);
var scorm_current_node;
var scorm_buttons = [];
var scorm_bloody_labelclick = false;
var scorm_nav_panel;
@ -124,15 +125,23 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
return;
}
// Check if the item is already active, avoid recursive calls.
if (Y.one('#scorm_object')) {
var content = Y.one('#scorm_content');
var old = Y.one('#scorm_object');
if (old) {
var scorm_active_url = Y.one('#scorm_object').getAttribute('src');
var node_full_url = M.cfg.wwwroot + '/mod/scorm/loadSCO.php?' + node.title;
if (node_full_url === scorm_active_url) {
return;
}
// Start to unload iframe here
if(!window_name){
content.removeChild(old);
old = null;
}
}
// End of - Avoid recursive calls.
scorm_current_node = node;
// Avoid recursive calls.
if (!scorm_current_node.state.selected) {
scorm_current_node.select();
}
@ -144,7 +153,6 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
el_old_api.parentNode.removeChild(el_old_api);
}
var content = Y.one('#scorm_content');
var obj = document.createElement('iframe');
obj.setAttribute('id', 'scorm_object');
obj.setAttribute('type', 'text/html');
@ -159,7 +167,6 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
mine.close();
}
var old = Y.one('#scorm_object');
if (old) {
if(window_name) {
var cwidth = scormplayerdata.cwidth;
@ -167,8 +174,6 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
var poptions = scormplayerdata.popupoptions;
poptions = poptions + ',resizable=yes'; // Added for IE (MDL-32506).
scorm_openpopup(M.cfg.wwwroot + "/mod/scorm/loadSCO.php?" + node.title, window_name, poptions, cwidth, cheight);
} else {
content.replaceChild(obj, old);
}
} else {
content.prepend(obj);
@ -577,14 +582,18 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
if (node.title == '' || node.title == null) {
return; //this item has no navigation
}
// If item is already active, return; avoid recursive calls.
if (Y.one('#scorm_data')) {
var scorm_active_url = Y.one('#scorm_object').getAttribute('src');
if (obj = Y.one('#scorm_object')) {
var scorm_active_url = obj.getAttribute('src');
var node_full_url = M.cfg.wwwroot + '/mod/scorm/loadSCO.php?' + node.title;
if (node_full_url === scorm_active_url) {
return;
}
} else if(scorm_current_node == node){
return;
}
// Update launch_sco.
if (typeof node.scoid !== 'undefined') {
launch_sco = node.scoid;