#!/usr/bin/perl
# Test that each installable theme has the necessery files within it.

foreach my $dir ( sort( glob( "../templates/*/" ) ) )
{
    next if ( $dir =~ /CVS/ );

    if ( ! &isThemeDirComplete( $dir ) )
    {
	print "\nTheme $dir is missing at least one file.\n";
	exit 1;

    }
}

exit 0;


sub isThemeDirComplete( $ )
{
    my ( $dir ) = ( @_ );

    if ( ( ! -e $dir . "/error.html" ) ||
	 ( ! -e $dir . "/COPYING.html" ) ||
	 ( ! -e $dir . "/bug.html" ) ||
	 ( ! -e $dir . "/index.html" ) ||
	 ( ! -e $dir . "/results.html" ) ||
	 ( ! -e $dir . "/recent.html" ) ||
	 ( ! -e $dir . "/random.html" ) ||
	 ( ! -e $dir . "/search.html" ) ||
	 ( ! -e $dir . "/stats.html" ) )
    {
	return 0;
    }
    return 1;
}
