OSSP CVS Repository

ossp - ossp-web/SHARE/ossp_filelist.wml
Not logged in
[Honeypot]  [Browse]  [Directory]  [Home]  [Login
[Reports]  [Search]  [Ticket]  [Timeline
  [Raw

ossp-web/SHARE/ossp_filelist.wml
##
##  ossp_filelist.wml -- News Flash
##  Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com> 
##

#   define a <filelist> tag which can be used to create a file listing which
#   is optically more compact than the stuff Apache's mod_autoindex creates.
#   Especially the current version is marked red, too.
<define-tag filelist>
<preserve url>
<preserve directory>
<preserve files>
<set-var %attributes>
<table width=100% cellspacing=1 cellpadding=0 border=0>
<tr>
  <td>File</td>
  <td align=right>Bytes</td><td align=right>Timestamp</td>
</tr>
<:
my $url       = "<get-var url>";
$url =~ s|/+$||sg;
my $directory = "<get-var directory>";
my $files     = "<get-var files>";
my $highlight = "<get-var highlight>";
my $odir = chdir($directory) || die;
my @F = reverse sort { (stat($a))[9] <=> (stat($b))[9]; } (glob($files));
chdir($odir);
my $O = '';
@COL = (
	'#e5e5e0',
	'NONE',
);
$ncol = 1;
foreach my $f (@F) {
    my @S = stat($f);
    $f = "$f/" if (-d $f);
    my @T = localtime($S[9]);
    my @moy = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
               'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    $f = "<a href=\"".$url."/".$f."\">$f</a>";
	$ncol = ($ncol + 1) % 2;
	$col  = $COL[$ncol];
    my $e = ($col eq "NONE" ? "<tr>" : "<tr bgcolor=\"$col\">").
	          "<td width=100%>".$f."&nbsp;&nbsp;</td>" .
		      "<td align=right>&nbsp;&nbsp;".$S[7]."</td>" .
	          "<td align=right>&nbsp;&nbsp;".sprintf("%"."02d-%"."s-%"."04d", $T[3], $moy[$T[4]], 1900+$T[5]) . "</td>".
			"</tr>";
    $O .= $e . "\n";
}
print $O;
:>
</table>
<restore url>
<restore directory>
<restore files>
</define-tag>


CVSTrac 2.0.1