*** empty log message ***

svn path=/trunk/boinc/; revision=11738
This commit is contained in:
David Anderson 2006-12-29 19:01:03 +00:00
parent e9d2bdc3e8
commit c6ee2edf87
5 changed files with 126 additions and 89 deletions

View File

@ -13790,3 +13790,18 @@ Rom 29 Dec 2006
BOINCBaseView.cpp, .h
BOINCDialupManager.cpp, .h
ViewStatistics.cpp, .h
David 29 Dec 2006
- user web: add project list to private use page also;
sort projects by descending avg credit;
don't link to user page on WCG (they don't have them)
- start script: say "not running", not "not found"
html/
inc/
user.inc
user/
home.php
show_user.php
sched/
start

View File

@ -4,6 +4,109 @@ require_once("../inc/credit.inc");
require_once("../inc/email.inc");
require_once("../inc/util.inc");
function parse_project($f) {
$p->total_credit = 0.0;
$p->expavg_credit = 0.0;
while (!feof($f)) {
$buf = fgets($f);
if (strstr($buf, "</project>")) break;
if ($x = parse_element($buf, "<name>")) {
$p->name = $x;
}
if ($x = parse_element($buf, "<name>")) {
$p->name = $x;
}
if ($x = parse_element($buf, "<url>")) {
$p->url = $x;
}
if ($x = parse_element($buf, "<total_credit>")) {
$p->total_credit = $x;
}
if ($x = parse_element($buf, "<expavg_credit>")) {
$p->expavg_credit = $x;
}
if ($x = parse_element($buf, "<id>")) {
$p->id = $x;
}
if ($x = parse_element($buf, "<country>")) {
$p->country = $x;
}
if ($x = parse_element($buf, "<team_id>")) {
$p->team_id = $x;
}
if ($x = parse_element($buf, "<team_name>")) {
$p->team_name = $x;
}
if ($x = parse_element($buf, "<create_time>")) {
$p->create_time = $x;
}
}
return $p;
}
function parse_user($f, $user) {
$user->projects = array();
while (!feof($f)) {
$buf = fgets($f);
if (strstr($buf, "</user>")) break;
if (strstr($buf, "<project>")) {
$user->projects[] = parse_project($f);
}
}
return $user;
}
function get_other_projects($user) {
$cpid = md5($user->cross_project_id . $user->email_addr);
$url = "http://boinc.netsoft-online.com/get_user.php?cpid=$cpid";
$f = fopen($url, "r");
if (!$f) {
return $user;
}
$u = parse_user($f, $user);
fclose($f);
return $u;
}
function show_project($project) {
if ($project->url == "http://www.worldcommunitygrid.org/") {
$x = $project->name;
} else {
$x = "<a href=$project->url/show_user.php?userid=$project->id>$project->name</a>";
}
echo "<tr>
<td>$x</td>
<td align=right>".number_format($project->total_credit, 0)."</td>
<td align=right>".number_format($project->expavg_credit, 0)."</td>
<td align=right>".date_str($project->create_time)."</td>
</tr>
";
}
function cmp($a, $b) {
if ($a->expavg_credit == $b->expavg_credit) return 0;
return ($a->expavg_credit < $b->expavg_credit)? 1 : -1;
}
function show_other_projects($user, $personal) {
if (count($user->projects) > 1) {
usort($user->projects, "cmp");
if ($personal) {
echo "<h3>Projects in which you are participating</h3>";
} else {
echo "<h3>Projects in which $user->name is participating</h3>";
}
start_table();
row_heading_array(array(
"Project<br><span class=note>Click for user page</span>", "Total credit", "Average credit", "Since"
));
foreach($user->projects as $project) {
show_project($project);
}
end_table();
}
}
function pending_credit($user) {
$result = mysql_query("select sum(claimed_credit) as total from result where userid=$user->id and (validate_state=0 or validate_state=4)");
$foobar = mysql_fetch_object($result);

View File

@ -10,6 +10,7 @@ require_once("../inc/forum.inc");
db_init();
$user = get_logged_in_user();
$user = getForumPreferences($user);
$user = get_other_projects($user);
page_head("Your account");
if (get_str("new_acct", true)) {
@ -29,6 +30,7 @@ if (get_str("via_web", true)) {
echo "<p>\n";
show_user_page_private($user);
show_other_projects($user, true);
project_user_page_private($user);
page_tail();

View File

@ -21,79 +21,6 @@ $id = get_int("userid", true);
$format = get_str("format", true);
$auth = get_str("auth", true);
function parse_project($f) {
$p->total_credit = 0.0;
$p->expavg_credit = 0.0;
while (!feof($f)) {
$buf = fgets($f);
if (strstr($buf, "</project>")) break;
if ($x = parse_element($buf, "<name>")) {
$p->name = $x;
}
if ($x = parse_element($buf, "<name>")) {
$p->name = $x;
}
if ($x = parse_element($buf, "<url>")) {
$p->url = $x;
}
if ($x = parse_element($buf, "<total_credit>")) {
$p->total_credit = $x;
}
if ($x = parse_element($buf, "<expavg_credit>")) {
$p->expavg_credit = $x;
}
if ($x = parse_element($buf, "<id>")) {
$p->id = $x;
}
if ($x = parse_element($buf, "<country>")) {
$p->country = $x;
}
if ($x = parse_element($buf, "<team_id>")) {
$p->team_id = $x;
}
if ($x = parse_element($buf, "<team_name>")) {
$p->team_name = $x;
}
if ($x = parse_element($buf, "<create_time>")) {
$p->create_time = $x;
}
}
return $p;
}
function parse_user($f, $user) {
$user->projects = array();
while (!feof($f)) {
$buf = fgets($f);
if (strstr($buf, "</user>")) break;
if (strstr($buf, "<project>")) {
$user->projects[] = parse_project($f);
}
}
return $user;
}
function get_other_projects($user) {
$cpid = md5($user->cross_project_id . $user->email_addr);
$url = "http://boinc.netsoft-online.com/get_user.php?cpid=$cpid";
$f = fopen($url, "r");
if (!$f) {
return $user;
}
$u = parse_user($f, $user);
fclose($f);
return $u;
}
function show_project($project) {
row_array(array(
"<a href=$project->url/show_user.php?userid=$project->id>$project->name</a>",
number_format($project->total_credit, 0), number_format($project->expavg_credit, 0),
date_str($project->create_time)
));
}
if ($format=="xml"){
// XML doesn't need translating, so use the full-file cache for this
//
@ -144,17 +71,7 @@ if ($format=="xml"){
show_profile_link($user);
end_table();
project_user_summary($user);
if (count($user->projects) > 0) {
echo "<h3>Projects in which $user->name is participating</h3>";
start_table();
row_heading_array(array(
"Project<br><span class=note>Click for user page</span>", "Total credit", "Average credit", "Since"
));
foreach($user->projects as $project) {
show_project($project);
}
end_table();
}
show_other_projects($user, false);
page_tail(true);
}

View File

@ -541,7 +541,7 @@ def command_status():
print "BOINC is DISABLED"
if verbose:
print
print "DAEMON pid status lockfile disabled commandline"
print "DAEMON pid status lockfile disabled commandline"
n = 0
for task in config.daemons:
if task.host != local_hostname:
@ -549,11 +549,11 @@ def command_status():
n += 1
pid = safe_read_int(get_daemon_pid_name(task)) or 0
if not pid:
rs = " "
rs = " "
elif is_pid_running(pid):
rs = " running "
rs = " running "
else:
rs = "NOT FOUND"
rs = "NOT RUNNING"
if is_lock_file_locked(get_task_lock_name(task)):
lu = " locked "
else:
@ -566,7 +566,7 @@ def command_status():
print " %2d"%n, " %5d"%pid, rs, lu, d, " ", task.cmd
print
print "TASK last run period next run lock file disabled commandline"
print "TASK last run period next run lock file disabled commandline"
n = 0
for task in config.tasks:
if task.host != local_hostname: