[system] / trunk / pg / macros / PGanswermacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGanswermacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1250 Revision 1267
2403# They provide a good model for how to tweak answer evaluators in special cases. 2403# They provide a good model for how to tweak answer evaluators in special cases.
2404 2404
2405sub anstext { 2405sub anstext {
2406 my $num = shift; 2406 my $num = shift;
2407 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS); 2407 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS);
2408 my $psvnNumber = PG_restricted_eval($main::psvnNumber);
2409 my $probNum = PG_restricted_eval($main::probNum);
2408 my $ans_eval = sub { 2410 my $ans_eval = sub {
2409 my $text = shift; 2411 my $text = shift;
2410 $text = '' unless defined($text); 2412 $text = '' unless defined($text);
2411 my $new_text = "\n$main::psvnNumber-Problem-$main::probNum-Question-$num:\n $text "; # modify entered text 2413 my $new_text = "\npsvnNumber-Problem-$probNum-Question-$num:\n $text "; # modify entered text
2412 my $out = &$ans_eval_template($new_text); # standard evaluator 2414 my $out = &$ans_eval_template($new_text); # standard evaluator
2413 #warn "$QUESTIONNAIRE_ANSWERS"; 2415 #warn "$QUESTIONNAIRE_ANSWERS";
2414 $out->{student_ans} = escapeHTML($text); # restore original entered text 2416 $out->{student_ans} = escapeHTML($text); # restore original entered text
2415 $out->{correct_ans} = "Question $num answered"; 2417 $out->{correct_ans} = "Question $num answered";
2416 $out->{original_student_ans} = escapeHTML($text); 2418 $out->{original_student_ans} = escapeHTML($text);
2419 $ans_eval; 2421 $ans_eval;
2420} 2422}
2421 2423
2422sub ansradio { 2424sub ansradio {
2423 my $num = shift; 2425 my $num = shift;
2426 my $psvnNumber = PG_restricted_eval($main::psvnNumber);
2427 my $probNum = PG_restricted_eval($main::probNum);
2428
2424 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS); 2429 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS);
2425 my $ans_eval = sub { 2430 my $ans_eval = sub {
2426 my $text = shift; 2431 my $text = shift;
2427 $text = '' unless defined($text); 2432 $text = '' unless defined($text);
2428 my $new_text = "\n$main::psvnNumber-Problem-$main::probNum-RADIO-$num:\n $text "; # modify entered text 2433 my $new_text = "\n$psvnNumber-Problem-$probNum-RADIO-$num:\n $text "; # modify entered text
2429 my $out = $ans_eval_template->($new_text); # standard evaluator 2434 my $out = $ans_eval_template->($new_text); # standard evaluator
2430 $out->{student_ans} =escapeHTML($text); # restore original entered text 2435 $out->{student_ans} =escapeHTML($text); # restore original entered text
2431 $out->{original_student_ans} = escapeHTML($text); 2436 $out->{original_student_ans} = escapeHTML($text);
2432 $out; 2437 $out;
2433 }; 2438 };
2436} 2441}
2437 2442
2438sub anstext_non_anonymous { 2443sub anstext_non_anonymous {
2439 ## this emails identifying information 2444 ## this emails identifying information
2440 my $num = shift; 2445 my $num = shift;
2446 my $psvnNumber = PG_restricted_eval($main::psvnNumber);
2447 my $probNum = PG_restricted_eval($main::probNum);
2448 my $studentLogin = PG_restricted_eval($main::studentLogin);
2449 my $studentID = PG_restricted_eval($main::studentID);
2450 my $studentName = PG_restricted_eval($main::studentName);
2451
2452
2441 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS); 2453 my $ans_eval_template = store_ans_at(\$QUESTIONNAIRE_ANSWERS);
2442 my $ans_eval = sub { 2454 my $ans_eval = sub {
2443 my $text = shift; 2455 my $text = shift;
2444 $text = '' unless defined($text); 2456 $text = '' unless defined($text);
2445 my $new_text = "\n$main::psvnNumber-Problem-$main::probNum-Question-$num:\n$main::studentLogin $main::studentID $main::studentName\n$text "; # modify entered text 2457 my $new_text = "\n$psvnNumber-Problem-$probNum-Question-$num:\n$studentLogin $main::studentID $studentName\n$text "; # modify entered text
2446 my $out = &$ans_eval_template($new_text); # standard evaluator 2458 my $out = &$ans_eval_template($new_text); # standard evaluator
2447 #warn "$QUESTIONNAIRE_ANSWERS"; 2459 #warn "$QUESTIONNAIRE_ANSWERS";
2448 $out->{student_ans} = escapeHTML($text); # restore original entered text 2460 $out->{student_ans} = escapeHTML($text); # restore original entered text
2449 $out->{correct_ans} = "Question $num answered"; 2461 $out->{correct_ans} = "Question $num answered";
2450 $out->{original_student_ans} = escapeHTML($text); 2462 $out->{original_student_ans} = escapeHTML($text);
3751##################################### 3763#####################################
3752# This is a model for plug-in problem graders 3764# This is a model for plug-in problem graders
3753##################################### 3765#####################################
3754sub install_problem_grader { 3766sub install_problem_grader {
3755 my $rf_problem_grader = shift; 3767 my $rf_problem_grader = shift;
3756 $main::PG_FLAGS{PROBLEM_GRADER_TO_USE} = $rf_problem_grader; 3768 PG_restricted_eval(q!$main::PG_FLAGS{PROBLEM_GRADER_TO_USE} = $rf_problem_grader!);
3757} 3769}
3758 3770
3759=head4 std_problem_grader 3771=head4 std_problem_grader
3760 3772
3761This is an all-or-nothing grader. A student must get all parts of the problem write 3773This is an all-or-nothing grader. A student must get all parts of the problem write

Legend:
Removed from v.1250  
changed lines
  Added in v.1267

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9