#!/usr/bin/perl
# Copyright 2001-2020 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',
'Grade' => 'Grade',
'Not Found' => 'Not Found',
'Error' => 'Error',
'Continue' => 'Continue',
'Month' => 'Month',
'Non-School Days' => 'Non-School Days',
'View' => 'View',
'Select' => 'Select',
'Part of Day' => 'Part of Day',
'Update' => 'Update',
'Updated' => 'Updated',
'Deleted' => 'Deleted',
'Record' => 'Record',
'Added' => 'Added',
'Home Room' => 'Home Room',
'Missing' => 'Missing',
'Value' => 'Value',
);
use DBI;
use CGI;
use CGI::Session;
use Time::JulianDay;
use Number::Format qw(:all);
use Cwd;
my @colors = ('#99D','#9D9','#D99', '#AAE','#ADA','#DAA','#AA8','#A8A',
'#9AA','#AAF','#AFA','#FAA','#866','#896','#878', '#DAD',
'#DDF', '#DFA', '#FFA','#FFC','#FFE','#FDD','#FAD','#FDA',
'#F99', '#9F9', '#99F','#FBB'
);
my $self = 'viewHomeroomsClosed.pl';
# Get current dir so know what path for config files.
my ($configpath, $teachermode );
if ( getcwd() =~ /tcgi/ ){ # we are in tcgi
$teachermode = 1;
$configpath = '..'; # go back one to get to etc.
} else {
$configpath = '../..'; # go back two to get to etc.
}
eval require "$configpath/etc/admin.conf.root";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
my $dbtype = 'mysql';
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
# Load Configuration Variables;
my $sth = $dbh->prepare("select id, datavalue from conf_system where filename = 'admin'");
$sth->execute;
if ( $DBI::errstr ) { print $DBI::errstr; die $DBI::errstr; }
while ( my ($id, $datavalue) = $sth->fetchrow ) {
eval $datavalue;
if ( $@ ) {
print "$lex{Error}: $@
\n";
die "$lex{Error}: $@\n";
}
}
# Teachermode
if ( $teachermode ) { # running on teacher site
$css = $tchcss;
$homepage = $tchpage;
}
my $q = new CGI;
print $q->header(-charset, $charset );
my %arr = $q->Vars;
if ( $arr{nocolor} ) {
@colors = ();
}
my $title = "$lex{View} Homerooms Closed";
print qq{$doctype\n