#!/usr/bin/perl # Copyright 2001-2007 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', 'Sorry. There was an error storing your data.' => 'Sorry. 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 staff position.' => 'You MUST have a unique userid and staff position.', 'Please go back and try again.' => 'Please go back and try again.', 'Preregistration' => 'Preregistration', 'Required Field' => 'Required Field', 'Bold' => 'Bold', ); use CGI; use DBI; 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}; } unless (require "../../etc/admin.conf") { print $lex{'Cannot open admin.conf!'}; die "Cannot open admin.conf!"; } unless (require "../../lib/libmeta.pl") { print $lex{'Cannot open libmeta.pl'}; die $lex{'Cannot open libmeta.pl'}; } $dsn = "DBI:$dbtype:dbname=$dbase"; $dbh = DBI->connect($dsn,$user,$password); # Print Page Header print "$doctype\n
". $lex{Bold}. " = ". $lex{'Required Field'}. "