Skip to content

Commit 4752d6f

Browse files
committed
Exercise: Add previously recorded audio and block the buttons when is uploading - refs BT#19115
1 parent c25841c commit 4752d6f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

main/inc/lib/exercise.lib.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,27 @@ function setRemoveLink(dataContext) {
297297

298298
echo $objQuestionTmp->returnRecorder();
299299
}
300-
300+
$fileUrl = $objQuestionTmp->getFileUrl();
301+
if (isset($fileUrl)) {
302+
$s .= '
303+
<div class="col-sm-4 col-sm-offset-4">
304+
<div class="form-group text-center">
305+
<audio src="'.$fileUrl.'" controls></audio>
306+
</div>
307+
</div>
308+
';
309+
}
310+
$s .= '<script>
311+
// The buttons are blocked waiting for the audio file to be uploaded
312+
$(document).ajaxStart(function() {
313+
$("button").attr("disabled", true);
314+
$("button").attr("title", "'.get_lang('WaitingForTheAudioFileToBeUploaded').'");
315+
});
316+
$(document).ajaxComplete(function() {
317+
$("button").attr("disabled", false);
318+
$("button").removeAttr("title");
319+
});
320+
</script>';
301321
$form = new FormValidator('free_choice_'.$questionId);
302322
$config = ['ToolbarSet' => 'TestFreeAnswer'];
303323

0 commit comments

Comments
 (0)