[system] / branches / rel-2-4-patches / webwork-modperl / lib / WeBWorK / PG.pm Repository:
ViewVC logotype

Diff of /branches/rel-2-4-patches/webwork-modperl/lib/WeBWorK/PG.pm

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

Revision 2419 Revision 4376
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-2006 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork-modperl/lib/WeBWorK/PG.pm,v 1.54 2004/06/23 01:19:56 sh002i Exp $ 4# $CVSHeader: webwork2/lib/WeBWorK/PG.pm,v 1.65 2006/05/23 20:47:27 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.
91 91
92 # Problem Information 92 # Problem Information
93 # ADDED: courseName, formatedDueDate 93 # ADDED: courseName, formatedDueDate
94 94
95 $envir{openDate} = $set->open_date; 95 $envir{openDate} = $set->open_date;
96 $envir{formattedOpenDate} = formatDateTime($envir{openDate}); 96 $envir{formattedOpenDate} = formatDateTime($envir{openDate}, $ce->{siteDefaults}{timezone});
97 $envir{dueDate} = $set->due_date; 97 $envir{dueDate} = $set->due_date;
98 $envir{formattedDueDate} = formatDateTime($envir{dueDate}); 98 $envir{formattedDueDate} = formatDateTime($envir{dueDate}, $ce->{siteDefaults}{timezone});
99 $envir{formatedDueDate} = $envir{formattedDueDate}; # typo in many header files 99 $envir{formatedDueDate} = $envir{formattedDueDate}; # typo in many header files
100 $envir{answerDate} = $set->answer_date; 100 $envir{answerDate} = $set->answer_date;
101 $envir{formattedAnswerDate} = formatDateTime($envir{answerDate}); 101 $envir{formattedAnswerDate} = formatDateTime($envir{answerDate}, $ce->{siteDefaults}{timezone});
102 $envir{numOfAttempts} = ($problem->num_correct || 0) + ($problem->num_incorrect || 0); 102 $envir{numOfAttempts} = ($problem->num_correct || 0) + ($problem->num_incorrect || 0);
103 $envir{problemValue} = $problem->value; 103 $envir{problemValue} = $problem->value;
104 $envir{sessionKey} = $key; 104 $envir{sessionKey} = $key;
105 $envir{courseName} = $ce->{courseName}; 105 $envir{courseName} = $ce->{courseName};
106 106
129 $envir{externalLaTeXPath} = $ce->{externalPrograms}->{latex}; 129 $envir{externalLaTeXPath} = $ce->{externalPrograms}->{latex};
130 $envir{externalDvipngPath} = $ce->{externalPrograms}->{dvipng}; 130 $envir{externalDvipngPath} = $ce->{externalPrograms}->{dvipng};
131 $envir{externalGif2EpsPath} = $ce->{externalPrograms}->{gif2eps}; 131 $envir{externalGif2EpsPath} = $ce->{externalPrograms}->{gif2eps};
132 $envir{externalPng2EpsPath} = $ce->{externalPrograms}->{png2eps}; 132 $envir{externalPng2EpsPath} = $ce->{externalPrograms}->{png2eps};
133 $envir{externalGif2PngPath} = $ce->{externalPrograms}->{gif2png}; 133 $envir{externalGif2PngPath} = $ce->{externalPrograms}->{gif2png};
134 134 $envir{externalCheckUrl} = $ce->{externalPrograms}->{checkurl};
135 # Directories and URLs 135 # Directories and URLs
136 # REMOVED: courseName 136 # REMOVED: courseName
137 # ADDED: dvipngTempDir 137 # ADDED: dvipngTempDir
138 # ADDED: jsMathURL 138 # ADDED: jsMathURL
139 # ADDED: asciimathURL 139 # ADDED: asciimathURL
140 # ADDED: macrosPath
141 # REMOVED: macrosDirectory, courseScriptsDirectory
140 142
141 $envir{cgiDirectory} = undef; 143 $envir{cgiDirectory} = undef;
142 $envir{cgiURL} = undef; 144 $envir{cgiURL} = undef;
143 $envir{classDirectory} = undef; 145 $envir{classDirectory} = undef;
144 $envir{courseScriptsDirectory} = $ce->{pg}->{directories}->{macros}."/"; 146 $envir{macrosPath} = $ce->{pg}->{directories}{macrosPath};
147 $envir{appletPath} = $ce->{pg}->{directories}{appletPath};
148 $envir{pgDirectories} = $ce->{pg}->{directories};
145 $envir{htmlDirectory} = $ce->{courseDirs}->{html}."/"; 149 $envir{htmlDirectory} = $ce->{courseDirs}->{html}."/";
146 $envir{htmlURL} = $ce->{courseURLs}->{html}."/"; 150 $envir{htmlURL} = $ce->{courseURLs}->{html}."/";
147 $envir{macroDirectory} = $ce->{courseDirs}->{macros}."/";
148 $envir{templateDirectory} = $ce->{courseDirs}->{templates}."/"; 151 $envir{templateDirectory} = $ce->{courseDirs}->{templates}."/";
149 $envir{tempDirectory} = $ce->{courseDirs}->{html_temp}."/"; 152 $envir{tempDirectory} = $ce->{courseDirs}->{html_temp}."/";
150 $envir{tempURL} = $ce->{courseURLs}->{html_temp}."/"; 153 $envir{tempURL} = $ce->{courseURLs}->{html_temp}."/";
151 $envir{scriptDirectory} = undef; 154 $envir{scriptDirectory} = undef;
152 $envir{webworkDocsURL} = $ce->{webworkURLs}->{docs}."/"; 155 $envir{webworkDocsURL} = $ce->{webworkURLs}->{docs}."/";
153 $envir{localHelpURL} = $ce->{webworkURLs}->{local_help}."/"; 156 $envir{localHelpURL} = $ce->{webworkURLs}->{local_help}."/";
154 $envir{jsMathURL} = $ce->{webworkURLs}->{jsMath}; 157 $envir{jsMathURL} = $ce->{webworkURLs}->{jsMath};
155 $envir{asciimathURL} = $ce->{webworkURLs}->{asciimath}; 158 $envir{asciimathURL} = $ce->{webworkURLs}->{asciimath};
159 $envir{server_root_url} = $ce->{apache_root_url};
156 160
157 # Information for sending mail 161 # Information for sending mail
158 162
159 $envir{mailSmtpServer} = $ce->{mail}->{smtpServer}; 163 $envir{mailSmtpServer} = $ce->{mail}->{smtpServer};
160 $envir{mailSmtpSender} = $ce->{mail}->{smtpSender}; 164 $envir{mailSmtpSender} = $ce->{mail}->{smtpSender};
167 171
168 # ---------------------------------------------------------------------- 172 # ----------------------------------------------------------------------
169 173
170 my $basename = "equation-$envir{psvn}.$envir{probNum}"; 174 my $basename = "equation-$envir{psvn}.$envir{probNum}";
171 $basename .= ".$envir{problemSeed}" if $envir{problemSeed}; 175 $basename .= ".$envir{problemSeed}" if $envir{problemSeed};
172 176
177 # to make grabbing these options easier, we'll pull them out now...
178 my %imagesModeOptions = %{$ce->{pg}->{displayModeOptions}->{images}};
179
173 # Object for generating equation images 180 # Object for generating equation images
174 $envir{imagegen} = WeBWorK::PG::ImageGenerator->new( 181 $envir{imagegen} = WeBWorK::PG::ImageGenerator->new(
175 tempDir => $ce->{webworkDirs}->{tmp}, # global temp dir 182 tempDir => $ce->{webworkDirs}->{tmp}, # global temp dir
176 latex => $envir{externalLaTeXPath}, 183 latex => $envir{externalLaTeXPath},
177 dvipng => $envir{externalDvipngPath}, 184 dvipng => $envir{externalDvipngPath},
178 useCache => 1, 185 useCache => 1,
179 cacheDir => $ce->{webworkDirs}->{equationCache}, 186 cacheDir => $ce->{webworkDirs}->{equationCache},
180 cacheURL => $ce->{webworkURLs}->{equationCache}, 187 cacheURL => $ce->{webworkURLs}->{equationCache},
181 cacheDB => $ce->{webworkFiles}->{equationCacheDB}, 188 cacheDB => $ce->{webworkFiles}->{equationCacheDB},
182 useMarkers => ($ce->{pg}->{renderers}->{dvipng_align} && 189 useMarkers => ($imagesModeOptions{dvipng_align} && $imagesModeOptions{dvipng_align} eq 'mysql'),
183 $ce->{pg}->{renderers}->{dvipng_align} eq 'mysql'), 190 dvipng_align => $imagesModeOptions{dvipng_align},
184 dvipng_align => $ce->{pg}->{renderers}->{dvipng_align}, 191 dvipng_depth_db => $imagesModeOptions{dvipng_depth_db},
185 dvipng_depth_db => $ce->{pg}->{renderers}->{dvipng_depth_db},
186 ); 192 );
193
194 # ADDED: jsMath options
195 $envir{jsMath} = {%{$ce->{pg}{displayModeOptions}{jsMath}}};
187 196
188 # Other things... 197 # Other things...
189 $envir{QUIZ_PREFIX} = $options->{QUIZ_PREFIX}; # used by quizzes 198 $envir{QUIZ_PREFIX} = $options->{QUIZ_PREFIX}; # used by quizzes
190 $envir{PROBLEM_GRADER_TO_USE} = $ce->{pg}->{options}->{grader}; 199 $envir{PROBLEM_GRADER_TO_USE} = $ce->{pg}->{options}->{grader};
191 $envir{PRINT_FILE_NAMES_FOR} = $ce->{pg}->{specialPGEnvironmentVars}->{PRINT_FILE_NAMES_FOR}; 200 $envir{PRINT_FILE_NAMES_FOR} = $ce->{pg}->{specialPGEnvironmentVars}->{PRINT_FILE_NAMES_FOR};
201
202 # ADDED: __files__
203 # an array for mapping (eval nnn) to filenames in error messages
204 $envir{__files__} = {
205 root => $ce->{webworkDirs}{root}, # used to shorten filenames
206 pg => $ce->{pg}{directories}{root}, # ditto
207 tmpl => $ce->{courseDirs}{templates}, # ditto
208 };
192 209
193 # variables for interpreting capa problems and other things to be 210 # variables for interpreting capa problems and other things to be
194 # seen in a pg file 211 # seen in a pg file
195 my $specialPGEnvironmentVarHash = $ce->{pg}->{specialPGEnvironmentVars}; 212 my $specialPGEnvironmentVarHash = $ce->{pg}->{specialPGEnvironmentVars};
196 for my $SPGEV (keys %{$specialPGEnvironmentVarHash}) { 213 for my $SPGEV (keys %{$specialPGEnvironmentVarHash}) {

Legend:
Removed from v.2419  
changed lines
  Added in v.4376

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9