[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 793 Revision 794
333 $problem->num_correct."\t". 333 $problem->num_correct."\t".
334 $problem->num_incorrect 334 $problem->num_incorrect
335 ); 335 );
336 } 336 }
337 } 337 }
338 # logging student answers
339 my $pastAnswerLog = undef;
340 if (defined( $self->{courseEnvironment}->{webworkFiles}->{logs}->{'pastAnswerList'} )) {
341
342 $pastAnswerLog = $self->{courseEnvironment}->{webworkFiles}->{logs}->{'pastAnswerList'};
343
344 if ($submitAnswers and defined($pastAnswerLog) ) {
345 my $answerString = "";
346 my %answerHash = %{ $pg->{answers} };
347 $answerString = $answerString . $answerHash{$_}->{original_student_ans}."\t"
348 foreach (sort keys %answerHash);
349 writeLog($self->{courseEnvironment}, "pastAnswerList",
350 '|'.$problem->login_id.
351 '|'.$problem->set_id.
352 '|'.$problem->id.'|'."\t".
353 time()."\t".
354 $answerString,
355
356 );
357
358 }
359
360 }
361 # end logging student answers
338 362
339 ##### output ##### 363 ##### output #####
340 print CGI::start_div({class=>"problemHeader"}); 364 print CGI::start_div({class=>"problemHeader"});
341 # attempt summary 365 # attempt summary
342 if ($submitAnswers or $will{showCorrectAnswers}) { 366 if ($submitAnswers or $will{showCorrectAnswers}) {
380 -label=>"Check Answers") 404 -label=>"Check Answers")
381 : ""), 405 : ""),
382 CGI::submit(-name=>"previewAnswers", 406 CGI::submit(-name=>"previewAnswers",
383 -label=>"Preview Answers"), 407 -label=>"Preview Answers"),
384 ); 408 );
409 print CGI::end_div();
410
411 print CGI::start_div({class=>"scoreSummary"});
385 # score summary 412 # score summary
386 my $attempts = $problem->num_correct + $problem->num_incorrect; 413 my $attempts = $problem->num_correct + $problem->num_incorrect;
387 my $attemptsNoun = $attempts != 1 ? "times" : "time"; 414 my $attemptsNoun = $attempts != 1 ? "times" : "time";
388 my $lastScore = int ($problem->status * 100) . "%"; 415 my $lastScore = int ($problem->status * 100) . "%";
389 my ($attemptsLeft, $attemptsLeftNoun); 416 my ($attemptsLeft, $attemptsLeftNoun);
412 $problem->attempted 439 $problem->attempted
413 ? "Your recorded score is $lastScore." . CGI::br() 440 ? "Your recorded score is $lastScore." . CGI::br()
414 : "", 441 : "",
415 $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining." 442 $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining."
416 ); 443 );
417 444 print CGI::end_div();
445 print CGI::hr(), CGI::start_div({class=>"viewOptions"});
418 print 446 print
419 $self->viewOptions(), 447 $self->viewOptions(),CGI::end_div(),
420 CGI::endform(); 448 CGI::endform();
421 449
422 print CGI::end_div(); 450 print CGI::start_div({class=>"problemFooter"});
423 # feedback form 451 # feedback form
424 my $ce = $self->{courseEnvironment}; 452 my $ce = $self->{courseEnvironment};
425 my $root = $ce->{webworkURLs}->{root}; 453 my $root = $ce->{webworkURLs}->{root};
426 my $courseName = $ce->{courseName}; 454 my $courseName = $ce->{courseName};
427 my $feedbackURL = "$root/$courseName/feedback/"; 455 my $feedbackURL = "$root/$courseName/feedback/";
456
457 # arguments for answer inspection button
458 my $prof_url = $ce->{webworkURLs}->{oldProf};
459 my $cgi_url = $prof_url;
460 $cgi_url=~ s|/[^/]*$||; # clip profLogin.pl
461 my $authen_args = $self->url_authen_args();
462 my $showPastAnswersURL = "$cgi_url/showPastAnswers.pl";
463
464 #print feedback form
428 print 465 print
429 CGI::startform("POST", $feedbackURL), 466 CGI::start_form(-method=>"POST", -action=>$feedbackURL),"\n",
430 $self->hidden_authen_fields, 467 $self->hidden_authen_fields,"\n",
431 CGI::hidden("module", __PACKAGE__), 468 CGI::hidden("module", __PACKAGE__),"\n",
432 CGI::hidden("set", $set->id), 469 CGI::hidden("set", $set->id),"\n",
433 CGI::hidden("problem", $problem->id), 470 CGI::hidden("problem", $problem->id),"\n",
434 CGI::hidden("displayMode", $self->{displayMode}), 471 CGI::hidden("displayMode", $self->{displayMode}),"\n",
435 CGI::hidden("showOldAnswers", $will{showOldAnswers}), 472 CGI::hidden("showOldAnswers", $will{showOldAnswers}),"\n",
436 CGI::hidden("showCorrectAnswers", $will{showCorrectAnswers}), 473 CGI::hidden("showCorrectAnswers", $will{showCorrectAnswers}),"\n",
437 CGI::hidden("showHints", $will{showHints}), 474 CGI::hidden("showHints", $will{showHints}),"\n",
438 CGI::hidden("showSolutions", $will{showSolutions}), 475 CGI::hidden("showSolutions", $will{showSolutions}),"\n",
439 CGI::p({-align=>"right"}, 476 CGI::p({-align=>"right"},
440 CGI::submit(-name=>"feedbackForm", -label=>"Send Feedback") 477 CGI::submit(-name=>"feedbackForm", -label=>"Send Feedback")
441 ), 478 ),
479 CGI::endform(),"\n";
480 # print answer inspection button
481 if ($self->{permissionLevel} >0) {
482
483
484 print "\n",
485 CGI::start_form(-method=>"POST",-action=>$showPastAnswersURL,-target=>"information"),"\n",
486 $self->hidden_authen_fields,"\n",
487 CGI::hidden(-name => 'course', -value=>$courseName), "\n",
488 CGI::hidden(-name => 'probNum', -value=>$problem->id), "\n",
489 CGI::hidden(-name => 'setNum', -value=>$problem->set_id), "\n",
490 CGI::hidden(-name => 'User', -value=>$problem->login_id), "\n",
491 CGI::submit(-name => 'action', -value=>'Show Past Answers'), "\n",
442 CGI::endform(); 492 CGI::endform();
443 493
494
495
496 }
497 print CGI::end_div();
498 # end answer inspection button
444 # warning output 499 # warning output
445 if ($pg->{warnings} ne "") { 500 if ($pg->{warnings} ne "") {
446 print CGI::hr(), $self->warningOutput($pg->{warnings}); 501 print CGI::hr(), $self->warningOutput($pg->{warnings});
447 } 502 }
448 503
630 } else { 685 } else {
631 return "<b>[math2img failed]</b>"; 686 return "<b>[math2img failed]</b>";
632 } 687 }
633 } 688 }
634} 689}
690##### logging subroutine ####
691
692
635 693
636##### permission queries ##### 694##### permission queries #####
637 695
638# this stuff should be abstracted out into the permissions system 696# this stuff should be abstracted out into the permissions system
639# however, the permission system only knows about things in the 697# however, the permission system only knows about things in the

Legend:
Removed from v.793  
changed lines
  Added in v.794

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9