
#
# Set background color
#

$ENV{BACKGROUND}="BGCOLOR=\"$ENV{SERVER_WWW_BACKGROUND}\"";

#
# Read in and fill out template
# Replace BASE_HREF with the value in $BASE_HREF 
# Replace <SERVER_NAME> with the value in $SERVER_NAME
# Replace BACKGROUND_COLOR with the value in $BACKGROUND
#

$SERVER_HOME = $ENV{SERVER_HOME};
$BASE_HREF   = $ENV{SERVER_WWW_URL};
$BASE_DIR    = $ENV{SERVER_WWW_HOME}; 
$SERVER_NAME = $ENV{SERVER_NAME};
$POST        = $ENV{SERVER_CGI_URL};

$TEXT = `cat  $ENV{SERVER_LIB}/html/server-homepage_1.html`;
$TEXT =~ s/<BASE_HREF>/$BASE_HREF\//g;
$TEXT =~ s/<SERVER_NAME>/$SERVER_NAME/g;
$TEXT =~ s/<BACKGROUND_COLOR>/$ENV{BACKGROUND}/;
if ($ENV{SERVER_FEEDBACK})
{
    $TEXT =~ s/Help justify this service!/User Feedback/;
}
print $TEXT;


#
# Read in and fill out the last template
# Replace BASE_HREF with the value in $BASE_HREF 
# Replace <SERVER_NAME> with the value in $SERVER_NAME
#

chdir("$SERVER_HOME/server/www/scripts");
$TEXT = `cat  $ENV{SERVER_LIB}/html/server-homepage_2.html`;
$TEXT =~ s/<SERVER_NAME>/$SERVER_NAME/g;
$TEXT =~ s/<SERVER_VERSION>/$ENV{"SERVER_VERSION"}/g;
$TEXT =~ s/<BASE_HREF>/$BASE_HREF/g;
$TEXT =~ s/<SERVER_CGI_URL>/$POST/g;
$TEXT =~ s/<SERVER_FTP_URL>/$ENV{SERVER_FTP_URL}/g;
# if there is no web stats compiler, comments out links
# to web stats pages.
if (($ENV{SERVER_ANALOG})==0) {
    $TEXT =~ s/SERVER_STATS_BEGIN-->/SERVER_STATS_BEGIN/;
    $TEXT =~ s/<!--SERVER_STATS_END/SERVER_STATS_END/;
}
# if you are not an authorized NEOS Server distributor, comments out links
if (($ENV{SERVER_DISTRIBUTOR})==0) {
    $TEXT =~ s/SERVER_DISTRIBUTOR_BEGIN-->/SERVER_DISTRIBUTOR_BEGIN/g;
    $TEXT =~ s/<!--SERVER_DISTRIBUTOR_END/SERVER_DISTRIBUTOR_END/g;
}
print $TEXT;





