#!/usr/local/bin/perl
#
# Calendar Admin Script
#
# Matt Kruse
# http://www.mattkruse.com/
#
$|=1;
print "Content-type: text/html\n\n";
# $base_dir = "";
#####################################################################
#
# SPLASH()
#
# Splash Screen
#
#####################################################################
sub SPLASH {
print <<"END";
Calendar Administration
END
exit(0);
}
#####################################################################
#
# ADMIN()
#
# Main Admin page
#
#####################################################################
sub ADMIN {
if ($vars{html_heading} eq "yes") { $html_heading = " CHECKED "; }
if ($vars{html_description} eq "yes") { $html_description= " CHECKED "; }
$monsunweek{$vars{monsunweek}} = " CHECKED ";
unless ($vars{calendarurl} =~ /http/) {
$vars{calendarurl} = "http://" . $ENV{SERVER_NAME} . $vars{cgi};
$vars{calendarurl} =~ s|_admin||;
$vars{message} .= "\\n\\nYour calendar URL needs to be entered. A URL has been entered for you based on this admin utility.\\n\\nYou must Save Options before this takes effect.";
}
opendir(DIR,$vars{template_dir});
$calendar_template_options = "";
$viewday_template_options = "";
while ($file = readdir(DIR)) {
$selected = "";
if ($file =~ /^calendar.*\.html/) {
$title = $file;
$title =~ m|^calendar_?(.*)\.html|i;
$title = $1;
$title =~ s|_| |g;
if ($vars{calendar_html} =~ /$file/) {
$selected = " SELECTED ";
}
$calendar_template_options .= "