#!/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. my %lex = ('Main' => 'Main', 'Schedule' => 'Schedule', 'Write Schedule Entries' => 'Write Schedule Entries', 'Edit Schedule Entries' => 'Edit Schedule Entries', 'Terms' => 'Terms', 'Update' => 'Update', 'Term' => 'Term', 'Day' => 'Day', 'Per' => 'Per', 'Teacher' => 'Teacher', 'Subject-Section' => 'Subject-Section', 'Period' => 'Period', 'Blank=same as above' => 'Blank=same as above', 'No Term' => 'No Term', 'Updating Record for' => 'Updating Record for', 'Adding Record for' => 'Adding Record for', 'Deleting Record for' => 'Deleting Record for', 'Add Backings' => 'Add Backings', 'Additional' => 'Additional', 'Adding' => 'Adding', 'Missing' => 'Missing', 'Edit Schedule Entries for term(s)' => 'Edit Schedule Entries for term(s)', 'Continue' => 'Continue', 'Writing Entries for' => 'Writing Entries for', 'for Term(s)' => 'for Term(s)', 'Please record the following error' => 'Please record the following error', 'Your schedule items now stored' => 'Your schedule items now stored', 'There was an error storing your data' => 'There was an error storing your data', 'Please contact network adminstrator' => 'Please contact network adminstrator', 'Teacher User Id' => 'Teacher User Id', 'Separate multiple terms with spaces' => 'Separate multiple terms with spaces', ); # max number of backed classes per cycle. #(control display and entry) my $maxbackings = 8; use DBI; use CGI; use CGI::Session; use Cwd; my $self = "schedit.pl"; my @time = localtime(time); my $year = $time[5] + 1900; my $month = $time[4] + 1; my $currdate = "$year-$month-$time[3]"; my $q = new CGI; my %arr = $q->Vars; #print $q->header; my $userid; if ( $arr{userid} ) { $userid = $arr{userid}; delete $arr{userid}; } # Set prepath for config file: (/tcgi or cgi/schedule) my $prepath = '../..'; if (getcwd() =~ /tcgi/){ # we are in tcgi $prepath = '..'; } require "$prepath/etc/admin.conf" or die "Cannot read admin.conf!"; # Get current dir so know what CSS to display; if (getcwd() =~ /tcgi/){ # we are in tcgi $css = $tchcss; } my $dsn = "DBI:$dbtype:dbname=$dbase"; my $dbh = DBI->connect($dsn,$user,$password); # Session Management my $session; if (not $userid ) { $session = new CGI::Session("driver:mysql;serializer:FreezeThaw", undef,{Handle => $dbh}) or die CGI::Session->errstr; $userid = $session->param('userid'); } print $q->header; # print page header. print "$doctype\n