new association code, need to check it in to test it.

This commit is contained in:
kestes%walrus.com 2002-05-10 21:24:39 +00:00
Родитель 4f188e18a5
Коммит 7941633613
1 изменённых файлов: 37 добавлений и 9 удалений

Просмотреть файл

@ -6,8 +6,8 @@
# on the tinderbox status page. # on the tinderbox status page.
# $Revision: 1.17 $ # $Revision: 1.18 $
# $Date: 2002-04-27 03:23:00 $ # $Date: 2002-05-10 21:24:39 $
# $Author: kestes%walrus.com $ # $Author: kestes%walrus.com $
# $Source: /home/jrmuizel/cvs-mirror/mozilla/webtools/tinderbox2/src/bin/addnote.cgi,v $ # $Source: /home/jrmuizel/cvs-mirror/mozilla/webtools/tinderbox2/src/bin/addnote.cgi,v $
# $Name: $ # $Name: $
@ -87,13 +87,13 @@ sub timestring2time {
$time = timelocal($sec,$min,$hours,$mday,$mon,$year - 1); $time = timelocal($sec,$min,$hours,$mday,$mon,$year - 1);
} }
# check that the result is reasonable. }
if ( (($main::TIME - $main::SECONDS_PER_YEAR) > $time) ||
(($main::TIME + $main::SECONDS_PER_MONTH) < $time) ) {
$time = time();
}
# check that the result is reasonable.
if ( (($main::TIME - $main::SECONDS_PER_YEAR) > $time) ||
(($main::TIME + $main::SECONDS_PER_MONTH) < $time) ) {
undefine $time;
} }
return $time; return $time;
@ -110,7 +110,7 @@ sub time2timestring {
$mon++; $mon++;
$year += 1900; $year += 1900;
my $display__time = sprintf("%02u/%02u %02u:%02u", my $display_time = sprintf("%02u/%02u %02u:%02u",
$mon, $mday, $hour, $min); $mon, $mday, $hour, $min);
return $display_time; return $display_time;
@ -159,6 +159,14 @@ sub get_params {
$NOTE = extract_html_chars($NOTE); $NOTE = extract_html_chars($NOTE);
{
TinderDB::loadtree_db($tree);
@ASSOCIATIONS = TinderDB::notice_association($tree);
}
@CHOSEN_ASSOCIATIONS = param("associations");
return 1; return 1;
} }
@ -213,6 +221,20 @@ sub format_input_page {
p(), p(),
); );
if (@ASSOCIATIONS) {
push @out, (
h3("Associated with"),
p(),
radio_group(
-name=>'associations',
-value=>[@ASSOCIATIONS],
# -default=>,
),
p(),
)
} # end if
push @out, ( push @out, (
"Enter Notice: \n",p(), "Enter Notice: \n",p(),
textarea(-name=>'note', textarea(-name=>'note',
@ -253,6 +275,11 @@ sub save_note {
my ($pretty_time) = HTMLPopUp::timeHTML($time); my ($pretty_time) = HTMLPopUp::timeHTML($time);
my %association;
foreach $association (@CHOSEN_ASSOCIATIONS) {
$association{$association} = 1;
}
# We embed the IP address of the host, just in case there is some bad # We embed the IP address of the host, just in case there is some bad
# html in the notice that gets through our defenses. If we know that # html in the notice that gets through our defenses. If we know that
# there is a problem with a page, then we know which machine it came # there is a problem with a page, then we know which machine it came
@ -267,6 +294,7 @@ sub save_note {
'posttime' => $TIME, 'posttime' => $TIME,
'localposttime' => $LOCALTIME, 'localposttime' => $LOCALTIME,
'remote_host' => $REMOTE_HOST, 'remote_host' => $REMOTE_HOST,
'associations' => \%association,
}; };
my ($update_file) = (FileStructure::get_filename($TREE, 'TinderDB_Dir'). my ($update_file) = (FileStructure::get_filename($TREE, 'TinderDB_Dir').