OpenPKG CVS Repository
  http://www.openpkg.org/cvsweb/cvsweb.cgi
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-web                      Date:   09-Aug-2002 12:25:06
  Branch: HEAD                             Handle: 2002080911250600

  Modified files:
    openpkg-web             status.cgi

  Log:
    new status page

  Summary:
    Revision    Changes     Path
    1.2         +72 -63     openpkg-web/status.cgi
  ____________________________________________________________________________

  Index: openpkg-web/status.cgi
  ============================================================
  $ cvs diff -u -r1.1 -r1.2 status.cgi
  --- openpkg-web/status.cgi    15 Nov 2001 10:27:32 -0000      1.1
  +++ openpkg-web/status.cgi    9 Aug 2002 10:25:06 -0000       1.2
  @@ -1,78 +1,87 @@
   #!/usr/bin/perl
   ##
  -##  status.cgi 
  +##  status.cgi -- Package Status Report
   ##
   
   require 5.000;
   use IO;
  -
   $|++;
   
  -my $page = '';
  -
  -open(FP, "<status.head.html");
  -$page .= $_ while (<FP>);
  -close(FP);
  -
  -#########################################################################
  -my $bgcolor = "ffffff";
  -my @array;
  -my $text0;
  -my $text1;
  -my $text2;
  -my $text3;
  -my $text4;
  -
  -
  -
  -$page .= "<table cellspacing=0 cellpadding=0 border=0>\r\n";
  -open(SFP, "<../SRC/00STATUS");
  -
  -
  -LOOP:while(<SFP>) {
  -@array = ($text0, $text1, $text2, $text3, $text4) = 
/^(\w+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+/;
  -
  -
  -$array[0] =~ s|^\s+(.*?)|{$array[0]=$1}|es;   # Remove whitespaces at the beginning
  -next LOOP if $array[0]  eq "";
  -next LOOP if $array[0]  =~ /^=/;
  -$array[0] =~ s|(.*?)\s+$|{$array[0]=$1}|es;       # Remove whitespaces at the end
  -
  +my $O = '';
   
  -$page .= sprintf("<tr bgcolor=#%s>\r\n", $bgcolor);
  -
  -
  -foreach (@array) {
  -    $page .= "<td>";
  -    ($dummy, $_) = ($_ =~ /^(\w+):(\S+)/) if ($_ =~ /^(\w+):(\S+)/); # Remove 1th 
part to ":"
  -    if ($_ eq "no") {
  -       $page .= "<font color=\"#cc3333\">";
  -    } elsif ($_ eq "yes") {
  -        $page .= "<font color=\"#33cc33\">";
  +my $bgcolors = [qw(#f0f0f0 #e5e5e5)];
  +my $okcolors = {
  +    "REL" => "#ff6666",
  +    "EXP" => "#f0f000",
  +    "BRK" => "#ccccff",
  +    "DEV" => "#f5f5f5",
  +};
  +my $io = new IO::File "<status.txt" || die;
  +my $n = 0;
  +$O .= "<table cellspacing=1 cellpadding=2 border=0>\n";
  +my $ishead = 1;
  +while ($line = <$io>) {
  +    # a2ps            4.13b           20020609   REL yes  OK   OK ...
  +    if ($line =~ m|^===|) {
  +        next;
       }
  -    $page .=  "$_";
  -    $page .= "</td>\r\n";
  -}
  -
  -
  -if   ($bgcolor eq "f0f0f0") { $bgcolor = "ffffff"; }
  -else                        { $bgcolor = "f0f0f0"; }
  -
  +    my @line = split(/\s+/, $line);
  +    my ($name, $version, $release, $dst, $rel) = @line[0..4];
  +    my @hosts = @line[5..$#line];
  +    if ($ishead) {
  +        $ishead = 0;
  +        $O .= "<tr bgcolor=\"#000000\">\n";
  +        $O .= "<td><font color=\"#ffffff\">$name</font></td>";
  +        $O .= "<td><font color=\"#ffffff\">$version</font></td>";
  +        $O .= "<td><font color=\"#ffffff\">$release</font></td>";
  +        $O .= "<td><font color=\"#ffffff\">$dst</font></td>";
  +        $O .= "<td><font color=\"#ffffff\">$rel</font></td>";
  +        foreach my $host (@hosts) {
  +            $O .= "<td><font color=\"#ffffff\">$host</font></td>";
  +        }
  +        $O .= "</tr>\n";
  +    }
  +    else {
  +        $O .= "<tr bgcolor=\"".$bgcolors->[$n]."\">\n";
  +        $O .= "<td>$name</td>";
  +        $O .= "<td>$version</td>";
  +        $O .= "<td>$release</td>";
  +        $O .= "<td>$dst</td>";
  +        $O .= "<td>$rel</td>";
  +        foreach my $host (@hosts) {
  +            if ($host eq "--") {
  +                $O .= "<td bgcolor=\"".$okcolors->{$dst}."\">";
  +            }
  +            else {
  +                $O .= "<td bgcolor=\"#99cc99\">";
  +            }
  +            $O .= $host;
  +            $O .= "</td>";
  +        }
  +        $O .= "</tr>\n";
  +    }
  +    $n = ($n + 1) % 2;
   }
  +$O .= "</table>\n";
  +$io->close();
   
  -$page .= ("</table>\r\n");
  -
  -close(SFP);
  -
  -##########################################################################
  -open(FP, "<status.foot.html");
  -$page .= $_ while (<FP>);
  -close(FP);
  -
  -$page = "Content-type: text/html\r\n" .
  -        sprintf("Content-length: %d\r\n", length($page)) .
  -        "\r\n" . $page;
  +######################################################
   
  -print STDOUT $page;
  +my $head = '';
  +$io = new IO::File "<status.head.html" || die;
  +$head .= $_ while (<$io>);
  +$io->close();
  +
  +my $foot = '';
  +$io = new IO::File "<status.foot.html" || die;
  +$foot .= $_ while (<$io>);
  +$io->close();
  +
  +$O = $head . $O . $foot;
  +
  +$O = "Content-type: text/html\r\n" .
  +     sprintf("Content-length: %d\r\n", length($O)) .
  +     "\r\n" . $O;
  +print STDOUT $O;
   exit(0);
   
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to