#!/usr/bin/perl
# Copyright 2001-2008 Leslie Richardson
# This file is part of Open Admin for Schools.
# Open Admin for Schools is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
%lex = ( 'Staff Member Entry' => 'Staff Member Entry',
'Member Entry' => 'Member Entry',
'Staff' => 'Staff',
'Main' => 'Main',
'Eoy' => 'Eoy',
'Unable to open template file:' => 'Unable to open template file:',
'The staff member is now stored in the database' =>
'The staff member is now stored in the database',
'Start/End of Year Page' => 'Start/End of Year Page',
'Add Another Staff Member' => 'Add Another Staff Member',
'Add Another Prereg Staff Member' =>
'Add Another Prereg Staff Member',
'There was an error storing your data.' => 'There was an error storing your data.',
'Please record the following error string' => 'Please record the following error string',
'Please contact' => 'Please contact',
'Cannot open libmeta.pl' => 'Cannot open libmeta.pl',
'Cannot open admin.conf!' => 'Cannot open admin.conf!',
'Add Staff Member Information' => 'Add Staff Member Information',
'Warning! You should have a unique userid for each staff.' =>
'Warning! You should have a unique userid for each staff.',
'This userid exists already exists.' => 'This userid exists already exists.',
'Ignore this warning if you are creating another entry' =>
'Ignore this warning if you are creating another entry',
'for the same staff.' => 'for the same staff.',
'You MUST have a unique userid and a password and staff position.' =>
'You MUST have a unique userid and a password and staff position.',
'Please go back and try again.' => 'Please go back and try again.',
'Preregistration' => 'Preregistration',
'Required Field' => 'Required Field',
'Bold' => 'Bold',
'Error' => 'Error',
'Password Error' => 'Password Error',
);
use CGI;
use DBI;
use Data::Password qw(:all); # for password checking...
my $self = 'staffadd.pl';
my $q = new CGI;
print $q->header;
my %arr = $q->Vars;
# Select table to add to; staff or prereg_staff;
my ($table, $tableview);
if ( $arr{tbl} ){ # add to prereg_staff table
$table = 'prereg_staff';
$tableview = ''. $lex{Preregistration}. ''. q{ }. $lex{Staff};
} else {
$table = 'staff';
$tableview = $lex{Staff};
}
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
eval require "../../lib/libmeta.pl";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
my $dsn = "DBI:$dbtype:dbname=$dbase";
$dbh = DBI->connect($dsn,$user,$password);
# Print Page Header
print "$doctype\n
". $lex{Bold}. " = ". $lex{'Required Field'}. "