The unit tests were initialising the structure class in a different way
from real use. That was clearly silly, so I got rid of create_for,
leaving just the real create_for_quiz.
The approach is that we have a new JavaScript function
M.mod_quiz.resource_toolbox.reorganise_edit_page which, after a ajax
action, fixes up everything like page breaks, page and question numbers,
that might now be wrong.
We call that function instead of reloading the page.
Also, there are a lot more Behat tests to verify this works correctly.
AMOS BEGIN
MOV [joinpages,mod_quiz],[removepagebreak,mod_quiz]
MOV [splitpages,mod_quiz],[addpagebreak,mod_quiz]
AMOS END
If a quiz is set to have a grace period when time has expired, we only
email studnets to warn them about their overdue attempt if they have put
in an answer to at least one question that is worth some marks.
Also, ensure that clicking the + icon adds the question on the right
page.
Bit of this fix are a bit hacky, but we have to deal with the fact there
is not a good general solution to MDL-47604.
As part of this, I tweaked the LTR style a bit, in a way that is both an
improvement (I hope) and also to reduce the amount of RTL-specific code
required. (Thanks to Fred for spotting some of the problems.)
Also, I changed one course style in boostrapbase, where the RTL rule was
different from the LTR rule.
Finally, I saw some repeated RTL rules in the quiz styles.css, and so
eliminated the the duplicate rules.
While doing this code clean-up, I noticed that the question bank pop-up was
only showing the question name, whereas it should have been showing the
question name and the start of the question text, so I fixed that.
This commit is actually the joint work of Mahmoud Kassaei, Colin
Chambers and Tim Hunt from The Open University. We could only use one
persons name for the commit, and this time Colin gets the credit/blame.
The goal of this work was to increase usability, and also clean up
the page enough that it will be possible to add new features in future.
Display of mod/quiz/edit.php is now entirely generated by
mod_quiz\output\edit_renderer. This uses a helper class
mod_quiz\structure to provide details of the structure of the quiz, and
mod_quiz\repaginate to alter that structure. (Acutally, there are still
some modification methods on mod_quiz\structure. Expect that to be
cleaned up in future.)
The new code uses much more ajax, and there are new scripts
mod/quiz/edit_rest.php and mod/quiz/repaginate.php to handle this.
(Again, don't be surprised if those two scripts get merged in future.)
Also questionbank.ajax.php (which may, in future, be made more generic,
and moved into the core question bank code.)
Most of the new JavaScript code has intentionally copied the way things
are done when editing activities on the course page.
As a result of this, mod/quiz/editlib.php is now much shorter than it
was. (In future, expect the remaining code in here to move into
mod/quiz/classes.)