#!/usr/bonsaitools/bin/perl -- # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape Public # License Version 1.1 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or # implied. See the License for the specific language governing # rights and limitations under the License. # # The Original Code is the Tinderbox build tool. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): use lib '../bonsai'; require "tbglobals.pl"; require 'lloydcgi.pl'; require 'header.pl'; use Date::Parse; use Date::Format; my $TIMEFORMAT = "%D %T"; $| = 1; print "Content-type: text/html\n\n\n"; my $tree = $form{'tree'}; my $start = $form{'start'}; my $end = $form{'end'}; sub str2timeAndCheck { my ($str) = (@_); my $result = str2time($str); if (defined $result && $result > 7000000) { return $result; } print "

Can't parse as a date: $str

\n"; return 0; } if ($form{terse}) { if (defined $tree && defined $start && defined $end) { my $first = str2timeAndCheck($start); my $last = str2timeAndCheck($end); if ($first > 0 && $last > 0) { if (open(IN, "<$tree/notes.txt")) { my %stats; while () { chop; my ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split /\|/; if ($nnow >= $first && $nnow <= $last) { my $note = &url_decode($nenc_note); $nbuildtime = print_time($nbuildtime); $nnow = print_time($nnow); print "$nbuildname "; print "$nwho "; print "$note "; print "\n"; } } } } else { print "There does not appear to be a tree " . "named '$tree'."; } } } elsif ($form{text}) { my $header = "

\nBuild Time\t\tBuild Name\t\t\tWho\t\t\tNote Time\t\t\tNote\n" . 
"----------------------------------------------------------------------------------------------------------------------------\n";

 if (defined $tree && defined $start && defined $end) {
    my $first = str2timeAndCheck($start);
    my $last = str2timeAndCheck($end);
    if ($first > 0 && $last > 0) {
        if (open(IN, "<$tree/notes.txt")) {
            print "
Notes for $tree\n\nfrom " .
                time2str($TIMEFORMAT, $first) . " to " .
                    time2str($TIMEFORMAT, $last) . "\n
"; my %stats; print "$header\n"; while () { chop; my ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split /\|/; if ($nnow >= $first && $nnow <= $last) { my $note = &url_decode($nenc_note); $nbuildtime = print_time($nbuildtime); $nnow = print_time($nnow); print "$nbuildtime\t"; print "$nbuildname\t"; print "$nwho\t"; print "$nnow\t\t"; print "$note\t"; print "\n"; } } } } else { print "

There does not appear to be a tree " . "named '$tree'.

"; } } print "\n

"; } else { my $header = ""; if (defined $tree && defined $start && defined $end) { my $first = str2timeAndCheck($start); my $last = str2timeAndCheck($end); if ($first > 0 && $last > 0) { if (open(IN, "<$tree/notes.txt")) { print "

Notes for $tree

from " . time2str($TIMEFORMAT, $first) . " to " . time2str($TIMEFORMAT, $last) . "

\n"; my %stats; print "$header\n"; while () { chop; my ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split /\|/; if ($nnow >= $first && $nnow <= $last) { my $note = &url_decode($nenc_note); $nbuildtime = print_time($nbuildtime); $nnow = print_time($nnow); print ""; print ""; print ""; print ""; print ""; print ""; print "\n"; if (++$count % 100 == 0) { print "
Build timeBuild nameWhoNote timeNote
$nbuildtime$nbuildname$nwho$nnow$note
$header\n"; } } } } else { print "

There does not appear to be a tree " . "named '$tree'.

"; } } print "\n"; } } if (!defined $tree) { $tree = ""; } if (!defined $start) { $start = time2str($TIMEFORMAT, time() - 7*24*60*60); # One week ago. } if (!defined $end) { $end = time2str($TIMEFORMAT, time()); # #now } print qq|

Tree:
Start time:
End time:
|;