<td class="content">
<?php

// $Date: 2004/02/03 03:35:56 $
// $Revision: 1.14 $
// $Author: jcrocholl $

// don't link to the current page
// print $path[count($path) - 2];
// unset($links[$path[count($path) - 2]]);

load_links($links, "$fileroot$stem");

if (
file_exists("$fileroot$stem" . "Abstract")) {
    
// print "$fileroot$stem" . "Abstract";
    
$abstract = file("$fileroot$stem" . "Abstract");
    if (
preg_match('/^\s*(.*[^\.\s])\s*$/', $abstract[0], $m) and
        
preg_match('/^\s*$/', $abstract[1])) {
        print 
h(1, trim(array_shift($abstract)));
        
array_shift($abstract);
    } else {
        
$text = $stem;
        print 
h(1, $text);
    }
    print 
format_input("$fileroot$stem", $abstract, $links, true, 'abstract');
}

if (
file_exists("$fileroot$stem" . "Readme")) {
    
// print "$fileroot$stem" . "Readme";
    
print format_file("$fileroot$stem", "Readme", $links, true);
}

if (
$absort) {
    
// print "abstracts";
    
foreach ($absort as $name) {
        
$text = $abstracts[$name];
        if (
$abtitles[$name]) $headline = $abtitles[$name];
        else 
$headline = "$name/";
        
// $h2 = "<a href=\"$links[$name]\">$name</a>";
        
print h(2, $headline, "$name/");
        
// print wrap("$fileroot$stem", $text);
        
print $text;
    }
}

function 
scan_releases($dir) {
    global 
$fileroot;
    if (
$dh = opendir("$fileroot$dir")) {
        while ((
$file = readdir($dh)) !== false) {
            if (
is_file("$fileroot$dir$file")
                and 
substr($file, 0, 7) == 'roemer-')
                
$release_files[] = $file;
        }
        
closedir($dh);
    }
    if (
$release_files) {
        
asort($release_files);
        return 
$release_files;
    }
    return 
false;
}

// print implode('-', $path);
// print "$fileroot$stem";
if ($path[0] == 'release' and count($path) == 3) {
    
$release_files = scan_releases($stem);
    if (
$release_files)
        foreach (
$release_files as $file)
            
$release_text .= "<a href=\"$file\">$file</a><br/>\n";

    if (
$dh = opendir("$fileroot$stem")) {
        while ((
$dir = readdir($dh)) !== false) {
            if (
is_dir("$fileroot$stem$dir")
                and 
$dir[0] != '.' and $dir != 'CVS')
            {
                
// print "$fileroot$stem$dir";
                
$release_files = scan_releases("$stem$dir/");
                if (
$release_files) {
                    
$release_text .= "<h3>$dir/</h3>\n";
                    if (
file_exists("$fileroot$stem$dir/Abstract"))
                        
$release_text .= format_file("$fileroot$stem$dir/", 
                                                     
"Abstract", $links, false);
                    foreach (
$release_files as $file) {
                        
$size = (int) (filesize("$fileroot$stem$dir/$file") / 1024);
                        
$size .= 'KB';
                        
$release_text .= "<a href=\"$dir/$file\">$file</a> ($size)<br/>\n";
                    }
                }
            }
        }
        
closedir($dh);
    }
    
    if (
$release_text) {
        print 
"<h2>Development Snapshots</h2>\n";
        print 
"<p>\n";
        print 
$release_text;
        print 
"</p>\n";
    }
}

?>
</td>