|
Home About
FAQs
General Admin Assist Student
Docs
Admin Assistant
CGI
Admin Assistant Download Form Student
Packages
AdminInterface Assignments AssistantInterface Form Interface Record Roster StudentInterface SystemVariables Teams VincentFile VincentLog |
|
0 #System Interface Package 1 #Copyright 2000 Matt Jadud 2 #This program is free software; you can redistribute it and/or 3 #modify it under the terms of the GNU General Public License 4 #as published by the Free Software Foundation; either version 2 5 #of the License, or (at your option) any later version. 6 # 7 #This program is distributed in the hope that it will be useful, 8 #but WITHOUT ANY WARRANTY; without even the implied warranty of 9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 #GNU General Public License for more details. 11 # 12 #You should have received a copy of the GNU General Public License 13 #along with this program; if not, write to the Free Software 14 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 16 17 use SystemVariables; 18 use Record; 19 use Interface; 20 use Assignments; 21 use VincentFile; 22 use VincentLog; 23 use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB 24 25 package StudentInterface; 26 27 #Turn debugging on or off; 28 $DEBUG = 1; 29 $| = 1; 30 31 sub mainMenu { 32 33 my ($studentUsername, 34 %menuOptions, 35 $choices, $choice, 36 @params, 37 $fullname 38 ); 39 40 $studentUsername = $ENV{REMOTE_USER}; 41 42 %menuOptions = ( #Assignment Options 43 "ChooseAssignment" => &chooseAssignmentToSubmit, 44 "AcknowledgeDone" => &acknowledgeDone, 45 "FileInputDialog" => &fileInputDialog, 46 "FileHandinError" => &fileHandinError, 47 "assignmentDownload" => &Interface::assignmentDownload, 48 "viewGrades" => &viewGrades, 49 "DoPeerEval" => &doPeerEval, 50 "IncompletePeerEval" => &incompletePeerEval, 51 "GoodPeerEval" => &goodPeerEval, 52 "Callback" => &callbackProcessor 53 ); 54 55 if($ENV{HTTP_USER_AGENT} =~ /MSIE/) { 56 VincentLog::clickLog("MAINPAGE", "Blocking Internet Explorer."); 57 58 Interface::menuTop(SystemVariables::getClassID . " " . 59 SystemVariables::getClassTagline); 60 61 print "<TR><TD>"; 62 print "<h2>Vincent thinks you are using <P>"; 63 print "<CENTER><FONT COLOR='RED'>" . $ENV{HTTP_USER_AGENT} . "</FONT></CENTER>"; 64 print "<P>as a browser. Unfortunately, Microsoft's browser does not obey"; 65 print "the HTTP protocol, and cannot be used with Vincent for purposes"; 66 print " of handing in assignments or completeing forms."; 67 print "<P>"; 68 print "<CENTER><h1><FONT COLOR='#006600'>"; 69 print "Please use <FONT COLOR='BLACK'>Netscape</FONT> or some other standards compliant browser."; 70 print "</FONT></H1></CENTER>"; 71 print "</TD></TR>"; 72 73 Interface::menuBottom(); 74 exit(); 75 } 76 77 #Same kind of toggle as in the Admin interface 78 foreach $choice (@_) { 79 foreach $key (keys %menuOptions) { 80 if($choice eq $key) { 81 82 Interface::menuTop(SystemVariables::getClassID . " " . 83 SystemVariables::getClassTagline); 84 $menuOptions{$key}->(@_); 85 86 $choices = 1; 87 Interface::menuBottom(); 88 print"<CENTER><A HREF='student.cgi'>Start over.</A></CENTER>"; 89 exit(); 90 91 } 92 } 93 } 94 95 #Default choices: if no control choices were 96 # hit above, then we present the standard 97 # options presented below 98 if(!$choices) { 99 100 ##LOGGING 101 VincentLog::clickLog("MAINPAGE", "Default student page."); 102 103 Interface::menuTop(SystemVariables::getClassID . " " . 104 SystemVariables::getClassTagline); 105 106 107 108 if (Record::isStudent($studentUsername)) { 109 110 if(Record::isStudentExpired($studentUsername)) { 111 expiredNotice(); 112 } else { 113 114 #print "<TR><TD><P ALIGN='RIGHT'>"; 115 #print "<A HREF='logout.cgi'>Don't forget to log out!</A>"; 116 #print "</P></TD></TR>"; 117 118 studentChooser(); 119 gradeChooser(); 120 fileDownloadChooser(); 121 122 if(SystemVariables::useSlipTime()) { 123 print "<TR><TD><CENTER>"; 124 slipTimeRemaining($ENV{REMOTE_USER}); 125 print "</TD></TR></CENTER>"; 126 } 127 } 128 } else { 129 #Well, this is actually if they aren't a student... 130 notInClassNotice(); 131 } 132 133 134 Interface::menuBottom(); 135 136 } 137 } 138 139 ###################################### 140 # Option Choosers 141 ###################################### 142 sub gradeChooser { 143 144 my($assignmentIDs, 145 $studentWebPath 146 ); 147 148 149 $studentWebPath = SystemVariables::getStudentWebPath(); 150 print "<TR><TD>"; 151 152 Interface::tableTop("Grade Options"); 153 Interface::startForm($studentWebPath . "student.cgi"); 154 Interface::hidden("_username", $ENV{REMOTE_USER}); 155 156 #$assignmentIDs = Assignments::getAssignmentIDs(); 157 Interface::selectInput("View grades for ", 158 "VIEWGRADES", 159 160 ######### 161 #WARNING 162 ######### 163 # There is an abuse of "doneness" going on here. 164 # For course admins who chose not to use "doneness," 165 # then they could, instead, declare that grades were not 166 # viewable until a certain date. This is, in essence, 167 # the "done" date. Therefore, even though they said (in 168 # the course config dialog) that they are _not_ using 169 # "doneness," it is, in fact, still being used by Vincent. 170 # 171 # This is a horrible, horrible double-usage of data. Hacked in 172 # days before the Fall00 semester, to satisfy desire for both 173 # the presence and absence of "doneness" by course administrators. 174 175 @{Assignments::getAllDoneAssignments($ENV{REMOTE_USER})}, 176 " -- ALL --"); 177 178 print "<TABLE WIDTH='100%'><TR><TD>"; 179 180 print "</TD></TR></TABLE>"; 181 182 Interface::endForm(); 183 Interface::tableBottom(); 184 print "</TD></TR>"; 185 } 186 187 sub studentChooser { 188 189 my ($studentWebPath); 190 191 $studentWebPath = SystemVariables::getStudentWebPath(); 192 193 print "<TR><TD>n"; 194 195 Interface::tableTop("Assignment Options"); 196 Interface::startForm($studentWebPath . "student.cgi"); 197 198 Interface::radio("SubmitAssignment", 199 "ASSIGNMENTCHOOSER", 200 "Submit an Assignment", 201 "CHECKED"); 202 203 Interface::radio("assignmentDownload", 204 "ASSIGNMENTCHOOSER", 205 "View files submitted to date."); 206 #print "<TABLE WIDTH='100%'><TR><TD>"; 207 #print "The 'view files' option will be added back in ASAP. -VPC"; 208 #print "</TD></TR></TABLE>"; 209 210 if(SystemVariables::useDoneness()) { 211 Interface::radio("AcknowledgeDone", 212 "ASSIGNMENTCHOOSER", 213 "Acknowledge you are DONE with an assignment." 214 ); 215 } 216 217 Interface::endForm(); 218 Interface::tableBottom(); 219 print "</TD></TR>"; 220 } 221 222 223 sub fileDownloadChooser { 224 225 my ($studentWebPath, 226 $files, 227 $file 228 ); 229 230 $studentWebPath = SystemVariables::getStudentWebPath(); 231 $downloadWebPath = SystemVariables::getDownloadWebPath(); 232 $downloadWebPath .= "download.cgi"; 233 234 $files = VincentFile::allDownloadableFiles($ENV{REMOTE_USER}); 235 236 if (scalar(@{$files}) > 0) { 237 238 239 print "<TR><TD>n"; 240 241 Interface::tableTop("Files Available for Download"); 242 243 print "<TABLE WIDTH='100%'><TR BGCOLOR='CCCCCC'>"; 244 print "<TD><STRONG>Description</STRONG></TD>"; 245 print "<TD><STRONG>File</STRONG></TD>"; 246 print "</TR>"; 247 248 foreach $file (@{$files}) { 249 $description = VincentFile::getDownloadableFileDescription($file); 250 $filename = VincentFile::getDownloadableFilename($file); 251 print "<TR><TD>$description</TD><TD><A HREF="download.cgi?"; 252 print "SYSID=$file&FILENAME=$filename&TYPE=admin">$filename</A></TD></TR>"; 253 } 254 255 print "</TABLE>"; 256 257 #Interface::endForm(); 258 print "<HR WIDTH='50%'><CENTER><A HREF='student.cgi'>Refresh</A> the download list.</CENTER>"; 259 print " <BR>"; 260 Interface::tableBottom(); 261 262 print "</TD></TR>"; 263 } 264 265 } 266 267 ###################################### 268 # Assignment Options 269 ###################################### 270 sub fileHandinError { 271 272 my ($datahash, 273 $filename, 274 $errorarrayvalue, 275 $index, 276 @errormessages, 277 $i, 278 @errors, 279 $noerrors 280 ); 281 282 #DEBUG("FHE: ", @_); 283 284 #The input is a hash, where each key is the 285 # system filename of all files submitted. 286 # Each hash entry points to an array, where 287 # the array has slots holding either a 1 or a 288 # zero. Each of those slots represents (in this 289 # order) the success of the... 290 # Time Check, Naming, Filesize 291 # If any one of those fields are zero, it 292 # means that the file either was late (and 293 # had a refuse late status), was 294 # named incorrectly, or had a 295 # filesize of 0. 296 297 $datahash = $_[1]; 298 299 @errormessages = (&fileLateMessage, 300 &fileNamedIncorrectlyMessage, 301 &zeroFilesizeMessage ); 302 303 SystemVariables::DEBUG("StuInt:", "Handling file handin errors."); 304 305 print "<TR><TD>"; 306 307 $index = 0; 308 foreach $filename (keys %{$datahash}) { 309 #DEBUG 310 #SystemVariables::DEBUG("StuInt:", "k1 Key: $filename"); 311 #SystemVariables::DEBUG("StuInt:", "Errors: ", @{$$datahash{$filename}\}); 312 313 @errors = @{$$datahash{$filename}\}; 314 315 for($i=0;$i<=$#errors;$i++) { 316 #DEBUG 317 #SystemVariables::DEBUG("StuInt:", "CurErr $i: ", $errors[$i]); 318 319 $errormessages[$i] -> ($filename, 320 $errors[$i] 321 ); 322 } 323 } 324 325 print "<HR>"; 326 327 if(!$errors[1] || !$errors[2]) { 328 fileErrorWarning(); 329 } 330 331 #startOver(); 332 333 print "</TD></TR>"; 334 } 335 336 sub fileErrorWarning { 337 print "<CENTER>"; 338 print "<STRONG><FONT COLOR='RED'>NO</FONT></STRONG> files were accepted"; 339 print " due to errors. <P> <STRONG>Please submit your work again.</STRONG>"; 340 print "</CENTER>"; 341 } 342 343 sub startOver { 344 345 print "<P><CENTER>"; 346 347 print "<STRONG><A HREF='student.cgi'>Start over</A></STRONG> and try again."; 348 print "</CENTER>"; 349 350 351 } 352 353 sub fileNoErrorMessage { 354 355 my($filename); 356 $filename = $_[0]; 357 358 359 ##LOGGING 360 VincentLog::clickLog("ASSIGNMENTS", "No errors in assignment upload."); 361 362 print "<CENTER>"; 363 print "<TABLE WIDTH = '80%'><TR><TD WIDTH='15%'>"; 364 print "<STRONG><FONT COLOR='#006600'>GOOD!</FONT></STRONG>"; 365 print "</TD><TD WIDTH = '85%'>"; 366 print "The file you submitted, "; 367 print "<STRONG><FONT COLOR='#006600'>$filename</FONT></STRONG>,"; 368 print " was without errors."; 369 print "</TD></TR></TABLE>"; 370 print "</CENTER>"; 371 } 372 373 sub fileLateMessage { 374 375 my($filename); 376 $filename = $_[0]; 377 378 if(!$_[1]) { 379 380 381 ##LOGGING 382 VincentLog::clickLog("ASSIGNMENTS", "$filename submitted late."); 383 384 print "<CENTER>"; 385 print "<TABLE WIDTH = '80%'><TR><TD WIDTH='15%'>"; 386 print "<STRONG>LATE</STRONG>"; 387 print "</TD><TD WIDTH = '85%'>"; 388 print "The file you submitted, "; 389 print "<STRONG><FONT COLOR='RED'>$filename</FONT></STRONG>,"; 390 print " is late. It will be handled according to your course's policies"; 391 print " regarding late assignments."; 392 print "</TD></TR></TABLE>"; 393 print "</CENTER>"; 394 } 395 } 396 397 sub fileNamedIncorrectlyMessage { 398 399 my($filename); 400 $filename = $_[0]; 401 402 if(!$_[1]) { 403 404 ##LOGGING 405 VincentLog::clickLog("ASSIGNMENTS", "$filename named incorrectly."); 406 407 print "<CENTER>"; 408 print "<TABLE WIDTH = '80%'><TR><TD WIDTH='15%'>"; 409 print "<STRONG>FILE NAMING</STRONG>"; 410 print "</TD><TD WIDTH = '85%'>"; 411 print "The file you submitted, "; 412 print "<STRONG><FONT COLOR='RED'>$filename</FONT></STRONG>,"; 413 print " is named incorrectly. Check the information provided"; 414 print " by your course instructor on the naming of this assignment,"; 415 print " name your file correctly, and submit all of the files"; 416 print " for this assignment again."; 417 print "</TD></TR></TABLE>"; 418 print "</CENTER>"; 419 } 420 421 } 422 423 sub zeroFilesizeMessage { 424 425 my($filename); 426 $filename = $_[0]; 427 428 if(!$_[1]) { 429 430 431 ##LOGGING 432 VincentLog::clickLog("ASSIGNMENTS", "$filename was a zero byte file."); 433 434 print "<CENTER>"; 435 print "<TABLE WIDTH = '80%'><TR><TD WIDTH='15%'>"; 436 print "<STRONG>NO FILE</STRONG>"; 437 print "</TD><TD WIDTH = '85%'>"; 438 print "The file you submitted, "; 439 print "<STRONG><FONT COLOR='RED'>$filename</FONT></STRONG>,"; 440 print " has a filesize of zero. Either the file you chose"; 441 print " to submit does not exist, or an error occurred in"; 442 print " submission. Submit all the files for this assignment"; 443 print " again, and double check that this file was selected"; 444 print " properly."; 445 print "</TD></TR></TABLE>"; 446 print "</CENTER>"; 447 } 448 } 449 450 sub fileInputDialog { 451 452 my ( $assignment, 453 $sysid, 454 @params, 455 $assign_data, 456 $numberoffiles, 457 $count, 458 $username 459 ); 460 461 $studentWebPath = SystemVariables::getStudentWebPath(); 462 SystemVariables::DEBUG("StuInt:", $studentWebPath); 463 $username = $ENV{REMOTE_USER}; 464 465 #The data regarding the particular assignment is 466 # tacked into the parameter passed to main menu 467 # as a pipe-delimited list. So, splitting it off and 468 # grabbing the fields of interest yield the data needed 469 # to build the file dialog. In this case, the 470 # assignment designator is the last of two fields. 471 $assignment = $_[2]; 472 #($assignment) = (split(/|/, $assignment))[1]; 473 474 SystemVariables::DEBUG("StuInt:", $assignment, " being turned in"); 475 476 #The assignment data for this particular assignment 477 # is grabbed, returning a hash reference. This 478 # reference can then be used to get any info needed 479 # about the assignment itself. 480 # 481 # This was previously written referencing the master data 482 # in the <ROOT>config/ directory. However, it now gets the 483 # data from the student's own parameter file (their personal record). 484 # This means any special cases are handled properly... 485 486 $sysid = Assignments::getAssignmentSystemID($assignment); 487 $assign_data = Assignments::getStuAssignmentData($sysid, $username); 488 $student_data = Record::getStudentRecord($username); 489 $numberoffiles = $$student_data{$sysid . "_NUMFILES"}; 490 491 print "<TR><TD>n"; 492 493 if($numberoffiles) { 494 Interface::tableTop( $$assign_data{$sysid . "_ASSIGNID"} 495 . 496 ": " 497 . 498 $$assign_data{$sysid . "_DESCRIPTION"}); 499 500 #If a message has been defined by the instructor, 501 # print that message here. 502 if(defined($$student_data{$sysid . "_MESSAGE"})) { 503 print $$student_data{$sysid . "_MESSAGE"}; 504 } 505 506 Interface::startForm($studentWebPath . "student.cgi"); 507 508 Interface::hidden("ASSIGNMENTHANDIN", $assignment); 509 510 #The file input boxes are generated based on the 511 # number of files in the _NUMFILES field 512 # when the assignment was created. 513 for($count = 1; $count <= $numberoffiles; $count++) { 514 Interface::file("File $count: ", "FILE$count"); 515 } 516 517 Interface::endForm(); 518 Interface::tableBottom(); 519 } 520 521 print "</TD></TR>n"; 522 523 } 524 525 sub submitAssignment { 526 527 } 528 529 sub acknowledgeDone { 530 531 my( $assignmentIDs, 532 $studentWebPath, 533 $studentUsername, 534 $id, 535 $stuRecord, 536 @notdone, 537 $num_files 538 ); 539 540 $num_files = 0; 541 542 $studentWebPath = SystemVariables::getStudentWebPath(); 543 SystemVariables::webErrOut($studentWebPath); 544 545 print "<TR><TD>n"; 546 547 Interface::tableTop("Which assignment are you done with?"); 548 549 #Check to see if the student has already submitted any 550 # of these assignments 551 $studentUsername = $ENV{REMOTE_USER}; 552 $assignmentIDs = Assignments::getAllNotDoneAssignments($studentUsername); 553 $num_files = scalar(@{$assignmentIDs}); 554 555 if(!$num_files) { 556 print " <P> <P>"; 557 print "<CENTER><FONT COLOR='RED'><H2>"; 558 print "<P>No assignments left to be done with!<P>"; 559 print "</H2></FONT></CENTER>"; 560 print " <P> <P>"; 561 print "<P ALIGN='RIGHT'><A HREF='student.cgi'>Start over.</A></P>"; 562 } 563 else { 564 Interface::startForm($studentWebPath . "student.cgi"); 565 566 print "<STRONG><FONT COLOR='RED'>WARNING!</FONT></STRONG> 567 Once you acknowledge you are done 568 with an assignment, you will no longer be able to submit files for that 569 assignment. Make sure you have met all the assignment's requirements before 570 continuing!"; 571 572 print "<P>"; 573 574 Interface::selectInput("I am now done with: ", 575 "ASSIGNMENTDONE", 576 @{$assignmentIDs} 577 ); 578 Interface::endForm(); 579 } 580 581 Interface::tableBottom(); 582 583 print "</TD></TR>n"; 584 585 } 586 587 sub chooseAssignmentToSubmit { 588 589 my( $assignmentIDs, 590 $studentWebPath, 591 $studentUsername, 592 $id, 593 $sysID, 594 $stuRecord, 595 @notdone, 596 $num_files 597 ); 598 599 $num_files = 0; 600 601 $studentWebPath = SystemVariables::getStudentWebPath(); 602 SystemVariables::webErrOut($studentWebPath); 603 604 print "<TR><TD>n"; 605 Interface::tableTop("Choose an Assignment to Submit"); 606 607 #Check to see if the student has already submitted any 608 # of these assignments 609 $studentUsername = $ENV{REMOTE_USER}; 610 611 if(SystemVariables::useDoneness()) { 612 $assignmentIDs = Assignments::getAllNotDoneAssignments($ENV{REMOTE_USER}); 613 } else { 614 $assignmentIDs = Assignments::getAssignmentIDs(); 615 } 616 617 SystemVariables::DEBUG("StuInt:", @{$assignmentIDs}); 618 619 $num_files = scalar(@{$assignmentIDs}); 620 if(!$num_files) { 621 print " <P> <P>"; 622 print "<CENTER><FONT COLOR='RED'><H2>"; 623 print "<P>No assignments left to turn in!<P>"; 624 print "</H2></FONT></CENTER>"; 625 print " <P> <P>"; 626 print "<P ALIGN='RIGHT'><A HREF='student.cgi'>Start over.</A></P>"; 627 } 628 else { 629 630 Interface::startForm($studentWebPath . "student.cgi"); 631 632 Interface::selectInput("Assignment To Submit", 633 "ASSIGNMENTTOSUBMIT", 634 @{$assignmentIDs} 635 ); 636 Interface::endForm(); 637 } 638 639 Interface::tableBottom(); 640 641 print "</TD></TR>n"; 642 643 } 644 645 sub expiredNotice { 646 ##LOGGING 647 VincentLog::clickLog("DENYACCESS", "User ", $ENV{REMOTE_USER}, " was denied access."); 648 649 print "<TR><TD>"; 650 print "<CENTER><H1>"; 651 print "<FONT COLOR='RED'>"; 652 print "Your access to the system has expired."; 653 print "</FONT></H1>"; 654 print "Contact your instructor or course administrator<BR>"; 655 print "to have your access reinstated."; 656 print "</TD></TR>"; 657 } 658 659 660 sub notInClassNotice { 661 662 print "<TR><TD>"; 663 print "<CENTER><H1>"; 664 print "<FONT COLOR='RED'>"; 665 print "You are not a student in this class."; 666 print "</FONT></H1>"; 667 print "If this comes as a surprise to you, please contact the course administrator,<BR>"; 668 print "or register for the class."; 669 print "</TD></TR>"; 670 } 671 672 sub viewGrades { 673 674 675 my($assignmentIDs, 676 $username, 677 $assignID, 678 $studata, 679 $sysID, 680 $grade, 681 $average, 682 $assigns, 683 @tmp, 684 $map, 685 $totalPoints, 686 $MAPINPUT, 687 $MAPOUTPUT, 688 $total 689 ); 690 691 $username = $_[0]; 692 $assignID = $_[2]; 693 694 if($assignID =~ /--.*ALL.*--/) { 695 $assigns = Assignments::getAllDoneAssignments($username); 696 foreach $assignID (@{$assigns}) { 697 push(@tmp, Assignments::getAssignmentSystemID($assignID)); 698 } 699 700 @{$assigns} = @tmp; 701 } else { 702 @{$assigns} = (Assignments::getAssignmentSystemID($assignID)); 703 } 704 705 $studata = Record::getStudentRecord($username); 706 707 foreach $sysID (@{$assigns}) { 708 709 #If they are done with the assignment, we show the 710 # grade. Otherwise, don't show anything... 711 712 if($$studata{$sysID . "_DONE"} eq 713 SystemVariables::getEarlierDate($$studata{$sysID . "_DONE"}, 714 SystemVariables::getCurrentTime())) { 715 716 if(defined($$studata{$sysID . "_GRADE"})) { 717 $grade = $$studata{$sysID . "_GRADE"}; 718 } else { 719 $grade = 0; 720 } 721 722 $total += $grade; 723 724 print "<TR><TD>"; 725 726 Interface::tableTop($username . "'s grade for " . $$studata{$sysID . "_ASSIGNID"}); 727 728 $MAPINPUT = $grade; 729 #Run the grademapping right now. 730 $map = Assignments::loadGradeMapping($$studata{$sysID . "_GRADEMAPPING"}); 731 eval $map; 732 733 #SystemVariables::DEBUG("StuInt:", $MAPINPUT, ",", $MAPOUTPUT); 734 735 #Progress bar's take the inputs 736 #($text, $inbartext, $current, $max, $referencebar, $shownumbers) = @_; 737 738 739 Interface::progressBar($username, 740 $MAPOUTPUT, 741 $grade, 742 $$studata{$sysID . "_MAXVALUE"}, 743 0, 744 0); 745 746 #Only show the average if it is set at the global level. 747 if(SystemVariables::showAverage()) { 748 $average = Assignments::getAssignmentAverage($sysID); 749 750 $MAPINPUT = $average; 751 #Run the grademapping right now. 752 $map = Assignments::loadGradeMapping($$studata{$sysID . "_GRADEMAPPING"}); 753 eval $map; 754 755 Interface::progressBar("Average", 756 $MAPOUTPUT, 757 $average, 758 $$studata{$sysID . "_MAXVALUE"}, 759 1, 760 0); 761 } 762 763 Interface::tableBottom(); 764 } #If it is done in the past... 765 # This makes sense for timed viewing of exams, 766 # which an administrator can make "DONE" at some time in the future. 767 } #Loop over the system IDs for each assignment 768 769 print "</TD></TR>"; 770 771 } 772 773 sub callbackProcessor { 774 775 my ($filedata, 776 $assignment, 777 $path, 778 $script, 779 $stdOut, 780 $stdErr, 781 ); 782 783 $filedata = $_[1]; 784 $assignment = $_[2]; 785 $path = SystemVariables::getCallbackPath(); 786 $path .= Assignments::getAssignmentCallback($assignment); 787 $path .= ".vpp"; 788 $script = ""; 789 790 #Define variables that postprocessor authors get for "free" 791 $classID = SystemVariables::getClassID(); 792 $classID =~ s/s*//g; 793 794 #Create the tempspace for the postprocessor 795 $tempDir = "/tmp/$classID" . $$; 796 mkdir($tempDir); 797 798 $VARIABLES{$classID . "RealFilePath"} = SystemVariables::getRecordPath() . $ENV{"REMOTE_USER"}; 799 $VARIABLES{$classID . "StudentUsername"} = $ENV{"REMOTE_USER"}; 800 $VARIABLES{$classID . "CallbacksPath"} = SystemVariables::getCallbackPath(); 801 $VARIABLES{$classID . "TempSpace"} = $tempDir; 802 803 foreach $key (keys %{$filedata}) { 804 SystemVariables::DEBUG("StuInt:", "Key: $key, ", $$filedata{$key}); 805 $FILELIST{$key} = $$filedata{$key}; 806 } 807 808 print "<TR><TD>"; 809 810 #SystemVariables::DEBUG("StuInt:", "Processing $assignment"); 811 #SystemVariables::DEBUG("StuInt:", "PostProcessor : ", $path); 812 813 #Readin the postprocessor. 814 open(CALLBACK, $path); 815 while(<CALLBACK>) { 816 $script .= $_; 817 } 818 close(CALLBACK); 819 820 #Redirect STDERR for a moment... 821 $stdErr = *STDERR; 822 $stdOut = *STDOUT; 823 open(STDERR, ">$tempDir/.STDERR"); 824 825 #Eval the postprocessor 826 eval($script); 827 828 close(STDERR); 829 830 #Dump the errors, replacing any occurances of 831 # $tempDir with nothing... 832 833 print "<CENTER>"; 834 print "<TABLE WIDTH='75%'><TR><TD>"; 835 836 print "<PRE>"; 837 open(ERRORS, "$tempDir/.STDERR"); 838 while(<ERRORS>) { 839 s/$tempDir//g; 840 s/^///g; 841 print; 842 } 843 print "</PRE>"; 844 845 print "</TD></TR></TABLE>"; 846 print "</CENTER>"; 847 848 #Remove all temp files created by this script 849 # and the postprocessor 850 system("rm -rf $tempDir"); 851 852 print "</TD></TR>"; 853 854 } 855 856 857 sub slipTimeRemaining { 858 859 my ($username, 860 $defaults 861 ); 862 863 $username = $_[0]; 864 $defaults = SystemVariables::getStudentDefaults(); 865 866 Interface::progressBar("Slip Time:", 867 Record::getSlipTime($username) . " hours remaining", 868 Record::getSlipTime($username), 869 $$defaults{"_SLIPTIME"}, 870 "REFERENCEBAR"); 871 } 872 873 874 #($text, $name, $value, $width, $lpercent, $rpercent) 875 #($text, $name, $value, $cols, $rows) 876 877 sub doPeerEval { 878 879 my($username, 880 $assignID, 881 $sysID, 882 $record, 883 $teammembers, 884 $member, 885 $studentWebPath, 886 $assign_data); 887 888 889 $username = $_[0]; 890 $assignID = $_[2]; 891 $sysID = Assignments::getAssignmentSystemID($assignID); 892 $record = Record::getStudentRecord($username); 893 $teammembers = $$record{"_TEAMMEMBERS"}; 894 $studentWebPath = SystemVariables::getStudentWebPath(); 895 print "<TR><TD>"; 896 897 Interface::tableTop("Peer Eval for $assignID"); 898 Interface::startForm($studentWebPath . "student.cgi"); 899 Interface::hidden("PEEREVALHANDIN", 1); 900 Interface::hidden("_assignID", $assignID); 901 902 print $$record{$sysID . "_MESSAGE"}; 903 904 foreach $member ((split(/s+/, $teammembers))) { 905 $member =~ s/s*//g; 906 chomp $member; 907 908 if($member) { 909 print "<TABLE WIDTH='100%'>"; 910 $memberrecord = Record::getStudentRecord($member); 911 912 print "<TR>"; 913 print "<TD><STRONG>", $$memberrecord{"_FIRSTNAME"}, " ", $$memberrecord{"_LASTNAME"}, "</STRONG> ($member)</TD>"; 914 print "<TD>"; 915 Interface::textInput("Max : " . Assignments::getAssignmentMaxValue($assignID), 916 $sysID . "_SCORE_" . $member, 917 "", 918 3); 919 print "</TD>"; 920 print "</TR>"; 921 print "<TR><TD COLSPAN='2'>"; 922 Interface::textArea("", 923 $sysID . "_COMMENTS_" . $member, 924 "", 925 40, 926 6); 927 print "</TD></TR>"; 928 print "</TABLE>"; 929 } 930 931 } 932 933 Interface::endForm(); 934 Interface::tableBottom(); 935 936 print "</TD></TR>"; 937 } 938 939 sub incompletePeerEval { 940 941 my($assignID); 942 943 $assignID = $_[1]; 944 945 Interface::tableTop("Incomplete Peer Evaluation"); 946 947 print "<FONT COLOR='RED'><CENTER><H1>Incomplete Peer Evaluation</H1></CENTER></FONT>"; 948 print "The peer evaluation you submitted did not have scores and comments "; 949 print "for everyone on your team. That being the case, you may "; 950 print "<A HREF='student.cgi'>start over</A> and submit a new "; 951 print "peer evaluation for $assignID. <P> "; 952 print "Please make sure to give a score and comments to everyone on your team. "; 953 954 955 Interface::tableBottom(); 956 } 957 958 sub goodPeerEval { 959 960 my($assignID); 961 962 $assignID = $_[0]; 963 964 Interface::tableTop("Good Peer Eval!"); 965 966 print "<CENTER>Your peer evaluation for $assignID was complete. <P>Thank you.</CENTER>"; 967 968 Interface::tableBottom(); 969 970 } 971 972 sub useDebugging())'>DEBUG { if(SystemVariables::useDebugging()) { print "StuInt: ", @_, "n<P>"; } } 973 974 975 976 |
|
Last update: 1/6/01; 9:32:37 AM |