[system] / branches / gage_dev / webwork2 / lib / WeBWorK / ContentGenerator / Problem.pm Repository:
ViewVC logotype

Diff of /branches/gage_dev/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm

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

Revision 736 Revision 737
281 my $pg = $self->{pg}; 281 my $pg = $self->{pg};
282 282
283 ##### translation errors? ##### 283 ##### translation errors? #####
284 284
285 if ($pg->{flags}->{error_flag}) { 285 if ($pg->{flags}->{error_flag}) {
286 return translationError($pg->{errors}, $pg->{body_text}); 286 return $self->errorOutput($pg->{errors}, $pg->{body_text});
287 } 287 }
288 288
289 ##### answer processing ##### 289 ##### answer processing #####
290 290
291 # if answers were submitted: 291 # if answers were submitted:
424 ), 424 ),
425 CGI::endform(); 425 CGI::endform();
426 426
427 # warning output 427 # warning output
428 if ($pg->{warnings} ne "") { 428 if ($pg->{warnings} ne "") {
429 print CGI::hr(), warningOutput($pg->{warnings}); 429 print CGI::hr(), $self->warningOutput($pg->{warnings});
430 } 430 }
431 431
432 # debugging stuff 432 # debugging stuff
433 #print 433 #print
434 # CGI::hr(), 434 # CGI::hr(),
446 446
447 return ""; 447 return "";
448} 448}
449 449
450##### output utilities ##### 450##### output utilities #####
451
452# this is used by ProblemSet.pm too, so don't fuck it up
453sub translationError($$) {
454 my ($error, $details) = @_;
455 return
456 CGI::h2("Software Error"),
457 CGI::p(<<EOF),
458WeBWorK has encountered a software error while attempting to process this problem.
459It is likely that there is an error in the problem itself.
460If you are a student, contact your professor to have the error corrected.
461If you are a professor, please consut the error output below for more informaiton.
462EOF
463 CGI::h3("Error messages"), CGI::blockquote(CGI::pre($error)),
464 CGI::h3("Error context"), CGI::blockquote(CGI::pre($details));
465}
466
467# this is used by ProblemSet.pm too, so don't fuck it up
468sub warningOutput($) {
469 my $warnings = shift;
470
471 return
472 CGI::h2("Software Warnings"),
473 CGI::p(<<EOF),
474WeBWorK has encountered warnings while attempting to process this problem.
475It is likely that this indicates an error or ambiguity in the problem itself.
476If you are a student, contact your professor to have the problem corrected.
477If you are a professor, please consut the error output below for more informaiton.
478EOF
479 CGI::h3("Warning messages"),
480 CGI::blockquote(CGI::pre($warnings)),
481 ;
482}
483 451
484sub attemptResults($$$$$) { 452sub attemptResults($$$$$) {
485 my $self = shift; 453 my $self = shift;
486 my $pg = shift; 454 my $pg = shift;
487 my $showAttemptAnswers = shift; 455 my $showAttemptAnswers = shift;
599 # so we'll just deal with each case explicitly here. there's some code 567 # so we'll just deal with each case explicitly here. there's some code
600 # duplication that can be dealt with later by abstracting out tth/dvipng/etc. 568 # duplication that can be dealt with later by abstracting out tth/dvipng/etc.
601 569
602 my $tex = $answerResult->{preview_latex_string}; 570 my $tex = $answerResult->{preview_latex_string};
603 571
572 return "" unless $tex;
573
604 if ($displayMode eq "plainText") { 574 if ($displayMode eq "plainText") {
605 return $tex; 575 return $tex;
606 } elsif ($displayMode eq "formattedText") { 576 } elsif ($displayMode eq "formattedText") {
607 my $tthCommand = $ce->{externalPrograms}->{tth} 577 my $tthCommand = $ce->{externalPrograms}->{tth}
608 . " -L -f5 -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n" 578 . " -L -f5 -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n"
609 . "\\($tex\\)\n" 579 . "\\(".$tex."\\)\n"
610 . "END_OF_INPUT\n"; 580 . "END_OF_INPUT\n";
611
612 581
613 # call tth 582 # call tth
614 my $result = `$tthCommand`; 583 my $result = `$tthCommand`;
615 if ($?) { 584 if ($?) {
616 return "<b>[tth failed: $? $@]</b>"; 585 return "<b>[tth failed: $? $@]</b>";

Legend:
Removed from v.736  
changed lines
  Added in v.737

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9