Web: add active/all button in host_app_versions.php

This commit is contained in:
David Anderson 2015-11-12 18:14:47 -08:00
parent 45a27257bf
commit 920ee2777c
1 changed files with 24 additions and 9 deletions

View File

@ -18,8 +18,6 @@
require_once("../inc/util.inc");
check_get_args(array("hostid"));
function rsc_name($t) {
switch ($t) {
case 2: return tra("CPU");
@ -30,11 +28,16 @@ function rsc_name($t) {
return tra("Unknown");
}
function av_desc($gavid) {
function av_desc($gavid, $show_dep) {
if ($gavid >= 1000000) {
// anonymous platform
//
$appid = (int)($gavid/1000000);
$app = BoincApp::lookup_id($appid);
if (!$app || $app->deprecated) {
if (!$app) {
return null;
}
if (!$show_dep && $app->deprecated) {
return null;
}
$rsc_type = $gavid % 1000000;
@ -42,11 +45,17 @@ function av_desc($gavid) {
return "$app->user_friendly_name (".tra("anonymous platform").", $r)";
} else {
$av = BoincAppVersion::lookup_id($gavid);
if (!$av || $av->deprecated) {
if (!$av) {
return null;
}
if (!$show_dep && $av->deprecated) {
return null;
}
$app = BoincApp::lookup_id($av->appid);
if (!$app || $app->deprecated) {
if (!$app) {
return null;
}
if (!$show_dep && $app->deprecated) {
return null;
}
$platform = BoincPlatform::lookup_id($av->platformid);
@ -57,8 +66,8 @@ function av_desc($gavid) {
}
}
function show_hav($hav) {
$desc = av_desc($hav->app_version_id);
function show_hav($hav, $show_dep) {
$desc = av_desc($hav->app_version_id, $show_dep);
if (!$desc) return;
row1($desc);
row2(tra("Number of tasks completed"), $hav->et_n);
@ -74,6 +83,7 @@ function show_hav($hav) {
}
$hostid = get_int('hostid');
$show_dep = get_int('show_dep', true);
$havs = BoincHostAppVersion::enum("host_id=$hostid");
@ -81,9 +91,14 @@ page_head(tra("Application details for host %1", $hostid));
start_table();
foreach ($havs as $hav) {
//if (!$hav->pfc_n) continue;
show_hav($hav);
show_hav($hav, $show_dep);
}
end_table();
if ($show_dep) {
show_button("host_app_versions.php?hostid=$hostid", "Show active versions");
} else {
show_button("host_app_versions.php?hostid=$hostid&show_dep=1", "Show all versions");
}
page_tail();
?>