- web: add links to cross-project host stats sites

(currently just boincstats)

svn path=/trunk/boinc/; revision=17156
This commit is contained in:
David Anderson 2009-02-05 21:19:19 +00:00
parent 20c2566ada
commit 03a0175d26
5 changed files with 42 additions and 9 deletions

View File

@ -1224,3 +1224,15 @@ David 5 Feb 2009
inc/
stats_sites.inc
team.inc
David 5 Feb 2009
- web: add links to cross-project host stats sites
(currently just boincstats)
html/
inc/
hosts.inc
stats_sites.inc
util.inc
user/
hosts_user.php

View File

@ -17,6 +17,7 @@
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
require_once("../inc/credit.inc");
require_once("../inc/stats_sites.inc");
require_once("../inc/boinc_db.inc");
function link_to_results($host) {
@ -61,6 +62,18 @@ function location_form($host) {
return $x;
}
function cross_project_links($host) {
global $host_sites;
$x = "";
shuffle($host_sites);
foreach ($host_sites as $h) {
$url = $h[0];
$name = $h[1];
$x .= "<a href=$url".$host->host_cpid.">$name</a><br>\n";
}
return $x;
}
// Show full-page description of $host.
// If $user is non-null, it's both the owner of the host
// and the logged in user (so show some extra fields)
@ -91,8 +104,9 @@ function show_host($host, $user, $ipprivate) {
}
}
row2("Created", time_str($host->create_time));
row2("Total Credit", format_credit_large($host->total_credit));
row2("Avg. credit", format_credit($host->expavg_credit));
row2("Total credit", format_credit_large($host->total_credit));
row2("Average credit", format_credit($host->expavg_credit));
row2("Cross project credit", cross_project_links($x));
row2("CPU type", "$host->p_vendor <br> $host->p_model");
row2("Number of processors", $host->p_ncpus);
if ($host->serialnum) {
@ -184,7 +198,7 @@ function show_host($host, $user, $ipprivate) {
function top_host_table_start($sort_by) {
start_table();
echo "<tr>";
echo "<th>Computer ID<br><font size=-2>Click for more info</font></th>\n";
echo "<th>Computer ID</th>\n";
echo "<th>Rank</th>";
echo "<th>Owner</th>\n";
if ($sort_by == 'total_credit') {
@ -235,8 +249,9 @@ function cpu_desc($host) {
function show_host_row($host, $i, $private, $show_owner) {
$j = $i % 2;
echo "<tr class=row$j><td>
<nobr><a href=show_host_detail.php?hostid=$host->id>$host->id</a>
| <a href=results.php?hostid=$host->id>tasks</a></nobr>
&bull <a href=show_host_detail.php?hostid=$host->id>Details</a>
<br>&bull <a href=results.php?hostid=$host->id>Tasks</a>
<br><nobr>&bull Cross-project credit:</nobr><br>".cross_project_links($host)."
</td>
";
if ($private) {
@ -466,8 +481,7 @@ function merge_hosts($old_host, $new_host) {
// update the database:
// - add credit from old to new host
// - change results to refer to new host
// - put old host in "zombie" state
// - update rpc_seqno if needed
// - put old host in "zombie" state (userid=0, rpc_seqno=new host ID)
//
$total_credit = $old_host->total_credit + $new_host->total_credit;
$recent_credit = $old_host->expavg_credit + $new_host->expavg_credit;

View File

@ -167,6 +167,12 @@ $team_name_sites = array(
),
);
$host_sites = array(
array("http://boincstats.com/stats/boinc_host_graph.php?pr=bo&id=",
"BOINCstats.com"
),
);
function site_list($sites) {
echo "<ul>\n";
for ($i=0; $i<count($sites); $i++) {

View File

@ -493,7 +493,7 @@ function user_links($user) {
if (is_banished($user)) {
return "(banished: ID $user->id)";
}
$x = "";
$x = "<nobr>";
if ($user->has_profile) {
$img_url = URL_BASE."img/head_20.png";
$x .= ' <a href="'.URL_BASE.'view_profile.php?userid='.$user->id.'"><img class="userimg" title="View the profile of '.$user->name.'" align="top" src="'.$img_url.'" alt="Profile"></a>';
@ -503,6 +503,7 @@ function user_links($user) {
require_once("../project/donations.inc");
$x .= DONATION_LINK;
}
$x .= "</nobr>";
return $x;
}

View File

@ -53,7 +53,7 @@ function user_host_table_start($private, $sort, $rev, $show_all) {
start_table();
echo "<tr>";
$url = link_url_rev($sort, "id", $rev, $show_all);
echo "<th><a href=$url>Computer ID</a><br><span class=note>Click for more info</span></th>\n";
echo "<th><a href=$url>Computer ID</a></th>\n";
if ($private) {
$url = link_url_rev($sort, "name", $rev, $show_all);
echo "<th><a href=$url>Name</a></th>\n";