[system] / trunk / pg / lib / Value / AnswerChecker.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value/AnswerChecker.pm

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

Revision 6247 Revision 6248
364# Lay out a matrix of answer rules 364# Lay out a matrix of answer rules
365# 365#
366sub ans_matrix { 366sub ans_matrix {
367 my $self = shift; 367 my $self = shift;
368 my ($extend,$name,$rows,$cols,$size,$open,$close,$sep) = @_; 368 my ($extend,$name,$rows,$cols,$size,$open,$close,$sep) = @_;
369 my $named_extension = pgRef('NAMED_ANS_RULE_EXTENSION'); 369 #my $named_extension = pgRef('NAMED_ANS_RULE_EXTENSION');
370 my $new_name = pgRef('RECORD_FORM_LABEL'); 370 my $named_extension = pgRef('NAMED_ANS_ARRAY_EXTENSION');
371 my $new_name = sub {@_}; # pgRef('RECORD_EXTRA_ANSWERS');
371 my $HTML = ""; my $ename = $name; 372 my $HTML = ""; my $ename = $name;
372 if ($name eq '') { 373 if ($name eq '') {
373 my $n = pgCall('inc_ans_rule_count'); 374 #my $n = pgCall('inc_ans_rule_count');
374 $name = pgCall('NEW_ANS_NAME',$n); 375 $name = pgCall('NEW_ANS_NAME',$n);
376 #$name = pgCall('NEW_ARRAY_NAME',$n);
375 $ename = $answerPrefix.$n; 377 $ename = "${answerPrefix}_${name}_";
376 } 378 }
377 $self->{ans_name} = $ename; 379 $self->{ans_name} = $ename;
378 $self->{ans_rows} = $rows; 380 $self->{ans_rows} = $rows;
379 $self->{ans_cols} = $cols; 381 $self->{ans_cols} = $cols;
380 my @array = (); 382 my @array = ();
381 foreach my $i (0..$rows-1) { 383 foreach my $i (0..$rows-1) {
382 my @row = (); 384 my @row = ();
383 foreach my $j (0..$cols-1) { 385 foreach my $j (0..$cols-1) {
384 if ($i == 0 && $j == 0) { 386 if ($i == 0 && $j == 0) {
387 if ($extend) {
388 push(@row,&$named_extension(&$new_name($name),$size,ans_label=>$name));
385 if ($extend) {push(@row,&$named_extension(&$new_name($name),$size))} 389 #push(@row,&$named_extension(&$new_name($name),$size))
390 }else {
386 else {push(@row,pgCall('NAMED_ANS_RULE',$name,$size))} 391 push(@row,pgCall('NAMED_ANS_RULE',$name,$size))
392 }
387 } else { 393 } else {
388 push(@row,&$named_extension(&$new_name(ANS_NAME($ename,$i,$j)),$size)); 394 push(@row,&$named_extension(&$new_name(ANS_NAME($ename,$i,$j)),$size,ans_label=>$name));
395 #push(@row,&$named_extension(&$new_name(ANS_NAME($ename,$i,$j)),$size,ans_label=>$name));
389 } 396 }
390 } 397 }
391 push(@array,[@row]); 398 push(@array,[@row]);
392 } 399 }
393 $self->format_matrix([@array],open=>$open,close=>$close,sep=>$sep); 400 $self->format_matrix([@array],open=>$open,close=>$close,sep=>$sep);

Legend:
Removed from v.6247  
changed lines
  Added in v.6248

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9