diff --git a/css/vips.css b/css/vips.css index 5a4a2d4a6d3469ae72064745ee5af68ce0451205..7651819aa16a7b063ce8203e207bf271d740bfb4 100644 --- a/css/vips.css +++ b/css/vips.css @@ -313,6 +313,7 @@ button.vips_file_upload:hover { min-height: 36px; min-width: 80px; vertical-align: middle; + white-space: normal; } .cloze_drop.hover { diff --git a/exercises/cloze_exercise.php b/exercises/cloze_exercise.php index 920df647b0a0818981ad40579c4b0fec5e3a5a3f..86841899e320ffbced3c80f219dd99bf95fb564a 100644 --- a/exercises/cloze_exercise.php +++ b/exercises/cloze_exercise.php @@ -370,15 +370,13 @@ class cloze_exercise extends Exercise $answers[] = '*' . $answer['text']; } else if ($answer['score'] == 0.5) { $answers[] = '~' . $answer['text']; + } else if (preg_match('/^([":*~]|$)/', $answer['text'])) { + $answers[] = '"' . $answer['text'] . '"'; } else { $answers[] = $answer['text']; } } - if (count($answers) === 1 && $answers[0] === '') { - $answers = [' ']; - } - $blank = '[[' . $select . implode('|', $answers) . ']]'; if ($is_html) { @@ -435,6 +433,10 @@ class cloze_exercise extends Exercise } } + if (preg_match('/^"(.*)"$/', $answer, $matches)) { + $answer = $matches[1]; + } + $answers[] = ['text' => $answer, 'score' => $points]; } } diff --git a/views/exercises/correct_cloze_exercise.php b/views/exercises/correct_cloze_exercise.php index 4bca0d8fcac2a1a0c0f49cb0d86f9b056eca2301..477cf810af8a61cc262429340429e8d94852b0a5 100644 --- a/views/exercises/correct_cloze_exercise.php +++ b/views/exercises/correct_cloze_exercise.php @@ -5,20 +5,20 @@ <? if (isset($exercise->task['answers'][$blank])) : ?> <? if ($solution->id): ?> <? if ($results[$blank]['points'] == 1): ?> - --><span class="correct_item"><?= htmlReady($response[$blank]) ?> - <?= Icon::create('accept', 'status-green', ['class' => 'correction_inline', 'title' => _vips('richtig')]) ?><!-- + --><span class="correct_item"><?= htmlReady($response[$blank]) ?><!-- + --><?= Icon::create('accept', 'status-green', ['class' => 'correction_inline', 'title' => _vips('richtig')]) ?><!-- --></span><!-- <? elseif ($results[$blank]['points'] == 0.5): ?> - --><span class="fuzzy_item"><?= htmlReady($response[$blank]) ?> - <?= Icon::create('decline', 'status-yellow', ['class' => 'correction_inline', 'title' => _vips('fast richtig')]) ?><!-- + --><span class="fuzzy_item"><?= htmlReady($response[$blank]) ?><!-- + --><?= Icon::create('decline', 'status-yellow', ['class' => 'correction_inline', 'title' => _vips('fast richtig')]) ?><!-- --></span><!-- <? elseif (!$edit_solution || $results[$blank]['safe']): ?> - --><span class="wrong_item"><?= htmlReady($response[$blank]) ?> - <?= Icon::create('decline', 'status-red', ['class' => 'correction_inline', 'title' => _vips('falsch')]) ?><!-- + --><span class="wrong_item"><?= htmlReady($response[$blank]) ?><!-- + --><?= Icon::create('decline', 'status-red', ['class' => 'correction_inline', 'title' => _vips('falsch')]) ?><!-- --></span><!-- <? else: ?> - --><span class="wrong_item"><?= htmlReady($response[$blank]) ?> - <?= Icon::create('question', 'status-red', ['class' => 'correction_inline', 'title' => _vips('unbekannte Antwort')]) ?><!-- + --><span class="wrong_item"><?= htmlReady($response[$blank]) ?><!-- + --><?= Icon::create('question', 'status-red', ['class' => 'correction_inline', 'title' => _vips('unbekannte Antwort')]) ?><!-- --></span><!-- <? endif ?> <? endif ?> diff --git a/views/exercises/print_cloze_exercise.php b/views/exercises/print_cloze_exercise.php index 6933cf6b41bdce5a574cae9c0c566d8485c84c31..f7e37c3c8fa497dfb720974e065abd8bdac280bc 100644 --- a/views/exercises/print_cloze_exercise.php +++ b/views/exercises/print_cloze_exercise.php @@ -16,9 +16,9 @@ <? endif ?> <? elseif ($exercise->isSelect($blank)): ?> <? foreach ($exercise->task['answers'][$blank] as $index => $option) : ?> - --><?= $index ? ' | ' : '' ?> - <?= Assets::img(vips_image_url('choice_unchecked.svg'), ['style' => 'vertical-align: text-bottom;']) ?> - <span style="border-bottom: 1px dotted black;"><?= htmlReady($option['text']) ?></span><!-- + --><?= $index ? ' | ' : '' ?><!-- + --><?= Assets::img(vips_image_url('choice_unchecked.svg'), ['style' => 'vertical-align: text-bottom;']) ?> <!-- + --><span style="border-bottom: 1px dotted black;"><?= htmlReady($option['text']) ?></span><!-- <? endforeach ?> <? else: ?> --><?= str_repeat('__', $exercise->getInputWidth($blank)) ?><!--