#!/usr/bin/perl -w
#
# makehtml
#
# This makes a web page with thumbnails of the images output by colimplot.
#
#------------------------------------------------------------------------
require 5.005;
use English;
#use strict;
my ($line);
my $testflag = 0;
my $taskname = 'makehtml';
my $write_log = 0;
my $log_name = '';
my $linkslist_file = 'links.lis';
my $html_file = 'colimages.html';
my $small_dir = 'thumbnails';
&quit("Thumbnail write directory not found.", -2) if (!-e $small_dir);
open(HTML, ">$html_file");
# print header info:
print HTML "\n";
print HTML "
\n";
print HTML "XMM Colour Images\n";
print HTML "\n";
print HTML "\n";
print HTML "XMM Colour Images:
\n";
print HTML "Click on a small image to see it larger.
\n";
print HTML "
\n";
open(LIS, "$linkslist_file");
while(defined($line = )) {
chomp($line);
($big_path, $small_path) = split('\s+', $line);
print HTML "
"
."$big_path\n";
}
close(LIS);
print HTML "
\n";
print HTML "\n";
print HTML "\n";
close(HTML);
exit 0;
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub tell {
open(LOG, ">> $log_name") if ($write_log);
foreach (@_) {
print "$taskname:- $_\n\n";
print LOG "$taskname:- $_\n\n" if ($write_log);
}
close(LOG) if ($write_log);
}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub warn {
open(LOG, ">> $log_name") if ($write_log);
foreach (@_) {
print "** $taskname: warning, $_\n\n";
print LOG "** $taskname: warning, $_\n\n" if ($write_log);
}
close(LOG) if ($write_log);
}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub quit {
my ($message, $status) = @_;
# my @end_times = times;
# my $proc_time_sec = $end_times[2] - $start_times[2] + $end_times[3]
# - $start_times[3];
# &tell("Execution time: $proc_time_sec seconds.");
open(LOG, ">> $log_name") if ($write_log);
print "** $taskname: ERROR! $message\n\n";
print LOG "** $taskname: ERROR! $message\n\n" if ($write_log);
close(LOG) if ($write_log);
exit $status;
}