#--------------------------------------------------------------------
#Print header
#--------------------------------------------------------------------
sub print_header {
print "
Thank you, district of $district
";
print "You have submitted the following data from $ENV{REMOTE_HOST}.
";
print "You are using a \"$browser\" browser.
\n";
print "
";
}
#---------------------------------------------------------------------
#Determine browser
#---------------------------------------------------------------------
sub whatbrowser {
#set scratch variable equal to browser type
$_ = $browser;
#scan scratch variable for HTML info type
if (/Mozilla\/[2-3]/) {
&with_tables;
} elsif (/Mozilla\/1\.1/) {
&with_tables;
} elsif (/MSIE [2-]/) {
&with_tables;
} elsif (/NCSA Mosaic\/[1-2]/) {
&with_tables;
} elsif (/NCSA Mosaic\/[3-]/) {
&with_tables;
} elsif (/Lynx/) {
&no_tables;
} elsif (/Mozilla\/1\.0/) {
&no_tables;
} else { # Table support assumed if browser is not recognizable.
&with_tables;
}
#---------------------------------------------------------------------
# With tables
#---------------------------------------------------------------------
sub with_tables {
print "";
print "";
print " Teaching Personnel | ";
print " Elementary | ";
print " Secondary | ";
print "
";
print "";
print " FTE's rounded to the nearest tenth | ";
print " Male | ";
print " Female | ";
print " Male | ";
print " Female | ";
print "
";
print "";
print " | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print "
";
print "";
print " 1a. Numer of pre-school teachers in full-time equivalents | ";
print " $thisyear{f1aa} | ";
print " $lastyear{f1aa} | ";
print " $thisyear{f1ab} | ";
print " $lastyear{f1ab} | ";
print "
";
print "";
print " 1b. Numer of kindergarten teachers in full-time equivalents | ";
print " $thisyear{f1ba} | ";
print " $lastyear{f1ba} | ";
print " $thisyear{f1bb} | ";
print " $lastyear{f1bb} | ";
print "
";
print "";
print "2. Numer of full-time classroom teachers | ";
print " $thisyear{f2a} | ";
print " $lastyear{f2a} | ";
print " $thisyear{f2b} | ";
print " $lastyear{f2b} | ";
print " $thisyear{f2c} | ";
print " $lastyear{f2c} | ";
print " $thisyear{f2d} | ";
print " $lastyear{f2d} | ";
print "
";
print "";
print "3. Numer of part-time classroom teachers in full-time equivalents | ";
print " $thisyear{f3a} | ";
print " $lastyear{f3a} | ";
print " $thisyear{f3b} | ";
print " $lastyear{f3b} | ";
print " $thisyear{f3c} | ";
print " $lastyear{f3c} | ";
print " $thisyear{f3d} | ";
print " $lastyear{f3d} | ";
print "
";
print "";
print "4. Numer of instructional Aides in full-time equivalents | ";
print " $thisyear{f4a} | ";
print " $lastyear{f4a} | ";
print " $thisyear{f4b} | ";
print " $lastyear{f4b} | ";
print " $thisyear{f4c} | ";
print " $lastyear{f4c} | ";
print " $thisyear{f4d} | ";
print " $lastyear{f4d} | ";
print "
";
print "";
print " 5. Average salary of all
FULL-TIME teachers in the district \$$thisyear{f5}
($year), \$$lastyear{f5} ($lyear)\. | ";
print "
";
print "
";
print "
";
print "
";
print "
";
print "";
print "";
print " Other Professional Personnel and Support Staff | ";
print " Elementary | ";
print " Secondary | ";
print "
";
print "";
print " FTE\'s rounded to the nearest tenth | ";
print " Male | ";
print " Female | ";
print " Male | ";
print " Female | ";
print "
";
print "";
print " | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print " $year | ";
print " $lyear | ";
print "
";
print "";
print " 6. Numer of principals in full-time equivalents | ";
print " $thisyear{f6a} | ";
print " $lastyear{f6a} | ";
print " $thisyear{f6b} | ";
print " $lastyear{f6b} | ";
print " $thisyear{f6c} | ";
print " $lastyear{f6c} | ";
print " $thisyear{f6d} | ";
print " $lastyear{f6d} | ";
print "
";
print "";
print " 7. Numer of assistant principals in full-time equivalents | ";
print " $thisyear{f7a} | ";
print " $lastyear{f7a} | ";
print " $thisyear{f7b} | ";
print " $lastyear{f7b} | ";
print " $thisyear{f7c} | ";
print " $lastyear{f7c} | ";
print " $thisyear{f7d} | ";
print " $lastyear{f7d} | ";
print "
";
print "";
print " 8. Numer of guidance couselors/directors in full-time equivalents | ";
print " $thisyear{f8a} | ";
print " $lastyear{f8a} | ";
print " $thisyear{f8b} | ";
print " $lastyear{f8b} | ";
print " $thisyear{f8c} | ";
print " $lastyear{f8c} | ";
print " $thisyear{f8d} | ";
print " $lastyear{f8d} | ";
print "
";
print "";
print " 9. Numer of librarians / media specialists in full-time";
print "equivalents | ";
print " $thisyear{f9a} | ";
print " $lastyear{f9a} | ";
print " $thisyear{f9b} | ";
print " $lastyear{f9b} | ";
print " $thisyear{f9c} | ";
print " $lastyear{f9c} | ";
print " $thisyear{f9d} | ";
print " $lastyear{f9d} | ";
print "
";
print "";
print " 10. Numer of library / media support staff in full-time equivalents | ";
print " $thisyear{f10a} | ";
print " $lastyear{f10a} | ";
print " $thisyear{f10b} | ";
print " $lastyear{f10b} | ";
print " $thisyear{f10c} | ";
print " $lastyear{f10c} | ";
print " $thisyear{f10d} | ";
print " $lastyear{f10d} | ";
print "
";
print "";
print " 11. Numer of non-teaching Special Education professionals not included above in full-time equivalents | ";
print " $thisyear{f11a} | ";
print " $lastyear{f11a} | ";
print " $thisyear{f11b} | ";
print " $lastyear{f11b} | ";
print " $thisyear{f11c} | ";
print " $lastyear{f11c} | ";
print " $thisyear{f11d} | ";
print " $lastyear{f11d} | ";
print "
";
print "";
print " 12. Numer of clerical support staff in full-time equivalents | ";
print " $thisyear{f12a} | ";
print " $lastyear{f12a} | ";
print " $thisyear{f12b} | ";
print " $lastyear{f12b} | ";
print " $thisyear{f12c} | ";
print " $lastyear{f12c} | ";
print " $thisyear{f12d} | ";
print " $lastyear{f12d} | ";
print "
";
print "";
print " 13. Numer of other support service staff in full-time equivalents | ";
print " $thisyear{f13a} | ";
print " $lastyear{f13a} | ";
print " $thisyear{f13b} | ";
print " $lastyear{f13b} | ";
print " $thisyear{f13c} | ";
print " $lastyear{f13c} | ";
print " $thisyear{f13d} | ";
print " $lastyear{f13d} | ";
print "
";
print "
";
print "
";
print "
";
print "
";
print "Submission Date: $thisyear{date}";
print "Please verify the data; otherwise return to change it.";
}
#---------------------------------------------------------------------
# No tables
#---------------------------------------------------------------------
sub no_tables {
print "";
print "";
print " Teaching Personnel | ";
print " Elementary | ";
print " Secondary | ";
print "
";
print "";
print " Round all FTE's to the nearest tenth | ";
print " Male | ";
print " Female | ";
print " Male | ";
print " Female | ";
print "
";
print "";
print " 1a. Numer of pre-school teachers in full-time equivalents | ";
print " $thisyear{f1aa} | ";
print " $thisyear{f1ab} | ";
print "
";
print "";
print " 1b. Numer of kindergarten teachers in full-time equivalents | ";
print " $thisyear{f1ba} | ";
print " $thisyear{f1bb} | ";
print "
";
print "";
print "2. Numer of full-time classroom teachers | ";
print " $thisyear{f2a} | ";
print " $thisyear{f2b} | ";
print " $thisyear{f2c} | ";
print " $thisyear{f2d} | ";
print "
";
print "";
print "3. Numer of part-time classroom teachers in full-time equivalents | ";
print " $thisyear{f3a} | ";
print " $thisyear{f3b} | ";
print " $thisyear{f3c} | ";
print " $thisyear{f3d} | ";
print "
";
print "";
print "4. Numer of instructional Aides in full-time equivalents | ";
print " $thisyear{f4a} | ";
print " $thisyear{f4b} | ";
print " $thisyear{f4c} | ";
print " $thisyear{f4d} | ";
print "
";
print "";
print " 5. Average salary of all
FULL-TIME teachers in the district \$$in{f5} | ";
print "
";
print "
";
print "
";
print "
";
print "
";
print "";
print "";
print " Other Professional Personnel and Support Staff | ";
print " Elementary | ";
print " Secondary | ";
print "
";
print "";
print " Round all FTE\'s to the nearest tenth | ";
print " Male | ";
print " Female | ";
print " Male | ";
print " Female | ";
print "
";
print "";
print " 6. Numer of principals in full-time equivalents | ";
print " $thisyear{f6a} | ";
print " $thisyear{f6b} | ";
print " $thisyear{f6c} | ";
print " $thisyear{f6d} | ";
print "
";
print "";
print " 7. Numer of assistant principals in full-time equivalents | ";
print " $thisyear{f7a} | ";
print " $thisyear{f7b} | ";
print " $thisyear{f7c} | ";
print " $thisyear{f7d} | ";
print "
";
print "";
print " 8. Numer of guidance couselors/directors in full-time equivalents | ";
print " $thisyear{f8a} | ";
print " $thisyear{f8b} | ";
print " $thisyear{f8c} | ";
print " $thisyear{f8d} | ";
print "
";
print "";
print " 9. Numer of librarians / media specialists in full-timev";
print "equivalents | ";
print " $thisyear{f9a} | ";
print " $thisyear{f9b} | ";
print " $thisyear{f9c} | ";
print " $thisyear{f9d} | ";
print "
";
print "";
print " 10. Numer of library / media support staff in full-time equivalents | ";
print " $thisyear{f10a} | ";
print " $thisyear{f10b} | ";
print " $thisyear{f10c} | ";
print " $thisyear{f10d} | ";
print "
";
print "";
print " 11. Numer of non-teaching Special Education professionals not included above in full-time equivalents | ";
print " $thisyear{f11a} | ";
print " $thisyear{f12b} | ";
print " $thisyear{f11c} | ";
print " $thisyear{f11d} | ";
print "
";
print "";
print " 12. Numer of clerical support staff in full-time equivalents | ";
print " $thisyear{f12a} | ";
print " $thisyear{f12b} | ";
print " $thisyear{f12c} | ";
print " $thisyear{f12d} | ";
print "
";
print "";
print " 13. Numer of other support service staff in full-time equivalents | ";
print " $thisyear{f13a} | ";
print " $thisyear{f13b} | ";
print " $thisyear{f13c} | ";
print " $thisyear{f13d} | ";
print "
";
print "
";
print "
";
print "
";
print "
";
print "Submission Date: $thisyear{date}";
print "Please verify the data; otherwise return to change it.";
}
}
#----------------------------------------------------------------------
# File data: store the data in a DBM file.
# This module receives a parameter from the main program.
# This parameter may be either the default value to be stored for
# empty fields, or a special code to signal an update of only a few
# values.
#----------------------------------------------------------------------
sub file_data {
local($separator, $error_value);
$separator=":"; # Separator for fieldnames, not URL paths!
$error_value = "Init value--if you see this, contact your sysadmin!";
$non_numeric_flag = 0; # Initialization
# open DBM file
# Any changes to associative array filehandle automatically get written to disk
$dbmfile = "Server HD:WebSTAR:nhdata:data:data";
dbmopen(%DATA, $dbmfile, 0644);
$in{date} = localtime; # Submission date. This can be changed to be
# inputted in the HTML form.
# Check data for non-numeric characters
while ( ($fieldname, $value) = each(%in) ) {
if ($value eq "") { # If field is left blank.
$in{$fieldname} = $_[0]; # Set the value to passed parameter.
} # end if
# \D stands for non-numeric characters.
elsif (($value =~ m!\D!) && (($fieldname ne "district") &&
($fieldname ne "date") && ($fieldname ne "super") &&
($fieldname ne "last_page") && ($fieldname ne "update"))) {
$non_numeric_flag = 1;
$error_value = "\'$value\'";
} # end if-elsif
} # end while
#transfer data from associative array %in to filehandle %DATA
unless ($non_numeric_flag == 1) {
while ( ($fieldname, $value) = each(%in) ) {
unless ($value == -1) { # A negative number signals an update,
# which implies not filing any blank fields.
# The -1 was chosen as an arbitrary numeric
# signal--any other special number could be used.
# Fieldnames are something like 1996:Manchester:f2b
$fieldname = $year . $separator . $in{district} . $separator . $fieldname;
$DATA{$fieldname} = $value;
} # end unless
} # end while
} else {
print "Error
Your entry \'$error_value\' is not valid.\n";
print "Only numeric data is acceptable. In other words, the form ";
print "will accept only numbers and decimals. If commas, letters, ";
print "and/or any other characters that are not numbers (or the ";
print "decimal point) are present in even a single field, the data ";
print "will all be rejected. In this specific case, ";
print "you submitted \'$error_value\', which is why your data is ";
print "being rejected.
\n";
} # end unless-else
dbmclose(DATA);
} # end sub
#----------------------------------------------------------------------
#Get date
#
#Get's date using "localtime". This date can then be used to write
#the data files.
#----------------------------------------------------------------------
sub get_date {
$date = localtime;
$date =~ s! ! !g; # Eliminate double spaces, which can wreak havoc at the beginning of the month.
local (@date_fields);
# $date is now something like "Mon Jul 15 15:15:01 1996"
# We only want the year, therefore we split up the string
@date_fields = split(/\s/,$date);
# The year is the fifth element. Since array starts at 0,
# $date_fields[4] is equal to the year.
$year = $date_fields[4];
$lyear = $year;
--$lyear;
}
#----------------------------------------------------------------------
# Load data
#
# Puts the year's data into %thisyear
# Puts last year's data into %lastyear
#
# Assumes filed data is valid.
#----------------------------------------------------------------------
sub load_data {
local($separator, $maxvalue);
$separator=":";
$maxvalue=0.25; # Set alert threshold to a difference of 25%.
#open DBM file
$dbmfile = "Server HD:WebSTAR:nhdata:data:data";
dbmopen(%DATA, $dbmfile, 0644);
#load %DATA into %thisyear and %lastyear
print "Year: $year
District: $district
\n";
print "
";
while ( ($fieldname, $value) = each(%DATA) ) {
($y, $d, $f) = split(/$separator/,$fieldname);
if (($y == $year) && ($d eq $district)) {
$thisyear{$f} = $value;
} elsif (($y == $lyear) && ($d eq $district)) {
$lastyear{$f} = $value;
} #end elsif
} #end while
dbmclose(DATA);
#Check values for large discrepancies (determined by $maxvalue)
while ( ($f, $value) = each(%thisyear) ) {
unless ( $lastyear{$f} <= 0) {
local($diff, $alert, $endalert);
$diff = ($value - $lastyear{$f}) / $lastyear{$f};
if ($diff >= $maxvalue) {
$alert = "";
$endalert = "*";
} else {
$alert = "";
$endalert = "";
} #end if-else
$thisyear{$f} = $alert . $thisyear{$f} . $endalert;
} # end unless
} #end while
} #end sub
#----------------------------------------------------------------------
# Validate superintendent
#
# Checks superintendent against a file of valid names
#----------------------------------------------------------------------
sub validate_superintendent {
local($super, $district);
$super=$in{super};
$district=$in{district};
$assoc_file = 'Server HD:WebSTAR:nhdata:data:associations';
#initialize $super_validity
$super_validity = 0;
dbmopen(%SUPER_OF, $assoc_file, 0644);
if ($super eq $SUPER_OF{$district}) {
$super_validity = 1;
} # end if
dbmclose(SUPER_OF);
} # end sub
#----------------------------------------------------------------------
# check_password
#
# This subroutine is not actually implemented. However, if password-
# checking is desirable, one way of implementing it would be
# something like the (commented out) lines below.
#----------------------------------------------------------------------
#sub check_password {
#[define password file]
#[open password file and check password-user matches]
#[set a password bit to 1 or 0]
#[close passoword file]
#} end sub