From: nfreear Date: Wed, 21 Nov 2007 14:50:32 +0000 (+0000) Subject: Fixes reopened bug MDL-7472, "Explicitly label radio buttons in Survey" - removes... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=532f494d9624053a2b61d200aba29ad9834616f5;p=moodle.git Fixes reopened bug MDL-7472, "Explicitly label radio buttons in Survey" - removes use of USER->screenreader using get_accesshide + many other accessibility fixes. --- diff --git a/lang/en_utf8/survey.php b/lang/en_utf8/survey.php index 21a3cfc1b7..e33f3c1494 100644 --- a/lang/en_utf8/survey.php +++ b/lang/en_utf8/survey.php @@ -193,6 +193,7 @@ $string['question'] = 'Question'; $string['questions'] = 'Questions'; $string['questionsnotanswered'] = 'Some of the multiple choice questions have not been answered.'; $string['report'] = 'Survey report'; +$string['responses'] = 'Responses'; $string['savednotes'] = 'Your notes were saved'; $string['scaleagree5'] = 'Strongly disagree,Somewhat disagree,Neither agree nor disagree,Somewhat agree,Strongly agree'; $string['scales'] = 'Scales'; diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 1f42a9ca90..5db869e9a1 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -349,14 +349,15 @@ function survey_shorten_name ($name, $numwords) { function survey_print_multi($question) { - GLOBAL $USER, $db, $qnum, $checklist; + global $USER, $db, $qnum, $checklist; $stripreferthat = get_string("ipreferthat", "survey"); $strifoundthat = get_string("ifoundthat", "survey"); - echo "
\n"; - echo "$question->text
"; - echo "
"; - echo ""; + $strdefault = get_string('default'); + $strresponses = get_string('responses', 'survey'); + + print_heading($question->text, null, 3, 'questiontext'); + echo "\n
"; $options = explode( ",", $question->options); $numoptions = count($options); @@ -367,20 +368,21 @@ function survey_print_multi($question) { } else { $P = ""; } - - if ($oneanswer) { - echo ""; - } else { - echo ""; - } + echo ""; while (list ($key, $val) = each ($options)) { - echo "\n"; + echo "\n"; + } + echo "\n"; + + if ($oneanswer) { + echo "\n"; + } else { + echo "\n"; } - echo "\n"; $subquestions = get_records_list("survey_questions", "id", $question->multi); - + foreach ($subquestions as $q) { $qnum++; $rowclass = survey_question_rowclass($qnum); @@ -388,54 +390,61 @@ function survey_print_multi($question) { $q->text = get_string($q->text, "survey"); } - echo ""; + echo ""; if ($oneanswer) { - echo ""; - echo ""; - for ($i=1;$i<=$numoptions;$i++) { - $screenreader = !empty($USER->screenreader)?"
":''; - echo ""; + echo "\n"; + for ($i=1;$i<=$numoptions;$i++) { + $hiddentext = get_accesshide($options[$i-1]); + $id = "q$P" . $q->id . "_$i"; + echo ""; } - echo ""; + $default = get_accesshide($strdefault, 'label', '', "for=\"q$P$q->id\""); + echo ""; $checklist["q$P$q->id"] = $numoptions; } else { // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly. - echo ""; + echo ""; - echo ""; + echo "$stripreferthat   "; + echo "$q->text\n"; for ($i=1;$i<=$numoptions;$i++) { - $screenreader = !empty($USER->screenreader)?"
":''; - echo ""; + $hiddentext = get_accesshide($options[$i-1]); + $id = "qP" . $q->id . "_$i"; + echo ""; } - echo ""; + $default = get_accesshide($strdefault, 'label', '', "for=\"qP$q->id\""); + echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo "\n"; for ($i=1;$i<=$numoptions;$i++) { - $screenreader = !empty($USER->screenreader)?"
":''; - echo ""; + $hiddentext = get_accesshide($options[$i-1]); + $id = "q" . $q->id . "_$i"; + echo ""; } - echo ""; + $default = get_accesshide($strdefault, 'label', '', "for=\"q$q->id\""); + echo ""; $checklist["qP$q->id"] = $numoptions; $checklist["q$q->id"] = $numoptions; } echo "\n"; - } echo "
$question->intro
$question->intro
$strresponses$val$val 
$question->intro
$question->intro
 
$qnum$q->text".$screenreader."id\" id=\"q$P" . $q->id . "_$i\" value=\"$i\" alt=\"$i\" />"; + echo "$qnum   "; + echo $q->text ."id\" value=\"0\" checked=\"checked\" alt=\"0\" />id\" id=\"q$P" . $q->id . "_D\" value=\"0\" checked=\"checked\" />$default$qnum"; + echo "$qnum   "; $qnum++; - echo "$stripreferthat $q->text".$screenreader."id\" id=\"qP" . $q->id . "_$i\" value=\"$i\" alt=\"$i\"/>id\" value=\"0\" checked=\"checked\" alt=\"0\" />id\" id=\"qP$q->id\" value=\"0\" checked=\"checked\" />$default
$qnum$strifoundthat $q->text
"; + echo "$qnum   "; + echo "$strifoundthat   "; + echo "$q->text".$screenreader."id\" id=\"q" . $q->id . "_$i\" value=\"$i\" alt=\"$i\" />id\" value=\"0\" checked=\"checked\" alt=\"0\" />id\" id=\"q$q->id\" value=\"0\" checked=\"checked\" />$default
"; - echo "
"; } function survey_print_single($question) { - GLOBAL $db, $qnum; + global $db, $qnum; $rowclass = survey_question_rowclass(0); @@ -444,17 +453,17 @@ function survey_print_single($question) { echo "
\n"; echo "\n"; echo ""; - echo ""; - echo "\n"; - echo "\n"; + echo "
$qnum$question->text\n"; + echo "\n"; if ($question->type == 0) { // Plain text field - echo ""; + echo ""; } else if ($question->type > 0) { // Choose one of a number $strchoose = get_string("choose"); - echo "id\" id=\"q$question->id\">"; echo ""; $options = explode( ",", $question->options); foreach ($options as $key => $val) { @@ -468,7 +477,7 @@ function survey_print_single($question) { notify("This question type not supported yet"); } - echo "
"; + echo ""; } diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index c2d6521a4c..3116d48873 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -4023,34 +4023,35 @@ table.quizreviewsummary td.cell { } .smalltext { - font-size:0.6em; + font-size: 0.75em; } -.smalltextcell, -.screenreadertext { - width:10%; - text-align:center; +#surveyform th { + font-weight: normal; + text-align: left; +} +#surveyform th.hresponse { + text-align: center; + width: 9%; +} + +.rblock label { + display: block; + text-align: center; } .foundthat, .preferthat { - width:10%; white-space: nowrap; } -.qnumtopcell { - width:10px; - vertical-align:top; -} - .qnummiddlecell { - width:10px; vertical-align:middle; } .optioncell { - width:40%; - vertical-align:middle; + width: 50%; + vertical-align: top; } .buttoncell {