#!/usr/bin/perl -Tw # check for student 4x4 and team # to start review # get review item number from list # Copyright 2002-2003 Dean F. Hougen. All rights reserved. $review_dir = '/home/hougen/www/classes/Spring-2003/Robotics/reviews/'; $class_file = $review_dir . 'classfile'; $sendmail = '/usr/lib/sendmail'; $num_teams = 10; use CGI; use Fcntl qw(:DEFAULT :flock); $review = new CGI; $ENV{'PATH'} = '/usr/bin:/usr/lib'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; # sub untaint; # sub user_login_form; # sub validate_login; # sub user_review_form; # sub thank_you; $action = $review->param('action'); if (!$action) { # there is no action, must be the first time here, present login form user_login_form(); } elsif ($action eq 'LOGIN'){ validate_login(); $review_num = $review_base; user_review_form(); } elsif ($action eq 'SUBMIT'){ validate_login(); process_review_form(); $review_offset++; if ($review_item eq 'P3Project'){ $review_base += 3; } $review_num = $review_base + $review_offset; if ($review_num > $num_teams) { $review_num -= $num_teams; } if ($review_offset < $num_reviews) { user_review_form(); } elsif ($review_offset == $num_reviews) { thank_you(); } else { die "Invalid Review Num: $review_num\n"; } } else { # action is undefined error_page ("
Note, for reviews of team projects, each person should evaluate the work of each team individually. The reviews are NOT to be done as a team. Each of you should independently look at each report and arrive at your own conclusions about the work of the teams. Think of this as homework that you are assigned to do on your own.
Note, for reviews of team projects, each person should evaluate the work of three other teams plus your own team.
For project 2, if you are in team N, the other teams you review will be N+1, N+2, and N+3. If any of the resulting values are greater than 10, subtract 10 from them. (E.g., if you are in team 9, you will review teams 9, 10, 1, and 2.)
For project 3, if you are in team N, the other teams you review will be N+4, N+5, and N+6. If any of the resulting values are greater than 10, subtract 10 from them. (E.g., if you are in team 9, you will review teams 9, 3, 4, and 5.)
Note, for peer reviews of team members, you should evaluate yourself as well as each of your team mates.
4 x 4 Given: $four_by_four
"); } #untaint 4x4 $four_by_four = untaint($four_by_four); #check for length of Team Number unless (length($team_num) < 3 && $team_num > 0 && $team_num < 11) { error_page("Team Number Given: $team_num
"); } #untaint Team Number $team_num = untaint($team_num); #check for length of Team Size unless (length($team_size) < 2 && $team_size > 2 && $team_size < 5) { error_page("Team Size Given: $team_size
"); } #untaint Team Size $team_size = untaint($team_size); #untaint Review Item $review_item = untaint($review_item); #determine number of times through form # if ($review_item eq 'P1Tasks' || $review_item eq 'P1Time' # || $review_item eq 'P1Project'){ # $num_reviews = $num_teams; # } # else { # $num_reviews = $team_size; # } if ($review_item eq 'P1Peer' || $review_item eq 'P2Peer' || $review_item eq 'P3Peer' || $review_item eq 'P4Peer'){ #for peer reviews of teammates, start with 1 and go to the number #of team members $num_reviews = $team_size; $review_base = 1; } else { #for reviews of team materials, start with own team number and #review three other teams (four reviews total) $review_base = $team_num; $num_reviews = 4; } #untaint Email Address $email_addr = untaint($email_addr); #combine 4x4 and Team Number into a single data item $login_code = $four_by_four . $team_num . $email_addr ; #$login_code = $four_by_four . $team_num; #debug_page("Login code is: $login_code"); #open class file non-destructively, read in entries #entry format is "4x4#email_addr" on each line $found = 0; sysopen(STUDENTS, "$class_file", O_RDONLY) or die "Can't open $class_file: $!"; flock(STUDENTS, LOCK_SH) or die "Can't get shared lock on $class_file: $!"; while(4 x 4 Given: $four_by_four
Team Number Given: $team_num
OU Email Address Given: $email_addr\@ou.edu
Data Value (must be 1000 characters or less): $value
"); } $review_data .= "$field: $value\n"; } } #generate file name from data $filename = $review_dir . $review_item . $login_code . $review_num; #open file, write, and close sysopen(REVIEW_FILE, "$filename", O_CREAT | O_EXCL | O_WRONLY) or error_page ("We already have this review on file for you. If this is incorrect, please contact Prof. Hougen.
"); flock(REVIEW_FILE, LOCK_EX) or error_page ("Can't write to $filename: $!
"); close(REVIEW_FILE) or error_page ("Can't close $filename: $!
"); } ####################################################################### sub user_review_form{ #the file name to open is built from the review item name $filename = $review_item . '.html'; print "Content-type: text/html\n\n"; sysopen(FORM_FILE, "$filename", O_RDONLY) or die "Can't open $filename: $!"; flock(FORM_FILE, LOCK_SH) or die "Can't get shared lock on $filename: $!"; while(