Breaking mod.pl into three parts, sheriff.pl, status.pl, rules.pl. Cleaning up admin HTML. Some help from timeless getting this change started.

This commit is contained in:
mcafee%netscape.com 2000-07-20 23:33:11 +00:00
parent 47a6f7740a
commit b749060d37
5 changed files with 157 additions and 45 deletions

View File

@ -194,7 +194,9 @@ rows separated by "\n" and columns by '|'.
$tree/${logfile}
$tree/${logfile}.brief.html
$tree/ignorebuilds.pl
$tree/mod.pl
$tree/rules.pl
$tree/status.pl
$tree/sheriff.pl
$tree/notes.txt
$tree/treedata.pl
$tree/who.dat
@ -212,9 +214,17 @@ ignorebuilds.pl is a file which specifies builds that should not be
performed. It is valid perl code which sets the hash reference
$ignore_builds, each key is a tree name.
mod.pl stores the tree specific message of the day. This is not to be
confused with mod perl the CGI library. Its contents looks like:
$message_of_day = 'message';
status.pl stores the tree-specific status. Its contents looks like:
$status_message = 'message';
1;
rules.pl stores the tree rules message. Its contents looks like:
$rules_message = 'message';
1;
sheriff.pl stores the current sheriff. Its contents looks like:
$current_sheriff = 'sheriff';
1;
notes.txt store the database of notes:
$buildtime|$buildname||$author|$time_now|$note

View File

@ -38,77 +38,147 @@ tb_load_data();
EmitHtmlHeader("administer tinderbox", "tree: $tree");
if (defined($tree)) {
if( -r "$tree/mod.pl" ){
require "$tree/mod.pl";
$message_of_day =~ s/\s*$//; # Trim trailing whitespace;
}
else {
$message_of_day = "";
# Sheriff
if( -r "$tree/sheriff.pl" ){
require "$tree/sheriff.pl";
$current_sheriff =~ s/\s*$//; # Trim trailing whitespace;
} else {
$current_sheriff = "";
}
# Status message.
if( -r "$tree/status.pl" ){
require "$tree/status.pl";
$status_message =~ s/\s*$//; # Trim trailing whitespace;
} else {
$status_message = "";
}
# Tree rules.
if( -r "$tree/rules.pl" ){
require "$tree/rules.pl";
$rules_message =~ s/\s*$//; # Trim trailing whitespace;
} else {
$rules_message = "";
}
#
# Change sheriff
#
print "
<FORM method=post action=doadmin.cgi>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=set_message>
<br><b>Message of the Day
<br><TEXTAREA NAME=message ROWS=30 COLS=75 WRAP=SOFT>$message_of_day
<INPUT TYPE=HIDDEN NAME=command VALUE=set_sheriff>
<br><b>Change sheriff info.</b> (mailto: url, phone number, etc.)<br>
<TEXTAREA NAME=sheriff ROWS=2 COLS=75 WRAP=SOFT>$current_sheriff
</TEXTAREA>
<br><INPUT TYPE=SUBMIT VALUE='Set Message of the Day'>
<br>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<b><INPUT TYPE=SUBMIT VALUE='Change Sheriff'></b>
</FORM>
<hr>
";
#
# Status message
#
print "
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=set_status_message>
<br><b>Status message.</b> (Use this for stay-out-of-the-tree warnings, etc.)<br>
<TEXTAREA NAME=status ROWS=5 COLS=75 WRAP=SOFT>$status_message
</TEXTAREA>
<br>
<b>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Change status message'>
</b>
</FORM>
<hr>
";
#
# Rules message.
#
print "
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=set_rules_message>
<br><b>The tree rules.</b>
<br><TEXTAREA NAME=rules ROWS=18 COLS=75 WRAP=SOFT>$rules_message
</TEXTAREA>
<br>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<b><INPUT TYPE=SUBMIT VALUE='Change rules message'></b>
</FORM>
<hr>
";
#
# Trim logs.
#
print "
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=trim_logs>
<br><b>Trim Logs to <INPUT NAME=days size=5 VALUE='7'> days.</b> (Tinderbox
shows 2 days history by default. You can see more by clicking show all).
<br><INPUT TYPE=SUBMIT VALUE='Trim Logs'>
<b>Trim Logs</b><br>
Trim Logs to <INPUT NAME=days size=5 VALUE='7'> days. (Tinderbox
shows 2 days history by default. You can see more by clicking show all).<br>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Trim Logs'>
</FORM>
<FORM method=post action=doadmin.cgi>
<hr>
" ;
}
#
# Create a new tinderbox page.
#
print "
<FORM method=post action=doadmin.cgi>
<B>Password:</B> <INPUT NAME=password TYPE=password> <BR>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=create_tree>
<b>Create a new tinderbox page.</b>
<TABLE>
<TR>
<TD><B>tinderbox tree name:</B></TD>
<TD>tinderbox tree name:</TD>
<TD><INPUT NAME=treename VALUE=''></TD>
</TR><TR>
<TD><B>cvs repository:</B></TD>
<TD>cvs repository:</TD>
<TD><INPUT NAME=repository VALUE=''></TD>
</TR><TR>
<TD><B>cvs module name:</B></TD>
<TD>cvs module name:</TD>
<TD><INPUT NAME=modulename VALUE=''></TD>
</TR><TR>
<TD><B>cvs branch:</B></TD>
<TD>cvs branch:</TD>
<TD><INPUT NAME=branchname VALUE='HEAD'></TD>
</TR>
</TABLE>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Create a new Tinderbox page'>
</FORM>
<FORM method=post action=doadmin.cgi>
<hr>
";
#
# Turn builds off.
#
if (defined($tree)) {
print "
<B><font size=+1>If builds are behaving badly you can turn them off.</font></b><br> Uncheck
the build that is misbehaving and click the button. You can still see all the
builds even if some are disabled by adding the parameter <b><tt>&noignore=1</tt></b> to
the tinderbox URL.<br>
<B>Password:</B> <INPUT NAME=password TYPE=password> <BR>
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=disable_builds>
";
@ -124,13 +194,10 @@ the tinderbox URL.<br>
}
print "
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Show only checked builds'>
</FORM>
<hr>
";
}

View File

@ -72,7 +72,7 @@ do
cd $tinderbox_dir/$tree
for file in build.dat mod.pl notes.txt treedata.pl who.dat ignorebuilds.pl bloat.dat warn.pl
for file in build.dat status.pl rules.pl sheriff.pl notes.txt treedata.pl who.dat ignorebuilds.pl bloat.dat warn.pl
do
rm -f $file
wget $tinderbox_link/$tree/$file

View File

@ -46,8 +46,14 @@ elsif( $command eq 'remove_build' ){
elsif( $command eq 'trim_logs' ){
&trim_logs;
}
elsif( $command eq 'set_message' ){
&set_message;
elsif( $command eq 'set_status_message' ){
&set_status_message;
}
elsif( $command eq 'set_rules_message' ){
&set_rules_message;
}
elsif( $command eq 'set_sheriff' ){
&set_sheriff;
}
elsif( $command eq 'disable_builds' ){
&disable_builds;
@ -206,15 +212,36 @@ sub disable_builds {
print "<h2><a href=showbuilds.cgi?tree=$treename>Build state Changed</a></h2>\n";
}
sub set_message {
$m = $form{'message'};
sub set_sheriff {
$m = $form{'sheriff'};
$m =~ s/\'/\\\'/g;
open(MOD, ">$tree/mod.pl");
print MOD "\$message_of_day = \'$m\'\;\n1;";
close(MOD);
chmod( 0777, "$tree/mod.pl");
open(SHERIFF, ">$tree/sheriff.pl");
print SHERIFF "\$current_sheriff = '$m';\n1;";
close(SHERIFF);
chmod( 0777, "$tree/sheriff.pl");
print "<h2><a href=showbuilds.cgi?tree=$tree>
Message Changed</a></h2>\n";
Sheriff Changed.</a><br></h2>\n";
}
sub set_status_message {
$m = $form{'status'};
$m =~ s/\'/\\\'/g;
open(TREESTATUS, ">$tree/status.pl");
print TREESTATUS "\$status_message = \'$m\'\;\n1;";
close(TREESTATUS);
chmod( 0777, "$tree/status.pl");
print "<h2><a href=showbuilds.cgi?tree=$tree>
Status message changed.</a><br></h2>\n";
}
sub set_rules_message {
$m = $form{'rules'};
$m =~ s/\'/\\\'/g;
open(RULES, ">$tree/rules.pl");
print RULES "\$rules_message = \'$m\';\n1;";
close(RULES);
chmod( 0777, "$tree/rules.pl");
print "<h2><a href=showbuilds.cgi?tree=$tree>
Rule message changed.</a><br></h2>\n";
}

View File

@ -169,9 +169,17 @@ sub print_page_head {
&print_javascript;
# Get the message of the day only on the first pageful
do "$::tree/mod.pl" if $nowdate eq $maxdate;
print "$message_of_day\n"; # from $::tree/mod.pl
# Print rules, sheriff, and status. Only on the first pageful.
if ($nowdate eq $maxdate) {
do "$::tree/rules.pl";
print "$rules_message<br>"; # from $::tree/rules.pl
do "$::tree/sheriff.pl";
print "$current_sheriff<br>"; # from $::tree/sheriff.pl
do "$::tree/status.pl";
print "$status_message<br>"; # from $::tree/status.pl
}
# Quote and Lengend
#