зеркало из https://github.com/mozilla/pjs.git
Have a default checkin url for non-javascript-enabled browsers
This commit is contained in:
Родитель
f6760fc28a
Коммит
d405f4c3bc
|
@ -1,129 +0,0 @@
|
|||
package Tinderbox3::BonsaiColumns;
|
||||
|
||||
use strict;
|
||||
|
||||
use Tinderbox3::Util;
|
||||
use Date::Format;
|
||||
use CGI qw/-oldstyle_urls/;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
$class = ref($class) || $class;
|
||||
my $this = {};
|
||||
bless $this, $class;
|
||||
|
||||
my ($start_time, $end_time, $bonsai_id, $display_name, $bonsai_url, $module, $branch,
|
||||
$directory, $cvsroot) = @_;
|
||||
$this->{START_TIME} = $start_time;
|
||||
$this->{END_TIME} = $end_time;
|
||||
$this->{BONSAI_ID} = $bonsai_id;
|
||||
$this->{DISPLAY_NAME} = $display_name;
|
||||
$this->{BONSAI_URL} = $bonsai_url;
|
||||
$this->{MODULE} = $module;
|
||||
$this->{BRANCH} = $branch;
|
||||
$this->{DIRECTORY} = $directory;
|
||||
$this->{CVSROOT} = $cvsroot;
|
||||
|
||||
$this->{EVENTS} = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
sub first_event_time {
|
||||
my $this = shift;
|
||||
return $this->{EVENTS}[0]{checkin_date};
|
||||
}
|
||||
|
||||
sub pop_first {
|
||||
my $this = shift;
|
||||
return ($this->{EVENTS}[0]{checkin_date}, shift @{$this->{EVENTS}}, 0);
|
||||
}
|
||||
|
||||
sub is_empty {
|
||||
my $this = shift;
|
||||
return @{$this->{EVENTS}} ? 0 : 1;
|
||||
}
|
||||
|
||||
sub column_header {
|
||||
my $this = shift;
|
||||
return "<th>$this->{DISPLAY_NAME}</th>";
|
||||
}
|
||||
|
||||
sub column_header_2 {
|
||||
return "<td>Click on a name to see what they did</td>";
|
||||
}
|
||||
|
||||
sub _escape {
|
||||
my ($str) = @_;
|
||||
$str =~ s/(['"<>\\])/\\$1/g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub cell {
|
||||
my $this = shift;
|
||||
my ($rows, $row_num, $column) = @_;
|
||||
my $cell = $rows->[$row_num][$column];
|
||||
|
||||
my $str;
|
||||
if (defined($cell)) {
|
||||
$str = "<td class=checkin>";
|
||||
foreach my $event (@{$cell}) {
|
||||
my $who = $event->{who};
|
||||
$who =~ s/%.+//g;
|
||||
my $who_email = $event->{who};
|
||||
$who_email =~ s/%/\@/g;
|
||||
my $checkin_date_str = time2str('%D %H:%M', $event->{checkin_date});
|
||||
my $popup_str = <<EOM;
|
||||
<a href='mailto:$who_email'>$who_email</a><br>
|
||||
<a href='@{[$this->build_bonsai_url($event->{checkin_date} - 7*60, $event->{checkin_date}, $event->{who})]}'>View Checkin</a> (+$event->{size_plus}/-$event->{size_minus}) $checkin_date_str<br>
|
||||
$event->{description}
|
||||
EOM
|
||||
|
||||
$str .= "<a href='#' onclick='return do_popup(event, \"cvs\", \"" . escape_html(escape_js($popup_str)) . "\")'>$who</a> ";
|
||||
}
|
||||
} else {
|
||||
$str = "<td>";
|
||||
}
|
||||
|
||||
$str .= "</td>";
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub build_bonsai_url {
|
||||
my $this = shift;
|
||||
my ($start_date, $end_date, $who) = @_;
|
||||
return "$this->{BONSAI_URL}/cvsquery.cgi?module=$this->{MODULE}&branch=$this->{BRANCH}&dir=$this->{DIRECTORY}&cvsroot=$this->{CVSROOT}&date=explicit&mindate=$start_date&maxdate=$end_date" . ($who ? "&who=" . escape_url($who) : "");
|
||||
}
|
||||
|
||||
sub get_bonsai_column_queues {
|
||||
my ($p, $dbh, $start_time, $end_time, $tree) = @_;
|
||||
|
||||
#
|
||||
# Get the list of bonsai installs
|
||||
#
|
||||
my %columns;
|
||||
my $sth = $dbh->prepare("SELECT bonsai_id, display_name, bonsai_url, module, branch, directory, cvsroot FROM tbox_bonsai WHERE tree_name = ?");
|
||||
$sth->execute($tree);
|
||||
while (my $row = $sth->fetchrow_arrayref) {
|
||||
$columns{$row->[0]} = new Tinderbox3::BonsaiColumns($start_time, $end_time, @{$row});
|
||||
}
|
||||
|
||||
if (keys %columns) {
|
||||
#
|
||||
# Fill in the bonsais with data
|
||||
#
|
||||
$sth = $dbh->prepare("SELECT bonsai_id, " . Tinderbox3::DB::sql_get_timestamp("checkin_date") . ", who, files, revisions, size_plus, size_minus, description FROM tbox_bonsai_cache WHERE checkin_date >= " . Tinderbox3::DB::sql_abstime("?") . " AND checkin_date <= " . Tinderbox3::DB::sql_abstime("?") . " AND bonsai_id IN (" . join(', ', map { "?" } keys %columns) . ") ORDER BY checkin_date");
|
||||
$sth->execute($start_time, $end_time, map { $_->{BONSAI_ID} } values %columns);
|
||||
while (my $row = $sth->fetchrow_arrayref) {
|
||||
push @{$columns{$row->[0]}{EVENTS}}, {
|
||||
checkin_date => $row->[1], who => $row->[2], files => $row->[3],
|
||||
revisions => $row->[4], size_plus => $row->[5], size_minus => $row->[6],
|
||||
description => $row->[7]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return sort { $a->{DISPLAY_NAME} cmp $b->{DISPLAY_NAME} } values %columns;
|
||||
}
|
||||
|
||||
1
|
|
@ -73,13 +73,14 @@ sub cell {
|
|||
my $who_email = $event->{who};
|
||||
$who_email =~ s/%/\@/g;
|
||||
my $checkin_date_str = time2str('%D %H:%M', $event->{checkin_date});
|
||||
my $bonsai_url = $this->build_bonsai_url($event->{checkin_date} - 7*60, $event->{checkin_date}, $event->{who});
|
||||
my $popup_str = <<EOM;
|
||||
<a href='mailto:$who_email'>$who_email</a><br>
|
||||
<a href='@{[$this->build_bonsai_url($event->{checkin_date} - 7*60, $event->{checkin_date}, $event->{who})]}'>View Checkin</a> (+$event->{size_plus}/-$event->{size_minus}) $checkin_date_str<br>
|
||||
<a href='$bonsai_url'>View Checkin</a> (+$event->{size_plus}/-$event->{size_minus}) $checkin_date_str<br>
|
||||
$event->{description}
|
||||
EOM
|
||||
|
||||
$str .= "<a href='#' onclick='return do_popup(event, \"cvs\", \"" . escape_html(escape_js($popup_str)) . "\")'>$who</a> ";
|
||||
$str .= "<a href='$bonsai_url' onclick='return do_popup(event, \"cvs\", \"" . escape_html(escape_js($popup_str)) . "\")'>$who</a> ";
|
||||
}
|
||||
} else {
|
||||
$str = "<td>";
|
||||
|
|
Загрузка…
Ссылка в новой задаче