Basic administrative operational interface

svn path=/trunk/boinc/; revision=387
This commit is contained in:
Eric Heien 2002-08-28 20:51:17 +00:00
parent 8e0d057270
commit ff7205e11b
11 changed files with 655 additions and 78 deletions

29
html/ops/app.php Executable file
View File

@ -0,0 +1,29 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Apps");
$query = "select * from app";
$english_query = "Show all apps";
if (strlen($id)) {
$query = append_sql_query( $query, "id = $id", $first );
$english_query = append_sql_query( $english_query, "id is $id", $first );
$first = 0;
}
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query($query);
while ($app = mysql_fetch_object($result)) {
show_app($app);
}
print_page_end();
?>

46
html/ops/app_version.php Executable file
View File

@ -0,0 +1,46 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("App Versions");
$query = "select * from app_version";
$english_query = "Show all application versions";
if (strlen($plat_id)) {
$query = append_sql_query( $query, "platformid = $plat_id", $first );
$english_query = append_sql_query( $english_query, "platform is ".platform_name_by_id($plat_id), $first );
$first = 0;
}
if (strlen($app_id)) {
$query = append_sql_query( $query, "appid = $app_id", $first );
$english_query = append_sql_query( $english_query, "application is ".app_name_by_id($app_id), $first );
$first = 0;
}
printf(
"<form method=get action=app_version.php>\n"
. "<p>\n"
. "<input type=checkbox name=show_xml_docs"
. (strlen($show_xml_docs) ? " checked" : "") . ">"
. "Show XML Docs\n"
. "<p>\n"
. "<input type=submit value=\"Query\">\n"
. "</form>"
);
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query($query);
while ($app_version = mysql_fetch_object($result)) {
show_app_version($app_version,$show_xml_docs);
}
print_page_end();
?>

View File

