diff --git a/checkin_notes b/checkin_notes index a5c3c2a7cf..0ff19b07c4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/html/inc/user.inc b/html/inc/user.inc index 5f60c90de5..5fd061b939 100644 --- a/html/inc/user.inc +++ b/html/inc/user.inc @@ -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, "")) break; + if ($x = parse_element($buf, "")) { + $p->name = $x; + } + if ($x = parse_element($buf, "")) { + $p->name = $x; + } + if ($x = parse_element($buf, "")) { + $p->url = $x; + } + if ($x = parse_element($buf, "")) { + $p->total_credit = $x; + } + if ($x = parse_element($buf, "")) { + $p->expavg_credit = $x; + } + if ($x = parse_element($buf, "")) { + $p->id = $x; + } + if ($x = parse_element($buf, "")) { + $p->country = $x; + } + if ($x = parse_element($buf, "")) { + $p->team_id = $x; + } + if ($x = parse_element($buf, "")) { + $p->team_name = $x; + } + if ($x = parse_element($buf, "")) { + $p->create_time = $x; + } + } + return $p; +} + +function parse_user($f, $user) { + $user->projects = array(); + while (!feof($f)) { + $buf = fgets($f); + if (strstr($buf, "")) break; + if (strstr($buf, "")) { + $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 = "url/show_user.php?userid=$project->id>$project->name"; + } + echo " + $x + ".number_format($project->total_credit, 0)." + ".number_format($project->expavg_credit, 0)." + ".date_str($project->create_time)." + + "; +} + +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 "

Projects in which you are participating

"; + } else { + echo "

Projects in which $user->name is participating

"; + } + start_table(); + row_heading_array(array( + "Project
Click for user page", "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); diff --git a/html/user/home.php b/html/user/home.php index 94f743453f..62f3581bd7 100644 --- a/html/user/home.php +++ b/html/user/home.php @@ -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 "

\n"; show_user_page_private($user); +show_other_projects($user, true); project_user_page_private($user); page_tail(); diff --git a/html/user/show_user.php b/html/user/show_user.php index daaa078469..c586012404 100644 --- a/html/user/show_user.php +++ b/html/user/show_user.php @@ -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, "")) break; - if ($x = parse_element($buf, "")) { - $p->name = $x; - } - if ($x = parse_element($buf, "")) { - $p->name = $x; - } - if ($x = parse_element($buf, "")) { - $p->url = $x; - } - if ($x = parse_element($buf, "")) { - $p->total_credit = $x; - } - if ($x = parse_element($buf, "")) { - $p->expavg_credit = $x; - } - if ($x = parse_element($buf, "")) { - $p->id = $x; - } - if ($x = parse_element($buf, "")) { - $p->country = $x; - } - if ($x = parse_element($buf, "")) { - $p->team_id = $x; - } - if ($x = parse_element($buf, "")) { - $p->team_name = $x; - } - if ($x = parse_element($buf, "")) { - $p->create_time = $x; - } - } - return $p; -} - -function parse_user($f, $user) { - $user->projects = array(); - while (!feof($f)) { - $buf = fgets($f); - if (strstr($buf, "")) break; - if (strstr($buf, "")) { - $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( - "url/show_user.php?userid=$project->id>$project->name", - 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 "

Projects in which $user->name is participating

"; - start_table(); - row_heading_array(array( - "Project
Click for user page", "Total credit", "Average credit", "Since" - )); - foreach($user->projects as $project) { - show_project($project); - } - end_table(); - } + show_other_projects($user, false); page_tail(true); } diff --git a/sched/start b/sched/start index 316634048b..30dc74e6c4 100755 --- a/sched/start +++ b/sched/start @@ -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: