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

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

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

Revision 1606 Revision 1607
27 summary: the URI controls 27 summary: the URI controls
28 28
29=cut 29=cut
30 30
31BEGIN { $main::VERSION = "2.0"; } 31BEGIN { $main::VERSION = "2.0"; }
32
33my $timingON =1;
34
32 35
33use strict; 36use strict;
34use warnings; 37use warnings;
35use Apache::Constants qw(:common REDIRECT DONE); 38use Apache::Constants qw(:common REDIRECT DONE);
36use Apache::Request; 39use Apache::Request;
228 $result = WeBWorK::ContentGenerator::ProblemSets->new($r, $ce, $db)->go; 231 $result = WeBWorK::ContentGenerator::ProblemSets->new($r, $ce, $db)->go;
229 } elsif ($arg eq "hardcopy") { 232 } elsif ($arg eq "hardcopy") {
230 233
231 my $hardcopyArgument = shift @components; 234 my $hardcopyArgument = shift @components;
232 $hardcopyArgument = "" unless defined $hardcopyArgument; 235 $hardcopyArgument = "" unless defined $hardcopyArgument;
233 $WeBWorK::timer1 = WeBWorK::Timing->new("hardcopy: $hardcopyArgument"); 236 $WeBWorK::timer1 = WeBWorK::Timing->new("hardcopy: $hardcopyArgument") if $timingON == 1;
234 $WeBWorK::timer1->start; 237 $WeBWorK::timer1->start if $timingON == 1;
235 238
236 my $result = WeBWorK::ContentGenerator::Hardcopy->new($r, $ce, $db)->go($hardcopyArgument); 239 my $result = WeBWorK::ContentGenerator::Hardcopy->new($r, $ce, $db)->go($hardcopyArgument);
237 $WeBWorK::timer1 ->stop; 240 $WeBWorK::timer1 ->stop if $timingON == 1;
238 $WeBWorK::timer1 ->save; 241 $WeBWorK::timer1 ->save if $timingON == 1;
239 return $result; 242 return $result;
240 } elsif ($arg eq "instructor2") { 243 } elsif ($arg eq "instructor2") {
241 my $instructorArgument = shift @components; 244 my $instructorArgument = shift @components;
242 if (!defined $instructorArgument) { 245 if (!defined $instructorArgument) {
243 $result = WeBWorK::ContentGenerator::Instructor::Index2->new($r, $ce, $db)->go; 246 $result = WeBWorK::ContentGenerator::Instructor::Index2->new($r, $ce, $db)->go;
244 } 247 }
245 } elsif ($arg eq "instructor") { 248 } elsif ($arg eq "instructor") {
246 my $instructorArgument = shift @components; 249 my $instructorArgument = shift @components;
247 if (!defined $instructorArgument) { 250 if (!defined $instructorArgument) {
248 $WeBWorK::timer2 = WeBWorK::Timing->new("Instructor index $course:"); 251 $WeBWorK::timer2 = WeBWorK::Timing->new("Instructor index $course:") if $timingON == 1;
249 $WeBWorK::timer2->start; 252 $WeBWorK::timer2->start if $timingON == 1;
250 $result = WeBWorK::ContentGenerator::Instructor::Index->new($r, $ce, $db)->go; 253 $result = WeBWorK::ContentGenerator::Instructor::Index->new($r, $ce, $db)->go;
251 $WeBWorK::timer2->continue("Listing instructor page is done"); 254 $WeBWorK::timer2->continue("Listing instructor page is done") if $timingON == 1;
252 $WeBWorK::timer2->stop; 255 $WeBWorK::timer2->stop if $timingON == 1;
253 $WeBWorK::timer2->save; 256 $WeBWorK::timer2->save if $timingON == 1;
254 } elsif ($instructorArgument eq "scoring") { 257 } elsif ($instructorArgument eq "scoring") {
255 $result = WeBWorK::ContentGenerator::Instructor::Scoring->new($r, $ce, $db)->go; #FIXME!!!! 258 $result = WeBWorK::ContentGenerator::Instructor::Scoring->new($r, $ce, $db)->go; #FIXME!!!!
256 } elsif ($instructorArgument eq "add_users") { 259 } elsif ($instructorArgument eq "add_users") {
257 $result = WeBWorK::ContentGenerator::Instructor::AddUsers->new($r, $ce, $db)->go; #FIXME!!!! 260 $result = WeBWorK::ContentGenerator::Instructor::AddUsers->new($r, $ce, $db)->go; #FIXME!!!!
258 } elsif ($instructorArgument eq "scoringDownload") { 261 } elsif ($instructorArgument eq "scoringDownload") {
271 $result = WeBWorK::ContentGenerator::Instructor::ProblemList->new($r, $ce, $db)->go($setID); 274 $result = WeBWorK::ContentGenerator::Instructor::ProblemList->new($r, $ce, $db)->go($setID);
272 } elsif ($setArg eq "users") { 275 } elsif ($setArg eq "users") {
273 $result = WeBWorK::ContentGenerator::Instructor::Assigner->new($r, $ce, $db)->go($setID); 276 $result = WeBWorK::ContentGenerator::Instructor::Assigner->new($r, $ce, $db)->go($setID);
274 } 277 }
275 } else { 278 } else {
279 $WeBWorK::timer2 = WeBWorK::Timing->new("Problem Set List $course:") if $timingON == 1;
280 $WeBWorK::timer2->start if $timingON == 1;
276 $result = WeBWorK::ContentGenerator::Instructor::ProblemSetList->new($r, $ce, $db)->go; 281 $result = WeBWorK::ContentGenerator::Instructor::ProblemSetList->new($r, $ce, $db)->go;
282 $WeBWorK::timer2->continue("Problem Set List is done");
283 $WeBWorK::timer2->stop if $timingON == 1;
284 $WeBWorK::timer2->save if $timingON == 1;
285
277 } 286 }
278 } elsif ($instructorArgument eq "pgProblemEditor") { 287 } elsif ($instructorArgument eq "pgProblemEditor") {
279 $result = WeBWorK::ContentGenerator::Instructor::PGProblemEditor->new($r, $ce, $db)->go(@components); 288 $result = WeBWorK::ContentGenerator::Instructor::PGProblemEditor->new($r, $ce, $db)->go(@components);
280 } elsif ($instructorArgument eq "send_mail") { 289 } elsif ($instructorArgument eq "send_mail") {
281 $result = WeBWorK::ContentGenerator::Instructor::SendMail->new($r, $ce, $db)->go(@components); 290 $result = WeBWorK::ContentGenerator::Instructor::SendMail->new($r, $ce, $db)->go(@components);
299 my $problem_set = $arg; 308 my $problem_set = $arg;
300 my $ps_arg = shift @components; 309 my $ps_arg = shift @components;
301 310
302 if (!defined $ps_arg) { 311 if (!defined $ps_arg) {
303 # list the problems in the problem set 312 # list the problems in the problem set
304 $WeBWorK::timer0 = WeBWorK::Timing->new("Problem $course:$problem_set"); 313 $WeBWorK::timer0 = WeBWorK::Timing->new("Problem $course:$problem_set") if $timingON == 1;
305 $WeBWorK::timer0->start; 314 $WeBWorK::timer0->start if $timingON == 1;
306 $result = WeBWorK::ContentGenerator::ProblemSet->new($r, $ce, $db)->go($problem_set); 315 $result = WeBWorK::ContentGenerator::ProblemSet->new($r, $ce, $db)->go($problem_set);
307 $WeBWorK::timer0->continue("problem set listing is done"); 316 $WeBWorK::timer0->continue("problem set listing is done") if $timingON == 1;
308 $WeBWorK::timer0->stop; 317 $WeBWorK::timer0->stop if $timingON == 1;
309 $WeBWorK::timer0->save; 318 $WeBWorK::timer0->save if $timingON == 1;
310 } else { 319 } else {
311 # We've got the name of a problem 320 # We've got the name of a problem
312 my $problem = $ps_arg; 321 my $problem = $ps_arg;
313 322
314 $WeBWorK::timer0 = WeBWorK::Timing->new("Problem $course:$problem_set/$problem"); 323 $WeBWorK::timer0 = WeBWorK::Timing->new("Problem $course:$problem_set/$problem") if $timingON == 1;
315 $WeBWorK::timer0->start; 324 $WeBWorK::timer0->start if $timingON == 1;
316# my $pid = fork(); 325# my $pid = fork();
317# if ($pid) { 326# if ($pid) {
318# wait; 327# wait;
319# } else { 328# } else {
320 my $result = WeBWorK::ContentGenerator::Problem->new($r, $ce, $db)->go($problem_set, $problem); 329 my $result = WeBWorK::ContentGenerator::Problem->new($r, $ce, $db)->go($problem_set, $problem);
323# #$WeBWorK::timer0->save; 332# #$WeBWorK::timer0->save;
324# eval{ APACHE::exit(0);} || warn "Error in leaving child |$@|"; 333# eval{ APACHE::exit(0);} || warn "Error in leaving child |$@|";
325# # We REALLY REALLY want this grandchild to exit. But not the child. How to do this 334# # We REALLY REALLY want this grandchild to exit. But not the child. How to do this
326# # cleanly???? FIXME 335# # cleanly???? FIXME
327# } 336# }
328 $WeBWorK::timer0->continue("Problem done)"); 337 $WeBWorK::timer0->continue("Problem done)") if $timingON == 1;
329 $WeBWorK::timer0->stop; 338 $WeBWorK::timer0->stop if $timingON == 1;
330 $WeBWorK::timer0->save; 339 $WeBWorK::timer0->save if $timingON == 1;
331 return $result; 340 return $result;
332 341
333 342
334 } 343 }
335 } 344 }

Legend:
Removed from v.1606  
changed lines
  Added in v.1607

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9