MDL-55911 Quiz: Accessibility, Label blanks in DD questions

This commit is contained in:
John Beedell 2016-09-08 16:17:07 +01:00
parent ddd8dc0d1b
commit b5cbcc4dfb
8 changed files with 24 additions and 6 deletions

View File

@ -26,6 +26,7 @@ $string['addmoredropzones'] = 'Blanks for {no} more drop zones';
$string['addmoreimages'] = 'Blanks for {no} more draggable items';
$string['answer'] = 'Answer';
$string['bgimage'] = 'Background image';
$string['blank'] = 'blank';
$string['correctansweris'] = 'The correct answer is: {$a}';
$string['draggableimage'] = 'Draggable image';
$string['draggableitem'] = 'Draggable item';

View File

@ -117,6 +117,7 @@ class qtype_ddtoimage_renderer_base extends qtype_with_combined_feedback_rendere
'topnode' => $topnode,
'readonly' => $options->readonly);
$PAGE->requires->string_for_js('blank', 'qtype_ddimageortext');
$PAGE->requires->yui_module('moodle-qtype_ddimageortext-dd',
'M.qtype_ddimageortext.init_question',
array($params));

View File

@ -482,7 +482,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
@ -530,4 +534,5 @@ M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};
}, '@VERSION@', {"requires": ["node", "dd", "dd-drop", "dd-constrain"]});

View File

@ -482,7 +482,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
@ -530,4 +534,5 @@ M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};
}, '@VERSION@', {"requires": ["node", "dd", "dd-drop", "dd-constrain"]});

View File

@ -480,7 +480,11 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
var drop = this.get('drops')[dropno];
var nodeclass = 'dropzone group' + drop.group + ' place' + dropno;
var title = drop.text.replace('"', '\"');
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">&nbsp;</div>';
if (!title) {
title = M.util.get_string('blank', 'qtype_ddimageortext');
}
var dropnodehtml = '<div title="' + title + '" class="' + nodeclass + '">' +
'<span class="accesshide">' + title + '</span>&nbsp;</div>';
var dropnode = Y.Node.create(dropnodehtml);
groupnodes[drop.group].append(dropnode);
dropnode.setStyles({'opacity': 0.5});
@ -526,4 +530,4 @@ Y.Event.define('dragchange', {
M.qtype_ddimageortext.init_question = function(config) {
return new DDIMAGEORTEXT_QUESTION(config);
};
};

View File

@ -24,6 +24,7 @@
$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
$string['answer'] = 'Answer';
$string['blank'] = 'blank';
$string['correctansweris'] = 'The correct answer is: {$a}';
$string['infinite'] = 'Unlimited';
$string['pleaseputananswerineachbox'] = 'Please put an answer in each box.';

View File

@ -104,7 +104,8 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
question_display_options $options) {
$question = $qa->get_question();
$group = $question->places[$place];
$boxcontents = '&#160;';
$boxcontents = '&#160;' . html_writer::tag('span',
get_string('blank', 'qtype_ddwtos'), array('class' => 'accesshide'));
$value = $qa->get_last_qt_var($question->field($place));