[system] / trunk / webwork / system / cgi / cgi-scripts / profEditClasslistDB.pl Repository:
ViewVC logotype

Annotation of /trunk/webwork/system/cgi/cgi-scripts/profEditClasslistDB.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 87 - (view) (download) (as text)

1 : sam 11 #!/usr/local/bin/webwork-perl
2 : sam 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 : gage 8 use lib '.'; use webworkInit; # WeBWorKInitLine
16 : sam 2
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/) ) {
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 : gage 6 }
109 : sam 2
110 :     elsif (defined( $inputs{'save'} ) and ($inputs{'save'} eq "ON" ) and ($action =~ /REMOVE/) ) {
111 : apizer 87 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 : sam 2
119 : apizer 87 elsif (defined( $inputs{'save'} ) and ($inputs{'save'} eq "ON" ) and ($action =~ /DO/) ) {
120 : sam 2 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('StudentLogin',$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 : gage 6
266 :     print '<BR>The drop down lists below are for information only. Selecting items from them
267 : sam 2 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{'StudentLogin'});
314 : gage 6
315 :     ## test entries for bad characters.
316 :     my @entries = ($newStudentLastName, $newStudentFirstName, $newStudentStatus, $newComment, $newClassSection,
317 :     $newClassRecitation, $newStudentEmail);
318 : sam 2 my $item ='';
319 :     foreach $item (@entries) {
320 : gage 6 my $msg = test_entry($item);
321 : sam 2 unless ($msg eq 'OK') {
322 :     &wwerror('Bad Entry',$msg);
323 : gage 6 }
324 :     }
325 :    
326 :     ## test student login and ID for validity.
327 : sam 2 my $studentLoginChanged = 0;
328 :     if ($newStudentLogin ne $orgStudentLogin) {
329 :     $studentLoginChanged = 1;
330 :     my $msg = testNewStudentLogin($newStudentLogin,$newStudentID);
331 :     unless ($msg eq 'OK') {
332 :     &wwerror('Bad Login Name',$msg);}
333 :     }
334 :     my $studentIDChanged = 0;
335 :     if ($newStudentID ne $orgStudentID) {
336 :     $studentIDChanged = 1;
337 :     my $msg = testNewStudentID($newStudentID,$newStudentLogin);
338 :     unless ($msg eq 'OK') {
339 :     &wwerror('Bad Student ID',"$msg");}
340 :     }
341 :    
342 :     if ($studentLoginChanged and $studentIDChanged) {
343 :     warningMsgPage(\%inputs,$orgStudentFirstName,$orgStudentLastName,$newStudentFirstName,$newStudentLastName);
344 :     exit(0);
345 :     }
346 :    
347 :     # these will be set to zero if the new section or recitation is unique
348 :     my $uniqueSection = 0;
349 :     my %section_hash = %{getAllSections()};
350 :     $uniqueSection = $section_hash{$newClassSection} if defined $section_hash{$newClassSection};
351 :    
352 :     my $uniqueRecitation = 0;
353 :     my %recitation_hash = %{getAllRecitations()};
354 :     $uniqueRecitation = $recitation_hash{$newClassRecitation} if defined $recitation_hash{$newClassRecitation};
355 :    
356 :     $$section_status_ref = 'unique' unless $uniqueSection;
357 :     $$recitation_status_ref = 'unique' unless $uniqueRecitation;
358 :    
359 :     # update the webwork database if it exists
360 :    
361 :     if ( -e "${databaseDirectory}$Global::database" ){
362 :     my %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin);
363 :     my @PSVNs = values %setNumberHash;
364 :     my $psvn;
365 :     foreach $psvn (@PSVNs) {
366 :     attachProbSetRecord($psvn);
367 : gage 6 putStudentLogin($newStudentLogin, $psvn);
368 : sam 2 detachProbSetRecord($psvn);
369 :     }
370 :     }
371 :     # update the password and permissions databases
372 :    
373 :     if ($studentLoginChanged) {
374 :     change_user_in_password_file($newStudentLogin, $orgStudentLogin,$passwordFile);
375 :     change_user_in_permissions_file($newStudentLogin, $orgStudentLogin,$permissionsFile);
376 :     }
377 :    
378 :     if (&dropStatus($newStudentStatus) != &dropStatus($orgStudentStatus)) {
379 :     if (&dropStatus($newStudentStatus)) {
380 :     delete_password($newStudentLogin,$passwordFile);
381 :     delete_permissions($newStudentLogin,$permissionsFile);
382 :     }
383 :     else {
384 :     new_password($newStudentLogin,$newStudentID,$passwordFile);
385 :     put_permissions(0,$newStudentLogin,$permissionsFile);
386 :     }
387 :     }
388 :     # update the classlist database
389 :    
390 :     if ($studentLoginChanged) {
391 :     deleteClassListRecord($orgStudentLogin);
392 :     $studentLogin = $newStudentLogin;
393 :     }
394 :    
395 :     &CL_putStudentLastName( $newStudentLastName ,$studentLogin);
396 :     &CL_putStudentFirstName( $newStudentFirstName,$studentLogin);
397 :     &CL_putStudentStatus( $newStudentStatus ,$studentLogin);
398 :     &CL_putComment( $newComment ,$studentLogin);
399 :     &CL_putClassSection( $newClassSection ,$studentLogin);
400 :     &CL_putClassRecitation( $newClassRecitation ,$studentLogin);
401 :     &CL_putStudentEmailAddress( $newStudentEmail ,$studentLogin);
402 :     &CL_putStudentID( $newStudentID ,$studentLogin);
403 :    
404 :     # save the updated information to the database
405 :     saveCLRecord($studentLogin);
406 :     $studentLogin; ## return the possibly new studentLogin
407 :    
408 :     }
409 : apizer 87 sub check_Record {
410 :     my $studentLogin = shift @_;
411 :    
412 :     my $setsExist = 0;
413 :     my @SetNumberKeys = ();
414 :    
415 :     # check to see if there is data for this student in the WW DB
416 : sam 2
417 : apizer 87 if ( -e "${databaseDirectory}$Global::database" ){
418 :     $setsExist = &setsExistForStudentLogin($studentLogin);
419 :     if ($setsExist) {
420 :     my %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin);
421 :     @SetNumberKeys = keys(%setNumberHash);
422 :     }
423 :     }
424 :     removeRecordWarningPage(\%inputs,$studentLogin,$setsExist,\@SetNumberKeys );
425 :    
426 :     }
427 :    
428 : gage 6 sub removeRecord {
429 : apizer 87 my $studentLogin = shift @_;
430 :    
431 :     my $setsExist = 0;
432 :     my @SetNumberKeys = ();
433 :     my %setNumberHash = ();
434 :    
435 :     # check to see if there is data for this student in the WW DB
436 :    
437 :     if ( -e "${databaseDirectory}$Global::database" ){
438 :     $setsExist = &setsExistForStudentLogin($studentLogin);
439 :     if ($setsExist) {
440 :     %setNumberHash=&getAllSetNumbersForStudentLoginHash($studentLogin);
441 :     @SetNumberKeys = keys(%setNumberHash);
442 :     }
443 :     }
444 :    
445 :     ## Now remove all that data in the WeBWorK database, the .sco files, and any LatEx2HTML images
446 :     my ($setName, $psvn);
447 :    
448 :     if ($setsExist) {
449 :     foreach $setName (@SetNumberKeys) {
450 :     $psvn = $setNumberHash{$setName};
451 :     &attachProbSetRecord($psvn);
452 :     &deleteProbSetRecord($psvn);
453 :     # remove .sco file if it exists
454 :     system ("rm ${databaseDirectory}S${setName}-${psvn}.sco") if (-e "${databaseDirectory}S${setName}-${psvn}.sco");
455 :     # remove any l2h files
456 :     my $l2hDir = getCoursel2hDirectory();
457 :     my $tempDir = convertPath("${l2hDir}set${setName}/*-$psvn");
458 :     system ("rm -rf $tempDir");
459 :     }
460 :     }
461 :    
462 :     ## Next remove all the classlist data
463 :    
464 : gage 6 attachCLRecord($studentLogin);
465 :     deleteClassListRecord($studentLogin);
466 : sam 2 delete_password($studentLogin,$passwordFile);
467 :     delete_permissions($studentLogin,$permissionsFile);
468 : apizer 87
469 :     &record_successfully_deleted_message($studentLogin);
470 : gage 6 }
471 : sam 2
472 :     # logs the incremental changes to a log file
473 :     sub logChanges {
474 :     my @dataArray = @_;
475 :     my $fullLogFileName ="${logsDirectory}classlist_DB.log";
476 :     open(LOGFILE,">>$fullLogFileName") || &Global::error( "Can't open $fullLogFileName");
477 :    
478 :     my $timeNow = formatDateAndTime(time);
479 :     print LOGFILE "\n$Course, student is $studentLogin, user is $User, time is $timeNow, data is: ";
480 :     my $dataString = join( ' ',@dataArray);
481 :     print LOGFILE "@dataArray\n" ;
482 :     close(LOGFILE);
483 :     }
484 :    
485 :    
486 :     sub formatDataCell {
487 :     my ($name,$value,$size) = @_;
488 :     # if the data hasn't been entered it appears as a blank:
489 :     $value = '' unless defined($value);
490 :    
491 :     my $out = qq!
492 :     <TD ALIGN=CENTER VALIGN=MIDDLE >
493 :     <INPUT TYPE="TEXT" NAME="$name" VALUE="$value", SIZE="$size">
494 :     </TD>
495 :     !;
496 :     $out;
497 :     }
498 :     sub formatFixedDataCell {
499 :     my ($name,$value,$size) = @_;
500 :     # if the data hasn't been entered it appears as a blank:
501 :     $value = '' unless defined($value);
502 :    
503 :     my $out = qq!
504 :     <TD ALIGN=CENTER VALIGN=MIDDLE >
505 :     <INPUT TYPE='HIDDEN' NAME="$name" VALUE="$value">
506 :     $value
507 :     </TD>
508 :     !;
509 :     $out;
510 :     }
511 :     sub formatHeaderCell {
512 :     my ($item,$options) = @_;
513 :     $options = '' unless defined($options);
514 :     my $out = qq!
515 :     <TH ALIGN=CENTER VALIGN=MIDDLE $options>
516 :     $item
517 :     </TH>
518 :     !;
519 :     $out;
520 :     }
521 :    
522 :    
523 :    
524 :     sub record_successfully_deleted_message {
525 :     my $studentLogin =shift;
526 :     print &htmlTOP("The student record with login $studentLogin has been deleted from the $Course classlist database.");
527 :     print <<END_OF_HTML;
528 :     <A HREF="${cgiURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
529 :     <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A>
530 :     END_OF_HTML
531 : apizer 87 print qq!<P><B> The student record with login $studentLogin has been deleted from the classlist database.
532 :     All associated data has been removed from the WeBWorK databases.</B><P>!;
533 : sam 2 print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs);
534 :    
535 :     }
536 :    
537 :    
538 :    
539 :     sub warningMsgPage {
540 :    
541 :     my ($inputref,$ofn,$oln,$nfn,$nln) = @_;
542 :     my %inputs = %$inputref;
543 :     # print HTML text
544 :     print &htmlTOP("Data for the classlist record for $studentLogin");
545 :    
546 :     # print navigation buttons
547 :     print qq!
548 :     <A HREF="${Global::cgiWebworkURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
549 :     <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p>
550 :     !;
551 :    
552 :     print <<EOF;
553 :     <HR><BR>
554 :     <h3 align="left">WeBWorK WARNING message for Student Login $studentLogin</h3>
555 :     EOF
556 :     print qq!You have attempted to change (edit) both the Student Login and Student ID for <BR><BR>
557 :     Original Name: $ofn $oln <BR>
558 :     Edited Name: $nfn $nln <BR><BR>
559 :    
560 :     <P><FONT COLOR='#ff00aa'><B>NO CHANGES HAVE BEEN MADE</B></font> <P>
561 :     It is possible you are making a mistake by trying to use this form to enter a new user. If you want to
562 :     enter a new user, goto the Professor's page and click on "Enter Add Student(s) Page". <BR><BR>
563 :    
564 :     If you really want to make these extensive changes to $ofn ${oln}'s classlist record, you must do it
565 :     in two steps. You can not change both the Student Login and Student ID at the same time. Use your
566 :     browser's "Back Button" to go back and change just one of these. Then edit the record again changing the other one.
567 :     <BR><BR>
568 :     To Quit and return to the Professor's page, select the "Up" button or the button below.!;
569 :    
570 :    
571 :    
572 :     print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs);
573 :     exit;
574 : apizer 87 } #end of warning Page
575 :    
576 :    
577 :     sub removeRecordWarningPage {
578 :     my ($inputref, $studentLogin, $setsExist, $SetNumberKeysref) = @_;
579 :    
580 :     my @SetNumberKeys = @$SetNumberKeysref;
581 :     my %inputs = %$inputref;
582 :    
583 :     attachCLRecord($studentLogin);
584 :     my $studentLastName = CL_getStudentLastName($studentLogin);
585 :     my $studentFirstName = CL_getStudentFirstName($studentLogin);
586 :     my $studentID = CL_getStudentID($studentLogin);
587 :    
588 :     my $word = 'informational';
589 :     $word = "<FONT COLOR='#ff00aa'>WARNING</font>" if $setsExist;
590 :     # print HTML text
591 :     print &htmlTOP("Data for the classlist record for $studentLogin");
592 :    
593 :    
594 :     print qq!<h3 align="left">WeBWorK $word message concerning user $studentLogin
595 :     ($studentFirstName $studentLastName $studentID)</h3>\n!;
596 :    
597 :     print qq!You have requested to remove the the classlist records and all associated data for the above user. <BR><BR>
598 :    
599 :     <P><FONT COLOR='#ff00aa'><B>NO CHANGES HAVE BEEN MADE YET</B></font> <P>!;
600 :    
601 :     if ($setsExist) {
602 :     print qq! Data exists in the WeBWorK databases for following sets for user <b>$studentLogin</b><BR>\n!;
603 :     foreach my $set (@SetNumberKeys) {
604 :     print "<BR> Set $set\n";
605 :     }
606 :     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";
607 :     }
608 :    
609 :     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
610 :     to "D" (for Drop) rather than to totally remove all records. That way records are not destroyed\n
611 :     and also the student can be reactivated simply by changing his or her "Enrollment Status" back to "C" (for Current).\n!;
612 :    
613 :     print qq! <BR><BR>If you have scored any of the above sets, scores for user <b>$studentLogin</b> will be contained in the
614 :     ${Course}_totals.csv file (and the other scoring files). These scores will not be removed.\n!;
615 :    
616 :     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!;
617 :    
618 :    
619 :     print qq!<FORM ACTION="${cgiURL}profEditClasslistDB.pl" METHOD=POST>\n!;
620 :     print &sessionKeyInputs(\%inputs);
621 :     print qq!<INPUT TYPE='HIDDEN' NAME='studentLogin' VALUE="$studentLogin">\n
622 :     <INPUT TYPE="HIDDEN" NAME="save" VALUE="ON">\n
623 :     <INPUT TYPE="HIDDEN" NAME="firsttime" VALUE= 1>\n
624 :     If you really want to remove all records for <b>$studentLogin</b>, click on\n
625 :     <INPUT TYPE="SUBMIT" NAME = "action" VALUE="DO IT"> \n
626 :     but think before you click since this data, once removed, can not be recovered.\n
627 :     </FORM>!;
628 :    
629 :     print &htmlBOTTOM('profEditClasslistDB.pl', \%inputs);
630 :    
631 :     } #end of removeRecordWarningPage

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9