Parent Directory
|
Revision Log
Restoring header #!/usr/local/bin/webwork-perl line --Mike
1 #!/usr/local/bin/webwork-perl 2 3 4 #################################################################### 5 # Copyright @ 1995-1998 University of Rochester 6 # All Rights Reserved 7 #################################################################### 8 9 ## This script is profEditClasslistDB.pl ## 10 11 ############################################################################### 12 ############ PRELIMINARY SETUP ####################### 13 ############################################################################### 14 15 use lib '.'; use webworkInit; # WeBWorKInitLine 16 17 use Global; 18 use CGI qw(:standard); 19 use Auth; 20 use TimeLocal; # the module Time::Local.pm has a bug which interacts 21 # with DProf. (They call a subroutine assuming @_ doesn't change. 22 23 use strict; 24 25 my $logTimingData = 0; 26 my $beginTime; 27 28 # begin Timing code 29 if ($logTimingData == 1) { 30 use Benchmark; 31 $beginTime = new Benchmark; 32 } 33 # end Timing code 34 35 my $cgi = new CGI; 36 37 &CGI::ReadParse(*main::inputs); 38 my %inputs=%main::inputs; 39 40 # get primary data from CGI form 41 my $User = $inputs{'user'}; 42 my $Course = $inputs{'course'}; 43 my $Key = $inputs{'key'}; 44 45 46 # set course environment 47 &Global::getCourseEnvironment($Course); 48 49 my $scriptDirectory = getWebworkScriptDirectory($Course); 50 my $databaseDirectory = getCourseDatabaseDirectory($Course); 51 my $cgiURL = getWebworkCgiURL($Course); 52 my $htmlURL = getCourseHtmlURL($Course); 53 my $logsDirectory = getCourseLogsDirectory($Course); 54 55 require "${scriptDirectory}$Global::DBglue_pl"; 56 require "${scriptDirectory}$Global::classlist_DBglue_pl"; 57 require "${scriptDirectory}$Global::FILE_pl"; 58 require "${scriptDirectory}HTMLglue.pl"; 59 60 my $keyFile = getCourseKeyFile($Course); 61 &verify_key($inputs{'user'}, $inputs{'key'}, "$keyFile", $inputs{'course'}); 62 63 my $passwordFile = &Global::getCoursePasswordFile($inputs{'course'}); 64 my $permissionsFile = &Global::getCoursePermissionsFile($inputs{'course'}); 65 my $permissions = &get_permissions($inputs{'user'}, $permissionsFile); 66 67 if ($permissions != $Global::instructor_permissions ) { 68 print "permissions = $permissions instructor_permissions = $Global::instructor_permissions\n"; 69 print &html_NO_PERMISSION; 70 } 71 72 73 # get additional data from calling CGI form 74 my ($Mode, $studentLogin, $action); 75 76 $Mode = "HTML"; #default viewing mode 77 $Mode = $inputs{'Mode'} if defined($inputs{'Mode'}); 78 $studentLogin = $inputs{'studentLogin'}; 79 $action = $inputs{'action'}; 80 81 wwerror("No Student Selected", "Go back and select the student whose record you want to view or edit") 82 unless defined $studentLogin; 83 84 # the following are used to send warning messages if a unique section 85 # or recitation name is saved. They are set in updateDatabase() 86 my $section_status = 'non_unique'; 87 my $recitation_status = 'non_unique'; 88 my $section_status_ref = \$section_status; 89 my $recitation_status_ref = \$recitation_status; 90 91 if (defined( $inputs{'save'} ) and ($inputs{'save'} eq "ON" ) and (($action =~ /SAVE/) or ($action =~ /DROP/) )) { 92 # in this case we obtain the data from the CGI from and store it in the database 93 my $status = get_CL_database_status(); 94 if ($status eq 'locked') { 95 wwerror("The Classlist Database is LOCKED", "This means the database can not be updated from the internet. 96 Go back and unlock the Classlist Database before proceeding."); 97 } 98 # update the database from the CGI script: 99 100 $studentLogin = &updateDatabase($studentLogin); 101 # loads the information into %CLRecord, 102 # modifies the data and saves it back to the database 103 104 #log the changes: -- the format for loggin the changes needs improvement 105 &logChanges( getClassListRecord() ); 106 &print_modification_form; 107 108 } 109 110 elsif (defined( $inputs{'save'} ) and ($inputs{'save'} eq "ON" ) and ($action =~ /REMOVE/) ) { 111 my $status = get_CL_database_status(); 112 if ($status eq 'locked') { 113 wwerror("The Classlist Database is LOCKED", "This means the database can not be updated from the internet. 114 Go back and unlock the Classlist Database before proceeding."); 115 } 116 &check_Record($studentLogin); 117 } 118 119 elsif (defined( $inputs{'save'} ) and ($inputs{'save'} eq "ON" ) and ($action =~ /DO/) ) { 120 my $status = get_CL_database_status(); 121 if ($status eq 'locked') { 122 wwerror("The Classlist Database is LOCKED", "This means the database can not be updated from the internet. 123 Go back and unlock the Classlist Database before proceeding."); 124 } 125 &removeRecord($studentLogin); 126 } 127 128 elsif (defined($inputs{'save'}) && $inputs{'save'} eq "OFF" ){ 129 # No new information in the calling CGI form 130 # and the information has already been loaded into %probSetRecord using &fetchProbSetRecord($psvn); 131 # Nothing needs to be done in this case except print the form 132 &print_modification_form; 133 134 } else { 135 # The calling CGI script must define the 'save' variable or the 'deleteMode' variable 136 wwerror( $0, "No value for 'save' mode in the calling CGI form"); 137 } 138 139 # begin Timing code 140 if ($logTimingData == 1) { 141 my $endTime = new Benchmark; 142 &Global::logTimingInfo($beginTime,$endTime,'profEditClasslistDB.pl',$Course,$User); 143 } 144 # end Timing code 145 exit; 146 147 #### END of main program 148 149 ############################################################################### 150 ############################ SUBROUTINES ############################ 151 ############################################################################### 152 153 154 ############################################################################### 155 ########################## PRINT FORM ############################## 156 ############################################################################### 157 sub print_modification_form { 158 print &htmlTOP('Classlist database edit form'); 159 print <<END_OF_HTML; 160 161 <A HREF="${cgiURL}profClasslist.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}&format=section"> 162 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p> 163 <H3 ALIGN ="CENTER">Course Name: <FONT COLOR="#AA4400"> $inputs{'course'}</FONT> 164 Data for Student Login: <FONT COLOR="#AA4400">$studentLogin</FONT></H3> 165 <HR SIZE =2> 166 <FORM ACTION="${cgiURL}profEditClasslistDB.pl" METHOD=POST> 167 168 Changes can be saved only if the Read/Write Mode button is selected: <BR> 169 170 <INPUT TYPE="radio" CHECKED NAME="save" VALUE="OFF" > Read Only Mode <BR> 171 <INPUT TYPE="radio" NAME="save" VALUE="ON"> Read/Write Mode <BR> 172 <INPUT TYPE='HIDDEN' NAME='firsttime' VALUE= 0> 173 174 END_OF_HTML 175 176 177 ###################################################### 178 # return messages 179 #print message about saving to the database and current mode of CGI form 180 if (defined( $inputs{'firsttime'} ) && $inputs{'firsttime'} == 0 ) { 181 if (defined( $inputs{'save'} ) && $inputs{'save'} eq "ON" ) { 182 print "<P><FONT COLOR='#ff00aa'><B>CLASSLIST DATABASE MODIFIED</B></font> <P>"; 183 } elsif (defined($inputs{'save'}) && $inputs{'save'} eq "OFF" ){ 184 185 print "<P><FONT COLOR='#ff00aa'><B>READ ONLY MODE: CLASSLIST DATABASE UNCHANGED</B></font> <P>"; 186 187 } else { 188 # When initially entering this CGI the 'save' mode is undefined. 189 wwerror( $0, "No value for 'save' mode.</B><P>"); 190 } 191 } 192 193 # Get set data 194 attachCLRecord($studentLogin); 195 ## student 196 my $StudentLastName = CL_getStudentLastName($studentLogin); 197 my $StudentFirstName = CL_getStudentFirstName($studentLogin); 198 my $StudentStatus = CL_getStudentStatus($studentLogin); 199 my $StudentComment = CL_getComment($studentLogin); 200 my $ClassSection = CL_getClassSection($studentLogin); 201 my $ClassRecitation = CL_getClassRecitation($studentLogin); 202 my $StudentEmail = CL_getStudentEmailAddress($studentLogin); 203 my $StudentID = CL_getStudentID($studentLogin); 204 205 if ($section_status eq 'unique') { 206 print "<P><FONT COLOR='#ff00aa'><B>$StudentFirstName $StudentLastName is the only 207 person in the section $ClassSection</B></font> <P>"; 208 } 209 210 if ($recitation_status eq 'unique') { 211 print "<P><FONT COLOR='#ff00aa'><B>$StudentFirstName $StudentLastName is the only 212 person in the recitation $ClassRecitation</B></font> <P>"; 213 } 214 215 216 # submit button 217 218 print qq!<INPUT TYPE='SUBMIT' NAME = 'action' VALUE='SAVE CHANGES'><INPUT TYPE = "RESET" VALUE= "RESET FORM"><INPUT TYPE='SUBMIT' NAME = 'action' VALUE='REMOVE THIS RECORD'> <BR>!; 219 220 # Get set data 221 222 223 # continue printing form ###################################################### 224 print &sessionKeyInputs(\%inputs); 225 print qq!<INPUT TYPE='HIDDEN' NAME='studentLogin' VALUE="$studentLogin">!; 226 print qq! <TABLE BORDER="1" CELLPADDING="1" CELLSPACING="2" > <FONT SIZE=-2>!; 227 228 print "<TR>\n"; 229 print &formatHeaderCell("Last Name"); 230 print &formatHeaderCell("First Name"); 231 print &formatHeaderCell("Student ID" ); 232 print "</TR>\n"; 233 print "<TR>\n"; 234 print &formatDataCell("StudentLastName",$StudentLastName, "20"); 235 print &formatDataCell("StudentFirstName", $StudentFirstName, "20"); 236 print &formatDataCell("StudentID", $StudentID, "30"); 237 print "</TR>\n"; 238 239 print "<TR>\n"; 240 print &formatHeaderCell("Student login name"); 241 print &formatHeaderCell("Enrollment Status"); 242 print &formatHeaderCell('Comment' ); 243 print "</TR>\n"; 244 print "<TR>\n"; 245 print &formatDataCell('NewStudentLogin',$studentLogin, "20"); 246 print &formatDataCell('StudentStatus',$StudentStatus, "20"); 247 print &formatDataCell('Comment', $StudentComment, "30"); 248 print "</TR>\n"; 249 250 print "<TR>\n"; 251 print &formatHeaderCell('Section'); 252 print &formatHeaderCell('Recitation'); 253 print &formatHeaderCell('Email Address'); 254 print "</TR>\n"; 255 256 print "<TR>\n"; 257 print &formatDataCell('ClassSection', $ClassSection, "20"); 258 print &formatDataCell('ClassRecitation', $ClassRecitation, "20"); 259 print &formatDataCell('StudentEmail', $StudentEmail, "30"); 260 print "</TR>\n"; 261 262 263 264 print ' </FONT></TABLE>'; 265 266 print '<BR>The drop down lists below are for information only. Selecting items from them 267 does nothing.<BR> Enter the section, recitation, and enrollment status, if any, above. <BR>'; 268 # Current Sections list 269 270 print $cgi -> popup_menu( -name => 'currentSections', 271 -values => ['List of current sections', keys (%{getAllSections()})] 272 ); 273 274 # Current Recitations list 275 print $cgi -> popup_menu( -name => 'currentRecitations', 276 -values => ['List of current recitations', keys (%{getAllRecitations()})] 277 ); 278 # Current Drop List 279 280 my @drop_status_labels = getStatusDrop(); 281 282 print $cgi -> popup_menu( -name => 'dropStatus', 283 -values => ['Valid Drop Status',@drop_status_labels] 284 ); 285 print 'Any other status (e.g. "C") indicates a current student.'; 286 287 print q!</FORM>!; 288 289 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs); 290 291 } # end of print_modification_form 292 293 294 sub updateDatabase { 295 296 my $studentLogin = shift @_; 297 attachCLRecord($studentLogin); 298 299 my $orgStudentLastName = CL_getStudentLastName($studentLogin); 300 my $orgStudentFirstName = CL_getStudentFirstName($studentLogin); 301 my $orgStudentID = CL_getStudentID($studentLogin); 302 my $orgStudentStatus = CL_getStudentStatus($studentLogin); 303 my $orgStudentLogin = $studentLogin; 304 305 my $newStudentLastName = stripWhiteSpace($inputs{'StudentLastName'}); 306 my $newStudentFirstName = stripWhiteSpace($inputs{'StudentFirstName'}); 307 my $newStudentStatus = stripWhiteSpace($inputs{'StudentStatus'}); 308 my $newComment = stripWhiteSpace($inputs{'Comment'}); 309 my $newClassSection = stripWhiteSpace($inputs{'ClassSection'}); 310 my $newClassRecitation = stripWhiteSpace($inputs{'ClassRecitation'}); 311 my $newStudentEmail = stripWhiteSpace($inputs{'StudentEmail'}); 312 my $newStudentID = stripWhiteSpace($inputs{'StudentID'}); 313 my $newStudentLogin = stripWhiteSpace($inputs{'NewStudentLogin'}); 314 315 ## test entries for bad characters. 316 my @entries = ($newStudentLastName, $newStudentFirstName, $newStudentStatus, $newComment, $newClassSection, 317 $newClassRecitation, $newStudentEmail); 318 my $item =''; 319 foreach $item (@entries) { 320 my $msg = test_entry($item); 321 unless ($msg eq 'OK') { 322 &wwerror('Bad Entry',$msg); 323 } 324 } 325 326 ## test for dropping a professor 327 my $studentPermissions = &get_permissions($orgStudentLogin, $permissionsFile); 328 if ( 329 defined $studentPermissions and 330 $studentPermissions == $Global::instructor_permissions and 331 &dropStatus($newStudentStatus) != &dropStatus($orgStudentStatus) and 332 &dropStatus($newStudentStatus) and 333 ($action =~ /SAVE/) 334 ) { 335 if ($newStudentLogin ne $orgStudentLogin) { 336 &wwerror("You can't do this",'You can not change both the login name and enrollment status at the same time for someone with professor privileges'); 337 } 338 else { 339 dropProfWarningPage(\%inputs,$orgStudentLogin); 340 exit(0);} 341 } 342 343 ## test student login and ID for validity. 344 my $studentLoginChanged = 0; 345 if ($newStudentLogin ne $orgStudentLogin) { 346 $studentLoginChanged = 1; 347 my $msg = testNewStudentLogin($newStudentLogin,$newStudentID); 348 unless ($msg eq 'OK') { 349 &wwerror('Bad Login Name',$msg); 350 } 351 } 352 my $studentIDChanged = 0; 353 if ($newStudentID ne $orgStudentID) { 354 $studentIDChanged = 1; 355 my $msg = testNewStudentID($newStudentID,$newStudentLogin); 356 unless ($msg eq 'OK') { 357 &wwerror('Bad Student ID',"$msg");} 358 } 359 360 if ($studentLoginChanged and $studentIDChanged) { 361 warningMsgPage(\%inputs,$orgStudentFirstName,$orgStudentLastName,$newStudentFirstName,$newStudentLastName); 362 exit(0); 363 } 364 365 # these will be set to zero if the new section or recitation is unique 366 my $uniqueSection = 0; 367 my %section_hash = %{getAllSections()}; 368 $uniqueSection = $section_hash{$newClassSection} if defined $section_hash{$newClassSection}; 369 370 my $uniqueRecitation = 0; 371 my %recitation_hash = %{getAllRecitations()}; 372 $uniqueRecitation = $recitation_hash{$newClassRecitation} if defined $recitation_hash{$newClassRecitation}; 373 374 $$section_status_ref = 'unique' unless $uniqueSection; 375 $$recitation_status_ref = 'unique' unless $uniqueRecitation; 376 377 378 if ($studentLoginChanged) { 379 380 # update the webwork database if it exists and sets have been built for the student 381 if ( -e "${databaseDirectory}$Global::database" ){ 382 if (setsExistForStudentLogin($studentLogin)) { 383 my %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin); 384 my @PSVNs = values %setNumberHash; 385 my $psvn; 386 foreach $psvn (@PSVNs) { 387 attachProbSetRecord($psvn); 388 putStudentLogin($newStudentLogin, $psvn); 389 detachProbSetRecord($psvn); 390 } 391 } 392 } 393 394 # update the password and permissions databases 395 change_user_in_password_file($newStudentLogin, $orgStudentLogin,$passwordFile); 396 change_user_in_permissions_file($newStudentLogin, $orgStudentLogin,$permissionsFile); 397 } 398 399 if (&dropStatus($newStudentStatus) != &dropStatus($orgStudentStatus)) { 400 if (&dropStatus($newStudentStatus)) { 401 delete_password($newStudentLogin,$passwordFile); 402 delete_permissions($newStudentLogin,$permissionsFile); 403 } 404 else { 405 new_password($newStudentLogin,$newStudentID,$passwordFile); 406 put_permissions(0,$newStudentLogin,$permissionsFile); 407 } 408 } 409 # update the classlist database 410 411 if ($studentLoginChanged) { 412 deleteClassListRecord($orgStudentLogin); 413 $studentLogin = $newStudentLogin; 414 } 415 416 &CL_putStudentLastName( $newStudentLastName ,$studentLogin); 417 &CL_putStudentFirstName( $newStudentFirstName,$studentLogin); 418 &CL_putStudentStatus( $newStudentStatus ,$studentLogin); 419 &CL_putComment( $newComment ,$studentLogin); 420 &CL_putClassSection( $newClassSection ,$studentLogin); 421 &CL_putClassRecitation( $newClassRecitation ,$studentLogin); 422 &CL_putStudentEmailAddress( $newStudentEmail ,$studentLogin); 423 &CL_putStudentID( $newStudentID ,$studentLogin); 424 425 # save the updated information to the database 426 saveCLRecord($studentLogin); 427 $studentLogin; ## return the possibly new studentLogin 428 429 } 430 sub check_Record { 431 my $studentLogin = shift @_; 432 433 my $setsExist = 0; 434 my @SetNumberKeys = (); 435 436 # check to see if there is data for this student in the WW DB 437 438 if ( -e "${databaseDirectory}$Global::database" ){ 439 $setsExist = &setsExistForStudentLogin($studentLogin); 440 if ($setsExist) { 441 my %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin); 442 @SetNumberKeys = keys(%setNumberHash); 443 } 444 } 445 removeRecordWarningPage(\%inputs,$studentLogin,$setsExist,\@SetNumberKeys ); 446 447 } 448 449 sub removeRecord { 450 my $studentLogin = shift @_; 451 452 my $setsExist = 0; 453 my @SetNumberKeys = (); 454 my %setNumberHash = (); 455 456 # check to see if there is data for this student in the WW DB 457 458 if ( -e "${databaseDirectory}$Global::database" ){ 459 $setsExist = &setsExistForStudentLogin($studentLogin); 460 if ($setsExist) { 461 %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin); 462 @SetNumberKeys = keys(%setNumberHash); 463 } 464 } 465 466 ## Now remove all that data in the WeBWorK database, the .sco files, 467 ## dvipng images, and any LaTeX2HTML images 468 my ($setName, $psvn); 469 470 if ($setsExist) { 471 foreach $setName (@SetNumberKeys) { 472 $psvn = $setNumberHash{$setName}; 473 &attachProbSetRecord($psvn); 474 &deleteProbSetRecord($psvn); 475 # remove .sco file if it exists 476 system ("rm ${databaseDirectory}S${setName}-${psvn}.sco") if (-e "${databaseDirectory}S${setName}-${psvn}.sco"); 477 # remove any l2h files 478 my $l2hDir = getCoursel2hDirectory(); 479 my $tempDir = convertPath("${l2hDir}set${setName}/*-$psvn"); 480 system ("rm -rf $tempDir"); 481 # remove any dvipng images -- reuse the variable names 482 $l2hDir = getCourseTempDirectory(); 483 $tempDir = convertPath("${l2hDir}png/${setName}/$psvn"); 484 system ("rm -rf $tempDir"); 485 } 486 } 487 488 ## Next remove all the classlist data 489 490 attachCLRecord($studentLogin); 491 deleteClassListRecord($studentLogin); 492 delete_password($studentLogin,$passwordFile); 493 delete_permissions($studentLogin,$permissionsFile); 494 495 &record_successfully_deleted_message($studentLogin); 496 } 497 498 # logs the incremental changes to a log file 499 sub logChanges { 500 my @dataArray = @_; 501 my $fullLogFileName ="${logsDirectory}classlist_DB.log"; 502 open(LOGFILE,">>$fullLogFileName") || &Global::error( "Can't open $fullLogFileName"); 503 504 my $timeNow = formatDateAndTime(time); 505 print LOGFILE "\n$Course, student is $studentLogin, user is $User, time is $timeNow, data is: "; 506 my $dataString = join( ' ',@dataArray); 507 print LOGFILE "@dataArray\n" ; 508 close(LOGFILE); 509 } 510 511 512 sub formatDataCell { 513 my ($name,$value,$size) = @_; 514 # if the data hasn't been entered it appears as a blank: 515 $value = '' unless defined($value); 516 517 my $out = qq! 518 <TD ALIGN=CENTER VALIGN=MIDDLE > 519 <INPUT TYPE="TEXT" NAME="$name" VALUE="$value", SIZE="$size"> 520 </TD> 521 !; 522 $out; 523 } 524 sub formatFixedDataCell { 525 my ($name,$value,$size) = @_; 526 # if the data hasn't been entered it appears as a blank: 527 $value = '' unless defined($value); 528 529 my $out = qq! 530 <TD ALIGN=CENTER VALIGN=MIDDLE > 531 <INPUT TYPE='HIDDEN' NAME="$name" VALUE="$value"> 532 $value 533 </TD> 534 !; 535 $out; 536 } 537 sub formatHeaderCell { 538 my ($item,$options) = @_; 539 $options = '' unless defined($options); 540 my $out = qq! 541 <TH ALIGN=CENTER VALIGN=MIDDLE $options> 542 $item 543 </TH> 544 !; 545 $out; 546 } 547 548 549 550 sub record_successfully_deleted_message { 551 my $studentLogin =shift; 552 print &htmlTOP("The student record with login $studentLogin has been deleted from the $Course classlist database."); 553 print <<END_OF_HTML; 554 <A HREF="${cgiURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}"> 555 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A> 556 END_OF_HTML 557 print qq!<P><B> The student record with login $studentLogin has been deleted from the classlist database. 558 All associated data has been removed from the WeBWorK databases.</B><P>!; 559 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs); 560 561 } 562 563 564 565 sub warningMsgPage { 566 567 my ($inputref,$ofn,$oln,$nfn,$nln) = @_; 568 my %inputs = %$inputref; 569 # print HTML text 570 print &htmlTOP("Data for the classlist record for $studentLogin"); 571 572 # print navigation buttons 573 print qq! 574 <A HREF="${Global::cgiWebworkURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}"> 575 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p> 576 !; 577 578 print <<EOF; 579 <HR><BR> 580 <h3 align="left">WeBWorK WARNING message for Student Login $studentLogin</h3> 581 EOF 582 print qq!You have attempted to change (edit) both the Student Login and Student ID for <BR><BR> 583 Original Name: $ofn $oln <BR> 584 Edited Name: $nfn $nln <BR><BR> 585 586 <P><FONT COLOR='#ff00aa'><B>NO CHANGES HAVE BEEN MADE</B></font> <P> 587 It is possible you are making a mistake by trying to use this form to enter a new user. If you want to 588 enter a new user, goto the Professor's page and click on "Enter Add Student(s) Page". <BR><BR> 589 590 If you really want to make these extensive changes to $ofn ${oln}'s classlist record, you must do it 591 in two steps. You can not change both the Student Login and Student ID at the same time. Use your 592 browser's "Back Button" to go back and change just one of these. Then edit the record again changing the other one. 593 <BR><BR> 594 To Quit and return to the Professor's page, select the "Up" button or the button below.!; 595 596 597 598 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs); 599 exit; 600 } #end of warning Page 601 602 603 sub removeRecordWarningPage { 604 my ($inputref, $studentLogin, $setsExist, $SetNumberKeysref) = @_; 605 606 my @SetNumberKeys = @$SetNumberKeysref; 607 my %inputs = %$inputref; 608 609 attachCLRecord($studentLogin); 610 my $studentLastName = CL_getStudentLastName($studentLogin); 611 my $studentFirstName = CL_getStudentFirstName($studentLogin); 612 my $studentID = CL_getStudentID($studentLogin); 613 614 my $studentPermissions = &get_permissions($studentLogin, $permissionsFile); 615 my $word = 'informational'; 616 617 if ($setsExist or (defined $studentPermissions and $studentPermissions == $Global::instructor_permissions)) 618 {$word = "<FONT COLOR='#ff00aa'>WARNING</font>";} 619 # print HTML text 620 print &htmlTOP("Data for the classlist record for $studentLogin"); 621 622 print qq!<h3 align="left">WeBWorK $word message concerning user $studentLogin 623 ($studentFirstName $studentLastName $studentID)</h3>\n!; 624 625 print qq!You have requested to remove the the classlist records and all associated data for the above user. <BR><BR> 626 627 <P><FONT COLOR='#ff00aa'><B>NO CHANGES HAVE BEEN MADE YET. </B></font> <P>!; 628 629 if ($User eq $studentLogin) { 630 print qq!<FONT COLOR='#ff00aa'><B>YOU ARE TRYING TO REMOVE YOURSELF FROM THE COURSE. </B></font>\n 631 If you do this, you will immediately be locked out of the course. You will no longer be able to\n 632 login and/or administer the course. Removing yourself is something you almost never want to do.\n 633 Use your browser's "Back" button to cancel this action.<P>\n!; 634 } 635 elsif (defined $studentPermissions and $studentPermissions == $Global::instructor_permissions){ 636 print qq!<FONT COLOR='#ff00aa'><B>YOU ARE TRYING TO REMOVE A PROFESSOR FROM THE COURSE. </B></font>\n 637 If you do this, $studentFirstName $studentLastName will imediately be locked out of the course. 638 He or she will no longer be able to login and/or administer the course. 639 Use your browser's "Back" button to cancel this action.<P>\n!; 640 } 641 642 if ($setsExist) { 643 print qq! Data exists in the WeBWorK databases for following sets for user <b>$studentLogin</b><BR>\n!; 644 foreach my $set (@SetNumberKeys) { 645 print "<BR> Set $set\n"; 646 } 647 print "<BR> <BR>If you choose to remove all records for <b>$studentLogin</b>, all this data will be destroyed. This action can not be undone.<BR>\n"; 648 } 649 650 print qq! <BR><BR>Generally if the user <b>$studentLogin</b> is a real user, it is preferable to change his or her "Enrollment Status"\n 651 to "D" (for Drop) rather than to totally remove all records. That way records are not destroyed\n 652 and also the student can be reactivated simply by changing his or her "Enrollment Status" back to "C" (for Current).\n!; 653 654 print qq! <BR><BR>If you have scored any of the above sets, scores for user <b>$studentLogin</b> will be contained in the 655 ${Course}_totals.csv file (and the other scoring files). These scores will not be removed.\n!; 656 657 print qq! <BR><BR>If you want to change the "Enrollment Status" for $studentLogin to "D" (for Drop), use your browser's "Back" button.<BR>\n!; 658 659 660 print qq!<FORM ACTION="${cgiURL}profEditClasslistDB.pl" METHOD=POST>\n!; 661 print &sessionKeyInputs(\%inputs); 662 print qq!<INPUT TYPE='HIDDEN' NAME='studentLogin' VALUE="$studentLogin">\n 663 <INPUT TYPE="HIDDEN" NAME="save" VALUE="ON">\n 664 <INPUT TYPE="HIDDEN" NAME="firsttime" VALUE= 1>\n 665 If you really want to remove all records for <b>$studentLogin</b>, click on\n 666 <INPUT TYPE="SUBMIT" NAME = "action" VALUE="DO IT"> \n 667 but think before you click since this data, once removed, can not be recovered.\n 668 </FORM>!; 669 670 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs); 671 672 } #end of removeRecordWarningPage 673 674 sub dropProfWarningPage { 675 my ($inputref, $studentLogin) = @_; 676 my %inputs = %$inputref; 677 678 attachCLRecord($studentLogin); 679 my $studentLastName = CL_getStudentLastName($studentLogin); 680 my $studentFirstName = CL_getStudentFirstName($studentLogin); 681 my $studentID = CL_getStudentID($studentLogin); 682 683 my $studentPermissions = &get_permissions($studentLogin, $permissionsFile); 684 my $word = "<FONT COLOR='#ff00aa'>WARNING</font>"; 685 686 # print HTML text 687 print &htmlTOP("Data for the classlist record for $studentLogin"); 688 689 print qq!<h3 align="left">WeBWorK $word message concerning user $studentLogin 690 ($studentFirstName $studentLastName $studentID)</h3>\n!; 691 692 print qq!You have requested to drop the above user from the course. <BR><BR> 693 694 <P><FONT COLOR='#ff00aa'><B>NO CHANGES HAVE BEEN MADE YET. </B></font> <P>!; 695 696 if ($User eq $studentLogin) { 697 print qq!<FONT COLOR='#ff00aa'><B>YOU ARE TRYING TO DROP YOURSELF FROM THE COURSE. </B></font>\n 698 If you do this, you will immediately be locked out of the course. You will no longer be able to\n 699 login and/or administer the course. Removing yourself is something you almost never want to do.\n 700 Use your browser's "Back" button to cancel this action.<P>\n!; 701 } 702 elsif (defined $studentPermissions and $studentPermissions == $Global::instructor_permissions){ 703 print qq!<FONT COLOR='#ff00aa'><B>YOU ARE TRYING TO DROP A PROFESSOR FROM THE COURSE. </B></font>\n 704 If you do this, $studentFirstName $studentLastName will imediately be locked out of the course. 705 He or she will no longer be able to login and/or administer the course. 706 Use your browser's "Back" button to cancel this action.<P>\n!; 707 } 708 709 print qq!<FORM ACTION="${cgiURL}profEditClasslistDB.pl" METHOD=POST>\n!; 710 print &sessionKeyInputs(\%inputs); 711 712 print qq!<INPUT TYPE='HIDDEN' NAME='studentLogin' VALUE="$studentLogin">\n 713 <INPUT TYPE='HIDDEN' NAME='save' VALUE="ON">\n 714 <INPUT TYPE='HIDDEN' NAME='firsttime' VALUE= 1>\n 715 <INPUT TYPE='HIDDEN' NAME='StudentLastName' VALUE= "$inputs{'StudentLastName'}">\n 716 <INPUT TYPE='HIDDEN' NAME='StudentFirstName' VALUE= "$inputs{'StudentFirstName'}">\n 717 <INPUT TYPE='HIDDEN' NAME='StudentStatus' VALUE="$inputs{'StudentStatus'}">\n 718 <INPUT TYPE='HIDDEN' NAME='Comment' VALUE= "$inputs{'Comment'}">\n 719 <INPUT TYPE='HIDDEN' NAME='ClassSection' VALUE="$inputs{'ClassSection'}">\n 720 <INPUT TYPE='HIDDEN' NAME='ClassRecitation' VALUE= "$inputs{'ClassRecitation'}">\n 721 <INPUT TYPE='HIDDEN' NAME='StudentEmail' VALUE="$inputs{'StudentEmail'}">\n 722 <INPUT TYPE='HIDDEN' NAME='StudentID' VALUE= "$inputs{'StudentID'}">\n 723 <INPUT TYPE='HIDDEN' NAME='NewStudentLogin' VALUE= "$inputs{'NewStudentLogin'}">\n 724 725 If you really want to drop <b>$studentLogin</b>, click on\n 726 <INPUT TYPE="SUBMIT" NAME = "action" VALUE="DROP PROF"> \n 727 but think before you click.\n 728 </FORM>!; 729 730 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs); 731 732 } #end of dropProfWarningPage 733 734
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |