// 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
* @subpackage imscp
* @copyright 2009 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.mod_imscp = {};
M.mod_imscp.init = function(Y) {
var imscp_layout_widget;
var imscp_current_node;
var imscp_buttons = [];
var imscp_bloody_labelclick = false;
Y.use('yui2-resize', 'yui2-dragdrop', 'yui2-container', 'yui2-button', 'yui2-layout', 'yui2-treeview', 'yui2-json', 'yui2-event', function(Y) {
var imscp_activate_item_by_index = function(index) {
imscp_activate_item(Y.YUI2.widget.TreeView.getNode('imscp_tree', index));
};
var imscp_activate_item = function(node) {
if (!node) {
return;
}
imscp_current_node = node;
imscp_current_node.highlight();
var content = new Y.YUI2.util.Element('imscp_content');
var obj;
if (node.href) {
try {
// First try IE way - it can not set name attribute later
// and also it has some restrictions on DOM access from object tag.
obj = document.createElement('