From 9e8c6c7bffef56fcdfda333b870c25bb4dda85fb Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 4 Apr 2013 21:03:10 +1300 Subject: [PATCH 1/2] MDL-37844 SCORM: fix js error and highlight selected node in TOC. --- mod/scorm/module.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod/scorm/module.js b/mod/scorm/module.js index 03902fa80fa..2b6b29d9d47 100644 --- a/mod/scorm/module.js +++ b/mod/scorm/module.js @@ -24,6 +24,7 @@ mod_scorm_launch_next_sco = null; mod_scorm_launch_prev_sco = null; mod_scorm_activate_item = null; +scorm_layout_widget = null; M.mod_scorm = {}; @@ -41,7 +42,6 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc } scoes_nav = JSON.parse(scoes_nav); - var scorm_layout_widget; var scorm_current_node; var scorm_buttons = []; var scorm_bloody_labelclick = false; @@ -152,7 +152,7 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc scorm_resize_frame(); var left = scorm_layout_widget.getUnitByPosition('left'); - if (left.expanded) { + if (left.expand) { scorm_current_node.focus(); } if (scorm_hide_nav == false) { @@ -608,9 +608,8 @@ M.mod_scorm.connectPrereqCallback = { hnode = scorm_tree_node.getNodeByIndex(hidx); if (hnode) { hnode.highlight(); - scorm_layout_widget = Y.YUI2.widget.Layout.getLayoutById('scorm_layout'); var left = scorm_layout_widget.getUnitByPosition('left'); - if (left.expanded) { + if (left.expand) { hnode.focus(); } } From 18c3001eb419aa18253aaf745c1136b95ba66735 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Fri, 19 Oct 2012 10:02:30 +0200 Subject: [PATCH 2/2] MDL-35840 SCORM TOC: fixed a typo, improvements on getting the focus --- mod/scorm/module.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mod/scorm/module.js b/mod/scorm/module.js index 2b6b29d9d47..b837ba8effe 100644 --- a/mod/scorm/module.js +++ b/mod/scorm/module.js @@ -493,6 +493,15 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc tree.expandAll(); tree.render(); + // On getting the window, always set the focus on the current item + Y.YUI2.util.Event.on(window, 'focus', function (e) { + var current = scorm_tree_node.getHighlightedNode(); + var left = scorm_layout_widget.getUnitByPosition('left'); + if (current && left.expand) { + current.focus(); + } + }); + // navigation if (scorm_hide_nav == false) { scorm_nav_panel = new Y.YUI2.widget.Panel('scorm_navpanel', { visible:true, draggable:true, close:false, xy: [250, 450],