Dear Richard,
sorry for the long delay, i
was in holiday the last days.
As I've seen you implemented some functionality to avoid that some results get
lost when the test ends by the timeout. Will you release this functionality in
the version 4.0 in the next weeks?
Also, I've read your documentation and added some words. I would already
mention that it’s possible to include the GraphUI in the HtmlUI. I'll also
included the necessary code in the tags
<<code>><</code>>. What do you think about it?
When the new functionality will be released, I will test the final implementation, add the example question as one of my last answers in this thread.
Thanks four your help
Markus
The textareaId macro
A problem
arises if the HTML supplied by the question author contains elements with
explicit id attributes, as might be required if there is also
JavaScript present that needs to refer to the new elements. If the review
options allow display of the question author's answer then when the student
reviews their quiz, the student answer and the author's answer will both
include the new elements, resulting in a conflict of id. Apart from being
invalid HTML, this is likely to result in wrong results when any JavaScript
code referencing the elements runs.
A workaround
for this problem is to include the special macro string
___textareaId___
as part of
any new ids. Note that there are THREE (3) underscores at both the start and
end of the macro string.
When the
HTML UI inserts the global extra html into the question, that macro is replaced
everywhere by the actual ID of the answer box's text-area, which is different
for the student and author answers. This technique can also be used to ensure
that the names given to elements like radio buttons are different in the two
answers.
Using this
macro, it is also possible to include the GraphUI in the HtmlUI. By including a
custom grader, it is possible to create a Question with several sub questions.
To do this, in the html-code a textarea element needs to be defined:
<textarea class="coderunner-ui-element"
id="graph_target_name____textareaId___" name="graph_target"
spellcheck="false" rows="18" data-params=""
data-globalextra=""></textarea>
This element is hidden, but at this position, the graph will be drawn. Secondly, the amd-script needs to get called using:
<script>
M.util.js_pending('qtype_coderunner/userinterfacewrapper');
require(['qtype_coderunner/userinterfacewrapper'], function(amd) {
amd.newUiWrapper("graph", "graph_target_name____textareaId___");
M.util.js_complete('qtype_coderunner/userinterfacewrapper');
});
</script>
By using multiple graph elements, keep in mind that the id and name should be unique. For more information, see
this CodeRunner author's forum thread where Markus Gafner (who
contributed this workaround) shows a HtmlUI question with an embedded GraphUI question, plus other embedded questions.
(Edited by Richard Lobb - original submission Friday, 29 January 2021, 8:54 AM)
(Edited by Richard Lobb - original submission Wednesday, 10 March 2021, 8:35 PM)
(Edited by Richard Lobb - original submission Wednesday, 10 March 2021, 8:40 PM)