user web pages: if can't delete host because there are still

results, give clearer error message and link to list of results.

svn path=/trunk/boinc/; revision=9246
This commit is contained in:
Bruce Allen 2006-01-16 14:29:32 +00:00
parent d68c82518a
commit 9483ced59e
2 changed files with 18 additions and 4 deletions

View File

@ -497,9 +497,13 @@ Bruce 16 Jan 2006
- ops page: add external IP to data shown for host
- user host info page: when giving IP data, show both private
AND external IP (only for owner of host machine).
- user web pages: if can't delete host because there are still
results, give clearer error message and link to list of results.
html/
inc/
db_ops.inc
host.inc
user/
host_delete.php

View File

@ -5,7 +5,7 @@ require_once("../inc/util.inc");
require_once("../inc/host.inc");
function fail($msg) {
echo "Error: $msg";
echo "<h2>Error: $msg</h2>";
page_tail();
exit();
}
@ -13,7 +13,7 @@ function fail($msg) {
function get_host($hostid, $user) {
$host = lookup_host($hostid);
if (!$host || $host->userid != $user->id) {
fail("We have no record of that computer");
fail("We have no record of that computer.");
}
return $host;
}
@ -28,7 +28,17 @@ $host = get_host($hostid, $user);
if (host_nresults($host)==0) {
mysql_query("delete from host where id=$hostid");
} else {
fail("existing results");
$config = get_config();
$results = "existing results";
if (parse_bool($config, "show_results")) {
$nresults = host_nresults($host);
if ($nresults) {
$results = "<a href=results.php?hostid=$host->id>existing $nresults results</a>";
}
}
fail("You can not delete this computer because the project database still contains work for it. ".
"You must wait a few days until all the $results for this computer ".
"have been deleted from the project database.");
}
echo "
Host deleted.