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

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm

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

Revision 395 Revision 396
1package WeBWorK::ContentGenerator::Problem; 1package WeBWorK::ContentGenerator::Problem;
2our @ISA = qw(WeBWorK::ContentGenerator); 2our @ISA = qw(WeBWorK::ContentGenerator);
3use lib '/Users/gage/webwork/xmlrpc/daemon'; 3
4use strict;
5use warnings;
6use lib '/home/malsyned/xmlrpc/daemon';
4use lib '/Users/gage/webwork-modperl/lib'; 7use lib '/Users/gage/webwork-modperl/lib';
5use PGtranslator5; 8use PGtranslator5;
6use WeBWorK::ContentGenerator; 9use WeBWorK::ContentGenerator;
7use Apache::Constants qw(:common); 10use Apache::Constants qw(:common);
8 11
9############################################################################### 12###############################################################################
10# Configuration 13# Configuration
11############################################################################### 14###############################################################################
12 15
13my $COURSE_SCRIPTS_DIRECTORY = '/Users/gage/webwork/system/courseScripts/'; 16my $COURSE_SCRIPTS_DIRECTORY = '/home/malsyned/webwork/system/courseScripts/';
14my $MACRO_DIRECTORY = '/Users/gage/webwork/courseData/templates/macro/'; 17my $MACRO_DIRECTORY = '/home/malsyned/webwork-modperl/courses/demoCourse/templates/macros/';
15my $TEMPLATE_DIRECTORY = '/Users/gage/webwork/rochester_problib/'; 18my $TEMPLATE_DIRECTORY = '/home/malsyned/rochester_problib/';
16my $TEMP_URL = 'http://127.0.0.1/~gage/rochester_problibtmp/'; 19my $TEMP_URL = 'http://127.0.0.1/~gage/rochester_problibtmp/';
17##my $HTML_DIRECTORY = '/Users/gage/Sites/rochester_problib/' #already obtained from courseEnvironment 20##my $HTML_DIRECTORY = '/Users/gage/Sites/rochester_problib/' #already obtained from courseEnvironment
18my $HTML_URL = 'http://127.0.0.1/~gage/rochester_problib/'; 21my $HTML_URL = 'http://127.0.0.1/~gage/rochester_problib/';
22my $TEMP_DIRECTORY = ""; # has to be here... for now
19 23
20############################################################################### 24###############################################################################
21# End configuration 25# End configuration
22############################################################################### 26###############################################################################
23 27
41############################################################################### 45###############################################################################
42# First some dummy values to use for testing. 46# First some dummy values to use for testing.
43# These should be available from the problemEnvironment(it might be ok to assume that PG and dangerousMacros 47# These should be available from the problemEnvironment(it might be ok to assume that PG and dangerousMacros
44# live in the courseScripts (system level macros) directory. 48# live in the courseScripts (system level macros) directory.
45 49
46print STDERR "Begin intitalization\n"; 50#print STDERR "Begin intitalization\n";
47my $dummy_envir = { courseScriptsDirectory => $COURSE_SCRIPTS_DIRECTORY, 51my $dummy_envir = { courseScriptsDirectory => $COURSE_SCRIPTS_DIRECTORY,
48 displayMode => 'HTML_tth', 52 displayMode => 'HTML_tth',
49 macroDirectory => $MACRO_DIRECTORY, 53 macroDirectory => $MACRO_DIRECTORY,
50 cgiURL => 'foo_cgiURL'}; 54 cgiURL => 'foo_cgiURL'};
51 55
61); 65);
62my @EXTRA_PACKAGES = ( "AlgParserWithImplicitExpand", "Expr", 66my @EXTRA_PACKAGES = ( "AlgParserWithImplicitExpand", "Expr",
63 "ExprWithImplicitExpand", "AnswerEvaluator", 67 "ExprWithImplicitExpand", "AnswerEvaluator",
64 68
65); 69);
66$INITIAL_MACRO_PACKAGES = <<END_OF_TEXT; 70my $INITIAL_MACRO_PACKAGES = <<END_OF_TEXT;
67 DOCUMENT(); 71 DOCUMENT();
68 loadMacros( 72 loadMacros(
69 "PGbasicmacros.pl", 73 "PGbasicmacros.pl",
70 "PGchoicemacros.pl", 74 "PGchoicemacros.pl",
71 "PGanswermacros.pl", 75 "PGanswermacros.pl",
97 my ($self, $problem_set, $problem) = @_; 101 my ($self, $problem_set, $problem) = @_;
98 my $r = $self->{r}; 102 my $r = $self->{r};
99 my $courseEnvironment = $self->{courseEnvironment}; 103 my $courseEnvironment = $self->{courseEnvironment};
100 my $user = $r->param('user'); 104 my $user = $r->param('user');
101 105
106 my $rh = {}; # this needs to be set to a hash containing CGI params
102 107
103 my $SOURCE1 = readFile('set0/prob1c.pg'); 108
109 my $SOURCE1 = readFile("$problem_set/$problem.pg");
104 print STDERR "SOURCEFILE: \n$SOURCE1\n\n"; 110 print STDERR "SOURCEFILE: \n$SOURCE1\n\n";
105 111
106 ########################################################################### 112 ###########################################################################
107 # The pg problem class should have a method for installing it's problemEnvironment 113 # The pg problem class should have a method for installing it's problemEnvironment
108 ########################################################################### 114 ###########################################################################
109 115
110 $problemEnvir_rh = defineProblemEnvir($self); 116 my $problemEnvir_rh = defineProblemEnvir($self);
111 117
112 118
113 ################################################################################## 119 ##################################################################################
114 # Prime the PGtranslator object and set it loose 120 # Prime the PGtranslator object and set it loose
115 ################################################################################## 121 ##################################################################################
215 $pt ->translate(); 221 $pt ->translate();
216 222
217 #print problem output 223 #print problem output
218 print "Problem goes here<p>\n"; 224 print "Problem goes here<p>\n";
219 print "Problem output <br>\n"; 225 print "Problem output <br>\n";
220 print "################################################################################<br<br>"; 226 print "################################################################################<br><br>";
221 print ${$pt->r_text()}; 227 print ${$pt->r_text()};
222 print "<br><br>################################################################################<br>"; 228 print "<br><br>################################################################################<br>";
223 print "<p>End of problem output<br>"; 229 print "<p>End of problem output<br>";
224 230
225 231
291 answers => $pt->rh_evaluated_answers, 297 answers => $pt->rh_evaluated_answers,
292 errors => $pt-> errors(), 298 errors => $pt-> errors(),
293 WARNINGS => $WARNINGS, #encode_base64($WARNINGS ), 299 WARNINGS => $WARNINGS, #encode_base64($WARNINGS ),
294 problem_result => $rh_problem_result, 300 problem_result => $rh_problem_result,
295 problem_state => $rh_problem_state, 301 problem_state => $rh_problem_state,
296 PG_flag => \%PG_flag 302 PG_flag => \%PG_FLAGS
297 }; 303 };
298 ########################################################################################## 304 ##########################################################################################
299 # Debugging printout of environment tables 305 # Debugging printout of environment tables
300 ########################################################################################## 306 ##########################################################################################
301 307
548 <BR>\n Use the back button to return to the previous page and recheck your entries.<BR>\n"; 554 <BR>\n Use the back button to return to the previous page and recheck your entries.<BR>\n";
549 exit(0); 555 exit(0);
550 } 556 }
551 557
552 $SIG{'FPE'} = \&PG_floating_point_exception_handler; 558 $SIG{'FPE'} = \&PG_floating_point_exception_handler;
553 559#!/usr/bin/perl -w
554 sub PG_warnings_handler { 560 sub PG_warnings_handler {
555 my @input = @_; 561 my @input = @_;
556 my $msg_string = longmess(@_); 562 my $msg_string = longmess(@_);
557 my @msg_array = split("\n",$msg_string); 563 my @msg_array = split("\n",$msg_string);
558 my $out_string = ''; 564 my $out_string = '';

Legend:
Removed from v.395  
changed lines
  Added in v.396

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9