#!/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'; use Fcntl; require 'tbglobals.pl'; require 'lloydcgi.pl'; # Process the form arguments # if (defined($args = $form{log})) { # Use simplified arguments that uses the logfile as a key. ($tree, $logfile) = split /\//, $args; my $br = tb_find_build_record($tree, $logfile); $errorparser = $br->{errorparser}; $buildname = $br->{buildname}; $buildtime = $br->{buildtime}; } else { # Use old style arguments; $tree = $form{tree}; $logfile = $form{logfile}; $errorparser = $form{errorparser}; $buildname = $form{buildname}; $buildtime = $form{buildtime}; } require "$tree/ignorebuilds.pl" if -r "$tree/ignorebuilds.pl"; print "Content-Type:text/html\n"; # Remember email address in cookie # if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'POST' and defined $form{note}) { # Expire the cookie 5 months from now print "Set-Cookie: email=$form{who}; expires=" . toGMTString(time + 86400 * 152) . "; path=/\n"; } print "\n\n"; if ($form{note}) { # Form Submission. # Add the comment. my $note = $form{note}; my $who = $form{who}; $note =~ s/\&/&/gi; $note =~ s/\</gi; $note =~ s/\>/>/gi; my $enc_note = url_encode($note); my $now = time; # Save comment to the notes.txt file. # flock NOTES, LOCK_EX; open NOTES, ">>$tree/notes.txt"; open TEST, ">$tree/test.txt"; print NOTES "$buildtime|$buildname|$who|$now|$enc_note\n"; # Find the latest times for the "other" trees my (%build_status, %build_times); tb_loadquickparseinfo($tree, \%build_status, \%build_times, 1); foreach my $element (keys %form) { # The checkboxes for the builds have "NAME" set to the build name print TEST "element: $element\n"; if (defined $build_times{$element}) { print NOTES "$build_times{$element}|$element|$who|$now|$enc_note\n"; } } close NOTES; # Give a confirmation # print "
\n[$who - ".print_time($now)."]\n$note\n"; my $enc_buildname = url_encode($buildname); print "
"
."Go back to the Error Log
"
."Go back to the build Page";
# Rebuild the static tinderbox pages
tb_build_static();
} else {
# Print the form to submit a comment
if ($buildname eq '' or $buildtime == 0) {
print "
Add a Log Comment |
$buildname
|