Moodle

Provide feedback to user about redirect delay in loadsco.php

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.5
  • Fix Version/s: 1.8.7, 1.9.3, 2.0
  • Component/s: SCORM
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

At the moment when a user opens a piece of content there is a 2 second delay in the loadsco.php page to allow API's etc to start, however there is no notification of this to the user so they may repeatedly click to launch course.

I suggest an enhancement to the .mod/scorm/loadsco.php to include a message and countdown timer.

Change the HTML at the end of the page to this:

<html>
<head>
<title>LoadSCO</title>
<script type="text/javascript">
function doredirect() {
var e = document.getElementById("COUNTDOWN");
var cSeconds = parseInt(e.innerHTML);
var timer = setInterval(function()
{
if( cSeconds )

{ e.innerHTML = --cSeconds; }

else

{ clearInterval(timer); document.body.innerHTML = "Redirecting...."; location = "<?php echo $result ?>"; }

}, 1000);
}
//<![CDATA[
//setTimeout('document.location = "<?php echo $result ?>";',<?php echo $delayseconds ?>000);
//]]>
</script>
<noscript>
<meta http-equiv="refresh" content="<?php echo $delayseconds ?>;url=<?php echo $result ?>" />
</noscript>
</head>
<body onload="doredirect();">
<p>You will be automatically redirected to the content in <span id="COUNTDOWN"><?php echo $delayseconds ?></span> second(s).<p>
</body>
</html>

Will provide messaging and for JavaScript enabled browsers it will actually countdown the time.

  1. MDL-14492-head.patch
    04/Aug/08 10:37 AM
    1 kB
    Piers Harding
  2. MDL-14492-head2.patch
    05/Aug/08 4:38 AM
    1 kB
    Piers Harding

Issue Links

Activity

Hide
Piers Harding added a comment -

patch file MDL-14492-head.patch, completes the changes that have been committed to head, providing the translatable language element for the user loading delay notification.
Cheers,
Piers Harding.

Show
Piers Harding added a comment - patch file MDL-14492-head.patch, completes the changes that have been committed to head, providing the translatable language element for the user loading delay notification. Cheers, Piers Harding.
Hide
Dan Marsden added a comment -

Hi Piers,

you don't need 2 lang strings, as you can pass a var into the get_string function - see:
$string['attemptsx'] = '$a attempts';
$string['missing_tag'] = 'Missing tag $a->tag';
in scorm.php for examples.

Dan

Show
Dan Marsden added a comment - Hi Piers, you don't need 2 lang strings, as you can pass a var into the get_string function - see: $string['attemptsx'] = '$a attempts'; $string['missing_tag'] = 'Missing tag $a->tag'; in scorm.php for examples. Dan
Hide
Piers Harding added a comment -

Admittedly it's not great, but infact you do need the two strings, as the counter for the seconds inbetween is being updated by JS, not PHP.

Cheers,
Piers Harding.

Show
Piers Harding added a comment - Admittedly it's not great, but infact you do need the two strings, as the counter for the seconds inbetween is being updated by JS, not PHP. Cheers, Piers Harding.
Hide
Piers Harding added a comment -

MDL-14492-head2.patch amended patch file for intial language entry for activityloading string.

This patch needs applying to head (lang/en_utf8/scorm.php) as I do not have commit access to the scorm texts files.

Cheers,
Piers Harding.

Show
Piers Harding added a comment - MDL-14492-head2.patch amended patch file for intial language entry for activityloading string. This patch needs applying to head (lang/en_utf8/scorm.php) as I do not have commit access to the scorm texts files. Cheers, Piers Harding.
Hide
Martin Holden added a comment -

This looks fine, but one comment. Should this code in loadsco.php reference the PHP variables for the document.body.innerHTML so that the localisation is supported:

//<![CDATA[
function doredirect() {
var e = document.getElementById("countdown");
var cSeconds = parseInt(e.innerHTML);
var timer = setInterval(function() {
if( cSeconds ) { e.innerHTML = --cSeconds; } else { clearInterval(timer); document.body.innerHTML = "<?php echo get_string('activityloading', 'scorm');?>" location = "<?php echo $result ?>"; }
}, 1000);
}
//]]>

