From: tjhunt Date: Thu, 28 Aug 2008 01:48:43 +0000 (+0000) Subject: MDL-8475 - Better handling of blank answer - further changes to make it even more... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=94a6d656a62a1a1c397f4dacd31ab7d7249fe1a0;p=moodle.git MDL-8475 - Better handling of blank answer - further changes to make it even more robust. Also, make the same changes to the shortanswer question type that were already made to the numerical question type. --- diff --git a/lang/en_utf8/qtype_shortanswer.php b/lang/en_utf8/qtype_shortanswer.php index f79f8cd0c9..9a5d85ba38 100644 --- a/lang/en_utf8/qtype_shortanswer.php +++ b/lang/en_utf8/qtype_shortanswer.php @@ -2,4 +2,5 @@ $string['addmoreanswerblanks'] = 'Blanks for {no} More Answers'; $string['answerno'] = 'Answer $a'; $string['filloutoneanswer'] = 'You must provide at least one possible answer. Answers left blank will not be used. \'*\' can be used as a wildcard to match any characters. The first matching answer will be used to determine the score and feedback.'; +$string['answermustbegiven'] = 'You must enter an answer if there is a grade or feedback.'; ?> \ No newline at end of file diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 4a9fe3a271..5b8b52489e 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -618,6 +618,19 @@ function is_number($value) { } } +/** + * This function is useful for testing whether something you got back from + * the HTML editor actually contains anything. Sometimes the HTML editor + * appear to be empty, but actually you get back a
tag or something. + * + * @param string $string a string containing HTML. + * @return boolean does the string contain any actual content - that is text, + * images, objcts, etc. + */ +function html_is_blank($string) { + return trim(strip_tags($string, '