Parent Directory
|
Revision Log
Rewrote ImageGenerator to work with WeBWorK2. Its arguments are now
passed in via an options hash instead of getting a whole %envir. Also,
the options are passed to the constructor and there is no initialize()
method. add() has the same interface, and render() has been changed
slightly. (This closes Bug #80!)
To make this work with 1.8, take a look at how I'm creating
ImageGenerator in &WeBWorK::PG::defineProblemEnvironment and make the
necessary modifications to processProblem8.pl.
I made changes to WeBWorK::PG to have "images" mode trigger HTML_dpng
rather than HTML_img, and also to create an ImageGenerator before
initializing and call render() after translation.
Also in PG, I shortened the names of the equation image files. They're
now "equation-$PSVN-$probnum-$seed.png". This has the added benefit of
forcing image regeneration if the problem seed changes, closing Bug
#70.
Equation files are now dumped directly into the $courseDirs{HTML_temp}
directory. This means that no one has to worry about whether "m2i"
exists any more.
global.conf.dist was changed to not include the switches to dvipng on
the command line (they're currently hardcoded into ImageGenerator).
I still have to get this to work with dvipng 0.3. I should also take
advantages of 0.3's new features, like pipelining (using the -follow
switch) and specifying the output file name (to avoid the "move" of
resulting images).
This is MUCH FASTER than the way I was calling dvipng, and I think it's
safe to say that it's a better method. Thanks JJ!
-sam
1 #!perl 2 ################################################################################ 3 # WeBWorK mod_perl (c) 1995-2002 WeBWorK Team, Univeristy of Rochester 4 # $Id: global.conf.dist,v 1.32 2003-06-13 02:30:44 sh002i Exp $ 5 ################################################################################ 6 7 # This file is used to set up the default WeBWorK course environment for all 8 # requests. Values may be overwritten by the course.conf for a specific course. 9 # All package variables set in this file are added to the course environment. 10 # If you wish to set a variable here but omit it from the course environment, 11 # use the "my" keyword. The following variables are available to this file: 12 # 13 # $webworkRoot directory that contains the WeBWorK distribution 14 # $webworkURL base URL handled by Apache::WeBWorK 15 # $pgRoot directory that contains the PG distribution 16 # $courseName name of the course being used 17 18 ################################################################################ 19 # WeBWorK settings 20 ################################################################################ 21 22 %webworkDirs = ( 23 root => "$webworkRoot", 24 bin => "$webworkRoot/bin", 25 conf => "$webworkRoot/conf", 26 courses => "$webworkRoot/courses", 27 lib => "$webworkRoot/lib", 28 logs => "$webworkRoot/logs", 29 macros => "$pgRoot/macros", 30 tmp => "$webworkRoot/tmp", 31 ); 32 33 %webworkFiles = ( 34 environment => "$webworkDirs{conf}/global.conf", 35 hardcopySnippets => { 36 preamble => "$webworkDirs{conf}/snippets/hardcopyPreamble.tex", 37 setHeader => "$webworkDirs{conf}/snippets/hardcopySetHeader.pg", 38 problemDivider => "$webworkDirs{conf}/snippets/hardcopyProblemDivider.tex", 39 setFooter => "$webworkDirs{conf}/snippets/hardcopySetFooter.pg", 40 setDivider => "$webworkDirs{conf}/snippets/hardcopySetDivider.tex", 41 userDivider => "$webworkDirs{conf}/snippets/hardcopyUserDivider.tex", 42 postamble => "$webworkDirs{conf}/snippets/hardcopyPostamble.tex", 43 }, 44 screenSnippets => { 45 setHeader => "$webworkDirs{conf}/snippets/screenSetHeader.pg", 46 }, 47 logs => { 48 timing => "$webworkDirs{logs}/timing.log", 49 }, 50 ); 51 52 %webworkURLs = ( 53 root => "$webworkURLRoot", 54 home => "/webwork2_files/index.html", 55 htdocs => "/webwork2_files", 56 docs => "http://webhost.math.rochester.edu/webworkdocs/docs", 57 oldProf => "/webwork-old/profLogin.pl", 58 ); 59 60 ################################################################################ 61 # Default course-specific settings 62 ################################################################################ 63 64 my $courseRoot = "$webworkDirs{courses}/$courseName"; 65 %courseDirs = ( 66 root => "$courseRoot", 67 DATA => "$courseRoot/DATA", 68 auth_DATA => "$courseRoot/DATA/.auth", 69 html => "$courseRoot/html", 70 html_images => "$courseRoot/html/images", 71 html_temp => "$courseRoot/html/tmp", 72 logs => "$courseRoot/logs", 73 scoring => "$courseRoot/scoring", 74 templates => "$courseRoot/templates", 75 macros => "$courseRoot/templates/macros", 76 ); 77 78 %courseFiles = ( 79 environment => "$courseDirs{root}/course.conf", 80 motd => "$courseDirs{root}/motd.txt", 81 ); 82 83 # quick hack to fix transaction logging. blah. 84 $webworkFiles{logs}->{transaction} = "$courseDirs{logs}/transaction.log"; 85 $webworkFiles{logs}->{pastAnswerList} = "$courseDirs{logs}/past_answers.log"; 86 87 my $courseURLRoot = "$webworkURLs{htdocs}/courses/$courseName"; 88 %courseURLs = ( 89 root => "$courseURLRoot", 90 html => "$courseURLRoot", 91 html_temp => "$courseURLRoot/tmp", 92 ); 93 94 ################################################################################ 95 # Other site-specific options 96 ################################################################################ 97 98 %mail = ( 99 smtpServer => "mail.math.rochester.edu", 100 smtpSender => "webwork\@math.rochester.edu", 101 # allowedRecipients defines addresses that the PG system is allowed to 102 # send mail to. this prevents subtle PG exploits. This should be set 103 # in course.conf to the addresses of professors of each course. Sending 104 # mail from the PG system (i.e. questionaires, essay questions) will 105 # fail if this is not set somewhere (either here or in course.conf). 106 #allowedRecipients => [ 107 # "yourname\@host.yourdomain.edu", 108 #], 109 # if defined, feedbackRecipients overrides the list of recipients for 110 # feedback email. It's appropriate to set this in the course.conf for 111 # specific courses, but probably not in global.conf. if not defined, 112 # mail is sent to all professors and TAs for a given course 113 #feedbackRecipients => [ 114 # "prof1\@host.yourdomain.edu", 115 # "prof2\@host.yourdomain.edu", 116 #], 117 # feedbackVerbosity: 118 # 0: send only the feedback comment and context link 119 # 1: as in 0, plus user, set, problem, and PG data 120 # 2: as in 1, plus the problem environment (debugging data) 121 feedbackVerbosity => 1, 122 ); 123 124 %externalPrograms = ( 125 mkdir => "/bin/mkdir", 126 tth => "/usr/local/bin/tth", 127 pdflatex => "/usr/local/bin/pdflatex", 128 latex => "/usr/local/bin/latex", 129 #dvipng => "/usr/local/bin/dvipng -mode ljfivemp -D600 -Q6 -x1000.5 -bgTransparent", 130 dvipng => "/usr/local/bin/dvipng", 131 gif2eps => "$webworkDirs{bin}/gif2eps", 132 png2eps => "$webworkDirs{bin}/png2eps", 133 gif2png => "$webworkDirs{bin}/gif2png", 134 ); 135 136 ################################################################################ 137 # Frontend options 138 ################################################################################ 139 140 %templates = ( 141 system => "$webworkDirs{conf}/templates/ur.template", 142 ); 143 144 ################################################################################ 145 # Database options 146 ################################################################################ 147 148 # Several database layouts are defined in separate environment files. Select the 149 # one which should be used by all courses by default, and include it. This can 150 # be overridden by including a difference environment file in the course.conf of 151 # a particular course. 152 153 # Include sql.conf to specify a database layout for use with an SQL server. 154 #include "conf/sql.conf"; 155 156 # Include gdbm.conf to specify a database layout for WeBWorK 1.x compatible GDBM 157 # databases. Use this layout if you wish to share courses between WeBWorK 1.x 158 # and WeBWorK 2. 159 include "conf/gdbm.conf"; 160 161 # Please read the documentation in the file that you chose to include, as there 162 # are layout-specific options that must be configured. 163 164 ################################################################################ 165 # Authorization system 166 ################################################################################ 167 168 # This lets you specify a minimum permission level needed to perform certain 169 # actions. In the current system, >=10 will allow a professor to perform the 170 # action, >=5 will allow a TA to, and >=0 will allow a student to perform an 171 # action (almost never what you want). 172 my $ta = 5; 173 my $professor = 10; 174 %permissionLevels = ( 175 become_student => $professor, 176 access_instructor_tools => $ta, 177 create_and_delete_problem_sets => $professor, 178 modify_problem_sets => $professor, 179 assign_problem_sets => $professor, 180 ); 181 182 ################################################################################ 183 # Session options 184 ################################################################################ 185 186 # $sessionKeyTimeout defines seconds of inactivity before a key expires 187 $sessionKeyTimeout = 60*30; 188 189 # $sessionKeyLength defines the length (in characters) of the session key 190 $sessionKeyLength = 40; 191 192 # @sessionKeyChars lists the legal session key characters 193 @sessionKeyChars = ('A'..'Z', 'a'..'z', '0'..'9', '.', '^', '/', '!', '*'); 194 195 # Practice users are users who's names start with $practiceUser 196 # (you can comment this out to remove practice user support) 197 $practiceUserPrefix = "practice"; 198 199 # There is a practice user who can be logged in multiple times. He's 200 # commented out by default, though, so you don't hurt yourself. It is 201 # kindof a backdoor to the practice user system, since he doesn't have a 202 # password. Come to think of it, why do we even have this?! 203 #$debugPracticeUser = "practice666"; 204 205 ################################################################################ 206 # PG translation options 207 ################################################################################ 208 209 %pg = ( 210 directories => { 211 # directories used only by PG 212 lib => "$pgRoot/lib", 213 macros => "$pgRoot/macros", 214 }, # (not used yet) 215 options => { 216 # default translation options 217 displayMode => "images", 218 showOldAnswers => 1, 219 showCorrectAnswers => 0, 220 showHints => 0, 221 showSolutions => 0, 222 catchWarnings => 0, # there's a global warning catcher now 223 # default grader 224 grader => "avg_problem_grader", 225 }, 226 # this will be customized in the course.conf file 227 specialPGEnvironmentVars => { 228 PRINT_FILE_NAMES_FOR => ['gage','apizer','voloshin','lr003k','professor'], 229 CAPA_Tools => "$courseDirs{macros}/CAPA_Tools/", 230 CAPA_MCTools => "$courseDirs{macros}/CAPA_MCTools/", 231 CAPA_Graphics_URL => "$courseDirs{html}/CAPA_Graphics/", 232 CAPA_GraphicsDirectory => "$courseDirs{html}CAPA_Graphics/", 233 }, 234 # modules lists module names and the packages each contains 235 modules => [ 236 [qw(DynaLoader)], 237 [qw(Exporter)], 238 [qw(GD)], 239 240 [qw(AlgParser AlgParserWithImplicitExpand Expr ExprWithImplicitExpand)], 241 [qw(AnswerHash AnswerEvaluator)], 242 [qw(WWPlot)], # required by Circle (and others) 243 [qw(Circle)], 244 [qw(Complex)], 245 [qw(Complex1)], 246 [qw(Distributions)], 247 [qw(Fraction)], 248 [qw(Fun)], 249 [qw(Hermite)], 250 [qw(Label)], 251 [qw(List)], 252 [qw(Match)], 253 [qw(MatrixReal1)], # required by Matrix 254 [qw(Matrix)], 255 [qw(Multiple)], 256 [qw(PGrandom)], 257 [qw(Regression)], 258 [qw(Select)], 259 [qw(Units)], 260 [qw(VectorField)], 261 ], 262 # defaults used by answer evaluators 263 ansEvalDefaults => { 264 functAbsTolDefault => .001, 265 functLLimitDefault => .0000001, 266 functMaxConstantOfIntegration => 1E8, 267 functNumOfPoints => 3, 268 functRelPercentTolDefault => .1, 269 functULimitDefault => .9999999, 270 functVarDefault => "x", 271 functZeroLevelDefault => 1E-14, 272 functZeroLevelTolDefault => 1E-12, 273 numAbsTolDefault => .001, 274 numFormatDefault => "", 275 numRelPercentTolDefault => .1, 276 numZeroLevelDefault => 1E-14, 277 numZeroLevelTolDefault => 1E-12, 278 }, 279 );
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |