// This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . /** * Javascript helper function for IMS Content Package module. * * @package mod-scorm * @copyright 2009 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ mod_scorm_next = null; mod_scorm_prev = null; mod_scorm_activate_item = null; M.mod_scorm = {}; M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launch_sco) { if (hide_nav == 0) { scorm_hide_nav = false; } else { scorm_hide_nav = true; } if (hide_toc == 0) { scorm_hide_toc = false; } else { scorm_hide_toc = true; } var scorm_layout_widget; var scorm_current_node; var scorm_buttons = []; var scorm_bloody_labelclick = false; var scorm_nav_panel; Y.use('yui2-resize', 'yui2-dragdrop', 'yui2-container', 'yui2-button', 'yui2-layout', 'yui2-treeview', 'yui2-json', 'yui2-event', function(Y) { var scorm_activate_item = function(node) { if (!node) { return; } scorm_current_node = node; scorm_current_node.highlight(); // remove any reference to the old API if (window.API) { window.API = null; } if (window.API_1484_11) { window.API_1484_11 = null; } var url_prefix = M.cfg.wwwroot + '/mod/scorm/loadSCO.php?'; var el_old_api = document.getElementById('scormapi123'); if (el_old_api) { el_old_api.parentNode.removeChild(el_old_api); } if (node.title) { var el_scorm_api = document.getElementById("external-scormapi"); el_scorm_api.parentNode.removeChild(el_scorm_api); el_scorm_api = document.createElement('script'); el_scorm_api.setAttribute('id','external-scormapi'); el_scorm_api.setAttribute('type','text/javascript'); var pel_scorm_api = document.getElementById('scormapi-parent'); pel_scorm_api.appendChild(el_scorm_api); var api_url = M.cfg.wwwroot + '/mod/scorm/api.php?' + node.title; document.getElementById('external-scormapi').src = api_url; } var content = new YAHOO.util.Element('scorm_content'); try { // first try IE way - it can not set name attribute later // and also it has some restrictions on DOM access from object tag if (window_name || node.title == null) { var obj = document.createElement('