Skip to content

Commit

Permalink
MDL-38355 qtype_multianswer: input boxes too big in Russian.
Browse files Browse the repository at this point in the history
... 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.
  • Loading branch information
timhunt committed Mar 14, 2013
1 parent 0f52118 commit e421b15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions question/type/multianswer/renderer.php
Expand Up @@ -189,9 +189,9 @@ public function subquestion(question_attempt $qa, question_display_options $opti
}

// 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.
Expand Down

0 comments on commit e421b15

Please sign in to comment.