@ -24,42 +24,59 @@ function lookup_user_auth($auth) {
}
}
function print_query_count($query, $nres, $start) {
$result = mysql_query($query);
$res = mysql_fetch_object($result);
if ($res->cnt < ($nres+$start)) {
$nres = $res->cnt-$start;
}
printf(
"<p>\n"
. "$res->cnt database entries match the query. Displaying $start to " . ($start+$nres) . "."
. "<p>\n"
);
}
function show_platform($platform) {
start_table();
row("ID", $platform->id);
row("created", time_str($platform->create_time));
row("name", $platform->name);
echo "</table>";
row("Created", time_str($platform->create_time));
row("Platform Name", $platform->name);
row("","<a href=app_version.php?plat_id=$platform->id>Application Versions for Platform $platform->name </a>");
end_table();
}
function show_app($app) {
start_table();
row("ID", $app->id);
row("created", time_str($app->create_time));
row("name", $app->name);
row("result template", "<pre>".htmlspecialchars($app->result_xml_template)."</pre>");
echo "</table>";
row("Created", time_str($app->create_time));
row("Application Name", $app->name);
row("","<a href=app_version?app_id=$app->id>Application Versions for Application $app->name</a>");
row("","<a href=workunit.php?app_id=$app->id>Workunits for this Application</a>");
end_table();
}
function show_app_version($app_version) {
function show_app_version($app_version,$show_xml_docs) {
start_table();
row("ID", $app_version->id);
row("created", time_str($app_version->create_time));
row("app ID", $app_version->appid);
row("version num", $app_version->version_num);
row("platform ID", $app_version->platformid);
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);
echo "</table>";
row("Created", time_str($app_version->create_time));
row("Application", "<a href=app.php?id=$app_version->appid>" . app_name_by_id($app_version->appid) . "</a>");
row("Version num", $app_version->version_num);
row("Platform", "<a href=platform.php?id=$app_version->platformid>" . platform_name_by_id($app_version->platformid) . "</a>" );
if ($show_xml_docs) {
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 show_host($host) {
echo TABLE2."\n";
echo "<tr>Below is information on all the hosts you have running the BOINC core client.";
echo "<tr>";
echo "<p>";
echo "<tr>".TD2.LG_FONT."<b>Host Information:</b></font></td></tr>\n";
row("<b>IP address: </b>", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
@ -92,81 +109,145 @@ function show_host($host) {
row("<b>% of time client on: </b>", 100*$host->on_frac." %");
row("<b>% of time host connected: </b>", 100*$host->connected_frac." %");
row("<b>% of time user active: </b>", 100*$host->active_frac." %");
echo "</table>\n";
row("","<a href=result.php?host_id=$host->id>Results Assigned to Host</a>");
end_table();
}
function show_workunit($wu) {
function show_workunit($wu,$show_xml_doc) {
start_table();
row("created", time_str($wu->create_time));
row("name", $wu->name);
row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
row("app ID", $wu->appid);
row("batch", $wu->batch);
row("FP operations", $wu->rsc_fpops);
row("integer operations", $wu->rsc_iops);
row("memory requirement", $wu->rsc_memory);
row("disk requirement", $wu->rsc_disk);
row("dynamic results", $wu->dynamic_results?"yes":"no");
row("max_results", $wu->max_results);
row("nresults", $wu->nresults);
row("nresults_unsent", $wu->nresults_unsent);
row("nresults_done", $wu->nresults_done);
row("nresults_fail", $wu->nresults_fail);
echo "</table>";
row4("Created", time_str($wu->create_time), "Name", $wu->name);
if ($show_xml_doc) {
row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
}
row4("Application", "<a href=app.php?id=$wu->appid>" . app_name_by_id($wu->appid) . "</a>",
"Batch", $wu->batch);
row4("FP Operations", $wu->rsc_fpops, "Integer Operations", $wu->rsc_iops);
row4("Memory Requirement", $wu->rsc_memory, "Disk Requirement", $wu->rsc_disk);
row4("Dynamic Results", $wu->dynamic_results?"yes":"no", "Max Results", $wu->max_results);
row4("Number of Results", $wu->nresults, "Number of Unsent Results", $wu->nresults_unsent);
row4("Number of Results Done", $wu->nresults_done, "Number of Failed Results",
$wu->nresults_fail);
row("","<a href=result.php?wu_id=$wu->id>Show Associated Results</a>");
end_table();
echo "<p>";
}
function res_state_string($s) {
switch($s) {
case 1: return "inactive";
case 2: return "unsent";
case 3: return "in progress";
case 4: return "done";
case 5: return "timeout";
case 6: return "error";
case 1: return "Inactive";
case 2: return "Unsent";
case 3: return "In Progress";
case 4: return "Done";
case 5: return "Timeout";
case 6: return "Error";
}
}
function show_result($result) {
function show_result($result,$show_xml_docs,$show_stderr,$show_times) {
start_table();
row("created", time_str($result->create_time));
row("name", $result->name);
row("workunit ID", $result->workunitid);
row("state", res_state_string($result->state));
row("host ID", $result->hostid);
row("sent", time_str($result->sent_time));
row("received", time_str($result->received_time));
row("exit status", $result->exit_status);
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("validated", $result->validated);
echo "</table>";
if ($show_times) {
row4("created", time_str($result->create_time), "sent", time_str($result->sent_time));
row4("received", time_str($result->received_time),"","");
}
row4("Name", $result->name, "Workunit",
"<a href=workunit.php?id=$result->workunitid>" . wu_name_by_id($result->workunitid) . "</a>" );
row4("state", res_state_string($result->state), "Host ID",
"<a href=host.php?id=$result->hostid>" . host_name_by_id($result->hostid) . "</a>");
row4("Exit Status", $result->exit_status, "CPU time", $result->cpu_time);
if ($show_xml_docs) {
row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
}
if ($show_stderr) {
row("stderr out", "<pre>".htmlspecialchars($result->stderr_out)."</pre>");
}
row4("batch", $result->batch, "validated", $result->validated);
end_table();
echo "<p>";
}
function show_user($user) {
start_table();
row("created", time_str($user->create_time));
row("total credit", $user->total_credit);
row("recent averaged credit:", $user->expavg_credit);
row("name", $user->name);
row("email address", $user->email_addr);
row("country", $user->country);
row("postal code", $user->postal_code);
echo "</table>\n";
row("Created", time_str($user->create_time));
row("Total Credit", $user->total_credit);
row("Recent Averaged Credit:", $user->expavg_credit);
row("Name", $user->name);
row("Email Address", $user->email_addr);
row("Country", $user->country);
row("Postal Code", $user->postal_code);
row("Team", ($user->teamid == 0 ? "None" : "<a href=team.php?id=$user->teamid>" . team_name_by_id($user->teamid) . "</a>" ));
row("", "<a href=host.php?user_id=$user->id>User Hosts</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("founder", $team->userid);
row("name", $team->name);
row("url", $team->url);
row("type", $team->type);
row("name_html", $team->name_html);
row("description", $team->description);
row("Team Founder", "<a href=user.php?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=user.php?team_id=$team->id>List All Members</a>");
end_table();
}
function team_name_by_id($team_id) {
$result = mysql_query("select * from team where id = $team_id");
$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($app_id) {
$result = mysql_query("select * from app where id = $app_id");
$app = mysql_fetch_object($result);
return $app->name;
}
function wu_name_by_id($wu_id) {
$result = mysql_query("select * from workunit where id = $wu_id");
$wu = mysql_fetch_object($result);
return $wu->name;
}
function platform_name_by_id($plat_id) {
$result = mysql_query("select * from platform where id = $plat_id");
$plat = mysql_fetch_object($result);
return $plat->name;
}
function host_name_by_id($host_id) {
$result = mysql_query("select * from host where id = $host_id");
$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 . ")";
}
?>

63
html/ops/host.php Executable file
View File

@ -0,0 +1,63 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Hosts");
$query = "";
$english_query = "Show all hosts";
if (strlen($id)) {
$query = append_sql_query( $query, "id = $id", $first );
$english_query = append_sql_query( $english_query, "id is $id", $first );
$first = 0;
}
if (strlen($user_id)) {
$query = append_sql_query( $query, "userid = $user_id", $first );
$english_query = append_sql_query( $english_query, "user is ".user_name_by_id($user_id), $first );
$first = 0;
}
printf(
"<form method=get action=host.php>\n"
. "<input type=checkbox name=show_aggregate"
. (strlen($show_aggregate) ? " checked" : "") . ">"
. "Show Aggregate Information\n"
. "<p>\n"
. "<input type=submit value=\"Query\">\n"
. "</form>\n"
);
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);
printf(
"<p>"
. "Sum of total disk space on these hosts: "
. $disk_info->tot_sum/(1024*1024*1024) . " GB"
. "<p>"
. "Sum of available disk space on these hosts: "
. $disk_info->free_sum/(1024*1024*1024) . " GB"
. "<p>"
. "Sum of memory on these hosts: " . $disk_info->tot_mem/(1024*1024) . " MB"
. "<p>"
);
}
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query("select * from host" . $query);
while ($host = mysql_fetch_object($result)) {
show_host($host);
}
print_page_end();
?>

View File

@ -1 +1,24 @@
<a href=db.php>Database contents</a>
<html>
<head>
<title>Operational Interface</title>
</head>
<body>
<a href=project.php>Project Information</a>
<p>
<a href=platform.php>Platform Information</a>
<p>
<a href=app.php>Application Information</a>
<p>
<a href=app_version.php>Application Version Information</a>
<p>
<a href=user.php>User Information</a>
<p>
<a href=team.php>Team Information</a>
<p>
<a href=host.php>Host Information</a>
<p>
<a href=workunit.php>Workunit Information</a>
<p>
<a href=result.php>Result Information</a>
</body>
</html>

30
html/ops/platform.php Executable file
View File

@ -0,0 +1,30 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Platforms");
$query = "select * from platform";
$english_query = "Show all platforms";
if (strlen($id)) {
$query = append_sql_query( $query, "id = $id", $first );
$english_query = append_sql_query( $english_query, "id is $id", $first );
$first = 0;
}
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query($query);
while ($platform = mysql_fetch_object($result)) {
show_platform($platform);
}
print_page_end();
?>

109
html/ops/result.php Executable file
View File

@ -0,0 +1,109 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Results");
$query = "select * from result";
$english_query = "Show all results";
$count_query = "";
if (strlen($result_state) && $result_state != 0) {
$query = append_sql_query( $query, "state = $result_state", $first );
$count_query = append_sql_query( $count_query, "state = $result_state", $first );
$english_query = append_sql_query( $english_query, "state is ".res_state_string($result_state), $first );
$rstate = $result_state;
$first = 0;
} else {
$rstate = 0;
}
if (strlen($wu_id)) {
$query = append_sql_query( $query, "workunitid = $wu_id", $first );
$count_query = append_sql_query( $count_query, "workunitid = $wu_id", $first );
$english_query = append_sql_query( $english_query, "workunit is ".wu_name_by_id($wu_id), $first );
$first = 0;
}
if (strlen($host_id)) {
$query = append_sql_query( $query, "hostid = $host_id", $first );
$count_query = append_sql_query( $count_query, "hostid = $host_id", $first );
$english_query = append_sql_query( $english_query, "host is ".host_name_by_id($host_id), $first );
$first = 0;
}
if (strlen($res_batch)) {
$query = append_sql_query( $query, "batch = $res_batch", $first );
$count_query = append_sql_query( $count_query, "batch = $res_batch", $first );
$english_query = append_sql_query( $english_query, "batch number is $res_batch", $first );
$first = 0;
}
if (strlen($exit_status)) {
$query = append_sql_query( $query, "exit_status = $exit_status", $first );
$count_query = append_sql_query( $count_query, "exit_status = $exit_status", $first );
$english_query = append_sql_query( $english_query, "exit status is $exit_status", $first );
$first = 0;
}
if (strlen($nresults)) {
$results_to_show = $nresults;
} else {
$results_to_show = 5;
}
if (strlen($show_more)) {
$start_at = $last_pos;
} else {
$start_at = 0;
}
printf(
"<form method=get action=result.php>\n"
. "Result State: <select name=result_state>\n"
. "<option value=\"0\"" . ($rstate == 0 ? "selected" : "") . "> All\n"
);
for( $i=1;$i<=6;$i++ ) {
printf( "<option value=\"$i\"" . ($rstate == $i ? "selected" : "") . ">" . res_state_string($i) . "\n" );
}
printf(
"</select>\n"
. "<p>\n"
. "Result in Batch: <input name=res_batch value=\"$res_batch\" type=text size=10>\n"
. "<p>\n"
. "Result has Exit Code: <input name=exit_status value=\"$exit_status\" type=text size=10>\n"
. "<p>\n"
. "Number of Results to Show: <input name=nresults value=\"$results_to_show\" type=text size=10>\n"
. "<p>\n"
);
print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs);
print_checkbox("Show Result stderr", "show_stderr", $show_stderr);
print_checkbox("Show Times", "show_times", $show_times);
printf( "<input type=hidden name=last_pos value=\"" . ($results_to_show+$start_at) . "\">\n" );
print_submit("Query","new_query");
print_submit("Show More","show_more");
printf( "</form>\n" );
echo "<p>Query is: <b>$english_query</b><p>";
print_query_count("select count(*) as cnt from result" . $count_query, $results_to_show, $start_at);
$result = mysql_query($query);
while (($res = mysql_fetch_object($result)) && ($results_to_show > 0)) {
if ($start_at <= 0) {
show_result($res,$show_xml_docs,$show_stderr,$show_times);
$results_to_show--;
} else {
$start_at--;
}
}
print_page_end();
?>

30
html/ops/team.php Executable file
View File

@ -0,0 +1,30 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header( "Teams" );
$query = "select * from team";
$english_query = "Show all teams";
if (strlen($id)) {
$query = append_sql_query( $query, "id = $id", $first );
$english_query = append_sql_query( $english_query, "id is $id", $first );
$first = 0;
}
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query($query);
while ($team = mysql_fetch_object($result)) {
show_team($team);
}
print_page_end();
?>

30
html/ops/user.php Executable file
View File

@ -0,0 +1,30 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Users");
$query = "select * from user";
$english_query = "Show all users";
if (strlen($team_id)) {
$query = append_sql_query( $query, "teamid = $team_id", $first );
$english_query = append_sql_query( $english_query, "team is " . team_name_by_id($team_id), $first );
$first = 0;
}
echo "<p>Query is: <b>$english_query</b><p>";
$result = mysql_query($query);
while ($user = mysql_fetch_object($result)) {
show_user($user);
}
print_page_end();
?>

View File

@ -62,6 +62,14 @@ function page_tail() {
echo "|<a href=home.php> User Page </a>|<a href=team.php> Teams </a>|<a href=index.php> Main Project Page </a>|</td></tr></table>\n";
}
function append_sql_query($original,$addition,$first) {
if ($first == 1) {
return $original . " where " . $addition;
} else {
return $original . " and " . $addition;
}
}
function date_str($when) {
return date("g:i A, l M j", $when);
}
@ -72,11 +80,26 @@ function time_str($x) {
}
function start_table() {
echo "<table width=600 border=2 cellpadding=4>";
echo "<table border=2 cellpadding=4 width=700>\n";
}
function end_table() {
echo "</table>\n";
}
function print_checkbox($text,$name,$checked) {
echo "<input type=checkbox name=$name"
. (strlen($checked) ? " checked" : "") . ">"
. "$text\n"
. "<p>\n";
}
function print_submit($text,$name) {
echo "<input type=submit name=\"$name\" value=\"$text\">\n";
}
function row($x, $y) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td></tr>\n";
echo "<tr>\n<td width=30% colspan=2 valign=top align=right>$x</td>\n<td colspan=2>$y</td>\n</tr>\n";
}
function row2($x, $y) {
@ -87,6 +110,11 @@ function row3($x, $y, $z) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td><td>$z</td></tr>\n";
}
function row4($xx, $xy, $yx, $yy) {
echo "<tr><td width=25% valign=top align=right>$xx</td><td width=25%>$xy</td>"
. "<td width=25% align=right>$yx</td><td width=%25>$yy</td></tr>\n";
}
function random_string() {
return md5(uniqid(rand()));
}
@ -100,8 +128,10 @@ function print_page_header($title) {
echo "<head>\n";
echo "<title>$title</title>\n";
echo "</head>\n";
echo "<body BGCOLOR=000000 TEXT=FFFFFF LINK=cc99ff VLINK=cc99ff>\n";
echo "<br clear=all><br>\n";
echo "<body TEXT=000000 BGCOLOR=FFFFFF>\n";
echo "<h2>$title</h2>\n";
echo "<a href=index.html>Return to Main Page</a>\n";
echo "<br clear=all>\n";
}
function print_page_end() {

106
html/ops/workunit.php Executable file
View File

@ -0,0 +1,106 @@
<?php
require_once("util.inc");
require_once("db.inc");
parse_str(getenv("QUERY_STRING"));
db_init();
$first = 1;
print_page_header("Workunits");
$query = "select * from workunit";
$count_query = "";
$english_query = "Show all workunits";
if (strlen($id)) {
$query = append_sql_query( $query, "id = $id", $first );
$count_query = append_sql_query( $count_query, "id = $id", $first );
$english_query = append_sql_query( $english_query, "id is $id", $first );
$first = 0;
}
if (strlen($app_id)) {
$query = append_sql_query( $query, "appid = $app_id", $first );
$count_query = append_sql_query( $count_query, "appid = $app_id", $first );
$english_query = append_sql_query( $english_query, "application is " . app_name_by_id($app_id), $first );
$first = 0;
}
if (strlen($wu_batch)) {
$query = append_sql_query( $query, "batch = $wu_batch", $first );
$count_query = append_sql_query( $count_query, "batch = $wu_batch", $first );
$english_query = append_sql_query( $english_query, "batch number is $wu_batch", $first );
$first = 0;
}
if (strlen($nres_done)) {
$query = append_sql_query( $query, "nresults_done = $nres_done", $first );
$count_query = append_sql_query( $count_query, "nresults_done = $nres_done", $first );
$english_query = append_sql_query( $english_query, "number of results done is $nres_done", $first );
$first = 0;
}
if (strlen($nres_fail)) {
$query = append_sql_query( $query, "nresults_fail = $nres_fail", $first );
$count_query = append_sql_query( $count_query, "nresults_fail = $nres_fail", $first );
$english_query = append_sql_query( $english_query, "number of results failed is $nres_fail", $first );
$first = 0;
}
if (strlen($nres_unsent)) {
$query = append_sql_query( $query, "nresults_unsent = $nres_unsent", $first );
$count_query = append_sql_query( $count_query, "nresults_unsent = $nres_unsent", $first );
$english_query = append_sql_query( $english_query, "number of results unsent is $nres_unsent", $first );
$first = 0;
}
if (strlen($show_more)) {
$start_at = $last_pos;
} else {
$start_at = 0;
}
if (strlen($nwus)) {
$wus_to_show = $nwus;
} else {
$wus_to_show = 5;
}
printf(
"<form method=get action=workunit.php>\n"
. "Workunits in Batch Number: <input name=wu_batch value=\"$wu_batch\" type=text size=10>\n"
. "<p>"
. "Number of Workunits to Show: <input name=nwus value=\"$wus_to_show\" type=text size=10>\n"
. "<p>"
. "Number of Results Done: <input name=nres_done value=\"$nres_done\" type=text size=10>\n"
. "<p>"
. "Number of Results Failed: <input name=nres_fail value=\"$nres_fail\" type=text size=10>\n"
. "<p>"
. "Number of Results Unsent: <input name=nres_unsent value=\"$nres_unsent\" type=text size=10>\n"
. "<p>"
);
print_checkbox("Show XML Docs", "show_xml_docs", $show_xml_docs);
printf( "<input type=hidden name=last_pos value=\"" . ($wus_to_show+$start_at) . "\">\n" );
print_submit("Query","new_query");
print_submit("Show More","show_more");
printf( "</form>\n" );
echo "<p>Query is: <b>$english_query</b><p>";
print_query_count("select count(*) as cnt from workunit" . $count_query, $wus_to_show, $start_at );
$result = mysql_query($query);
while (($workunit = mysql_fetch_object($result)) && ($wus_to_show > 0)) {
if ($start_at <= 0) {
show_workunit($workunit,$show_xml_docs);
$wus_to_show--;
} else {
$start_at--;
}
}
print_page_end();
?>