monthly.cgi - webform to help with formatting status reports.
Submitted by: julian (with changes) Reviewed by: www Approved by: trhodes
This commit is contained in:
parent
e2c57ac780
commit
ed3675ae2c
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/www/; revision=24261
2 changed files with 248 additions and 2 deletions
en/cgi
|
@ -1,4 +1,4 @@
|
|||
# $FreeBSD: www/en/cgi/Makefile,v 1.22 2004/02/16 16:57:10 ceri Exp $
|
||||
# $FreeBSD: www/en/cgi/Makefile,v 1.23 2004/02/16 17:25:38 ceri Exp $
|
||||
|
||||
.if exists(../Makefile.conf)
|
||||
.include "../Makefile.conf"
|
||||
|
@ -14,7 +14,7 @@ CGI+= search.cgi cvsweb.cgi query-pr.cgi query-pr-summary.cgi
|
|||
CGI+= dosendpr.cgi sendpr-code.cgi
|
||||
CGI+= reg.cgi missing_handler.cgi
|
||||
CGI+= ports.cgi pds.cgi man.cgi url.cgi getmsg.cgi mid.cgi
|
||||
CGI+= mailindex.cgi
|
||||
CGI+= mailindex.cgi monthly.cgi
|
||||
|
||||
.SUFFIXES: .C .cgi
|
||||
|
||||
|
|
246
en/cgi/monthly.cgi
Executable file
246
en/cgi/monthly.cgi
Executable file
|
@ -0,0 +1,246 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
require "./cgi-style.pl";
|
||||
|
||||
use CGI qw(:all);
|
||||
use strict;
|
||||
|
||||
|
||||
my $Submit = param("Submit");
|
||||
my $debug = param("debug") || "";
|
||||
|
||||
my $NumDevelopers = 3;
|
||||
my $NumLinks = 4;
|
||||
my $NumTasks = 5;
|
||||
|
||||
my @messages;
|
||||
|
||||
#
|
||||
# Routine to format some xml nicely
|
||||
#
|
||||
sub xml
|
||||
{
|
||||
my($Indent, $TagEtc, @Text) = @_;
|
||||
|
||||
my($Tag, $Etc) = split(' ', $TagEtc, 2);
|
||||
|
||||
my $Spaces = " " x ($Indent*3);
|
||||
if (!@Text)
|
||||
{
|
||||
# No text in the tag
|
||||
return ("$Spaces<$TagEtc >\n");
|
||||
}
|
||||
elsif (@Text == 1)
|
||||
{
|
||||
# Bottom level tag - output on one line
|
||||
return ("$Spaces<$TagEtc>@Text</$Tag>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
# This is not a bottom level tag - output a new line after
|
||||
# starting tag
|
||||
return ("$Spaces<$TagEtc>\n",
|
||||
@Text,
|
||||
"$Spaces</$Tag>\n");
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# As above to format indented text but no tag
|
||||
#
|
||||
sub xmltext
|
||||
{
|
||||
my($Indent, @Text) = @_;
|
||||
|
||||
my $Spaces = " " x ($Indent*3);
|
||||
|
||||
return map { "$Spaces$_\n" } @Text;
|
||||
}
|
||||
|
||||
if ($Submit)
|
||||
{
|
||||
my $errors = 0;
|
||||
|
||||
my @hidden;
|
||||
|
||||
my $Project = param("Project") || "";
|
||||
my $Category = param("Category") || "misc";
|
||||
push(@hidden, hidden("Project"));
|
||||
|
||||
my @contacts;
|
||||
foreach my $Num (1..$NumDevelopers)
|
||||
{
|
||||
my $fname = param("FirstName$Num") || "";
|
||||
my $lname = param("LastName$Num") || "";
|
||||
my $email = param("Email$Num") || "";
|
||||
|
||||
push(@hidden, hidden("FirstName$Num"));
|
||||
push(@hidden, hidden("LastName$Num"));
|
||||
push(@hidden, hidden("Email$Num"));
|
||||
|
||||
next unless $fname || $lname || $email;
|
||||
|
||||
my @name;
|
||||
push(@name, xml(4, 'given', $fname)) if $fname;
|
||||
push(@name, xml(4, 'common', $lname)) if $lname;
|
||||
|
||||
my @person;
|
||||
push(@person, xml(3, 'name', "", @name)) if @name;
|
||||
push(@person, xml(3, 'email', $email)) if $email;
|
||||
|
||||
push(@contacts, xml(2, 'person', "", @person));
|
||||
}
|
||||
|
||||
if (!@contacts)
|
||||
{
|
||||
++$errors;
|
||||
push(@messages, b("Please specify at least one contact"));
|
||||
}
|
||||
|
||||
my @links;
|
||||
foreach my $Num (1..$NumLinks)
|
||||
{
|
||||
my $url = param("Url$Num") || "";
|
||||
my $desc = param("Desc$Num") || "";
|
||||
|
||||
push(@hidden, hidden("Url$Num"));
|
||||
push(@hidden, hidden("Desc$Num"));
|
||||
|
||||
next unless $url;
|
||||
my @link;
|
||||
if ($desc)
|
||||
{
|
||||
push(@links, xml(2, "url href=\"$url\"", $desc));
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@links, xml(2, "url href=\"$url\""));
|
||||
}
|
||||
}
|
||||
|
||||
my @tasks;
|
||||
foreach my $Num (1..$NumTasks)
|
||||
{
|
||||
my $desc = param("Task$Num") || "";
|
||||
$desc =~ s/\r//g;
|
||||
my @desc = split("\n", $desc);
|
||||
|
||||
push(@hidden, hidden("Task$Num"));
|
||||
|
||||
next unless $desc;
|
||||
push(@tasks, xml(2, "task", "",xmltext(3, @desc)));
|
||||
}
|
||||
|
||||
my $info = param("SubmittedInfo") || "";
|
||||
push(@hidden, hidden("SubmittedInfo"));
|
||||
|
||||
$info =~ s/\r//g;
|
||||
my @info = split("\n", $info);
|
||||
|
||||
my $title = "FreeBSD project submission output";
|
||||
|
||||
my @contents = xml(0, "project cat=\'$Category\'",
|
||||
xml(1, "title", $Project),
|
||||
"\n",
|
||||
xml(1, "contact", "", @contacts),
|
||||
"\n",
|
||||
xml(1, "links", "", @links),
|
||||
"\n",
|
||||
xml(1, "body",
|
||||
xml(2, "p", "", xmltext(3, @info))),
|
||||
"\n",
|
||||
xml(1, "help", "", @tasks),
|
||||
);
|
||||
my $contents = join('', @contents);
|
||||
|
||||
$contents = "<!-- Mail to: monthly\@freebsd.org -->\n$contents";
|
||||
|
||||
if (!$errors)
|
||||
{
|
||||
print "Content-Type: text/plain\n\n";
|
||||
print $contents;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
my @DeveloperTable;
|
||||
foreach my $Num (1..$NumDevelopers)
|
||||
{
|
||||
push(@DeveloperTable,
|
||||
TR(td(textfield(-name => "FirstName$Num", -size => 20)),
|
||||
td(textfield(-name => "LastName$Num", -size => 20)),
|
||||
td(textfield(-name => "Email$Num", -size => 32))));
|
||||
}
|
||||
|
||||
my @LinksTable;
|
||||
foreach my $Num (1..$NumLinks)
|
||||
{
|
||||
push(@LinksTable,
|
||||
TR(td(textfield(-name => "Url$Num", -size => 55)),
|
||||
td(textfield(-name => "Desc$Num", -size => 20))));
|
||||
}
|
||||
|
||||
my @TaskTable;
|
||||
foreach my $Num (1..$NumTasks)
|
||||
{
|
||||
push(@TaskTable,
|
||||
TR(td(textarea(-name => "Task$Num", -rows => 3, -cols => 60))));
|
||||
}
|
||||
|
||||
print
|
||||
(html_header("Submitting a FreeBSD Project Status Report"),
|
||||
hr,
|
||||
join("<BR>\n", @messages, ""),
|
||||
p,
|
||||
"To submit status information about a FreeBSD project, fill out the following:",
|
||||
br,
|
||||
start_form(),
|
||||
|
||||
h3("Project:"),
|
||||
textfield(-name => "Project", -size => "32"),
|
||||
|
||||
h3("Category:"),
|
||||
scrolling_list(-name => "Category", -values => ['proj', 'docs', 'kern',
|
||||
'arch', 'ports', 'vendor', 'misc'], -default => ['proj'], -size => 7,
|
||||
-multiple => 'false', -lables => {'proj'=> 'Projects (non-specific)',
|
||||
'docs' => 'Documentation', 'kern' => 'Kernel', 'arch' => 'Architectures',
|
||||
'ports' => 'Ports', 'vendor' => 'Vendor / 3rd party software',
|
||||
'misc' => 'Miscellaneous' }),
|
||||
|
||||
h3("Developers:"),
|
||||
blockquote(table({"BORDER" => 0,
|
||||
"COLS" => 3,
|
||||
"NOSAVE" => 1},
|
||||
TR(td("First Name"),
|
||||
td("Family Name"),
|
||||
td("Email address")),
|
||||
@DeveloperTable)),
|
||||
|
||||
h3("Links:"),
|
||||
blockquote(table({"BORDER" => 0,
|
||||
"COLS" => 2,
|
||||
"NOSAVE" => 1},
|
||||
TR(td("Url"),
|
||||
td("Description (optional)")),
|
||||
@LinksTable)),
|
||||
|
||||
h3("Present status:"),
|
||||
blockquote(textarea(-name => "SubmittedInfo",
|
||||
-rows => 7,
|
||||
-cols => 60)),
|
||||
|
||||
h3("Open tasks (optional):"),
|
||||
blockquote(table({"BORDER" => 0,
|
||||
"COLS" => 5,
|
||||
"NOSAVE" => 1},
|
||||
TR(td("Description")),
|
||||
@TaskTable)),
|
||||
|
||||
|
||||
submit(-name => "Submit", -label => "Download XML"),
|
||||
reset(-value => "Reset"),
|
||||
br,
|
||||
end_form(),
|
||||
html_footer());
|
||||
|
||||
__END__
|
Loading…
Reference in a new issue