10 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $sort_by);
13 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
14 #require "BuildFarmWeb.pl";
17 my %sort_ok = ('name' => 'lower(name)' ,
18 'owner' => 'lower(owner_email)',
19 'os' => 'lower(operating_system), os_version',
20 'compiler' => 'lower(compiler), compiler_version' ,
21 'arch' => 'lower(architecture)' );
22 $sort_by = $query->param('sort_by');$sort_by =~ s/[^a-zA-Z0-9_ -]//g;
23 $sort_by = $sort_ok{$sort_by} || $sort_ok{name};
25 my $dsn="dbi:Pg:dbname=$dbname";
26 $dsn .= ";host=$dbhost" if $dbhost;
27 $dsn .= ";port=$dbport" if $dbport;
29 my $db = DBI->connect($dsn,$dbuser,$dbpass);
31 # there is possibly some redundancy in this query, but it makes
32 # a lot of the processing simpler.
34 my $statement = <<EOS;
36 select name, operating_system, os_version, compiler, compiler_version, owner_email,
37 architecture as arch, ARRAY(
38 select branch || ':' ||
39 extract(days from now() - latest_snapshot)
40 from build_status_latest l
41 where l.sysname = s.name
42 order by branch <> 'HEAD', branch desc
45 where status = 'approved'
52 my $sth=$db->prepare($statement);
54 while (my $row = $sth->fetchrow_hashref)
56 $row->{branches} =~ s/^\{(.*)\}$/$1/;
57 $row->{owner_email} =~ s/\@/ [ a t ] /;
58 push(@$statrows,$row);
65 # use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit;
68 my $template = new Template({});
70 print "Content-Type: text/html\n\n";
72 $template->process(\*DATA,{statrows=>$statrows});
78 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
79 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
80 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
82 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
83 <title>PostgreSQL BuildFarm Members</title>
84 <link rel="icon" type="image/png" href="/elephant-icon.png" />
85 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
86 <style type="text/css"><!--
87 li#members a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
88 li#members { background: url(/inc/b/l.png) no-repeat 0% -20px; }
92 <body class="members">
95 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
98 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
99 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
100 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
101 <li id="register"><a href="/cgi-bin/register-form.pl" title="Join PostgreSQL BuildFarm">Register</a></li>
102 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
105 </div><!-- banner -->
107 <h1>PostgreSQL BuildFarm Members</h1>
108 <p>Click branch links to see build history. Click the heading links to resort the list. Select members by checkbox and hit the button at the bottom to create a status custom filter.</p>
109 <form name="filter" method="GET" action="/cgi-bin/show_status.pl">
110 <table cellspacing="0">
113 <th><a href="/cgi-bin/show_members.pl?sort_by=name">Name</a><br /><a href="/cgi-bin/show_members.pl?sort_by=owner">Owner</a></th>
114 <th><a href="/cgi-bin/show_members.pl?sort_by=os">OS / Version</a></th>
115 <th><a href="/cgi-bin/show_members.pl?sort_by=compiler">Compiler / Version</a></th>
116 <th><a href="/cgi-bin/show_members.pl?sort_by=arch">Arch</a></th>
117 <th>Branches reported on<br />(most recent report)</th>
120 [% FOREACH row IN statrows ;
122 FOREACH branch_days IN row.branches.split(',') ;
123 branch_fields = branch_days.split(':');
124 branch_day = branch_fields.1;
125 IF branch_day < 365 ; have_recent = 1; END;
128 %] <tr [%- IF alt %]class="alt"[% END -%]>
130 <td><input type="checkbox" name="member" value="[% row.name %]" /></td>
131 <td>[% row.name %]<br />[% row.owner_email %]</td>
132 <td>[% row.operating_system %]<br />[% row.os_version %]</td>
133 <td>[% row.compiler %]<br />[% row.compiler_version %]</td>
134 <td>[% row.arch %]</td>
135 <td class="branch">[% IF ! row.branches ; ' ' ; END -%]
138 FOREACH branch_days IN row.branches.split(',') ;
139 branch_fields = branch_days.split(':');
140 branch = branch_fields.0;
141 branch_day = branch_fields.1;
142 IF branch_day < 365 ;
144 href="show_history.pl?nm=[% row.name %]&br=[% branch %]"
146 >[% branch %]</a> ([% branch_day %] days ago)</li>[% END; END %]</ul></td>
150 <input type="submit" value="Make Filter" />
154 <p style="text-align: center;">
155 Hosting for the PostgreSQL Buildfarm is generously
157 <a href="http://www.commandprompt.com">CommandPrompt,
158 The PostgreSQL Company</a>
160 </div><!-- wrapper -->