2006-12-07 07:59:39 +03:00
|
|
|
#!/usr/bin/perl --
|
1998-06-17 01:43:24 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# 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/
|
1998-06-17 01:43:24 +04:00
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# 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.
|
1998-06-17 01:43:24 +04:00
|
|
|
#
|
|
|
|
# The Original Code is the Tinderbox build tool.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
1998-06-17 01:43:24 +04:00
|
|
|
|
2007-01-23 20:49:10 +03:00
|
|
|
use strict;
|
|
|
|
use Fcntl qw(:flock);
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
require 'tbglobals.pl';
|
2006-07-17 21:14:35 +04:00
|
|
|
require 'showbuilds.pl';
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Process the form arguments
|
2007-01-23 20:49:10 +03:00
|
|
|
my %form = &split_cgi_args();
|
|
|
|
my %cookie_jar = &split_cookie_args();
|
|
|
|
|
|
|
|
my ($args, $tree, $logfile, $errorparser, $buildname, $buildtime);
|
2006-05-27 04:18:42 +04:00
|
|
|
|
1999-07-07 02:35:00 +04:00
|
|
|
if (defined($args = $form{log})) {
|
1999-10-29 22:52:04 +04:00
|
|
|
# Use simplified arguments that uses the logfile as a key.
|
1999-07-07 02:35:00 +04:00
|
|
|
($tree, $logfile) = split /\//, $args;
|
2007-01-25 01:27:55 +03:00
|
|
|
$tree = &require_only_one_tree($tree);
|
1999-07-07 02:35:00 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
my $br = tb_find_build_record($tree, $logfile);
|
1999-07-07 02:35:00 +04:00
|
|
|
$errorparser = $br->{errorparser};
|
|
|
|
$buildname = $br->{buildname};
|
|
|
|
$buildtime = $br->{buildtime};
|
|
|
|
} else {
|
1999-10-29 22:52:04 +04:00
|
|
|
# Use old style arguments;
|
2007-01-25 01:27:55 +03:00
|
|
|
$tree = &require_only_one_tree($form{tree});
|
1999-10-29 22:52:04 +04:00
|
|
|
$logfile = $form{logfile};
|
|
|
|
$errorparser = $form{errorparser};
|
|
|
|
$buildname = $form{buildname};
|
|
|
|
$buildtime = $form{buildtime};
|
1999-07-07 02:35:00 +04:00
|
|
|
}
|
|
|
|
|
1999-04-23 01:02:48 +04:00
|
|
|
print "Content-Type:text/html\n";
|
1999-10-29 22:52:04 +04:00
|
|
|
|
|
|
|
# Remember email address in cookie
|
|
|
|
#
|
|
|
|
if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'POST'
|
|
|
|
and defined $form{note}) {
|
1999-04-23 01:02:48 +04:00
|
|
|
# Expire the cookie 5 months from now
|
|
|
|
print "Set-Cookie: email=$form{who}; expires="
|
|
|
|
. toGMTString(time + 86400 * 152) . "; path=/\n";
|
|
|
|
}
|
|
|
|
print "\n<HTML>\n";
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
if ($form{note}) {
|
|
|
|
# Form Submission.
|
|
|
|
# Add the comment.
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
my $note = $form{note};
|
|
|
|
my $who = $form{who};
|
1999-06-05 02:56:36 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
$note =~ s/\&/&/gi;
|
|
|
|
$note =~ s/\</</gi;
|
|
|
|
$note =~ s/\>/>/gi;
|
|
|
|
my $enc_note = url_encode($note);
|
1998-08-26 01:22:32 +04:00
|
|
|
|
2007-12-15 03:28:02 +03:00
|
|
|
$who =~ s/\&/&/gi;
|
|
|
|
$who =~ s/\</</gi;
|
|
|
|
$who =~ s/\>/>/gi;
|
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
my $now = time;
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Save comment to the notes.txt file.
|
|
|
|
#
|
2006-06-05 21:49:31 +04:00
|
|
|
my $err = 0;
|
2007-12-19 23:00:54 +03:00
|
|
|
open NOTES, ">>", "$::tree_dir/$tree/notes.txt" or $err++;
|
2006-06-05 21:49:31 +04:00
|
|
|
if ($err) {
|
|
|
|
print "<title>Error</title>\n";
|
|
|
|
print "<h1>Could not open $tree/notes.txt for writing.</h1>\n";
|
|
|
|
print "<h2>Please contact the webmaster.</h2>\n";
|
|
|
|
die "Could not open $tree/notes.txt for writing.\n";
|
|
|
|
}
|
1999-10-29 22:52:04 +04:00
|
|
|
flock NOTES, LOCK_EX;
|
|
|
|
print NOTES "$buildtime|$buildname|$who|$now|$enc_note\n";
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Find the latest times for the "other" trees
|
2007-02-10 03:38:34 +03:00
|
|
|
my (%quickdata);
|
2007-03-13 01:44:03 +03:00
|
|
|
tb_loadquickparseinfo($tree, $form{maxdate}, \%quickdata, 1);
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
foreach my $element (keys %form) {
|
|
|
|
# The checkboxes for the builds have "NAME" set to the build name
|
2007-02-10 03:38:34 +03:00
|
|
|
if (defined $quickdata{$element}->{buildtime}) {
|
|
|
|
print NOTES "$quickdata{$element}->{buildtime}|$element|$who|$now|$enc_note\n";
|
1999-10-29 22:52:04 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
close NOTES;
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Give a confirmation
|
|
|
|
#
|
|
|
|
print "<H1>The following comment has been added to the log</h1>\n";
|
|
|
|
print "<pre>\n[<b>$who - ".print_time($now)."</b>]\n$note\n</pre>";
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
my $enc_buildname = url_encode($buildname);
|
|
|
|
print "<p><a href='showlog.cgi?tree=$tree&buildname=$enc_buildname"
|
2007-03-13 01:44:03 +03:00
|
|
|
."&buildtime=$buildtime&logfile=$logfile&errorparser=$errorparser'>"
|
|
|
|
."Go back to the Error Log</a><br><a href='showbuilds.cgi?tree=$tree'>"
|
1999-10-29 22:52:04 +04:00
|
|
|
."Go back to the build Page</a>";
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Rebuild the static tinderbox pages
|
2007-01-23 20:49:10 +03:00
|
|
|
my %new_form = ();
|
|
|
|
$new_form{tree} = $tree;
|
2007-01-25 01:27:55 +03:00
|
|
|
&tb_build_static(\%new_form);
|
1999-06-05 02:56:36 +04:00
|
|
|
|
1998-08-26 01:22:32 +04:00
|
|
|
} else {
|
1999-10-29 22:52:04 +04:00
|
|
|
# Print the form to submit a comment
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
if ($buildname eq '' or $buildtime == 0) {
|
1999-07-07 02:35:00 +04:00
|
|
|
print "<h1>Invalid parameters</h1>\n";
|
|
|
|
die "\n";
|
|
|
|
}
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
# Retrieve the email address from the cookie jar.
|
|
|
|
#
|
2007-01-23 20:49:10 +03:00
|
|
|
my $emailvalue = '';
|
1999-10-29 22:52:04 +04:00
|
|
|
$emailvalue = " value='$cookie_jar{email}'" if defined $cookie_jar{email};
|
2007-12-15 03:28:02 +03:00
|
|
|
$emailvalue =~ s/\&/&/gi;
|
|
|
|
$emailvalue =~ s/\</</gi;
|
|
|
|
$emailvalue =~ s/\>/>/gi;
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
print <<__END_FORM;
|
1999-02-13 00:29:53 +03:00
|
|
|
<head><title>Add a Comment to $buildname log</title></head>
|
|
|
|
<body BGCOLOR="#FFFFFF" TEXT="#000000"LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-02-13 00:29:53 +03:00
|
|
|
<table><tr><td>
|
1999-10-29 22:52:04 +04:00
|
|
|
<b><font size="+2">
|
|
|
|
Add a Log Comment
|
|
|
|
</font></b>
|
1999-02-13 00:29:53 +03:00
|
|
|
</td></tr><tr><td>
|
1999-10-29 22:52:04 +04:00
|
|
|
<b><code>
|
|
|
|
$buildname
|
|
|
|
</code></b>
|
1999-02-13 00:29:53 +03:00
|
|
|
</td></tr></table>
|
1998-06-17 01:43:24 +04:00
|
|
|
|
1999-02-18 00:56:14 +03:00
|
|
|
<form action='addnote.cgi' METHOD='post'>
|
|
|
|
|
1998-06-17 01:43:24 +04:00
|
|
|
<INPUT Type='hidden' name='buildname' value='${buildname}'>
|
|
|
|
<INPUT Type='hidden' name='buildtime' value='${buildtime}'>
|
|
|
|
<INPUT Type='hidden' name='errorparser' value='$errorparser'>
|
|
|
|
<INPUT Type='hidden' name='logfile' value='$logfile'>
|
1999-02-13 00:29:53 +03:00
|
|
|
<INPUT Type='hidden' name='tree' value='$tree'>
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-02-13 00:29:53 +03:00
|
|
|
<table border=0 cellpadding=4 cellspacing=1>
|
|
|
|
<tr valign=top>
|
|
|
|
<td align=right>
|
|
|
|
<NOWRAP>Email address:</NOWRAP>
|
|
|
|
</td><td>
|
1999-04-23 01:02:48 +04:00
|
|
|
<INPUT Type='input' name='who' size=32$emailvalue><BR>
|
1999-02-13 00:29:53 +03:00
|
|
|
</td>
|
|
|
|
</tr><tr valign=top>
|
|
|
|
<td align=right>
|
|
|
|
Comment:
|
|
|
|
</td><td>
|
1999-04-22 23:52:23 +04:00
|
|
|
<TEXTAREA NAME=note ROWS=10 COLS=30 WRAP=HARD></textarea>
|
1999-02-13 00:29:53 +03:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2003-05-02 06:54:18 +04:00
|
|
|
<br><b><font size="+2">Additional Builds</font></b><br>
|
1999-02-18 23:13:30 +03:00
|
|
|
(Comment will be added to the most recent cycle.)<br>
|
1999-10-29 22:52:04 +04:00
|
|
|
__END_FORM
|
|
|
|
|
|
|
|
# Find the names of the "other" trees
|
2007-02-10 03:38:34 +03:00
|
|
|
my (%quickdata);
|
2007-03-13 01:44:03 +03:00
|
|
|
tb_loadquickparseinfo($tree, $form{maxdate}, \%quickdata);
|
2007-01-31 01:34:14 +03:00
|
|
|
my $ignore_builds = &tb_load_ignorebuilds($tree);
|
1999-10-29 22:52:04 +04:00
|
|
|
|
|
|
|
# Add a checkbox for the each of the other builds
|
2007-02-10 03:38:34 +03:00
|
|
|
for my $other_build_name (sort keys %quickdata) {
|
1999-10-29 22:52:04 +04:00
|
|
|
if ($other_build_name ne '' and $other_build_name ne $buildname
|
2007-01-31 01:34:14 +03:00
|
|
|
and not $ignore_builds->{$other_build_name}) {
|
1999-10-29 22:52:04 +04:00
|
|
|
print "<INPUT TYPE='checkbox' NAME='$other_build_name'>";
|
|
|
|
print "$other_build_name<BR>\n";
|
1998-08-26 01:22:32 +04:00
|
|
|
}
|
1999-10-29 22:52:04 +04:00
|
|
|
}
|
1998-08-26 01:22:32 +04:00
|
|
|
|
1999-10-29 22:52:04 +04:00
|
|
|
print "<INPUT Type='submit' name='submit' value='Add Comment'><BR>";
|
|
|
|
print "</form>\n</body>\n</html>";
|
1998-08-26 01:22:32 +04:00
|
|
|
}
|