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 distinct on (branch <> 'HEAD', branch)
40 extract(days from now() - snapshot)
43 order by branch <> 'HEAD', branch desc,
47 where status = 'approved'
54 my $sth=$db->prepare($statement);
56 while (my $row = $sth->fetchrow_hashref)
58 $row->{branches} =~ s/^\{(.*)\}$/$1/;
59 $row->{owner_email} =~ s/\@/ [ a t ] /;
60 push(@$statrows,$row);
67 # use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit;
70 my $template = new Template({});
72 print "Content-Type: text/html\n\n";
74 $template->process(\*DATA,{statrows=>$statrows});
80 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
81 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
82 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
84 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
85 <title>PostgreSQL BuildFarm Members</title>
86 <link rel="icon" type="image/png" href="/elephant-icon.png" />
87 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
88 <style type="text/css"><!--
89 li#members a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
90 li#members { background: url(/inc/b/l.png) no-repeat 0% -20px; }
94 <body class="members">
97 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
100 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
101 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
102 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
103 <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
104 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
107 </div><!-- banner -->
109 <h1>PostgreSQL BuildFarm Members</h1>
110 <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>
111 <form name="filter" method="GET" action="/cgi-bin/show_status.pl">
112 <table cellspacing="0">
115 <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>
116 <th><a href="/cgi-bin/show_members.pl?sort_by=os">OS / Version</a></th>
117 <th><a href="/cgi-bin/show_members.pl?sort_by=compiler">Compiler / Version</a></th>
118 <th><a href="/cgi-bin/show_members.pl?sort_by=arch">Arch</a></th>
119 <th>Branches reported on<br />(most recent report)</th>
122 [% FOREACH row IN statrows %] <tr [%- IF alt %]class="alt"[% END -%]>
124 <td><input type="checkbox" name="member" value="[% row.name %]" /></td>
125 <td>[% row.name %]<br />[% row.owner_email %]</td>
126 <td>[% row.operating_system %]<br />[% row.os_version %]</td>
127 <td>[% row.compiler %]<br />[% row.compiler_version %]</td>
128 <td>[% row.arch %]</td>
129 <td class="branch">[% IF ! row.branches ; ' ' ; END -%]
132 FOREACH branch_days IN row.branches.split(',') ;
133 branch_fields = branch_days.split(':');
134 branch = branch_fields.0;
135 branch_day = branch_fields.1;
137 href="show_history.pl?nm=[% row.name %]&br=[% branch %]"
139 >[% branch %]</a> ([% branch_day %] days ago)</li>[% END %]</ul></td>
143 <input type="submit" value="Make Filter" />
147 <p style="text-align: center;">
148 Hosting for the PostgreSQL Buildfarm is generously
150 <a href="http://www.commandprompt.com">CommandPrompt,
151 The PostgreSQL Company</a>
153 </div><!-- wrapper -->