MDL-38355 qtype_multianswer: input boxes too big in Russian.

... and any other language where the characters take multiple
bytes in UTF-8.

This fix was worked out by Dušan Ristić. I am just committing it.
This commit is contained in:
Tim Hunt
2013-03-14 22:27:48 +00:00
parent 0f52118a4a
commit e421b1524f
+2 -2
View File
@@ -189,9 +189,9 @@ class qtype_multianswer_textfield_renderer extends qtype_multianswer_subq_render
}
// Work out a good input field size.
$size = max(1, strlen(trim($response)) + 1);
$size = max(1, textlib::strlen(trim($response)) + 1);
foreach ($subq->answers as $ans) {
$size = max($size, strlen(trim($ans->answer)));
$size = max($size, textlib::strlen(trim($ans->answer)));
}
$size = min(60, round($size + rand(0, $size*0.15)));
// The rand bit is to make guessing harder.