Show
Martin Holden added a comment - This looks fine, but one comment. Should this code in loadsco.php reference the PHP variables for the document.body.innerHTML so that the localisation is supported: //<![CDATA[ function doredirect() { var e = document.getElementById("countdown"); var cSeconds = parseInt(e.innerHTML); var timer = setInterval(function() { if( cSeconds ) { e.innerHTML = --cSeconds; } else { clearInterval(timer); document.body.innerHTML = "<?php echo get_string('activityloading', 'scorm');?>" location = "<?php echo $result ?>"; } }, 1000); } //]]>
Hide
Piers Harding added a comment -

Fair point - I've added in a new text for this (the other text string isn't appropriate). It's been commited to head, and I'll propagate this to 1.9, and 1.8 after the code freeze is over.

Cheers.

Show
Piers Harding added a comment - Fair point - I've added in a new text for this (the other text string isn't appropriate). It's been commited to head, and I'll propagate this to 1.9, and 1.8 after the code freeze is over. Cheers.
Hide
Ashley Holman added a comment -

Could there be an option added to turn the countdown on or off for a particular SCORM activity? I've gotten some feedback from people who develop SCORM content for Moodle, saying that they'd rather just have the 2 second delay without the progress bar. The "wait" screen with spinning progress icon could be considered confusing/unnecessary for users to see.

Show
Ashley Holman added a comment - Could there be an option added to turn the countdown on or off for a particular SCORM activity? I've gotten some feedback from people who develop SCORM content for Moodle, saying that they'd rather just have the 2 second delay without the progress bar. The "wait" screen with spinning progress icon could be considered confusing/unnecessary for users to see.
Hide
Dan Marsden added a comment -

closing. - looks good to me - thanks Piers.

Ashley - have you actually tested this patch? - I don't see how making this an optional feature is very useful. - or how the interface could be confusing or unecessary. IMO adding this as another configurable option just adds another config options to the scorm settings - which makes a very busy config interface and could cause more confusion for users (even if added as an advanced option)

you're welcome to create a new tracker item for it, but it wont be something we are likely to spend much time on.

thanks,

Dan

Show
Dan Marsden added a comment - closing. - looks good to me - thanks Piers. Ashley - have you actually tested this patch? - I don't see how making this an optional feature is very useful. - or how the interface could be confusing or unecessary. IMO adding this as another configurable option just adds another config options to the scorm settings - which makes a very busy config interface and could cause more confusion for users (even if added as an advanced option) you're welcome to create a new tracker item for it, but it wont be something we are likely to spend much time on. thanks, Dan
Hide
Dan Marsden added a comment -

reopening as per MDL-16060

Show
Dan Marsden added a comment - reopening as per MDL-16060
Hide
Dan Marsden added a comment -

resolving this issue again - MH and I don't think this patch caused the issue. Piers is looking into it.

Dan

Show
Dan Marsden added a comment - resolving this issue again - MH and I don't think this patch caused the issue. Piers is looking into it. Dan
Hide
Piers Harding added a comment -

Additional commit was made to fix up the scorm_resize() JS. Apparently some users specify extremely small window height parameters eg.100px and can therefore end up with negative numbers.
Thanks Francois, for digging this one out.

Show
Piers Harding added a comment - Additional commit was made to fix up the scorm_resize() JS. Apparently some users specify extremely small window height parameters eg.100px and can therefore end up with negative numbers. Thanks Francois, for digging this one out.
Hide
Eloy Lafuente (stronk7) added a comment -

Ho guys,

I just have received this @ Github (about his problem reapearing)

https://github.com/moodle/moodle/pull/24

For your consideration...ciao

Show
Eloy Lafuente (stronk7) added a comment - Ho guys, I just have received this @ Github (about his problem reapearing) https://github.com/moodle/moodle/pull/24 For your consideration...ciao
Hide
Dan Marsden added a comment -

Thanks Eloy, I've just commented on Github, rd.js is no longer used in Moodle 2.0+ so can safely be deleted.

Show
Dan Marsden added a comment - Thanks Eloy, I've just commented on Github, rd.js is no longer used in Moodle 2.0+ so can safely be deleted.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: