Parent Directory
|
Revision Log
update to work with Apache2
1 #!/usr/local/bin/perl -w 2 3 # Copyright (C) 2001 Michael Gage 4 5 6 7 package WebworkWebservice::RenderProblem; 8 use WebworkWebservice; 9 use base qw(WebworkWebservice); 10 11 my $debugXmlCode=1; # turns on the filter for debugging XMLRPC and SOAP code 12 local(*DEBUGCODE); 13 14 BEGIN { 15 $main::VERSION = "2.1"; 16 } 17 18 19 20 use strict; 21 use sigtrap; 22 use Carp; 23 use Safe; 24 #use Apache; 25 use WeBWorK::CourseEnvironment; 26 use WeBWorK::PG::Translator; 27 use WeBWorK::PG::Local; 28 use WeBWorK::DB; 29 use WeBWorK::Constants; 30 use WeBWorK::Utils qw(runtime_use formatDateTime makeTempDirectory); 31 use WeBWorK::DB::Utils qw(global2user user2global); 32 use WeBWorK::Utils::Tasks qw(fake_set fake_problem); 33 use WeBWorK::PG::IO; 34 use WeBWorK::PG::ImageGenerator; 35 use Benchmark; 36 use MIME::Base64 qw( encode_base64 decode_base64); 37 38 #print "rereading Webwork\n"; 39 40 41 our $WW_DIRECTORY = $WebworkWebservice::WW_DIRECTORY; 42 our $PG_DIRECTORY = $WebworkWebservice::PG_DIRECTORY; 43 our $COURSENAME = $WebworkWebservice::COURSENAME; 44 our $HOST_NAME = $WebworkWebservice::HOST_NAME; 45 our $HOSTURL ="http://$HOST_NAME:80"; 46 our $ce =$WebworkWebservice::SeedCE; 47 # create a local course environment for some course 48 $ce = WeBWorK::CourseEnvironment->new($WW_DIRECTORY, "", "", $COURSENAME); 49 #print "\$ce = \n", WeBWorK::Utils::pretty_print_rh($ce); 50 51 52 #other services 53 # File variables 54 #our $WARNINGS=''; 55 56 57 # imported constants 58 59 my $COURSE_TEMP_DIRECTORY = $ce->{courseDirs}->{html_tmp}; 60 my $COURSE_TEMP_URL = $HOSTURL.$ce->{courseURLs}->{html_tmp}; 61 62 my $pgMacrosDirectory = $ce->{pg_dir}.'/macros/'; 63 my $macroDirectory = $ce->{courseDirs}->{macros}.'/'; 64 my $templateDirectory = $ce->{courseDirs}->{templates}; 65 66 my %PG_environment = $ce->{pg}->{specialPGEnvironmentVars}; 67 68 69 use constant DISPLAY_MODES => { 70 # display name # mode name 71 tex => "TeX", 72 plainText => "HTML", 73 formattedText => "HTML_tth", 74 images => "HTML_dpng", 75 jsMath => "HTML_jsMath", 76 asciimath => "HTML_asciimath", 77 }; 78 79 use constant DISPLAY_MODE_FAILOVER => { 80 TeX => [], 81 HTML => [], 82 HTML_tth => [ "HTML", ], 83 HTML_dpng => [ "HTML_tth", "HTML", ], 84 HTML_jsMath => [ "HTML_dpng", "HTML_tth", "HTML", ], 85 HTML_asciimath => [ "HTML_dpng", "HTML_tth", "HTML", ], 86 # legacy modes -- these are not supported, but some problems might try to 87 # set the display mode to one of these values manually and some macros may 88 # provide rendered versions for these modes but not the one we want. 89 Latex2HTML => [ "TeX", "HTML", ], 90 HTML_img => [ "HTML_dpng", "HTML_tth", "HTML", ], 91 }; 92 93 94 95 96 97 98 99 sub renderProblem { 100 101 my $rh = shift; 102 103 104 ########################################### 105 # Grab the course name, if this request is going to depend on 106 # some course other than the default course 107 ########################################### 108 my $courseName; 109 my $ce; 110 my $db; 111 my $user; 112 my $beginTime = new Benchmark; 113 if (defined($rh->{course}) and $rh->{course}=~/\S/ ) { 114 $courseName = $rh->{course}; 115 } else { 116 $courseName = $COURSENAME; 117 # use the default $ce 118 } 119 #FIXME put in check to make sure the course exists. 120 eval { 121 $ce = WeBWorK::CourseEnvironment->new($WW_DIRECTORY, "", "", $courseName); 122 # Create database object for this course 123 $db = WeBWorK::DB->new($ce->{dbLayout}); 124 }; 125 # $ce->{pg}->{options}->{catchWarnings}=1; #FIXME warnings aren't automatically caught 126 # when using xmlrpc -- turn this on in the daemon2_course. 127 #^FIXME need better way of determining whether the course actually exists. 128 if ($@) { 129 $ce = WeBWorK::CourseEnvironment->new($WW_DIRECTORY, "", "", $COURSENAME); 130 $db = WeBWorK::DB->new($ce->{dbLayout}); 131 } 132 my $user = $rh->{user}; 133 $user = 'gage' unless defined $user and $user =~/\S/; 134 135 ########################################### 136 # Authenticate this request 137 ########################################### 138 139 140 141 ########################################### 142 # Determine the authorization level (permissions) 143 ########################################### 144 145 146 147 148 ########################################### 149 # Determine the method for accessing data 150 ########################################### 151 my $problem_source_access = $rh->{problem_source_access}; 152 # One of 153 # source_from_course_set_problem 154 # source_from_source_file_path 155 # source_from_request 156 157 my $data_access = $rh->{data_access}; 158 # One of 159 # data_from_course 160 # data_from_request 161 162 ########################################### 163 # Determine an effective user for this interaction 164 # or create one if it is not given 165 # In order: use effectiveUserName, studentLogin, or user or 'foobar' 166 ########################################### 167 my $effectiveUserName; 168 if (defined($rh->{effectiveUser}) and $rh->{effectiveUser}=~/\S/ ) { 169 $effectiveUserName = $rh->{effectiveUser}; 170 } elsif (defined($rh->{envir}->{studentLogin}) and $rh->{envir}->{studentLogin}=~/\S/ ) { 171 $effectiveUserName = $rh->{envir}->{studentLogin}; 172 } elsif (defined($user) and $user =~ /\S/ ) { 173 $effectiveUserName = $user; 174 } else { 175 $effectiveUserName = 'foobar'; 176 } 177 ################################################## 178 my $effectiveUser = $db->getUser($effectiveUserName); # checked 179 my $effectiveUserPermissionLevel; 180 my $effectiveUserPassword; 181 unless (defined $effectiveUser ) { 182 $effectiveUser = $db->newUser; 183 $effectiveUserPermissionLevel = $db->newPermissionLevel; 184 $effectiveUserPassword = $db->newPassword; 185 $effectiveUser->user_id($effectiveUserName); 186 $effectiveUserPermissionLevel->user_id($effectiveUserName); 187 $effectiveUserPassword->user_id($effectiveUserName); 188 $effectiveUserPassword->password(''); 189 $effectiveUser->last_name($rh->{envir}->{studentName}|| 'foobar'); 190 $effectiveUser->first_name(''); 191 $effectiveUser->student_id($rh->{envir}->{studentID}|| 'foobar'); 192 $effectiveUser->email_address($rh->{envir}->{email}|| ''); 193 $effectiveUser->section($rh->{envir}->{section} ||''); 194 $effectiveUser->recitation($rh->{envir}->{recitation} ||''); 195 $effectiveUser->comment(''); 196 $effectiveUser->status('C'); 197 $effectiveUser->password($rh->{envir}->{studentID}|| 'foobar'); 198 $effectiveUserPermissionLevel->permission(0); 199 } 200 #FIXME these will fail if the keys are not defined within the environment. 201 ########################################### 202 # Insure that set and problem are defined 203 # Define the set and problem information from 204 # data in the environment if necessary 205 ########################################### 206 # determine the set name and the set problem number 207 my $setName = (defined($rh->{envir}->{setNumber}) ) ? $rh->{envir}->{setNumber} : ''; 208 my $problemNumber = (defined($rh->{envir}->{probNum}) ) ? $rh->{envir}->{probNum} : 1 ; 209 my $problemSeed = (defined($rh->{envir}->{problemSeed})) ? $rh->{envir}->{problemSeed} : 1 ; 210 my $psvn = (defined($rh->{envir}->{psvn}) ) ? $rh->{envir}->{psvn} : 1234 ; 211 my $problemStatus = $rh->{problem_state}->{recorded_score}|| 0 ; 212 my $problemValue = (defined($rh->{envir}->{problemValue})) ? $rh->{envir}->{problemValue} : 1 ; 213 my $num_correct = $rh->{problem_state}->{num_correct} || 0 ; 214 my $num_incorrect = $rh->{problem_state}->{num_incorrect} || 0 ; 215 my $problemAttempted = ($num_correct && $num_incorrect); 216 my $lastAnswer = ''; 217 218 my $setRecord = $db->getMergedSet($effectiveUserName, $setName); 219 unless (defined($setRecord) and ref($setRecord) ) { 220 # if a User Set does not exist for this user and this set 221 # then we check the Global Set 222 # if that does not exist we create a fake set 223 # if it does, we add fake user data 224 my $userSetClass = $db->{set_user}->{record}; 225 my $globalSet = $db->getGlobalSet($setName); # checked 226 227 if (not defined $globalSet) { 228 $setRecord = fake_set($db); 229 } else { 230 $setRecord = global2user($userSetClass, $globalSet); 231 } 232 # initializations 233 $setRecord->set_id($setName); 234 $setRecord->set_header(""); 235 $setRecord->hardcopy_header(""); 236 $setRecord->open_date(time()-60*60*24*7); # one week ago 237 $setRecord->due_date(time()+60*60*24*7*2); # in two weeks 238 $setRecord->answer_date(time()+60*60*24*7*3); # in three weeks 239 $setRecord->psvn($rh->{envir}->{psvn}||0); 240 } 241 #warn "set Record is $setRecord"; 242 # obtain the merged problem for $effectiveUser 243 my $problemRecord = $db->getMergedProblem($effectiveUserName, $setName, $problemNumber); 244 245 # if that is not yet defined obtain the global problem, 246 # convert it to a user problem, and add fake user data 247 unless (defined $problemRecord) { 248 my $userProblemClass = $db->{problem_user}->{record}; 249 my $globalProblem = $db->getGlobalProblem($setName, $problemNumber); # checked 250 # if the global problem doesn't exist either, bail! 251 if(not defined $globalProblem) { 252 $problemRecord = fake_problem($db); 253 } else { 254 $problemRecord = global2user($userProblemClass, $globalProblem); 255 } 256 # initializations 257 $problemRecord->user_id($effectiveUserName); 258 $problemRecord->problem_id($problemNumber); 259 $problemRecord->set_id($setName); 260 $problemRecord->problem_seed($problemSeed); 261 $problemRecord->status($problemStatus); 262 $problemRecord->value($problemValue); 263 $problemRecord->attempted($problemAttempted); 264 $problemRecord->last_answer($lastAnswer); 265 $problemRecord->num_correct($num_correct); 266 $problemRecord->num_incorrect($num_incorrect); 267 } 268 # initialize problem source 269 my $problem_source; 270 my $r_problem_source =undef; 271 if (defined($rh->{source})) { 272 $problem_source = decode_base64($rh->{source}); 273 $problem_source =~ tr /\r/\n/; 274 $r_problem_source =\$problem_source; 275 $problemRecord->source_file($rh->{envir}->{fileName}) if defined $rh->{envir}->{fileName}; 276 } elsif (defined($rh->{sourceFilePath}) and $rh->{sourceFilePath} =/\S/) { 277 $problemRecord->source_file($rh->{sourceFilePath}); 278 } 279 $problemRecord->source_file('foobar') unless defined($problemRecord->source_file); 280 281 #warn "problem Record is $problemRecord"; 282 # now we're sure we have valid UserSet and UserProblem objects 283 # yay! 284 285 ################################################## 286 # Other initializations 287 ################################################## 288 my $translationOptions = { 289 displayMode => $rh->{envir}->{displayMode}, 290 showHints => $rh->{envir}->{showHints}, 291 showSolutions => $rh->{envir}->{showSolutions}, 292 refreshMath2img => $rh->{envir}->{showHints} || $rh->{envir}->{showSolutions}, 293 processAnswers => 1, 294 # methods for supplying the source, 295 r_source => $r_problem_source, # reference to a source file string. 296 # if reference is not defined then the path is obtained 297 # from the problem object. 298 r_envirOverrides => $rh, 299 }; 300 301 my $formFields = $rh->{envir}->{inputs_ref}; 302 my $key = $rh->{envir}->{key} || ''; 303 304 305 #check definitions 306 #warn "setRecord is ", WebworkWebservice::pretty_print_rh($setRecord); 307 #warn "problemRecord is",WebworkWebservice::pretty_print_rh($problemRecord); 308 # warn "envir is\n ",WebworkWebservice::pretty_print_rh(__PACKAGE__->defineProblemEnvir( 309 # $ce, 310 # $effectiveUser, 311 # $key, 312 # $setRecord, 313 # $problemRecord, 314 # $psvn, 315 # $formFields, 316 # $translationOptions, 317 # )); 318 ################################################# 319 320 # Other options can be over ridden by modifying 321 # $ce->{pg} 322 323 324 325 # We'll try to use this code instead so that Local does all of the work. 326 # Most of the configuration will take place in the fake course associated 327 # with XMLRPC responses 328 # problem needs to be loaded with the following: 329 # source_file 330 # status 331 # num_correct 332 # num_incorrect 333 # it doesn't seem that $effectiveUser, $set or $key is used in the subroutine 334 # except that it is passed on to defineProblemEnvironment 335 336 my $pg; 337 $pg = WebworkWebservice::RenderProblem->new( 338 $ce, 339 $effectiveUser, 340 $key, 341 $setRecord, 342 $problemRecord, 343 $setRecord->psvn, # FIXME: this field should be removed 344 $formFields, 345 # translation options 346 $translationOptions, 347 348 ); 349 350 351 352 # new version of output: 353 my $out2 = { 354 text => encode_base64( $pg->{body_text} ), 355 header_text => encode_base64( $pg->{head_text} ), 356 answers => $pg->{answers}, 357 errors => $pg->{errors}, 358 WARNINGS => encode_base64($pg->{warnings} ), 359 problem_result => $pg->{result}, 360 problem_state => $pg->{state}, 361 PG_flag => $pg->{flags}, 362 }; 363 # Filter out bad reference types 364 ################### 365 # DEBUGGING CODE 366 ################### 367 if ($debugXmlCode) { 368 my $logDirectory =$ce->{courseDirs}->{logs}; 369 my $xmlDebugLog = "$logDirectory/xml_debug.txt"; 370 warn "Opening debug log $xmlDebugLog\n" ; 371 open (DEBUGCODE, ">>$xmlDebugLog") || die "Can't open $xmlDebugLog"; 372 print DEBUGCODE "\n\nStart xml encoding\n"; 373 } 374 375 $out2->{answers} = xml_filter($out2->{answers}); # check this -- it might not be working correctly 376 ################## 377 close(DEBUGCODE) if $debugXmlCode; 378 ################### 379 380 $out2->{PG_flag}->{PROBLEM_GRADER_TO_USE} = undef; 381 my $endTime = new Benchmark; 382 $out2->{compute_time} = logTimingInfo($beginTime, $endTime); 383 # warn "flags are" , WebworkWebservice::pretty_print_rh($pg->{flags}); 384 385 $out2; 386 387 } 388 389 # insures proper conversion to xml structure. 390 sub xml_filter { 391 my $input = shift; 392 my $level = shift || 0; 393 my $space=" "; 394 # Hack to filter out CODE references 395 my $type = ref($input); 396 if (!defined($type) or !$type ) { 397 print DEBUGCODE $space x $level." : scalar -- not converted\n" if $debugXmlCode; 398 } elsif( $type =~/HASH/i or "$input"=~/HASH/i) { 399 print DEBUGCODE "HASH reference with ".%{$input}." elements will be investigated\n" if $debugXmlCode; 400 $level++; 401 foreach my $item (keys %{$input}) { 402 print DEBUGCODE " "x$level."$item is " if $debugXmlCode; 403 $input->{$item} = xml_filter($input->{$item},$level); 404 } 405 $level--; 406 print DEBUGCODE " "x$level."HASH reference completed \n" if $debugXmlCode; 407 } elsif( $type=~/ARRAY/i or "$input"=~/ARRAY/i) { 408 print DEBUGCODE " "x$level."ARRAY reference with ".@{$input}." elements will be investigated\n" if $debugXmlCode; 409 $level++; 410 my $tmp = []; 411 foreach my $item (@{$input}) { 412 $item = xml_filter($item,$level); 413 push @$tmp, $item; 414 } 415 $input = $tmp; 416 $level--; 417 print DEBUGCODE " "x$level."ARRAY reference completed",join(" ",@$input),"\n" if $debugXmlCode; 418 } elsif($type =~ /CODE/i or "$input" =~/CODE/i) { 419 $input = "CODE reference"; 420 print DEBUGCODE " "x$level."CODE reference, converted $input\n" if $debugXmlCode; 421 } else { 422 print DEBUGCODE " "x$level." $type and was converted to string\n" if $debugXmlCode; 423 $input = "$type reference"; 424 } 425 $input; 426 427 } 428 429 430 sub logTimingInfo{ 431 my ($beginTime,$endTime,) = @_; 432 my $out = ""; 433 $out .= Benchmark::timestr( Benchmark::timediff($endTime , $beginTime) ); 434 $out; 435 } 436 437 438 ###################################################################### 439 sub new { 440 shift; # throw away invocant -- we don't need it 441 my ($ce, $user, $key, $set, $problem, $psvn, $formFields, 442 $translationOptions) = @_; 443 444 #my $renderer = 'WeBWorK::PG::Local'; 445 my $renderer = $ce->{pg}->{renderer}; 446 447 runtime_use $renderer; 448 # the idea is to have Local call back to the defineProblemEnvir below. 449 #return WeBWorK::PG::Local::new($renderer,@_); 450 return $renderer->new(@_); 451 } 452 453 454 #FIXME 455 # Save these subroutines. 456 # I'd like to use this version of defineProblemEnvir instead of the 457 # the version in PG.pm That adds flexibility. 458 459 460 # sub translateDisplayModeNames($) { 461 # my $name = shift; 462 # return DISPLAY_MODES()->{$name}; 463 # } 464 # sub defineProblemEnvir { 465 # my ( 466 # $self, 467 # $ce, 468 # $user, 469 # $key, 470 # $set, 471 # $problem, 472 # $psvn, 473 # $formFields, 474 # $options, 475 # ) = @_; 476 # 477 # my %envir; 478 # 479 # # ---------------------------------------------------------------------- 480 # 481 # # PG environment variables 482 # # from docs/pglanguage/pgreference/environmentvariables as of 06/25/2002 483 # # any changes are noted by "ADDED:" or "REMOVED:" 484 # 485 # # Vital state information 486 # # ADDED: displayModeFailover, displayHintsQ, displaySolutionsQ, 487 # # refreshMath2img, texDisposition 488 # 489 # $envir{psvn} = $set->psvn; 490 # $envir{psvnNumber} = $envir{psvn}; 491 # $envir{probNum} = $problem->problem_id; 492 # $envir{questionNumber} = $envir{probNum}; 493 # $envir{fileName} = $problem->source_file; 494 # $envir{probFileName} = $envir{fileName}; 495 # $envir{problemSeed} = $problem->problem_seed; 496 # $envir{displayMode} = translateDisplayModeNames($options->{displayMode}); 497 # $envir{languageMode} = $envir{displayMode}; 498 # $envir{outputMode} = $envir{displayMode}; 499 # $envir{displayHintsQ} = $options->{showHints}; 500 # $envir{displaySolutionsQ} = $options->{showSolutions}; 501 # $envir{texDisposition} = "pdf"; # in webwork2, we use pdflatex 502 # 503 # # Problem Information 504 # # ADDED: courseName, formatedDueDate 505 # 506 # $envir{openDate} = $set->open_date; 507 # $envir{formattedOpenDate} = formatDateTime($envir{openDate}, $ce->{siteDefaults}{timezone}); 508 # $envir{dueDate} = $set->due_date; 509 # $envir{formattedDueDate} = formatDateTime($envir{dueDate}, $ce->{siteDefaults}{timezone}); 510 # $envir{formatedDueDate} = $envir{formattedDueDate}; # typo in many header files 511 # $envir{answerDate} = $set->answer_date; 512 # $envir{formattedAnswerDate} = formatDateTime($envir{answerDate}, $ce->{siteDefaults}{timezone}); 513 # $envir{numOfAttempts} = ($problem->num_correct || 0) + ($problem->num_incorrect || 0); 514 # $envir{problemValue} = $problem->value; 515 # $envir{sessionKey} = $key; 516 # $envir{courseName} = $ce->{courseName}; 517 # 518 # # Student Information 519 # # ADDED: studentID 520 # 521 # $envir{sectionName} = $user->section; 522 # $envir{sectionNumber} = $envir{sectionName}; 523 # $envir{recitationName} = $user->recitation; 524 # $envir{recitationNumber} = $envir{recitationName}; 525 # $envir{setNumber} = $set->set_id; 526 # $envir{studentLogin} = $user->user_id; 527 # $envir{studentName} = $user->first_name . " " . $user->last_name; 528 # $envir{studentID} = $user->student_id; 529 # 530 # # Answer Information 531 # # REMOVED: refSubmittedAnswers 532 # 533 # $envir{inputs_ref} = $formFields; 534 # 535 # # External Programs 536 # # ADDED: externalLaTeXPath, externalDvipngPath, 537 # # externalGif2EpsPath, externalPng2EpsPath 538 # 539 # $envir{externalTTHPath} = $ce->{externalPrograms}->{tth}; 540 # $envir{externalLaTeXPath} = $ce->{externalPrograms}->{latex}; 541 # $envir{externalDvipngPath} = $ce->{externalPrograms}->{dvipng}; 542 # $envir{externalGif2EpsPath} = $ce->{externalPrograms}->{gif2eps}; 543 # $envir{externalPng2EpsPath} = $ce->{externalPrograms}->{png2eps}; 544 # $envir{externalGif2PngPath} = $ce->{externalPrograms}->{gif2png}; 545 # 546 # # Directories and URLs 547 # # REMOVED: courseName 548 # # ADDED: dvipngTempDir 549 # # ADDED: jsMathURL 550 # # ADDED: asciimathURL 551 # 552 # $envir{cgiDirectory} = undef; 553 # $envir{cgiURL} = undef; 554 # $envir{classDirectory} = undef; 555 # $envir{courseScriptsDirectory} = $ce->{pg}->{directories}->{macros}."/"; 556 # $envir{htmlDirectory} = $ce->{courseDirs}->{html}."/"; 557 # $envir{htmlURL} = $ce->{courseURLs}->{html}."/"; 558 # $envir{macroDirectory} = $ce->{courseDirs}->{macros}."/"; 559 # $envir{templateDirectory} = $ce->{courseDirs}->{templates}."/"; 560 # $envir{tempDirectory} = $ce->{courseDirs}->{html_temp}."/"; 561 # $envir{tempURL} = $ce->{courseURLs}->{html_temp}."/"; 562 # $envir{scriptDirectory} = undef; 563 # $envir{webworkDocsURL} = $ce->{webworkURLs}->{docs}."/"; 564 # $envir{localHelpURL} = $ce->{webworkURLs}->{local_help}."/"; 565 # $envir{jsMathURL} = $ce->{webworkURLs}->{jsMath}; 566 # $envir{asciimathURL} = $ce->{webworkURLs}->{asciimath}; 567 # 568 # # Information for sending mail 569 # 570 # $envir{mailSmtpServer} = $ce->{mail}->{smtpServer}; 571 # $envir{mailSmtpSender} = $ce->{mail}->{smtpSender}; 572 # $envir{ALLOW_MAIL_TO} = $ce->{mail}->{allowedRecipients}; 573 # 574 # # Default values for evaluating answers 575 # 576 # my $ansEvalDefaults = $ce->{pg}->{ansEvalDefaults}; 577 # $envir{$_} = $ansEvalDefaults->{$_} foreach (keys %$ansEvalDefaults); 578 # 579 # # ---------------------------------------------------------------------- 580 # 581 # my $basename = "equation-$envir{psvn}.$envir{probNum}"; 582 # $basename .= ".$envir{problemSeed}" if $envir{problemSeed}; 583 # 584 # # to make grabbing these options easier, we'll pull them out now... 585 # my %imagesModeOptions = %{$ce->{pg}->{displayModeOptions}->{images}}; 586 # 587 # # Object for generating equation images 588 # $envir{imagegen} = WeBWorK::PG::ImageGenerator->new( 589 # tempDir => $ce->{webworkDirs}->{tmp}, # global temp dir 590 # latex => $envir{externalLaTeXPath}, 591 # dvipng => $envir{externalDvipngPath}, 592 # useCache => 1, 593 # cacheDir => $ce->{webworkDirs}->{equationCache}, 594 # cacheURL => $ce->{webworkURLs}->{equationCache}, 595 # cacheDB => $ce->{webworkFiles}->{equationCacheDB}, 596 # useMarkers => ($imagesModeOptions{dvipng_align} && $imagesModeOptions{dvipng_align} eq 'mysql'), 597 # dvipng_align => $imagesModeOptions{dvipng_align}, 598 # dvipng_depth_db => $imagesModeOptions{dvipng_depth_db}, 599 # ); 600 # 601 # # ADDED: jsMath options 602 # $envir{jsMath} = {%{$ce->{pg}{displayModeOptions}{jsMath}}}; 603 # 604 # # Other things... 605 # $envir{QUIZ_PREFIX} = $options->{QUIZ_PREFIX}; # used by quizzes 606 # $envir{PROBLEM_GRADER_TO_USE} = $ce->{pg}->{options}->{grader}; 607 # $envir{PRINT_FILE_NAMES_FOR} = $ce->{pg}->{specialPGEnvironmentVars}->{PRINT_FILE_NAMES_FOR}; 608 # 609 # # ADDED: __files__ 610 # # an array for mapping (eval nnn) to filenames in error messages 611 # $envir{__files__} = { 612 # root => $ce->{webworkDirs}{root}, # used to shorten filenames 613 # pg => $ce->{pg}{directories}{root}, # ditto 614 # tmpl => $ce->{courseDirs}{templates}, # ditto 615 # }; 616 # 617 # # variables for interpreting capa problems and other things to be 618 # # seen in a pg file 619 # my $specialPGEnvironmentVarHash = $ce->{pg}->{specialPGEnvironmentVars}; 620 # for my $SPGEV (keys %{$specialPGEnvironmentVarHash}) { 621 # $envir{$SPGEV} = $specialPGEnvironmentVarHash->{$SPGEV}; 622 # } 623 # 624 # return \%envir; 625 # } 626 627 628 629 630 1;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |