redirect speed for 'continue page' - set faster plz!

redirect speed for 'continue page' - set faster plz!

by Rorschach Vision -
Number of replies: 19
Hi,

At the end of the quiz after 'submission', you are taken to a page with just the button 'continue'. After a wait of 3 seconds, you are redirected to the feedback page.

This page we find very redundant, but I can't find the relevant part which reduces the 3 second wait to 0.5 seconds.

Part of the relevant code is on:

/mod/quiz/attempt.php

At the bottom after a quiz it says:
<!--
 function redirect() {
 document.location.replace('review.php?attempt=21');
 }
 setTimeout("redirect()", 3000);
-->
Where does the 3000 timeout setting come from? Where can I change it to 500 or less?

While I'm at it, is it also possible to remove the 'save without submitting' and the 'start again' buttons?

Look forward to your feedback!


Average of ratings: -
In reply to Rorschach Vision

Re: redirect speed for 'continue page' - set faster plz!

by Just H -
Hi Rorschach

Haven't got much time to look into it but to get rid of the "Save without submitting" button we commented out line 531 in the file mod/quiz/attempt.php:

/// echo "<input type=\"submit\" name=\"saveattempt\" value=\"".get_string("savenosubmit", "quiz")."\" />\n";

Guessing the start again button is in the same file somewhere, for the timeout, can't you just change it in the part of the code you already tracked down?

Good luck smile

Harry
In reply to Just H

Re: redirect speed for 'continue page' - set faster plz!

by Rorschach Vision -
Thanks for the tip on the submission button Harry!

Well I only tracked down the javascript output, but I can't find where the figure 3000 comes from in the view.php or attempt.php files. If it's passed as a variable I can't see where it is black eye

It's been 5yrs since I last played with php mixed Anyone else? Maybe I'll add another redirect in there, and specify the timeout to be less :D

I don't want to mess with the other timer settings, coz those affect the 'countdown clock'.


In reply to Rorschach Vision

Re: redirect speed for 'continue page' - set faster plz!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think it is the default value in redirect(), which I think is in lib/weblib.php. So at the place where redirect() is called, you need to specify a value, instead of letting the fuction use it's default.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: redirect speed for 'continue page' - set faster plz!

by Rorschach Vision -
Thanks Tim, that was great! Found the default delay timer, and reduced it to 0.1 seconds ;D
In reply to Rorschach Vision

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: redirect speed for 'continue page' - set faster plz!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Searching for 3000 is no good, because that is the default, so normally it does not appear. Searching the code for 'redirect(' is probably easiest.

In Moodle 1.8 it is around line 420 of mod/quiz/attempt.php:
 if ($finishattempt) {
 redirect('review.php?attempt='.$attempt->id);
 }
change that to
 if ($finishattempt) {
 redirect('review.php?attempt='.$attempt->id, 0);
 }

In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: redirect speed for 'continue page' - set faster plz!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Sorry. This is the right bit to change, but I gave you the wrong new code. It should be

redirect('review.php?attempt='.$attempt->id, "", 0);
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: redirect speed for 'continue page' - set faster plz!

by Luciano Rodriguez -
Hey guys,
I know this forum is old but just thought I say that I changed the 3000ms(3sec) to 1000ms(1sec)
The file I edited was /moodlesite/lib/weblib.php
I went down to line 6089 and found
}

if ($delay == -1) {
$delay = 3; // if no delay specified wait 3 seconds
}

to

}

if ($delay == -1) {
$delay = 1; // if no delay specified wait 1 seconds
}


Pretty much change this number to 0 or 1, at your own risk. ;)
Hope this helps you with that pesky Continue button.

I am running Moodle 1.9 + (Build: 20080317)
p.s. So far everything seems to be going okay. I will update you with any problems if any. smile
Regards
-Luciano
In reply to Luciano Rodriguez

Re: redirect speed for 'continue page' - set faster plz!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I thought that in 1.9, most of the delays in the quiz had been reduced to 0.
In reply to Tim Hunt

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Rorschach Vision

Re: redirect speed for 'continue page' - set faster plz!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
3000 = 3000ms = 3s
In reply to Tim Hunt

Re: redirect speed for 'continue page' - set faster plz!

by Timothy Takemoto -
If the number is there in the php then there is no place to change it but in the code.

I wonder what the rational is for having that three second delay.
In reply to Timothy Takemoto

Re: redirect speed for 'continue page' - set faster plz!

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

The displaying of the pesky Continue button (in contexts where it is totally useless to the user) has been discussed at length in the Lesson forum and also in bug report MDL-5403.

From what I understand, it is only maintained to preserve accessibility to "non-enabled Javascript" browsers. Need I say that I disagree with Petr Skoda's view that " non-javasciprt compatibility is IMO a must". On the contrary I think that Moodle should be more open to Javascript.

Joseph

In reply to Joseph Rézeau

Re: redirect speed for 'continue page' - set faster plz!

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Hi!

it is not important if I like JS or not, in this case the redirection with timeout brings major accessibility problems.

The problem can be solved with a new status notification framework that would be fully accessible and without the need for any JS. The idea is to use fast header redirects (the only fully working and recommended solution) and no meta refresh or JS tricks. The status messages would be passed through session and displayed on the target page in a special area. Some message ID would have to be passed in URL, there could be several types of messages - we might find plenty of other possibilities how to make it more effective.

The implementation would not be difficult, the only problem is time sad 2.0?

skodak

PS: I was reviewing the use of JS in main codebase this week, it is used in far more places than I expected see bug http://tracker.moodle.org/browse/MDL-7492
In reply to Petr Skoda

Re: redirect speed for 'continue page' - set faster plz!

by Rorschach Vision -
Skodak, would u be able to tell me where the settimeout setting comes from, for that part of the quiz module? :/ I'm wondering why it's so hard to find in the code!
In reply to Petr Skoda

Re: redirect speed for 'continue page' - set faster plz!

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Petr!
Regarding your PS, one might add to this long (?) list of JS uses in Moodle the fact that the Hot Potatoes exercises (although not part of Moodle itself) totally rely on JS being enabled.
Too bad!wink
Joseph