2003-08-05 01:18:41 +00:00
|
|
|
<?php {
|
2003-07-21 21:38:54 +00:00
|
|
|
require_once("util_ops.inc");
|
2003-07-21 21:39:38 +00:00
|
|
|
require_once("db_ops.inc");
|
2003-08-05 20:30:21 +00:00
|
|
|
|
2003-08-05 01:18:41 +00:00
|
|
|
function append_sql_query($original,$addition,$first) {
|
|
|
|
if ($first == 1) {
|
|
|
|
return $original . " where " . $addition;
|
|
|
|
} else {
|
|
|
|
return $original . " and " . $addition;
|
|
|
|
}
|
2003-06-11 23:36:47 +00:00
|
|
|
}
|
2003-08-05 20:30:21 +00:00
|
|
|
|
2003-06-11 23:36:47 +00:00
|
|
|
db_init();
|
2003-08-05 20:30:21 +00:00
|
|
|
|
2003-11-07 00:54:53 +00:00
|
|
|
parse_str(getenv("QUERY_STRING"));
|
2003-08-05 21:34:38 +00:00
|
|
|
$q = build_sql_query();
|
2003-06-11 23:36:47 +00:00
|
|
|
|
|
|
|
if (strlen($nresults)) {
|
|
|
|
$entries_to_show = $nresults;
|
|
|
|
} else {
|
|
|
|
$entries_to_show = 10;
|
|
|
|
}
|
2003-08-05 01:26:46 +00:00
|
|
|
$page_entries_to_show = $entries_to_show;
|
2003-06-11 23:36:47 +00:00
|
|
|
|
|
|
|
if (strlen($last_pos)) {
|
|
|
|
$start_at = $last_pos;
|
|
|
|
} else {
|
|
|
|
$start_at = 0;
|
|
|
|
}
|
|
|
|
|
2003-11-05 22:57:07 +00:00
|
|
|
admin_page_head($table);
|
2003-08-05 20:30:21 +00:00
|
|
|
|
2003-08-05 01:18:41 +00:00
|
|
|
$count = $q->count();
|
2003-06-11 23:36:47 +00:00
|
|
|
|
|
|
|
if ($count < $start_at + $entries_to_show) {
|
|
|
|
$entries_to_show = $count - $start_at;
|
|
|
|
}
|
|
|
|
|
|
|
|
$last = $start_at + $entries_to_show;
|
2003-08-05 20:30:21 +00:00
|
|
|
|
2003-08-05 01:18:41 +00:00
|
|
|
$main_query = $q->get_select_query($entries_to_show, $start_at);
|
2003-06-11 23:36:47 +00:00
|
|
|
|
2003-07-01 18:28:33 +00:00
|
|
|
echo "<p>Query: <b>$main_query</b><p>\n";
|
2003-11-11 20:49:07 +00:00
|
|
|
|
|
|
|
$start_1_offset = $start_at + 1;
|
2003-06-11 23:36:47 +00:00
|
|
|
echo "
|
2003-11-11 20:49:07 +00:00
|
|
|
<p>$count records match the query.
|
|
|
|
Displaying $start_1_offset to $last.<p>
|
2003-06-11 23:36:47 +00:00
|
|
|
";
|
|
|
|
|
2003-08-05 21:16:16 +00:00
|
|
|
$urlquery = $q->urlquery;
|
2003-11-07 00:54:53 +00:00
|
|
|
if ($start_at || $last < $count) {
|
|
|
|
echo "<table border=1><tr><td width=100>";
|
|
|
|
if ($start_at) {
|
|
|
|
$prev_pos = $start_at - $page_entries_to_show;
|
|
|
|
if ($prev_pos < 0) {
|
|
|
|
$prev_pos = 0;
|
|
|
|
}
|
|
|
|
echo "
|
|
|
|
<a href=db_action.php?table=$table&query=$urlquery&last_pos=$prev_pos&detail=$detail>Previous $page_entries_to_show</a><br>
|
|
|
|
";
|
2003-08-05 01:26:46 +00:00
|
|
|
}
|
2003-11-07 00:54:53 +00:00
|
|
|
echo "</td><td width=100>";
|
|
|
|
if ($last < $count) {
|
|
|
|
echo "
|
|
|
|
<a href=db_action.php?table=$table&query=$urlquery&last_pos=$last&detail=$detail>Next $entries_to_show</a><br>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
echo "</td></tr></table>";
|
2003-06-11 23:36:47 +00:00
|
|
|
}
|
2003-11-07 00:54:53 +00:00
|
|
|
|
2003-08-05 20:30:21 +00:00
|
|
|
if ($table == "result") {
|
|
|
|
echo "<a href=result_summary.php?query=$urlquery>Summary</a> |";
|
|
|
|
}
|
2003-06-11 23:36:47 +00:00
|
|
|
if ($detail == "high") {
|
|
|
|
echo "
|
2003-08-05 01:26:46 +00:00
|
|
|
<a href=db_action.php?table=$table&query=$urlquery&detail=low>Less detail</a>
|
2003-06-11 23:36:47 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
if ($detail == "low") {
|
|
|
|
echo "
|
2003-08-05 01:26:46 +00:00
|
|
|
<a href=db_action.php?table=$table&query=$urlquery&detail=high>More detail</a>
|
2003-06-11 23:36:47 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2003-07-01 18:28:33 +00:00
|
|
|
echo " | <a href=index.php>Return to main admin page</a>\n";
|
|
|
|
echo "<p>\n";
|
|
|
|
if ($table == "host") {
|
|
|
|
if ($show_aggregate) {
|
|
|
|
$result = mysql_query("select sum(d_total) as tot_sum, sum(d_free) as free_sum, " . "sum(m_nbytes) as tot_mem from host" . $query);
|
|
|
|
$disk_info = mysql_fetch_object($result);
|
|
|
|
$dt = $disk_info->tot_sum/(1024*1024*1024);
|
|
|
|
$df = $disk_info->free_sum/(1024*1024*1024);
|
|
|
|
$mt = $disk_info->tot_mem/(1024*1024);
|
|
|
|
echo "<p>\n
|
|
|
|
Sum of total disk space on these hosts:
|
|
|
|
$dt GB
|
|
|
|
<p>
|
|
|
|
Sum of available disk space on these hosts:
|
|
|
|
$df GB
|
|
|
|
<p>
|
|
|
|
Sum of memory on these hosts:
|
|
|
|
$mt MB
|
|
|
|
<p>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
}
|
2003-06-11 23:36:47 +00:00
|
|
|
$result = mysql_query($main_query);
|
2003-08-05 21:34:38 +00:00
|
|
|
if ($result) {
|
2003-06-11 23:36:47 +00:00
|
|
|
if ($detail == "low") {
|
2003-08-05 21:34:38 +00:00
|
|
|
start_table();
|
|
|
|
switch($table) {
|
2003-10-10 22:55:29 +00:00
|
|
|
case "result":
|
|
|
|
result_short_header();
|
|
|
|
break;
|
|
|
|
case "host":
|
|
|
|
host_short_header();
|
|
|
|
break;
|
|
|
|
case "app_version":
|
|
|
|
app_version_short_header();
|
|
|
|
break;
|
|
|
|
case "workunit":
|
|
|
|
workunit_short_header();
|
|
|
|
break;
|
2003-06-11 23:36:47 +00:00
|
|
|
}
|
2003-08-05 21:34:38 +00:00
|
|
|
}
|
|
|
|
while ($res = mysql_fetch_object($result)) {
|
|
|
|
if ($detail == "low") {
|
|
|
|
switch ($table) {
|
2003-10-10 22:55:29 +00:00
|
|
|
case "result":
|
|
|
|
show_result_short($res);
|
|
|
|
break;
|
|
|
|
case "host":
|
|
|
|
show_host_short($res);
|
|
|
|
break;
|
|
|
|
case "app_version":
|
|
|
|
show_app_version_short($res);
|
|
|
|
break;
|
|
|
|
case "workunit":
|
|
|
|
show_workunit_short($res);
|
|
|
|
break;
|
2003-08-05 21:34:38 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch ($table) {
|
2003-10-10 22:55:29 +00:00
|
|
|
case "platform":
|
|
|
|
show_platform($res);
|
|
|
|
break;
|
|
|
|
case "app":
|
|
|
|
show_app($res);
|
|
|
|
break;
|
|
|
|
case "app_version":
|
2003-11-11 20:49:07 +00:00
|
|
|
show_app_version($res);
|
2003-10-10 22:55:29 +00:00
|
|
|
break;
|
|
|
|
case "host":
|
|
|
|
show_host($res);
|
|
|
|
break;
|
|
|
|
case "workunit":
|
2003-11-11 20:49:07 +00:00
|
|
|
show_workunit($res);
|
2003-10-10 22:55:29 +00:00
|
|
|
break;
|
|
|
|
case "result":
|
2003-11-11 20:49:07 +00:00
|
|
|
show_result($res);
|
2003-10-10 22:55:29 +00:00
|
|
|
break;
|
|
|
|
case "team":
|
|
|
|
show_team($res);
|
|
|
|
break;
|
|
|
|
case "user":
|
|
|
|
show_user($res);
|
|
|
|
break;
|
2003-08-05 21:34:38 +00:00
|
|
|
}
|
2003-06-11 23:36:47 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-05 21:34:38 +00:00
|
|
|
if ($detail == "low") {
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo "<h2>No results found</h2>";
|
2003-07-01 18:28:33 +00:00
|
|
|
}
|
2003-06-11 23:36:47 +00:00
|
|
|
|
2003-11-05 22:57:07 +00:00
|
|
|
admin_page_tail();
|
2003-08-05 01:18:41 +00:00
|
|
|
} ?>
|