Skip to content

Commit

Permalink
Merge branch 'm21_MDL-26482' of git://github.com/danmarsden/moodle in…
Browse files Browse the repository at this point in the history
…to MOODLE_21_STABLE
  • Loading branch information
samhemelryk committed Jul 18, 2011
2 parents 082325c + 2987d69 commit 0a02548
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 44 deletions.
1 change: 1 addition & 0 deletions mod/scorm/lang/en/scorm.php
Expand Up @@ -65,6 +65,7 @@
$string['deleteallattempts'] = 'Delete all SCORM attempts'; $string['deleteallattempts'] = 'Delete all SCORM attempts';
$string['details'] = 'Track details'; $string['details'] = 'Track details';
$string['directories'] = 'Show the directory links'; $string['directories'] = 'Show the directory links';
$string['disabled'] = 'Disabled';
$string['display'] = 'Display package'; $string['display'] = 'Display package';
$string['displayattemptstatus'] = 'Display attempt status'; $string['displayattemptstatus'] = 'Display attempt status';
$string['displayattemptstatus_help'] = 'If enabled, scores and grades for attempts are displayed on the SCORM outline page.'; $string['displayattemptstatus_help'] = 'If enabled, scores and grades for attempts are displayed on the SCORM outline page.';
Expand Down
4 changes: 4 additions & 0 deletions mod/scorm/lib.php
Expand Up @@ -30,6 +30,10 @@
/** SCORM_TYPE_IMSREPOSITORY = imsrepository */ /** SCORM_TYPE_IMSREPOSITORY = imsrepository */
define('SCORM_TYPE_IMSREPOSITORY', 'imsrepository'); define('SCORM_TYPE_IMSREPOSITORY', 'imsrepository');


define('SCORM_TOC_SIDE', 0);
define('SCORM_TOC_HIDDEN', 1);
define('SCORM_TOC_POPUP', 2);
define('SCORM_TOC_DISABLED', 3);


/** /**
* Given an object containing all the necessary data, * Given an object containing all the necessary data,
Expand Down
9 changes: 5 additions & 4 deletions mod/scorm/locallib.php
Expand Up @@ -106,10 +106,11 @@ function scorm_get_skip_view_array(){
* *
* @return array an array of hide table of contents options * @return array an array of hide table of contents options
*/ */
function scorm_get_hidetoc_array(){ function scorm_get_hidetoc_array() {
return array(0 =>get_string('sided','scorm'), return array(SCORM_TOC_SIDE =>get_string('sided', 'scorm'),
1 => get_string('hidden','scorm'), SCORM_TOC_HIDDEN => get_string('hidden', 'scorm'),
2 => get_string('popupmenu','scorm')); SCORM_TOC_POPUP => get_string('popupmenu', 'scorm'),
SCORM_TOC_DISABLED => get_string('disabled', 'scorm'));
} }


/** /**
Expand Down
88 changes: 51 additions & 37 deletions mod/scorm/module.js
Expand Up @@ -28,18 +28,16 @@ mod_scorm_activate_item = null;
M.mod_scorm = {}; M.mod_scorm = {};


M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launch_sco) { M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launch_sco) {

var scorm_disable_toc = false;
var scorm_hide_nav = true;
var scorm_hide_toc = true;
if (hide_nav == 0) { if (hide_nav == 0) {
scorm_hide_nav = false; scorm_hide_nav = false;
} }
else {
scorm_hide_nav = true;
}
if (hide_toc == 0) { if (hide_toc == 0) {
scorm_hide_toc = false; scorm_hide_toc = false;
} } else if (hide_toc == 3) {
else { scorm_disable_toc = true;
scorm_hide_toc = true;
} }


var scorm_layout_widget; var scorm_layout_widget;
Expand Down Expand Up @@ -290,23 +288,36 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
YAHOO.widget.LayoutUnit.prototype.STR_COLLAPSE = M.str.moodle.hide; YAHOO.widget.LayoutUnit.prototype.STR_COLLAPSE = M.str.moodle.hide;
YAHOO.widget.LayoutUnit.prototype.STR_EXPAND = M.str.moodle.show; YAHOO.widget.LayoutUnit.prototype.STR_EXPAND = M.str.moodle.show;


scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', { if (scorm_disable_toc) {
minWidth: 255, scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', {
minHeight: 600, minWidth: 255,
units: [ minHeight: 600,
{ position: 'left', body: 'scorm_toc', header: toc_title, width: 250, resize: true, gutter: '2px 5px 5px 2px', collapse: true, minWidth:250, maxWidth: 590}, units: [
{ position: 'center', body: '<div id="scorm_content"></div>', gutter: '2px 5px 5px 2px', scroll: true} { position: 'left', body: 'scorm_toc', header: toc_title, width: 0, resize: true, gutter: '0px 0px 0px 0px', collapse: false},
] { position: 'center', body: '<div id="scorm_content"></div>', gutter: '0px 0px 0px 0px', scroll: true}
}); ]
});
} else {
scorm_layout_widget = new YAHOO.widget.Layout('scorm_layout', {
minWidth: 255,
minHeight: 600,
units: [
{ position: 'left', body: 'scorm_toc', header: toc_title, width: 250, resize: true, gutter: '2px 5px 5px 2px', collapse: true, minWidth:250, maxWidth: 590},
{ position: 'center', body: '<div id="scorm_content"></div>', gutter: '2px 5px 5px 2px', scroll: true}
]
});
}

scorm_layout_widget.render(); scorm_layout_widget.render();
var left = scorm_layout_widget.getUnitByPosition('left'); var left = scorm_layout_widget.getUnitByPosition('left');
left.on('collapse', function() { if (!scorm_disable_toc) {
scorm_resize_frame(); left.on('collapse', function() {
}); scorm_resize_frame();
left.on('expand', function() { });
scorm_resize_frame(); left.on('expand', function() {
}); scorm_resize_frame();

});
}
// ugly resizing hack that works around problems with resizing of iframes and objects // ugly resizing hack that works around problems with resizing of iframes and objects
left._resize.on('startResize', function() { left._resize.on('startResize', function() {
var obj = YAHOO.util.Dom.get('scorm_object'); var obj = YAHOO.util.Dom.get('scorm_object');
Expand All @@ -319,10 +330,11 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
}); });


// hide the TOC if that is the default // hide the TOC if that is the default
if (scorm_hide_toc == true) { if (!scorm_disable_toc) {
left.collapse(); if (scorm_hide_toc == true) {
left.collapse();
}
} }

// TOC tree // TOC tree
var tree = new YAHOO.widget.TreeView('scorm_tree'); var tree = new YAHOO.widget.TreeView('scorm_tree');
scorm_tree_node = tree; scorm_tree_node = tree;
Expand All @@ -333,18 +345,20 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc
scorm_bloody_labelclick = true; scorm_bloody_labelclick = true;
} }
}); });
tree.subscribe('collapse', function(node) { if (!scorm_disable_toc) {
if (scorm_bloody_labelclick) { tree.subscribe('collapse', function(node) {
scorm_bloody_labelclick = false; if (scorm_bloody_labelclick) {
return false; scorm_bloody_labelclick = false;
} return false;
}); }
tree.subscribe('expand', function(node) { });
if (scorm_bloody_labelclick) { tree.subscribe('expand', function(node) {
scorm_bloody_labelclick = false; if (scorm_bloody_labelclick) {
return false; scorm_bloody_labelclick = false;
} return false;
}); }
});
}
tree.expandAll(); tree.expandAll();
tree.render(); tree.render();


Expand Down
6 changes: 3 additions & 3 deletions mod/scorm/player.php
Expand Up @@ -202,9 +202,9 @@
<?php echo $mode == 'review' ? '<div id="scormmode" class="scorm-left">'.get_string('reviewmode','scorm')."</div>\n" : ''; ?> <?php echo $mode == 'review' ? '<div id="scormmode" class="scorm-left">'.get_string('reviewmode','scorm')."</div>\n" : ''; ?>
<div id="scormnav" class="scorm-right"> <div id="scormnav" class="scorm-right">
<?php <?php
if ($scorm->hidetoc == 2) { if ($scorm->hidetoc == SCORM_TOC_POPUP) {
echo $result->tocmenu; echo $result->tocmenu;
} }
?> ?>
</div> <!-- Scormnav --> </div> <!-- Scormnav -->
</div> <!-- Scormtop --> </div> <!-- Scormtop -->
Expand Down

0 comments on commit 0a02548

Please sign in to comment.