2004-02-02 23:34:39 +00:00
|
|
|
<?php
|
2004-11-14 01:55:38 +00:00
|
|
|
echo "<!--\$Id$ -->\n";
|
|
|
|
|
|
|
|
// Function prints a description of $table
|
|
|
|
function print_describe_table_onecol($table, $which, $columns) {
|
|
|
|
$result=mysql_query("SELECT * from $table LIMIT 1");
|
|
|
|
$fields=mysql_num_fields($result);
|
|
|
|
|
|
|
|
$avgnum=(int)($fields/$columns);
|
|
|
|
if ($avgnum*$columns<$fields)
|
|
|
|
$avgnum++;
|
|
|
|
|
|
|
|
$actualcolumns=0;
|
|
|
|
while ($avgnum*$actualcolumns<$fields)
|
|
|
|
$actualcolumns++;
|
|
|
|
|
|
|
|
if ($which>$actualcolumns)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
$bot=($which-1)*$avgnum;
|
|
|
|
$top=$which*$avgnum;
|
|
|
|
|
|
|
|
$width=100.0/$actualcolumns;
|
|
|
|
|
|
|
|
// echo "<td><table border='2' width=\"$width%\">\n";
|
|
|
|
echo "<td><table border='1' width=\"100%\">\n";
|
|
|
|
echo "<tr><th align='left'>NAME</th><th align='left'>Type</th><th align='left'>Bytes</th>\n";
|
|
|
|
for ($count=$bot; $count<$top; $count++) {
|
|
|
|
if ($count<$fields) {
|
|
|
|
$name= mysql_field_name($result, $count);
|
|
|
|
$type= mysql_field_type($result, $count);
|
|
|
|
$length=mysql_field_len($result, $count);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$name="<br/> ";
|
|
|
|
$type="<br/>";
|
|
|
|
$length="<br/>";
|
|
|
|
}
|
|
|
|
echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
|
|
|
|
}
|
|
|
|
echo "</table></td>";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function print_describe_table($table, $how_many_columns) {
|
|
|
|
// Number of columns for showing table description
|
|
|
|
echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
|
|
|
|
echo "<table border='0' width='100%'>\n\t<tr>";
|
|
|
|
for ($i=1; $i<=$how_many_columns; $i++)
|
|
|
|
print_describe_table_onecol($table, $i, $how_many_columns);
|
|
|
|
echo "\t</tr>\n</table>\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
|
|
|
|
function join_query_string($s1, $s2) {
|
|
|
|
if ($s1) {
|
|
|
|
if ($s2) {
|
|
|
|
return "$s1&s2";
|
|
|
|
} else {
|
|
|
|
return $s1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return $s2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SqlQueryString maps a bunch of form items to a SQL query
|
|
|
|
//
|
|
|
|
// The items are
|
|
|
|
// table (name of table)
|
|
|
|
// id
|
|
|
|
// platformid
|
|
|
|
// appid
|
|
|
|
// workunitid
|
|
|
|
// hostid
|
|
|
|
// userid
|
|
|
|
// teamid
|
|
|
|
// nsecs (received_time > now - nsecs)
|
|
|
|
// received_time (> x)
|
|
|
|
// server_state (== x if z nonzero)
|
|
|
|
// outcome (== x if z nonzero)
|
|
|
|
// client_state (== x if z nonzero)
|
2004-05-04 21:23:28 +00:00
|
|
|
// exit_status (== x if z nonzero)
|
2004-02-02 23:34:39 +00:00
|
|
|
// clauses (literals added after the above)
|
|
|
|
// sort_by (order by x desc added after all else)
|
|
|
|
//
|
|
|
|
// Once you've parsed the items (using parse_form_items()):
|
|
|
|
//
|
|
|
|
// get_select_query(n, m) returns the SQL query to get items from m to m+n
|
|
|
|
// get_url() returns the URL-encoded version of everything
|
|
|
|
// count() returns the number of records satisfying the query
|
|
|
|
|
|
|
|
class SqlQueryString {
|
|
|
|
var $table;
|
|
|
|
var $query;
|
|
|
|
var $urlquery;
|
|
|
|
|
|
|
|
function SqlQueryString() {
|
|
|
|
$this->table = $_GET['table'];
|
|
|
|
//$this->query = $_GET['query'];
|
|
|
|
$this->query = "";
|
|
|
|
$this->urlquery = "";
|
|
|
|
}
|
|
|
|
function add($clause) {
|
2004-11-16 22:24:33 +00:00
|
|
|
$cleaned=boinc_real_escape_string($clause);
|
|
|
|
if (!$this->query) {
|
2004-11-16 20:38:00 +00:00
|
|
|
$this->query .= "where $cleaned";
|
2004-02-02 23:34:39 +00:00
|
|
|
} else {
|
2004-11-16 20:38:00 +00:00
|
|
|
$this->query .= " and $cleaned";
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function addclause($clause) {
|
|
|
|
if ($clause) {
|
|
|
|
$this->add($clause);
|
|
|
|
$this->urlquery .= "&clauses=".urlencode($clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function addeq($name) {
|
|
|
|
$value = $_GET[$name];
|
|
|
|
if (strlen($value)) {
|
|
|
|
$this->add("$name = '$value'");
|
|
|
|
$this->urlquery .= "&$name=".urlencode($value);
|
|
|
|
}
|
|
|
|
}
|
2004-11-17 10:37:08 +00:00
|
|
|
function addeq_not_CHOOSE_ALL($name) {
|
2004-02-02 23:34:39 +00:00
|
|
|
$value = $_GET[$name];
|
2004-11-17 10:37:08 +00:00
|
|
|
// On the selection menu, the ALL selection criteria sets (for example)
|
|
|
|
// outcome=='CHOOSE_ALL' rather than a numeric value. This means that
|
|
|
|
// we enter no condition for this case.
|
|
|
|
if (strlen($value) && strcmp("CHOOSE_ALL", $value)) {
|
2004-11-17 01:32:42 +00:00
|
|
|
$this->add("$name = '$value'");
|
|
|
|
$this->urlquery .= "&$name=".urlencode($value);
|
|
|
|
}
|
|
|
|
}
|
2004-02-02 23:34:39 +00:00
|
|
|
function addgt($name) {
|
|
|
|
$value = $_GET[$name];
|
|
|
|
if (strlen($value) && $value > 0) {
|
|
|
|
$this->add("$name > '$value'");
|
|
|
|
$this->urlquery .= "&$name=".urlencode($value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function addsort($name) {
|
|
|
|
$value = $_GET[$name];
|
|
|
|
if (strlen($value)) {
|
|
|
|
$this->query .= " order by $value desc";
|
|
|
|
$this->urlquery .= "&$name=".urlencode($value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function count() {
|
|
|
|
$count_query = "select count(*) as cnt from $this->table $this->query";
|
|
|
|
$result = mysql_query($count_query);
|
|
|
|
if (!$result) return 0;
|
|
|
|
$res = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
return $res->cnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_select_query($entries_to_show, $start_at) {
|
|
|
|
if ($entries_to_show) {
|
|
|
|
if ($start_at) {
|
|
|
|
return "select * from $this->table $this->query limit $start_at,$entries_to_show";
|
|
|
|
} else {
|
|
|
|
return "select * from $this->table $this->query limit $entries_to_show";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return "select * from $this->table $this->query";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_url($base) {
|
|
|
|
$s = "db_action.php?table=$this->table$this->urlquery";
|
|
|
|
return $s;
|
|
|
|
}
|
|
|
|
|
|
|
|
function process_form_items() {
|
|
|
|
$this->addeq('id');
|
|
|
|
$this->addeq('platformid');
|
|
|
|
$this->addeq('appid');
|
|
|
|
$this->addeq('workunitid');
|
|
|
|
$this->addeq('hostid');
|
|
|
|
$this->addeq('userid');
|
|
|
|
$this->addeq('teamid');
|
2004-05-04 21:31:51 +00:00
|
|
|
$this->addeq('exit_status');
|
|
|
|
if ($_GET['nsecs']) {
|
2004-02-02 23:34:39 +00:00
|
|
|
$_GET['received_time'] = time() - $_GET['nsecs'];
|
|
|
|
}
|
|
|
|
$this->addgt('received_time');
|
2004-11-17 10:37:08 +00:00
|
|
|
$this->addeq_not_CHOOSE_ALL('server_state');
|
|
|
|
$this->addeq_not_CHOOSE_ALL('outcome');
|
|
|
|
$this->addeq_not_CHOOSE_ALL('client_state');
|
|
|
|
$this->addeq_not_CHOOSE_ALL('validate_state');
|
2004-02-02 23:34:39 +00:00
|
|
|
if ($_GET['clauses']) {
|
2004-11-12 19:55:36 +00:00
|
|
|
$this->addclause("( " . urldecode($_GET['clauses']) . " )");
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
$this->addsort('sort_by');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-27 23:47:51 +00:00
|
|
|
function link_results($n, $mq, $query, $clauses) {
|
2004-02-02 23:34:39 +00:00
|
|
|
if ($n == '0') { // intentional compare by string
|
|
|
|
return "0";
|
|
|
|
} else {
|
2004-08-27 23:47:51 +00:00
|
|
|
if(strlen($clauses)) {
|
|
|
|
return "<a href=db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=received_time&detail=low>$n</a>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "<a href=db_action.php?table=result&query=$mq&$query&sort_by=received_time&detail=low>$n</a>";
|
|
|
|
}
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
function exit_status_string($result) {
|
|
|
|
$x = $result->exit_status;
|
|
|
|
if ($x == 0) {
|
|
|
|
$y = parse_element($result->stderr_out, "<exit_status>");
|
|
|
|
if ($y) {
|
|
|
|
$x = (int)$y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sprintf("%d (0x%x)", $x, $x);
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_result_summary() {
|
2004-05-04 20:45:02 +00:00
|
|
|
|
|
|
|
$ntotal =0; // TODO: how to count $result?
|
|
|
|
$nvalid = 0; // for SUCCESS results
|
|
|
|
$ninvalid = 0;
|
|
|
|
$nfile_deleted = 0;
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
$server_state = array();
|
|
|
|
$outcome = array();
|
|
|
|
$client_state = array();
|
|
|
|
|
|
|
|
for ($ss=1; $ss<6; $ss++) {
|
|
|
|
$server_state[$ss] = 0;
|
|
|
|
}
|
2004-11-17 01:32:42 +00:00
|
|
|
for ($ro=0; $ro<7; $ro++) {
|
2004-02-02 23:34:39 +00:00
|
|
|
$outcome[$ro] = 0;
|
|
|
|
}
|
|
|
|
for ($cs=1; $cs<6; $cs++) {
|
|
|
|
$client_state[$cs] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$_GET['table'] = 'result';
|
|
|
|
$_GET['sort_by'] = ''; // ignore sort
|
|
|
|
|
2004-05-04 20:45:02 +00:00
|
|
|
$query_appid = $_GET['appid'];
|
2004-11-14 01:55:38 +00:00
|
|
|
if ($_GET['nsecs'])
|
|
|
|
$query_received_time = time() - $_GET['nsecs'];
|
|
|
|
$query_wuid = $_GET['workunitid'];
|
2004-05-04 20:45:02 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
$q = new SqlQueryString();
|
|
|
|
$q->process_form_items();
|
|
|
|
|
2004-11-16 22:24:33 +00:00
|
|
|
// Important: these need to be kept consistent with db/boinc_db.h and lib/result_state.h
|
2004-05-04 20:45:02 +00:00
|
|
|
$main_query = "
|
|
|
|
SELECT COUNT(id) AS nTotal,
|
|
|
|
SUM(case when server_state = '1' then 1 else 0 end) AS serverstate_inactive,
|
|
|
|
SUM(case when server_state = '2' then 1 else 0 end) AS serverstate_unset,
|
|
|
|
SUM(case when server_state = '3' then 1 else 0 end) AS serverstate_unset_seq,
|
|
|
|
SUM(case when server_state = '4' then 1 else 0 end) AS serverstate_inprogress,
|
|
|
|
SUM(case when server_state = '5' then 1 else 0 end) AS serverstate_over,
|
|
|
|
SUM(case when server_state = '5' and outcome = '0' then 1 else 0 end) AS outcome_init,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' then 1 else 0 end) AS outcome_success,
|
|
|
|
SUM(case when server_state = '5' and outcome = '2' then 1 else 0 end) AS outcome_couldntsend,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' then 1 else 0 end) AS outcome_failure,
|
|
|
|
SUM(case when server_state = '5' and outcome = '4' then 1 else 0 end) AS outcome_noreply,
|
|
|
|
SUM(case when server_state = '5' and outcome = '5' then 1 else 0 end) AS outcome_didntneed,
|
2004-11-16 22:24:33 +00:00
|
|
|
SUM(case when server_state = '5' and outcome = '6' then 1 else 0 end) AS outcome_validateerror,
|
2004-05-04 20:45:02 +00:00
|
|
|
SUM(case when server_state = '5' and outcome = '1' and validate_state = '0' then 1 else 0 end) AS validate_init,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and validate_state = '1' then 1 else 0 end) AS validate_valid,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and validate_state = '2' then 1 else 0 end) AS validate_invalid,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and validate_state = '3' then 1 else 0 end) AS validate_nocheck,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and file_delete_state = '0' then 1 else 0 end) AS filedeletestate_init,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and file_delete_state = '1' then 1 else 0 end) AS filedeletestate_ready,
|
|
|
|
SUM(case when server_state = '5' and outcome = '1' and file_delete_state = '2' then 1 else 0 end) AS filedeletestate_done,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '0' then 1 else 0 end) AS clientstate_init,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '1' then 1 else 0 end) AS clientstate_downloading,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '2' then 1 else 0 end) AS clientstate_downloaded,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '3' then 1 else 0 end) AS clientstate_computedone,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '4' then 1 else 0 end) AS clientstate_uploading,
|
|
|
|
SUM(case when server_state = '5' and outcome = '3' and client_state = '5' then 1 else 0 end) AS clientstate_uploaded
|
2004-11-14 01:55:38 +00:00
|
|
|
FROM result WHERE
|
2004-05-04 20:45:02 +00:00
|
|
|
";
|
|
|
|
|
2004-11-14 01:55:38 +00:00
|
|
|
if ($query_appid)
|
|
|
|
$main_query .= "appid=$query_appid and ";
|
|
|
|
if ($query_received_time)
|
|
|
|
$main_query .= "received_time > $query_received_time and ";
|
|
|
|
if ($query_wuid)
|
|
|
|
$main_query .= "workunitid=$query_wuid and ";
|
|
|
|
|
|
|
|
$main_query .= "1=1";
|
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
$urlquery = $q->urlquery;
|
|
|
|
$result = mysql_query($main_query);
|
|
|
|
|
2004-11-14 01:55:38 +00:00
|
|
|
// echo "Main query was $main_query<br/>";
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
|
|
|
|
$res = mysql_fetch_object($result);
|
2004-05-04 20:45:02 +00:00
|
|
|
$ntotal = $res->nTotal;
|
2004-02-02 23:34:39 +00:00
|
|
|
|
2004-05-04 20:45:02 +00:00
|
|
|
$server_state[1] = $res->serverstate_inactive;
|
|
|
|
$server_state[2] = $res->serverstate_unset;
|
|
|
|
$server_state[3] = $res->serverstate_unset_seq;
|
|
|
|
$server_state[4] = $res->serverstate_inprogress;
|
|
|
|
$server_state[5] = $res->serverstate_over;
|
|
|
|
|
2004-11-17 01:32:42 +00:00
|
|
|
$outcome[0] = $res->outcome_init;
|
2004-05-04 20:45:02 +00:00
|
|
|
$outcome[1] = $res->outcome_success;
|
|
|
|
$outcome[2] = $res->outcome_couldntsend;
|
|
|
|
$outcome[3] = $res->outcome_failure;
|
|
|
|
$outcome[4] = $res->outcome_noreply;
|
|
|
|
$outcome[5] = $res->outcome_didntneed;
|
2004-11-16 22:24:33 +00:00
|
|
|
$outcome[6] = $res->outcome_validateerror;
|
2004-05-04 20:45:02 +00:00
|
|
|
|
|
|
|
$client_state[1] = $res->clientstate_downloading;
|
|
|
|
$client_state[2] = $res->clientstate_downloaded;
|
|
|
|
$client_state[3] = $res->clientstate_computedone;
|
|
|
|
$client_state[4] = $res->clientstate_uploading;
|
|
|
|
$client_state[5] = $res->clientstate_uploaded;
|
|
|
|
|
|
|
|
$nvalid = $res->validate_valid;
|
|
|
|
$ninvalid = $res->validate_invalid;
|
|
|
|
|
|
|
|
$nfile_deleted = $res->filedeletestate_ready + $res->filedeletestate_done;
|
2004-11-14 01:55:38 +00:00
|
|
|
mysql_free_result($result);
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
|
2004-05-04 20:45:02 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
echo "<table>";
|
|
|
|
echo "<tr valign=top>";
|
2004-08-27 23:47:51 +00:00
|
|
|
echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>";
|
|
|
|
echo "<td><h2>" . link_results("'Over' results", $urlquery, "server_state=5", '') . "</h2></td>";
|
|
|
|
echo "<td><h2>" . link_results("'Success' results", $urlquery, "outcome=1", '') . "</h2></td>";
|
|
|
|
echo "<td><h2>" . link_results("'Client error' results", $urlquery, "outcome=3", '') . "</h2></td>";
|
2004-02-02 23:34:39 +00:00
|
|
|
echo "</tr>";
|
|
|
|
echo "<tr valign=top>";
|
|
|
|
echo "<td><table border=2 cellpadding=4\n";
|
|
|
|
echo "<tr><th>Server state</th><th># results</th></tr>\n";
|
|
|
|
for ($ss=1; $ss<6; $ss++) {
|
|
|
|
row2(server_state_string($ss),
|
2004-11-14 01:55:38 +00:00
|
|
|
link_results("$server_state[$ss]", $urlquery,"server_state=$ss", ''));
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
echo "</table></td>";
|
|
|
|
|
|
|
|
echo "<td><table border=2 cellpadding=4\n";
|
|
|
|
echo "<tr><th>Outcome</th><th># results</th></tr>\n";
|
2004-11-17 01:32:42 +00:00
|
|
|
|
|
|
|
for ($ro=0; $ro<7; $ro++) {
|
2004-02-02 23:34:39 +00:00
|
|
|
c_row2($outcome[$ro]?outcome_color($ro):'', outcome_string($ro),
|
2004-11-14 01:55:38 +00:00
|
|
|
link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '')
|
2004-02-02 23:34:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
echo "</table></td>";
|
|
|
|
|
|
|
|
echo "<td><table border=2 cellpadding=4\n";
|
|
|
|
echo "<tr><th>Validate state</th><th># results</th></tr>\n";
|
2004-11-17 01:32:42 +00:00
|
|
|
c_row2($nvalid?validate_color(1):'', "Valid", link_results("$nvalid", $urlquery, "validate_state=1", "outcome=1"));
|
|
|
|
c_row2($ninvalid?validate_color(2):'', "Invalid", link_results("$ninvalid", $urlquery, "validate_state=2", "outcome=1"));
|
2004-02-02 23:34:39 +00:00
|
|
|
echo "</table>";
|
|
|
|
echo "<table border=2 cellpadding=4\n";
|
|
|
|
echo "<tr><th>File Delete state</th><th># results</th></tr>\n";
|
2004-11-14 01:55:38 +00:00
|
|
|
row2("Files deleted", link_results("$nfile_deleted", $urlquery, "outcome=1", "(file_delete_state=1 or file_delete_state=2)"));
|
2004-02-02 23:34:39 +00:00
|
|
|
echo "</table></td>";
|
|
|
|
|
|
|
|
echo "<td><table border=2 cellpadding=4\n";
|
|
|
|
echo "<tr><th>Client state</th><th># results</th></tr>\n";
|
|
|
|
for ($cs=1; $cs<6; $cs++) {
|
|
|
|
row2(client_state_string($cs),
|
2004-11-14 01:55:38 +00:00
|
|
|
link_results("$client_state[$cs]", $urlquery, "client_state=$cs", "outcome=3")
|
2004-02-02 23:34:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
echo "</table></td>";
|
|
|
|
echo "</table>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function server_state_select() {
|
|
|
|
echo "
|
|
|
|
<select name=server_state>
|
2004-11-17 10:37:08 +00:00
|
|
|
<option value='CHOOSE_ALL' selected> Any
|
2004-02-02 23:34:39 +00:00
|
|
|
";
|
2004-11-17 10:37:08 +00:00
|
|
|
for($i=1; $i<6; $i++) {
|
|
|
|
echo "<option value=$i> "."[$i] ".' '.server_state_string($i)."</option>\n";
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
echo "</select>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function outcome_select() {
|
|
|
|
echo "
|
|
|
|
<select name=outcome>
|
2004-11-17 10:37:08 +00:00
|
|
|
<option value='CHOOSE_ALL' selected> Any
|
|
|
|
";
|
|
|
|
for($i=0; $i<7; $i++) {
|
|
|
|
echo "<option value=$i> "."[$i] ".' '.outcome_string($i)."</option>\n";
|
|
|
|
}
|
|
|
|
echo "</select>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate_state_select() {
|
|
|
|
echo "
|
|
|
|
<select name=validate_state>
|
|
|
|
<option value='CHOOSE_ALL' selected> Any
|
2004-02-02 23:34:39 +00:00
|
|
|
";
|
2004-11-17 10:37:08 +00:00
|
|
|
for($i=0; $i<4; $i++) {
|
|
|
|
echo "<option value=$i> "."[$i] ".' '.validate_state_str($i)."</option>\n";
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
echo "</select>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function client_state_select() {
|
|
|
|
echo "
|
|
|
|
<select name=client_state>
|
2004-11-17 10:37:08 +00:00
|
|
|
<option value='CHOOSE_ALL' selected> Any
|
2004-02-02 23:34:39 +00:00
|
|
|
";
|
2004-11-17 10:37:08 +00:00
|
|
|
for($i=0; $i<6; $i++) {
|
|
|
|
echo "<option value=$i> "."[$i] ".client_state_string($i)."</option>\n";
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
echo "</select>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function result_sort_select() {
|
|
|
|
echo "
|
|
|
|
<select name=sort_by>
|
|
|
|
<option value=''>None
|
|
|
|
<option value=id>ID
|
|
|
|
<option value=sent_time>Sent time
|
|
|
|
<option value=received_time>Received time
|
|
|
|
</select>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function table_title($table) {
|
|
|
|
switch($table) {
|
|
|
|
case "platform": return "Platforms";
|
|
|
|
case "app": return "Applications";
|
|
|
|
case "app_version": return "Application Versions";
|
|
|
|
case "host": return "Hosts";
|
|
|
|
case "workunit": return "Workunits";
|
|
|
|
case "result": return "Results";
|
|
|
|
case "team": return "Teams";
|
|
|
|
case "user": return "Users";
|
|
|
|
default: return "????";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_platform($platform) {
|
|
|
|
start_table();
|
|
|
|
row("ID", $platform->id);
|
|
|
|
row("Created", time_str($platform->create_time));
|
|
|
|
row("Name", $platform->name);
|
|
|
|
row("User friendly name", $platform->user_friendly_name);
|
|
|
|
row("","<a href=db_action.php?table=app_version&platformid=$platform->id>App versions for this platform</a>");
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_app($app) {
|
|
|
|
start_table();
|
|
|
|
row("ID", $app->id);
|
|
|
|
row("Created", time_str($app->create_time));
|
|
|
|
row("Name", $app->name);
|
2004-09-27 04:26:51 +00:00
|
|
|
row("User-friendly name", $app->user_friendly_name);
|
|
|
|
row("Deprecated", $app->deprecated);
|
|
|
|
row("Homogeneous redundancy", $app->homogeneous_redundancy);
|
2004-02-02 23:34:39 +00:00
|
|
|
row("","<a href=db_action.php?table=app_version&appid=$app->id>App Versions for this application</a>");
|
|
|
|
row("","<a href=db_action.php?table=workunit&appid=$app->id&detail=low>Workunits for this application</a>");
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_app_version($app_version) {
|
|
|
|
start_table();
|
|
|
|
row("ID", $app_version->id);
|
|
|
|
row("Created", time_str($app_version->create_time));
|
|
|
|
row("Application", "<a href=db_action.php?table=app&id=$app_version->appid>" . app_name_by_id($app_version->appid) . "</a>");
|
|
|
|
row("Version num", $app_version->version_num);
|
|
|
|
row("Platform", "<a href=db_action.php?table=platform&id=$app_version->platformid>" . platform_name_by_id($app_version->platformid) . "</a>" );
|
|
|
|
row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>");
|
|
|
|
row("Min_core_version", $app_version->min_core_version);
|
|
|
|
row("Max_core_version", $app_version->max_core_version);
|
|
|
|
row("Message", $app_version->message);
|
|
|
|
row("Deprecated", $app_version->deprecated);
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function app_version_short_header() {
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>ID</th>
|
|
|
|
<th>Application</th>
|
|
|
|
<th>Version</th>
|
|
|
|
<th>Platform</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_app_version_short($app_version) {
|
|
|
|
$x = app_name_by_id($app_version->appid);
|
|
|
|
$y = platform_name_by_id($app_version->platformid);
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<td><a href=db_action.php?table=app_version&id=$app_version->id>$app_version->id</a></td>
|
|
|
|
<td><a href=db_action.php?table=app?id=$app_version->appid>$x</a></td>
|
|
|
|
<td>$app_version->version_num</td>
|
|
|
|
<td><a href=db_action.php?table=platform&id=$app_version->platformid>$y</a></td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function host_short_header() {
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>host ID</th>
|
|
|
|
<th>IP address</th>
|
|
|
|
<th>name</th>
|
|
|
|
<th>CPU</th>
|
|
|
|
<th>OS</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_host_short($host) {
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<td><a href=db_action.php?table=host&id=$host->id>$host->id</a></td>
|
|
|
|
<td>$host->last_ip_addr</td>
|
|
|
|
<td>$host->domain_name</td>
|
|
|
|
<td>$host->p_vendor $host->p_model</td>
|
|
|
|
<td>$host->os_name $host->os_version</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_host($host) {
|
|
|
|
start_table();
|
|
|
|
|
|
|
|
row("ID", $host->id);
|
|
|
|
row("Created", time_str($host->create_time));
|
|
|
|
row("User", "<a href=db_action.php?table=user&id=$host->userid>$host->userid</a>");
|
|
|
|
row("Venue", $host->venue);
|
|
|
|
row("Total credit", $host->total_credit);
|
|
|
|
row("Average credit", $host->expavg_credit);
|
|
|
|
row("Average update time", time_str($host->expavg_time));
|
|
|
|
row("IP address", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
|
|
|
|
row("Domain name", $host->domain_name);
|
|
|
|
$x = $host->timezone/3600;
|
|
|
|
row("Time zone", "UTC - $x hours");
|
|
|
|
row("Number of CPUs", $host->p_ncpus);
|
|
|
|
row("CPU", "$host->p_vendor $host->p_model");
|
|
|
|
row("FP ops/sec", $host->p_fpops);
|
|
|
|
row("Int ops/sec", $host->p_iops);
|
|
|
|
row("memory bandwidth", $host->p_membw);
|
|
|
|
row("Operating System", "$host->os_name $host->os_version");
|
|
|
|
$x = $host->m_nbytes/(1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row("Memory", "$y MB");
|
|
|
|
$x = $host->m_cache/1024;
|
|
|
|
$y = round($x, 2);
|
|
|
|
row("Cache", "$y KB");
|
|
|
|
$x = $host->m_swap/(1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row("Swap Space", "$y MB");
|
|
|
|
$x = $host->d_total/(1024*1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row("Total Disk Space", "$y GB");
|
|
|
|
$x = $host->d_free/(1024*1024*1024);
|
|
|
|
$y = round($x, 2);
|
|
|
|
row("Free Disk Space", "$y GB");
|
|
|
|
row("Avg network bandwidth (upstream)", "$host->n_bwup bytes/sec");
|
|
|
|
row("Avg network bandwidth (downstream)", "$host->n_bwdown bytes/sec");
|
|
|
|
row("Number of RPCs", $host->rpc_seqno);
|
|
|
|
row("Last RPC", time_str($host->rpc_time));
|
|
|
|
row("% of time client on", 100*$host->on_frac." %");
|
|
|
|
row("% of time host connected", 100*$host->connected_frac." %");
|
|
|
|
row("% of time user active", 100*$host->active_frac." %");
|
2004-05-28 22:11:42 +00:00
|
|
|
row("# of results today", $host->nresults_today);
|
2004-02-02 23:34:39 +00:00
|
|
|
row("Results", "<a href=db_action.php?table=result&detail=low&hostid=$host->id&sort_by=sent_time>click here</a>");
|
|
|
|
end_table();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function wu_error_mask_str($s) {
|
|
|
|
$x = "";
|
|
|
|
if ($s & 1) $x = $x."Couldn't send result; ";
|
|
|
|
if ($s & 2) $x = $x."Too many errors (may have bug); ";
|
|
|
|
if ($s & 4) $x = $x."Too many results (may be nondeterministic)";
|
|
|
|
$x = $x."<br>";
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function assimilate_state_str($s) {
|
|
|
|
switch($s) {
|
|
|
|
case 0: return "Initial";
|
|
|
|
case 1: return "Ready to assimilate";
|
|
|
|
case 2: return "Assimilated";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function file_delete_state_str($s) {
|
|
|
|
switch($s) {
|
|
|
|
case 0: return "Initial";
|
|
|
|
case 1: return "Ready to delete";
|
|
|
|
case 2: return "Deleted";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_workunit($wu) {
|
|
|
|
start_table();
|
|
|
|
row("Created", time_str($wu->create_time));
|
|
|
|
row("Name", $wu->name);
|
|
|
|
row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
|
|
|
|
row("Application", "<a href=db_action.php?table=app&id=$wu->appid>" . app_name_by_id($wu->appid) . "</a>");
|
|
|
|
row("Batch", $wu->batch);
|
|
|
|
row("Estimated FP Operations", $wu->rsc_fpops_est);
|
|
|
|
row("Max FP Operations", $wu->rsc_fpops_bound);
|
|
|
|
row("Max Memory Usage", $wu->rsc_memory_bound);
|
|
|
|
row("Max Disk Usage", $wu->rsc_disk_bound);
|
|
|
|
row("Need validate?", $wu->need_validate?"yes":"no");
|
|
|
|
row("Canonical resultid",
|
|
|
|
"<a href=db_action.php?table=result&id=$wu->canonical_resultid>".$wu->canonical_resultid."</a>");
|
|
|
|
row("Canonical credit", $wu->canonical_credit);
|
|
|
|
row("Timeout check time", time_str($wu->timeout_check_time));
|
|
|
|
row("Delay bound", $wu->delay_bound);
|
|
|
|
row("Error mask", wu_error_mask_str($wu->error_mask));
|
|
|
|
row("File delete state", file_delete_state_str($wu->file_delete_state));
|
|
|
|
row("Assimilation state", assimilate_state_str($wu->assimilate_state));
|
|
|
|
// row("","<a href=db_action.php?table=result&workunitid=$wu->id&detail=low>Show associated results</a>");
|
|
|
|
row("min quorum", $wu->min_quorum);
|
|
|
|
row("max error results", $wu->max_error_results);
|
|
|
|
row("max total results", $wu->max_total_results);
|
|
|
|
row("max success results", $wu->max_success_results);
|
|
|
|
row("","<a href='show_log.php?s=$wu->name'>Grep logs</a>");
|
|
|
|
row("result template", "<pre>".htmlspecialchars($wu->result_template)."</pre>");
|
|
|
|
end_table();
|
|
|
|
|
|
|
|
$_GET = array('workunitid' => $wu->id);
|
|
|
|
show_result_summary();
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function workunit_short_header() {
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>WU ID</th>
|
|
|
|
<th>canonical result</th>
|
|
|
|
<th>error_mask</th>
|
|
|
|
<th>file delete</th>
|
|
|
|
<th>assimilate</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_workunit_short($wu) {
|
|
|
|
if ($wu->canonical_resultid) {
|
|
|
|
$cr = "<a href=db_action.php?table=result&id=$wu->canonical_resultid>$wu->canonical_resultid</a>";
|
|
|
|
} else {
|
|
|
|
$cr = "none";
|
|
|
|
}
|
|
|
|
$cr = $cr. " <a href=db_action.php?table=result&workunitid=$wu->id&detail=low>all</a>";
|
|
|
|
$e = wu_error_mask_str($wu->error_mask);
|
|
|
|
$f = file_delete_state_str($wu->file_delete_state);
|
|
|
|
$a = assimilate_state_str($wu->assimilate_state);
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<td>$wu->id</td>
|
|
|
|
<td>$cr</td>
|
|
|
|
<td>$e</td>
|
|
|
|
<td>$f</td>
|
|
|
|
<td>$a</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function server_state_string($s) {
|
|
|
|
switch($s) {
|
|
|
|
case 1: return "Inactive";
|
|
|
|
case 2: return "Unsent";
|
2004-11-16 22:24:33 +00:00
|
|
|
case 3: return "Unsent (in work seq)";
|
2004-02-02 23:34:39 +00:00
|
|
|
case 4: return "In Progress";
|
|
|
|
case 5: return "Over";
|
|
|
|
}
|
2004-11-17 10:37:08 +00:00
|
|
|
echo "<b>THIS IS AN INTERNAL BUG IN BOINC: PLEASE CONTACT BOINC DEVELOPERS</b><br/>";
|
2004-02-02 23:34:39 +00:00
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
function outcome_string($s) {
|
|
|
|
switch($s) {
|
2004-11-17 01:32:42 +00:00
|
|
|
case 0: return "Init";
|
2004-02-02 23:34:39 +00:00
|
|
|
case 1: return "Success";
|
|
|
|
case 2: return "Couldn't send";
|
|
|
|
case 3: return "Client error";
|
|
|
|
case 4: return "No reply";
|
|
|
|
case 5: return "Didn't need";
|
2004-11-16 22:24:33 +00:00
|
|
|
case 6: return "Validate error";
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
2004-11-17 10:37:08 +00:00
|
|
|
echo "<b>THIS IS AN INTERNAL BUG IN BOINC: PLEASE CONTACT BOINC DEVELOPERS</b><br/>";
|
2004-02-02 23:34:39 +00:00
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
function client_state_string($s) {
|
|
|
|
switch($s) {
|
|
|
|
case 0: return "New";
|
|
|
|
case 1: return "Downloading";
|
|
|
|
case 2: return "Downloaded";
|
|
|
|
case 3: return "Computing";
|
|
|
|
case 4: return "Uploading";
|
|
|
|
case 5: return "Done";
|
|
|
|
}
|
2004-11-17 10:37:08 +00:00
|
|
|
echo "<b>THIS IS AN INTERNAL BUG IN BOINC: PLEASE CONTACT BOINC DEVELOPERS</b><br/>";
|
2004-02-02 23:34:39 +00:00
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate_state_str($s) {
|
|
|
|
switch($s) {
|
|
|
|
case 0: return "Initial";
|
|
|
|
case 1: return "Valid";
|
|
|
|
case 2: return "Invalid";
|
|
|
|
case 3: return "Skipped";
|
|
|
|
}
|
2004-11-17 10:37:08 +00:00
|
|
|
echo "<b>THIS IS AN INTERNAL BUG IN BOINC: PLEASE CONTACT BOINC DEVELOPERS</b><br/>";
|
2004-02-02 23:34:39 +00:00
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
function host_user_link($hostid)
|
|
|
|
{
|
|
|
|
if (!$hostid) return '----';
|
|
|
|
|
|
|
|
$h = "<a href=db_action.php?table=host&id=$hostid>$hostid</a>";
|
|
|
|
$result = mysql_query("select userid from host where id='$hostid' limit 1");
|
|
|
|
if (!$result) return $h;
|
|
|
|
$host = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
if (!$host->userid) return $h;
|
|
|
|
$result = mysql_query("select * from user where id='$host->userid' limit 1");
|
|
|
|
if (!$result) return $h;
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
return "$h<br><small>(<a href=db_action.php?table=user&id=$user->id>$user->name</a>)</small>";
|
|
|
|
}
|
|
|
|
|
2004-11-17 01:32:42 +00:00
|
|
|
function validate_color($validate_state) {
|
|
|
|
switch ($validate_state) {
|
|
|
|
case 1: return '33cc33'; // valid, green
|
|
|
|
case 2: return 'ffa500'; // invalid result, orange
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
function outcome_color($outcome) {
|
|
|
|
switch($outcome) {
|
|
|
|
// case 0: return 'eeeeee'; // unknown (server state not over probably)
|
|
|
|
case 1: return '33cc33'; // "Success", green
|
|
|
|
case 3: return 'ff3333'; // "Client error", red
|
|
|
|
case 6: return 'ffff33'; // "Validate error", yellow
|
2004-02-02 23:34:39 +00:00
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
function credit_str($c) {
|
|
|
|
if ($c) {
|
|
|
|
return sprintf("%.3f", $c);
|
|
|
|
} else {
|
|
|
|
return '---';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_result($result) {
|
|
|
|
$wu_name = wu_name_by_id($result->workunitid);
|
|
|
|
|
|
|
|
|
|
|
|
start_table();
|
|
|
|
|
|
|
|
row("Created", time_str($result->create_time));
|
|
|
|
row("Sent", time_str($result->sent_time));
|
|
|
|
row("Received", time_str($result->received_time));
|
|
|
|
row("Name", $result->name);
|
|
|
|
row("Workunit", "<a href=db_action.php?table=workunit&id=$result->workunitid>" . wu_name_by_id($result->workunitid) . "</a>" );
|
|
|
|
row("Server state", server_state_string($result->server_state));
|
|
|
|
row("Outcome", outcome_string($result->outcome));
|
|
|
|
row("Client state", client_state_string($result->client_state));
|
|
|
|
row("Exit status", exit_status_string($result));
|
|
|
|
row("Host ID", "<a href=db_action.php?table=host&id=$result->hostid>" . host_name_by_id($result->hostid) . "</a>");
|
|
|
|
row("Report deadline", time_str($result->report_deadline));
|
|
|
|
row("CPU time", $result->cpu_time);
|
|
|
|
row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
|
|
|
|
row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
|
|
|
|
row("stderr out", "<pre>".htmlspecialchars($result->stderr_out)."</pre>");
|
|
|
|
row("Batch", $result->batch);
|
|
|
|
row("File delete state", file_delete_state_str($result->file_delete_state));
|
|
|
|
row("Validate state", validate_state_str($result->validate_state));
|
|
|
|
row("claimed credit", $result->claimed_credit);
|
|
|
|
row("Granted credit", $result->granted_credit);
|
2004-05-04 19:54:28 +00:00
|
|
|
row("Client version", $result->app_version_num);
|
2004-02-02 23:34:39 +00:00
|
|
|
row("Random",$result->random);
|
|
|
|
row("","<a href='show_log.php?s=$result->name'>Grep logs</a>");
|
|
|
|
end_table();
|
|
|
|
echo "<p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function result_short_header() {
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<th>result ID</th>
|
|
|
|
<th>WU ID</th>
|
2004-11-17 01:32:42 +00:00
|
|
|
<th>server<br>state</th>
|
2004-02-02 23:34:39 +00:00
|
|
|
<th>outcome</th>
|
2004-11-17 01:32:42 +00:00
|
|
|
<th>validate<br>state</th>
|
|
|
|
<th>exit<br>status</th>
|
|
|
|
<th>host<br>(user)</th>
|
|
|
|
<th>client<br>ver</th>
|
2004-02-02 23:34:39 +00:00
|
|
|
<th>received</th>
|
|
|
|
<th>CPU hours</th>
|
|
|
|
<th>claimed<br>credit</th>
|
|
|
|
<th>granted<br>credit</th>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_result_short($result) {
|
|
|
|
$ss = server_state_string($result->server_state);
|
|
|
|
$oc = outcome_string($result->outcome);
|
2004-11-17 01:32:42 +00:00
|
|
|
$vs = validate_state_str($result->validate_state);
|
2004-02-02 23:34:39 +00:00
|
|
|
if ($result->outcome == 3) {
|
|
|
|
$cs = client_state_string($result->client_state);
|
|
|
|
$oc = "$oc ($cs)";
|
|
|
|
}
|
|
|
|
$received = time_str($result->received_time);
|
2004-05-04 20:00:46 +00:00
|
|
|
$version = $result->app_version_num;
|
2004-02-02 23:34:39 +00:00
|
|
|
$outcome_color = outcome_color($result->outcome);
|
2004-11-17 01:32:42 +00:00
|
|
|
$validate_color = validate_color($result->validate_state);
|
2004-02-02 23:34:39 +00:00
|
|
|
$host_user = host_user_link($result->hostid);
|
|
|
|
$cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
|
|
|
|
$claimed_credit = credit_str($result->claimed_credit);
|
|
|
|
$granted_credit = credit_str($result->granted_credit);
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<tr>
|
|
|
|
<td><a href=db_action.php?table=result&id=$result->id>$result->id</a></td>
|
|
|
|
<td><a href=db_action.php?table=workunit&id=$result->workunitid>$result->workunitid</a></td>
|
|
|
|
<td>$ss</td>
|
|
|
|
<td bgcolor=$outcome_color>$oc</td>
|
2004-11-17 01:32:42 +00:00
|
|
|
<td bgcolor=$validate_color>$vs</td>
|
|
|
|
<td>", exit_status_string($result), "</td>
|
2004-02-02 23:34:39 +00:00
|
|
|
<td>$host_user</td>
|
|
|
|
<td>$version</td>
|
|
|
|
<td>$received</td>
|
|
|
|
<td>$cpu_hours</td>
|
|
|
|
<td>$claimed_credit</td>
|
|
|
|
<td>$granted_credit</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_user($user) {
|
|
|
|
start_table();
|
|
|
|
row("ID", $user->id);
|
|
|
|
row("Created", time_str($user->create_time));
|
|
|
|
row("Name", $user->name);
|
|
|
|
row("Authenticator", $user->authenticator);
|
|
|
|
row("Email address", $user->email_addr);
|
|
|
|
row("Country", $user->country);
|
|
|
|
row("Postal code", $user->postal_code);
|
|
|
|
row("Total credit", $user->total_credit);
|
|
|
|
row("Average credit", $user->expavg_credit);
|
|
|
|
row("Last average time", time_str($user->expavg_time));
|
|
|
|
row("Default venue", $user->venue);
|
|
|
|
row("Hosts", "<a href=db_action.php?table=host&userid=$user->id&detail=low>click</a>");
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function team_type_string($s) {
|
|
|
|
switch ($s) {
|
|
|
|
case 1: return "Small Company";
|
|
|
|
case 2: return "Medium Company";
|
|
|
|
case 3: return "Large Company";
|
|
|
|
case 4: return "Club";
|
|
|
|
case 5: return "Primary School";
|
|
|
|
case 6: return "Secondary School";
|
|
|
|
case 7: return "Junior College";
|
|
|
|
case 8: return "University or Department";
|
|
|
|
case 9: return "Government Agency";
|
|
|
|
default: return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_team($team) {
|
|
|
|
start_table();
|
|
|
|
row("ID", $team->id);
|
|
|
|
row("Team Founder", "<a href=db_action.php?table=user&id=$team->userid>" . user_name_by_id($team->userid) . "</a>");
|
|
|
|
row("Name", $team->name);
|
|
|
|
row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" );
|
|
|
|
row("Url", "<a href=http://$team->url>" . $team->url . "</a>");
|
|
|
|
row("Type", team_type_string($team->type));
|
|
|
|
row("Description", $team->description);
|
|
|
|
row("", "<a href=db_action.php?table=user&teamid=$team->id>List All Members</a>");
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function team_name_by_id($teamid) {
|
|
|
|
$result = mysql_query("select * from team where id = $teamid");
|
|
|
|
$team = mysql_fetch_object($result);
|
|
|
|
return $team->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function user_name_by_id($user_id) {
|
|
|
|
$result = mysql_query("select * from user where id = $user_id");
|
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
return $user->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function app_name_by_id($appid) {
|
|
|
|
$result = mysql_query("select * from app where id = $appid");
|
|
|
|
$app = mysql_fetch_object($result);
|
|
|
|
return $app->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function wu_name_by_id($workunitid) {
|
|
|
|
$result = mysql_query("select * from workunit where id = $workunitid");
|
|
|
|
$wu = mysql_fetch_object($result);
|
|
|
|
return $wu->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function platform_name_by_id($platformid) {
|
|
|
|
$result = mysql_query("select * from platform where id = $platformid");
|
|
|
|
$plat = mysql_fetch_object($result);
|
|
|
|
return $plat->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
function host_name_by_id($hostid) {
|
|
|
|
$result = mysql_query("select * from host where id = $hostid");
|
|
|
|
$host = mysql_fetch_object($result);
|
|
|
|
if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) {
|
|
|
|
return "(blank)";
|
|
|
|
} else {
|
|
|
|
return $host->domain_name . " (" . $host->last_ip_addr . ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|