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

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

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

Revision 3033 Revision 3034
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.167 2004/11/18 01:45:29 gage Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.168 2004/11/18 16:00:37 gage Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
32use WeBWorK::PG::ImageGenerator; 32use WeBWorK::PG::ImageGenerator;
33use WeBWorK::PG::IO; 33use WeBWorK::PG::IO;
34use WeBWorK::Utils qw(writeLog writeCourseLog encodeAnswers decodeAnswers ref2string makeTempDirectory); 34use WeBWorK::Utils qw(writeLog writeCourseLog encodeAnswers decodeAnswers ref2string makeTempDirectory);
35use WeBWorK::DB::Utils qw(global2user user2global findDefaults); 35use WeBWorK::DB::Utils qw(global2user user2global findDefaults);
36use WeBWorK::Timing; 36use WeBWorK::Timing;
37use URI::Escape;
37 38
38use WeBWorK::Utils::Tasks qw(fake_set fake_problem); 39use WeBWorK::Utils::Tasks qw(fake_set fake_problem);
39 40
40################################################################################ 41################################################################################
41# CGI param interface to this module (up-to-date as of v1.153) 42# CGI param interface to this module (up-to-date as of v1.153)
272 return 273 return
273 CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows)) 274 CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows))
274 . ($showSummary ? CGI::p({class=>'emphasis'},$summary) : ""); 275 . ($showSummary ? CGI::p({class=>'emphasis'},$summary) : "");
275} 276}
276 277
277# sub viewOptions {
278# my ($self) = @_;
279# my $ce = $self->r->ce;
280#
281# # don't show options if we don't have anything to show
282# return if $self->{invalidSet} or $self->{invalidProblem};
283# return unless $self->{isOpen};
284#
285# my $displayMode = $self->{displayMode};
286# my %must = %{ $self->{must} };
287# my %can = %{ $self->{can} };
288# my %will = %{ $self->{will} };
289#
290# my $optionLine;
291# $can{showOldAnswers} and $optionLine .= join "",
292# "Show saved answers?".CGI::br(),
293# CGI::radio_group(
294# -name => "showOldAnswers",
295# -values => [1,0],
296# -default => $will{showOldAnswers},
297# -labels => {
298# 0 => 'No',
299# 1 => 'Yes',
300# },
301# ), .CGI::br();
302#
303# $optionLine and $optionLine .= join "", CGI::br();
304#
305# my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()};
306# my @active_modes = grep { exists $display_modes{$_} }
307# @{$ce->{pg}->{displayModes}};
308# my $modeLine = (scalar(@active_modes) > 1) ?
309# "View equations as:    ".CGI::br().
310# CGI::radio_group(
311# -name => "displayMode",
312# -values => \@active_modes,
313# -default => $displayMode,
314# -linebreak=>'true',
315# -labels => {
316# plainText => "plain",
317# formattedText => "formatted",
318# images => "images",
319# jsMath => "jsMath",
320# asciimath => "asciimath",
321# },
322# ). CGI::br().CGI::hr() : '';
323#
324# return CGI::div({-style=>"border: thin groove; padding: 1ex; margin: 2ex align: left"},
325# $modeLine,
326# $optionLine,
327# CGI::submit(-name=>"redisplay", -label=>"Apply Options"),
328# );
329# }
330 278
331sub previewAnswer { 279sub previewAnswer {
332 my ($self, $answerResult, $imgGen) = @_; 280 my ($self, $answerResult, $imgGen) = @_;
333 my $ce = $self->r->ce; 281 my $ce = $self->r->ce;
334 my $effectiveUser = $self->{effectiveUser}; 282 my $effectiveUser = $self->{effectiveUser};
522 $self->{checkAnswers} = $checkAnswers; 470 $self->{checkAnswers} = $checkAnswers;
523 $self->{previewAnswers} = $previewAnswers; 471 $self->{previewAnswers} = $previewAnswers;
524 $self->{formFields} = $formFields; 472 $self->{formFields} = $formFields;
525 473
526 # get result and send to message 474 # get result and send to message
527 my $success = $r->param("sucess"); 475# my $success = $r->param("success");
528 my $failure = $r->param("failure"); 476# my $failure = $r->param("failure");
477 my $status_message = $r->param("status_message");
529 $self->addbadmessage(CGI::p($failure)) if $failure; 478# $self->addbadmessage(CGI::p($failure)) if $failure;
530 $self->addgoodmessage(CGI::p($success)) if $success; 479# $self->addgoodmessage(CGI::p($success)) if $success;
480 $self->addgoodmessage(CGI::p("$status_message")) if $status_message;
531 481
532 # now that we've set all the necessary variables quit out if the set or problem is invalid 482 # now that we've set all the necessary variables quit out if the set or problem is invalid
533 return if $self->{invalidSet} || $self->{invalidProblem}; 483 return if $self->{invalidSet} || $self->{invalidProblem};
534 484
535 ##### permissions ##### 485 ##### permissions #####
642 592
643 return "" unless $self->{isOpen}; 593 return "" unless $self->{isOpen};
644 return $self->{pg}->{head_text} if $self->{pg}->{head_text}; 594 return $self->{pg}->{head_text} if $self->{pg}->{head_text};
645} 595}
646 596
647sub options { 597# sub options {
648 my ($self) = @_; 598# my ($self) = @_;
649 599# warn "doing options in Problem";
650 return "" if $self->{invalidProblem}; 600# return "" if $self->{invalidProblem};
651 my $sourceFilePathfield = ''; 601# my $sourceFilePathfield = '';
652 if($self->r->param("sourceFilePath")) { 602# if($self->r->param("sourceFilePath")) {
653 $sourceFilePathfield = CGI::hidden(-name => "sourceFilePath", 603# $sourceFilePathfield = CGI::hidden(-name => "sourceFilePath",
654 -value => $self->r->param("sourceFilePath")); 604# -value => $self->r->param("sourceFilePath"));
655 } 605# }
656 606#
657 return join("", 607# return join("",
658 CGI::start_form("POST", $self->{r}->uri), 608# CGI::start_form("POST", $self->{r}->uri),
659 $self->hidden_authen_fields, 609# $self->hidden_authen_fields,
660 $sourceFilePathfield, 610# $sourceFilePathfield,
661 CGI::hr(), 611# CGI::hr(),
662 CGI::start_div({class=>"viewOptions"}), 612# CGI::start_div({class=>"viewOptions"}),
663 $self->viewOptions(), 613# $self->viewOptions(),
664 CGI::end_div(), 614# CGI::end_div(),
665 CGI::end_form() 615# CGI::end_form()
666 ); 616# );
667} 617# }
668 618
669sub siblings { 619sub siblings {
670 my ($self) = @_; 620 my ($self) = @_;
671 my $r = $self->r; 621 my $r = $self->r;
672 my $db = $r->db; 622 my $db = $r->db;
927 } 877 }
928 878
929 $WeBWorK::timer->continue("end answer processing") if defined($WeBWorK::timer); 879 $WeBWorK::timer->continue("end answer processing") if defined($WeBWorK::timer);
930 880
931 ##### output ##### 881 ##### output #####
932
933 print CGI::start_div({class=>"problemHeader"});
934
935 # custom message for editor 882 # custom message for editor
936 if ($authz->hasPermissions($user, "modify_problem_sets") and defined $editMode) { 883 if ($authz->hasPermissions($user, "modify_problem_sets") and defined $editMode) {
937 if ($editMode eq "temporaryFile") { 884 if ($editMode eq "temporaryFile") {
938 print CGI::p(CGI::i("Editing temporary file: ", $problem->source_file)); 885 print CGI::p(CGI::div({class=>'temporaryFile'}, "Viewing temporary file: ", $problem->source_file));
939 } elsif ($editMode eq "savedFile") { 886 } elsif ($editMode eq "savedFile") {
940 # taken care of in the initialization phase 887 # taken care of in the initialization phase
941 } 888 }
942 } 889 }
890 print CGI::start_div({class=>"problemHeader"});
891
892
943 893
944 # attempt summary 894 # attempt summary
945 #FIXME -- the following is a kludge: if showPartialCorrectAnswers is negative don't show anything. 895 #FIXME -- the following is a kludge: if showPartialCorrectAnswers is negative don't show anything.
946 # until after the due date 896 # until after the due date
947 # do I need to check $will{showCorrectAnswers} to make preflight work?? 897 # do I need to check $will{showCorrectAnswers} to make preflight work??

Legend:
Removed from v.3033  
changed lines
  Added in v.3034

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9