From 0f79afb5d47e84c30022766b2ac0f29e1322d8bd Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 8 Nov 2002 17:21:45 +0000 Subject: [PATCH] user web svn path=/trunk/boinc/; revision=586 --- html/user/db.inc | 171 +------- html/user/download.php | 21 +- html/user/edit.inc | 72 ++-- html/user/home.php | 10 +- html/user/index.php | 40 +- html/user/login.inc | 49 +-- html/user/login_action.php | 32 +- html/user/show_hosts.php | 45 +- html/user/team.inc | 813 +++++++++++++++++++------------------ html/user/this_user.php | 12 - html/user/top_users.php | 14 + html/user/user.inc | 56 ++- html/user/util.inc | 30 +- 13 files changed, 638 insertions(+), 727 deletions(-) delete mode 100644 html/user/this_user.php create mode 100644 html/user/top_users.php diff --git a/html/user/db.inc b/html/user/db.inc index 7def7d08fe..90148e5259 100644 --- a/html/user/db.inc +++ b/html/user/db.inc @@ -1,5 +1,8 @@ id); - row("created", time_str($platform->create_time)); - row("name", $platform->name); - echo ""; -} - -function show_app($app) { - start_table(); - row("ID", $app->id); - row("created", time_str($app->create_time)); - row("name", $app->name); - row("alpha version", $app->alpha_vers); - row("beta version", $app->beta_vers); - row("production version", $app->prod_vers); - row("result template", "
".htmlspecialchars($app->result_xml_template)."
"); - echo ""; -} - -function show_app_version($app_version) { - 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", "
".htmlspecialchars($app_version->xml_doc)."
"); - 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 ""; -} - -function show_host($host) { - - echo TABLE2."\n"; - echo "Below is information on all the hosts you have running the BOINC core client."; - echo "

"; - echo "".TD2.LG_FONT."Host Information:\n"; - row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); - row("Domain name: ", $host->domain_name); - $x = $host->timezone/3600; - row("Time zone: ", "UTC - $x hours"); - row("Created: ", time_str($host->create_time)); - row("Total Credit:(specific to project) ", $host->total_credit); - row("Recent Averaged Credit:(credits per second) ", $host->expavg_credit); - row("CPU: ", "$host->p_vendor $host->p_model"); - row("Number of CPUs: ", $host->p_ncpus); - row("Operating System: ", "$host->os_name $host->os_version"); - $x = $host->m_nbytes/(1024*1024); - $y = round($x, 2); - row("Memory: ", "$y MB"); - $x = $host->m_cache/1024; - $y = round($x, 2); - row("Cache: ", "$y KB"); - $x = $host->m_swap/(1024*1024); - $y = round($x, 2); - row("Swap Space: ", "$y MB"); - $x = $host->d_total/(1024*1024*1024); - $y = round($x, 2); - row("Total Disk Space: ", "$y GB"); - $x = $host->d_free/(1024*1024*1024); - $y = round($x, 2); - row("Free Disk Space: ", "$y GB"); - row("Avg network bandwidth:
(upstream)
", "$host->n_bwup bytes/sec"); - row("Avg network bandwidth:
(downstream)
", "$host->n_bwdown bytes/sec"); - row("Number of times client has contacted server: ", $host->rpc_seqno); - row("Last time contacted server: ", time_str($host->rpc_time)); - row("% of time client on: ", 100*$host->on_frac." %"); - row("% of time host connected: ", 100*$host->connected_frac." %"); - row("% of time user active: ", 100*$host->active_frac." %"); - echo "\n"; - -} - -function show_workunit($wu) { - start_table(); - row("created", time_str($wu->create_time)); - row("name", $wu->name); - row("XML doc", "

".htmlspecialchars($wu->xml_doc)."
"); - 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 ""; -} - -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"; - } -} - -function show_result($result) { - 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", "
".htmlspecialchars($result->xml_doc_in)."
"); - row("XML doc out", "
".htmlspecialchars($result->xml_doc_out)."
"); - row("stderr out", "
".htmlspecialchars($result->stderr_out)."
"); - row("batch", $result->batch); - row("validated", $result->validated); - echo ""; -} - -function show_user_stats($user, $project) { - echo TABLE2."\n"; - echo "".TD2.LG_FONT."User Stats:\n"; - row("User ID: ", $user->id); - $row = sprintf("%s user since: ", $project); - row($row, time_str($user->create_time)); - row("Total credit: ", $user->total_credit); - row("Recent averaged credit: ", $user->expavg_credit); - if ($user->teamid) { - $result = mysql_query("select * from team where id = $user->teamid"); - $team = mysql_fetch_object($result); - row("Member of team: ", "id>$team->name"); - } else { - row("Member of team: ", "You are currently not part of a team"); - } - echo "\n"; -} - -function show_user_profile($user) { - echo TABLE2."\n"; - echo "".TD2.LG_FONT."User Information:\n"; - row("User name: ", $user->name); - row("Email address: ", $user->email_addr); - row("Country: ", $user->country); - row("Postal (ZIP) code: ", $user->postal_code); - echo "Edit User Information\n"; - echo "Change Password\n"; - echo "\n"; -} - -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); -} - ?> diff --git a/html/user/download.php b/html/user/download.php index 0e4b6cb1df..ee4548bebb 100644 --- a/html/user/download.php +++ b/html/user/download.php @@ -3,28 +3,25 @@ function platform_downloads($platform, $core_app) { $result = mysql_query("select * from app_version where platformid=$platform->id and appid=$core_app->id"); + if (!$result) return; echo "$platform->name\n"; while ($app_version = mysql_fetch_object($result)) { - $version = sprintf("BOINC core client, version %s.", - $platform->name, $app_version->version_num, $app_version->version_num); + $version = sprintf( + "BOINC core client, version %s.", + $platform->name, $app_version->version_num, + $app_version->version_num + ); echo "      $version\n"; //$app_version->md5_cksum"; } + mysql_free_result($result); } require_once("db.inc"); require_once("util.inc"); db_init(); - page_head("Download the BOINC Core Client"); - - printf( - TABLE2."\n" - ."
\n" - ."To select the right core client for your computer, click on the download\n" - ."link corresponding to the name of your operating system.\n" - ."".TD2.LG_FONT."To Download:\n" - ); + page_head("Download the BOINC client"); $result = mysql_query("select * from app where name='core_client'"); $core_app = mysql_fetch_object($result); @@ -34,7 +31,7 @@ function platform_downloads($platform, $core_app) { while ($platform = mysql_fetch_object($result)) { platform_downloads($platform, $core_app); } + mysql_free_result($result); echo "\n"; page_tail(); - mysql_free_result($result); ?> diff --git a/html/user/edit.inc b/html/user/edit.inc index 59cfdbf61d..b564723486 100644 --- a/html/user/edit.inc +++ b/html/user/edit.inc @@ -50,33 +50,33 @@ function print_change_password($user) { function print_update_ok($e_ok) { if ($e_ok == EMAIL_EXISTS) { printf( - TABLE2."\n" - ."There's already an account with that email address. Click the Back button\n" - ." on your browser to edit your information, or login to your \n" - .$project." account.\n" - ."Any other changes you've made, if any, were successfully updated.\n" - ."\n" + TABLE2."\n" + ."There's already an account with that email address. Click the Back button\n" + ." on your browser to edit your information, or login to your \n" + .$project." account.\n" + ."Any other changes you've made, if any, were successfully updated.\n" + ."\n" ); } else if ($e_ok == EMAIL_FAIL) { printf( - TABLE2."\n" - ."Your email address failed to be updated. Click the Back button\n" - ." on your browser to edit your information, or try again later.\n" - ."Any other changes you've made, if any, were successfully updated.\n" - ."\n" + TABLE2."\n" + ."Your email address failed to be updated. Click the Back button\n" + ." on your browser to edit your information, or try again later.\n" + ."Any other changes you've made, if any, were successfully updated.\n" + ."\n" ); } else if ($e_ok == EMAIL_UPDATED) { printf( - TABLE2."\n" - ."Your information was successfully updated. A new, temporary password will be sent to the\n" - ." email address you provided. You must use this new password the next time you login.\n" - ."\n" + TABLE2."\n" + ."Your information was successfully updated. A new, temporary password will be sent to the\n" + ." email address you provided. You must use this new password the next time you login.\n" + ."\n" ); } else { printf( - TABLE2."\n" - ."Your information was successfully updated.\n" - ."\n" + TABLE2."\n" + ."Your information was successfully updated.\n" + ."\n" ); } } @@ -84,33 +84,33 @@ function print_update_ok($e_ok) { function print_update_fail($e_ok) { if ($e_ok == EMAIL_EXISTS) { printf( - TABLE2."\n" - ."There's already an account with that email address. Click the Back button\n" - ." on your browser to edit your information, or login to your \n" - .$project." account. \n" - ."Any other changes you've made, if any, failed to be updated. Please try again later.\n" - ."\n" + TABLE2."\n" + ."There's already an account with that email address. Click the Back button\n" + ." on your browser to edit your information, or login to your \n" + .$project." account. \n" + ."Any other changes you've made, if any, failed to be updated. Please try again later.\n" + ."\n" ); } else if ($e_ok == EMAIL_FAIL) { printf( - TABLE2."\n" - ."Your information failed to be updated. Click the Back button\n" - ." on your browser to edit your information, or try again later.\n" - ."\n" + TABLE2."\n" + ."Your information failed to be updated. Click the Back button\n" + ." on your browser to edit your information, or try again later.\n" + ."\n" ); } else if ($e_ok == EMAIL_UPDATED) { printf( - TABLE2."\n" - ."Your email address was successfully updated. A new, temporary password will be sent to the\n" - ." email address you provided. You must use this new password the next time you login.\n" - ."Any other changes you've made, if any, failed to be updated. Please try again later.\n" - ."\n" + TABLE2."\n" + ."Your email address was successfully updated. A new, temporary password will be sent to the\n" + ." email address you provided. You must use this new password the next time you login.\n" + ."Any other changes you've made, if any, failed to be updated. Please try again later.\n" + ."\n" ); } else { printf( - TABLE2."\n" - ."Your information failed to be updated. Please try again later.\n" - ."\n" + TABLE2."\n" + ."Your information failed to be updated. Please try again later.\n" + ."\n" ); } } diff --git a/html/user/home.php b/html/user/home.php index 8d3de93bd8..bfb906ab93 100644 --- a/html/user/home.php +++ b/html/user/home.php @@ -4,15 +4,15 @@ require_once("db.inc"); require_once("login.inc"); + // show the home page of whoever's logged in + db_init(); $user = get_user_from_cookie(); if ($user) { - $head = sprintf("%s's User Page", $user->name); - page_head($head); - show_user_page($user, PROJECT); + page_head($user->name); + show_user_page_private($user); + page_tail(); } else { - page_head("Log in"); print_login_form(); } - page_tail(); ?> diff --git a/html/user/index.php b/html/user/index.php index 739fb8b76c..c733e50928 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -1,5 +1,4 @@

-This distributed computing project is running on the BOINC software platform. BOINC is a software platform for public-participation distributed computing projects. Users are allowed -to simultaneously participate in multiple projects and to choose how to allocate their resources -for each project. +This distributed computing project is running on the BOINC software platform. +BOINC is a software platform for public-participation distributed +computing projects. +Users are allowed to simultaneously participate in multiple projects +and to choose how to allocate their resources for each project. -

Joining Sample Project

-First, create an account, setting your preferences to specify how much your computer should be -working on this project. You may view your user page to see how much credit you have accumulated as your -participation proceeds. In addition, you may update your user information or modify your preferences -through your user page at anytime to reallocate your resources among the different projects you may -be involved in. -

-When creating you account the project will send you an authenticator to the email specified. After successfully -creating an account download the core client. In order to run the core client you must cut and paste in the -authenticator provided in the email sent to you by the project. -

Joining Other Projects

- -When you join subsequent projects make sure to edit your project preferences for your home project -(the first BOINC supported project you joined) accordingly. You will need to update project preferences with each new project you join. You will be asked to provide the authenticator for each -project so make sure to cut and paste those in from the emails sent to you. This will inform other projects -of the other projects you are involved in, allowing you to participate in all of them simultaneously. -

-If this is not the first project you are joining, make sure to edit the project preferences of your home -project. +

Joining this project

+First, create an account. +You will be sent an authenticator +to the email specified. +After successfully creating an account, +download the BOINC client. +Install and run the client. +When it asks you for authenticator, +cut and paste the authenticator from the email. - diff --git a/html/user/login.inc b/html/user/login.inc index 9be372fa69..98da11a16e 100644 --- a/html/user/login.inc +++ b/html/user/login.inc @@ -1,30 +1,31 @@ \n" - .TABLE2."\n" - ."Enter the email address and password of your account to login:\n" - ."
\n" - ."\n" - ." Email Address\n" - ." \n" - ."\n" - ."\n" - ." Password\n" - ." \n" - ."\n" - ."\n" - ."
\n" - ." \n" - ."\n" - ."\n" - ."\n" - ."
\n" - .TABLE2."\n" - ."If you don't have an account, please create a new one\n" - ."\n" - ); + .TABLE2."\n + Enter the email address and password of your account to login:\n +
\n + \n + Email Address\n + \n + \n + \n + Password\n + \n + \n + \n +
\n + \n + \n + \n + \n +
\n + .TABLE2."\n + If you don't have an account, please create a new one\n + \n"; + page_tail(); } function print_create_account_form() { @@ -69,7 +70,7 @@ function print_create_account_form() { ." \n" ." \n" diff --git a/html/user/login_action.php b/html/user/login_action.php index 97a7ad1018..7aa8da1973 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -24,7 +24,7 @@ } else { setcookie("auth", $user->authenticator, time()+100000000); page_head("User Page"); - show_user_page($user, PROJECT); + show_user_page_private($user); } } else if (strlen($HTTP_POST_VARS["new"])) { $query = sprintf( @@ -87,23 +87,25 @@ if ($result) { setcookie("auth", $authenticator); page_head("Creating Account"); - printf( - TABLE2."\n" - ."Account has been created successfully. In order to run the client you will need a BOINC key. A key will be sent to \n" - ."the email address you provided, and you can simply copy and paste the key, which will be a string of letters and numbers, \n" - ."in the location indicated when you run the client.\n" - ."

\n" - ."Download core client\n" - ."\n" - ); + echo( TABLE2."\n + + Your account has been created successfully. + In order to run the client you will need a BOINC key. + A key will be sent to the email address you provided, + and you can simply copy and paste the key, + which will be a string of letters and numbers, + in the location indicated when you run the client. + \n +

\n + Download core client\n + \n"; mail($email_addr, "BOINC key", "Your BOINC key is " . $authenticator); } else { page_head("Creating Account"); - printf( - TABLE2."\n" - ."Couldn't create account. Please try again later.\n" - ."\n" - ); + echo(TABLE2."\n + Couldn't create account. + Please try again later.\n + \n"; } } } diff --git a/html/user/show_hosts.php b/html/user/show_hosts.php index 19f1cc7f97..6c7bd0a278 100644 --- a/html/user/show_hosts.php +++ b/html/user/show_hosts.php @@ -5,13 +5,54 @@ require_once("login.inc"); require_once("user.inc"); +function show_host($host) { + + echo TABLE2."\n"; + echo "Below is information on all the hosts you have running the BOINC core client."; + echo "

"; + echo "".TD2.LG_FONT."Host Information:\n"; + row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); + row("Domain name: ", $host->domain_name); + $x = $host->timezone/3600; + row("Time zone: ", "UTC - $x hours"); + row("Created: ", time_str($host->create_time)); + row("Total Credit:(specific to project) ", $host->total_credit); + row("Recent Averaged Credit:(credits per second) ", $host->expavg_credit); + row("CPU: ", "$host->p_vendor $host->p_model"); + row("Number of CPUs: ", $host->p_ncpus); + row("Operating System: ", "$host->os_name $host->os_version"); + $x = $host->m_nbytes/(1024*1024); + $y = round($x, 2); + row("Memory: ", "$y MB"); + $x = $host->m_cache/1024; + $y = round($x, 2); + row("Cache: ", "$y KB"); + $x = $host->m_swap/(1024*1024); + $y = round($x, 2); + row("Swap Space: ", "$y MB"); + $x = $host->d_total/(1024*1024*1024); + $y = round($x, 2); + row("Total Disk Space: ", "$y GB"); + $x = $host->d_free/(1024*1024*1024); + $y = round($x, 2); + row("Free Disk Space: ", "$y GB"); + row("Avg network bandwidth:
(upstream)
", "$host->n_bwup bytes/sec"); + row("Avg network bandwidth:
(downstream)
", "$host->n_bwdown bytes/sec"); + row("Number of times client has contacted server: ", $host->rpc_seqno); + row("Last time contacted server: ", time_str($host->rpc_time)); + row("% of time client on: ", 100*$host->on_frac." %"); + row("% of time host connected: ", 100*$host->connected_frac." %"); + row("% of time user active: ", 100*$host->active_frac." %"); + echo "\n"; + +} db_init(); $user = get_user_from_cookie(); - page_head("Hosts stats"); if ($user) { + page_head("Hosts stats"); show_hosts($user); + page_tail(); } else { print_login_form(); } - page_tail(); ?> diff --git a/html/user/team.inc b/html/user/team.inc index 525e072d08..8cfba2f561 100644 --- a/html/user/team.inc +++ b/html/user/team.inc @@ -3,442 +3,445 @@ require_once("util.inc"); require_once("db.inc"); -function print_teams_display() { +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); +} -page_head("Teams"); -echo ""; -echo ""; -echo "

BOINC Teams

"; -echo "

"; -echo "BOINC users may form "teams" - "; -echo "for example, students in a school, employees of a company, etc. "; -echo "

"; -echo "Teams may compete against other teams to analyze the most data, "; -echo "or they may meet and discuss BOINC projects via the web. "; -echo "Team members may view their individual records and compare "; -echo "personals statistics with other team members' statistics, in addition "; -echo "to viewing their team's total statistics on the team's statistics page."; -echo "

"; -echo "
"; -echo "To create a team click on the below link. "; -echo "Team founder's have more privileges than normal team members."; -echo "

"; -echo "Create a new team"; -echo "

"; -echo "
"; -echo "
"; -echo "To search for a team type in the team name below and hit the Search button. "; -echo "You may join teams through these team pages."; -echo "

"; -echo "It may be more effective to type in only a portion of the team name "; -echo "and choose from the search results in order to assure "; -echo "that you do not overlook a variation of the team. "; -echo "(i.e. If you work for a team affiliated with Apple Computer, Inc. it will be more effective "; -echo "to search for \"Apple\" and to choose fromt eh search results than to search for the entire name of the company.)"; -echo "

"; -echo "

"; -echo "Search for a team: "; -echo ""; -echo ""; -echo "
"; -echo "
"; -page_tail(); +function print_teams_display() { + page_head("Teams"); + echo ""; + echo ""; + echo "

BOINC Teams

"; + echo "

"; + echo "BOINC users may form "teams" - "; + echo "for example, students in a school, employees of a company, etc. "; + echo "

"; + echo "Teams may compete against other teams to analyze the most data, "; + echo "or they may meet and discuss BOINC projects via the web. "; + echo "Team members may view their individual records and compare "; + echo "personals statistics with other team members' statistics, in addition "; + echo "to viewing their team's total statistics on the team's statistics page."; + echo "

"; + echo "
"; + echo "To create a team click on the below link. "; + echo "Team founder's have more privileges than normal team members."; + echo "

"; + echo "Create a new team"; + echo "

"; + echo "
"; + echo "
"; + echo "To search for a team type in the team name below and hit the Search button. "; + echo "You may join teams through these team pages."; + echo "

"; + echo "It may be more effective to type in only a portion of the team name "; + echo "and choose from the search results in order to assure "; + echo "that you do not overlook a variation of the team. "; + echo "(i.e. If you work for a team affiliated with Apple Computer, Inc. it will be more effective "; + echo "to search for \"Apple\" and to choose fromt eh search results than to search for the entire name of the company.)"; + echo "

"; + echo "

"; + echo "Search for a team: "; + echo ""; + echo ""; + echo "
"; + echo "
"; + page_tail(); } function display_team_page($team) { - -page_head("$team->name"); -if ($team->name_html != null) { + page_head("$team->name"); + if ($team->name_html != null) { + echo "

"; + echo "$team->name_html"; + } echo "

"; - echo "$team->name_html"; -} -echo "

"; -echo "[id>Join] "; -echo "[id>Quit] "; -echo "[id>Edit*] "; -echo "[id>Remove Inactive Members*] "; -echo "[id>Disband Team*] "; -echo "[id>View Team Emails*]"; -echo "
* Team founder only"; -echo ""; -echo "
"; -echo "
    "; -echo "
  • Anyone may join a team at any time.
  • "; -echo "
  • Likewise, anyone may quit a team at any time.
  • "; -echo "
  • Only the team founder may edit a team's fields (i.e. name, html code, "; -echo "description, etc.).
  • "; -echo "
  • In addition, team founder's have the right of removing inactive members "; -echo "from a team.
  • "; -echo "
  • Only the team founder may disband a team, however, in order to successfully disband a "; -echo "team all members of the team must no longer be members of the team, including the team founder. "; -echo "Then the team founder may go to the team page and disband the team. "; -echo "A team may not be disbanded if it still has members.
  • "; -echo "
  • Finally, the team founder has access to all team members' email addresses.
  • "; -echo "
"; -echo "
"; + echo "[id>Join] "; + echo "[id>Quit] "; + echo "[id>Edit*] "; + echo "[id>Remove Inactive Members*] "; + echo "[id>Disband Team*] "; + echo "[id>View Team Emails*]"; + echo "
* Team founder only"; + echo ""; + echo "
"; + echo "
    "; + echo "
  • Anyone may join a team at any time.
  • "; + echo "
  • Likewise, anyone may quit a team at any time.
  • "; + echo "
  • Only the team founder may edit a team's fields (i.e. name, html code, "; + echo "description, etc.).
  • "; + echo "
  • In addition, team founder's have the right of removing inactive members "; + echo "from a team.
  • "; + echo "
  • Only the team founder may disband a team, however, in order to successfully disband a "; + echo "team all members of the team must no longer be members of the team, including the team founder. "; + echo "Then the team founder may go to the team page and disband the team. "; + echo "A team may not be disbanded if it still has members.
  • "; + echo "
  • Finally, the team founder has access to all team members' email addresses.
  • "; + echo "
"; + echo "
"; -echo "
"; -echo "

"; -echo ""; -echo "
"; -echo "Team Info:
"; -echo ""; -if (strlen($team->description)) { - row("Description: ", $team->description); -} -if (strlen($team->url)) {; - row("Web site: ", "url>http://$team->url"); -} -row("Members: ", $team->nusers); + echo "
"; + echo "

"; + echo "

"; + echo "
"; + echo "Team Info:
"; + echo ""; + if (strlen($team->description)) { + row("Description: ", $team->description); + } + if (strlen($team->url)) {; + row("Web site: ", "url>http://$team->url"); + } + row("Members: ", $team->nusers); -$query = sprintf( - "select * from user where teamid = %d", - $team->id + $query = sprintf( + "select * from user where teamid = %d", + $team->id + ); + $result = mysql_query($query); + $total_credit = 0; + for ($i = 0; $i < $team->nusers; $i++) { + $user = mysql_fetch_object($result); + $total_credit = $total_credit + $user->total_credit; + } + + row("Total Credit: ", $total_credit); + $query = sprintf( + "select * from user where id = %d", + $team->userid ); -$result = mysql_query($query); -$total_credit = 0; -for ($i = 0; $i < $team->nusers; $i++) { + $result = mysql_query($query); $user = mysql_fetch_object($result); - $total_credit = $total_credit + $user->total_credit; -} - -row("Total Credit: ", $total_credit); -$query = sprintf( - "select * from user where id = %d", - $team->userid -); -$result = mysql_query($query); -$user = mysql_fetch_object($result); -row("Founder: ", $user->name); -echo "
"; -echo "

"; -echo ""; -echo "
"; -echo "Team Members:
"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; - -$query = sprintf( - "select * from user where teamid = %d", - $team->id -); -$result = mysql_query($query); - -for ($i = 0; $i < $team->nusers; $i++) { - $user = mysql_fetch_object($result); - $j = $i+1; - echo ""; - echo ""; - echo ""; + row("Founder: ", $user->name); + echo "
NameTotal creditRecent average CPU
time per work unit
Country
$j) $user->name"; - echo "$user->total_credit$user->expavg_time$user->country
"; + echo "

"; + echo ""; + echo "
"; + echo "Team Members:
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; -} -echo "
NameTotal creditRecent average CPU
time per work unit
Country
"; -page_tail(); + + $query = sprintf( + "select * from user where teamid = %d", + $team->id + ); + $result = mysql_query($query); + + for ($i = 0; $i < $team->nusers; $i++) { + $user = mysql_fetch_object($result); + $j = $i+1; + echo "$j) $user->name"; + echo "$user->total_credit"; + echo "$user->expavg_time"; + echo "$user->country"; + echo ""; + } + echo ""; + page_tail(); } function print_team_create_form() { - -page_head("Create Team"); -echo "

Create a BOINC Team

"; -echo ""; -echo "
"; -echo "

"; -echo "Use this form to create a team. "; -echo "

"; -echo "You'll become the first member of the team. "; -echo "Then tell your friends/co-workers/etc. about the team. "; -echo "They may join it using the BOINC "Teams" page. "; -echo "

"; -echo "

"; -echo "

"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
Team name (plain-text version):

 
"; -echo "
This name will be printed as-is and is the name "; -echo "you should use
when searching for your Team."; -echo "
Team name (HTML version):

 
"; -echo "
This name will be printed as HTML source, so you may include any HTML"; -echo "
code that you want. This will only be displayed in your teams' page."; -echo "
If you don't know HTML, just leave this box blank."; -echo "
URL of team web page, if any:
(without "http://")
"; -echo "
This URL will be linked to from the team's page.
Description of team:
Type of team:"; -echo "Club"; -echo "
"; -echo "Small Company (< 50 employees)"; -echo "
"; -echo "Medium Company (50-1000 employees)"; -echo "
"; -echo "Large Company (> 1000 employees)"; -echo "
"; -echo "Primary School"; -echo "
"; -echo "Secondary School"; -echo "
"; -echo "Junior College"; -echo "
"; -echo "University or Department"; -echo "
"; -echo "Government Agency"; -echo "
"; -echo ""; -echo "
"; -page_tail(); + page_head("Create Team"); + echo "

Create a BOINC Team

"; + echo ""; + echo "
"; + echo "

"; + echo "Use this form to create a team. "; + echo "

"; + echo "You'll become the first member of the team. "; + echo "Then tell your friends/co-workers/etc. about the team. "; + echo "They may join it using the BOINC "Teams" page. "; + echo "

"; + echo "

"; + echo "

"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
Team name (plain-text version):

 
"; + echo "
This name will be printed as-is and is the name "; + echo "you should use
when searching for your Team."; + echo "
Team name (HTML version):

 
"; + echo "
This name will be printed as HTML source, so you may include any HTML"; + echo "
code that you want. This will only be displayed in your teams' page."; + echo "
If you don't know HTML, just leave this box blank."; + echo "
URL of team web page, if any:
(without "http://")
"; + echo "
This URL will be linked to from the team's page.
Description of team:
Type of team:"; + echo "Club"; + echo "
"; + echo "Small Company (< 50 employees)"; + echo "
"; + echo "Medium Company (50-1000 employees)"; + echo "
"; + echo "Large Company (> 1000 employees)"; + echo "
"; + echo "Primary School"; + echo "
"; + echo "Secondary School"; + echo "
"; + echo "Junior College"; + echo "
"; + echo "University or Department"; + echo "
"; + echo "Government Agency"; + echo "
"; + echo ""; + echo "
"; + page_tail(); } function print_team_join_form($id) { - -$query = sprintf( - "select * from team where id = %d", - $id -); -$result = mysql_query($query); -if ($result) { - $team = mysql_fetch_object($result); - mysql_free_result($result); -} -$team_name = $team->name; -$team_id = $team->id; -page_head("Join $team_name"); -echo "

Join $team_name

"; -echo ""; -echo "
"; -echo "

Please note before joining or switching to a new team:"; -echo "

    "; -echo "
  • If this is the first team you have ever joined "; -echo "then all of your current credit will be given to this "; -echo "team, in addition to all new credit you receive."; -echo "
  • If you are currently a member of a team "; -echo "and are switching to another team, the new team will receive "; -echo "all of your credits, the old teams total will be decreased by "; -echo "your credit amount."; -echo "
  • Joining a team does not affect your personal credit "; -echo "statistics in any way."; -echo "
  • Joining a team gives your team's founder access to your email address."; -echo "
"; -echo "

"; -echo "
"; -echo "
"; -echo ""; -echo ""; -echo "
"; -echo "
"; -page_tail(); + $query = sprintf( + "select * from team where id = %d", + $id + ); + $result = mysql_query($query); + if ($result) { + $team = mysql_fetch_object($result); + mysql_free_result($result); + } + $team_name = $team->name; + $team_id = $team->id; + page_head("Join $team_name"); + echo "

Join $team_name

"; + echo ""; + echo "
"; + echo "

Please note before joining or switching to a new team:"; + echo "

    "; + echo "
  • If this is the first team you have ever joined "; + echo "then all of your current credit will be given to this "; + echo "team, in addition to all new credit you receive."; + echo "
  • If you are currently a member of a team "; + echo "and are switching to another team, the new team will receive "; + echo "all of your credits, the old teams total will be decreased by "; + echo "your credit amount."; + echo "
  • Joining a team does not affect your personal credit "; + echo "statistics in any way."; + echo "
  • Joining a team gives your team's founder access to your email address."; + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo ""; + echo ""; + echo "
"; + echo "
"; + page_tail(); } function print_team_quit_form($id) { - -$query = sprintf( - "select * from team where id = %d", - $id -); -$result = mysql_query($query); -if ($result) { - $team = mysql_fetch_object($result); - mysql_free_result($result); -} -$team_name = $team->name; -$team_id = $team->id; -page_head("Quit $team_name"); -echo "

Quit $team_name

"; -echo ""; -echo "
"; -echo "

Please note before quitting a team:"; -echo "

    "; -echo "
  • By quitting a team you remove your name from the team listing. "; -echo "Your credit contribution to the team is also removed"; -echo "
  • Even if you quit a team, you may rejoin later, "; -echo "or join any other team you desire "; -echo "
  • Quitting a team does not affect your personal credit "; -echo "statistics in any way."; -echo "
"; -echo "

"; -echo "
"; -echo "
"; -echo ""; -echo ""; -echo "
"; -echo "
"; -page_tail(); + $query = sprintf( + "select * from team where id = %d", + $id + ); + $result = mysql_query($query); + if ($result) { + $team = mysql_fetch_object($result); + mysql_free_result($result); + } + $team_name = $team->name; + $team_id = $team->id; + page_head("Quit $team_name"); + echo "

Quit $team_name

"; + echo ""; + echo "
"; + echo "

Please note before quitting a team:"; + echo "

    "; + echo "
  • By quitting a team you remove your name from the team listing. "; + echo "Your credit contribution to the team is also removed"; + echo "
  • Even if you quit a team, you may rejoin later, "; + echo "or join any other team you desire "; + echo "
  • Quitting a team does not affect your personal credit "; + echo "statistics in any way."; + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo ""; + echo ""; + echo "
"; + echo "
"; + page_tail(); } function print_team_edit_form($id) { - -$query = sprintf( - "select * from team where id = %d", - $id -); -$result = mysql_query($query); -if ($result) { - $team = mysql_fetch_object($result); - mysql_free_result($result); -} -$team_name = $team->name; -$team_id = $team->id; -$team_name_html = $team->name_html; -$team_url = $team->url; -$team_description = $team->description; -$team_type = $team->type; -page_head("Edit $team_name"); -echo "

Edit $team_name

"; -echo ""; -echo "
"; -echo "

Please note before editing a team:"; -echo "

    "; -echo "
  • Only the founder may edit a team"; -echo "
"; -echo "

"; -echo "
"; -echo "
"; -echo ""; -echo "
"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "", ($team->type==9)?" checked":""); -echo "
Team name (plain-text version):

 
"; -echo "
This name will be print as-is"; -echo "
and is the name you should use when searching for your team."; -echo "
Team name (HTML version):

 
"; -echo "
This name will be printed as HTML source, so you may include any HTML"; -echo "
code that you want. This will only be displayed in your team's page."; -echo "
If you don't know HTML, just leave this box blank."; -echo "
URL of team web page, if any:
(without "http://")
"; -echo "
This page will be linked to from the project's team page."; -echo "
Description of team:"; -echo "
Type of team:"; -printf("Club
", ($team->type==4)?" checked":""); -printf("Small Company (< 50 employees)
", ($team->type==1)?" checked":""); -printf("Medium Company (50-1000 employees)
", ($team->type==2)?" checked":""); -printf("Large Company (> 1000 employees)
", ($team->type==3)?" checked":""); -printf("Primary School
", ($team->type==5)?" checked":""); -printf("Secondary School
", ($team->type==6)?" checked":""); -printf("Junior College
", ($team->type==8)?" checked":""); -printf("University or Department
", ($team->type==7)?" checked":""); -printf("Government Agency
"; -echo ""; -echo ""; -page_tail(); + $query = sprintf( + "select * from team where id = %d", + $id + ); + $result = mysql_query($query); + if ($result) { + $team = mysql_fetch_object($result); + mysql_free_result($result); + } + $team_name = $team->name; + $team_id = $team->id; + $team_name_html = $team->name_html; + $team_url = $team->url; + $team_description = $team->description; + $team_type = $team->type; + page_head("Edit $team_name"); + echo "

Edit $team_name

"; + echo ""; + echo "
"; + echo "

Please note before editing a team:"; + echo "

    "; + echo "
  • Only the founder may edit a team"; + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo ""; + echo "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "", ($team->type==9)?" checked":""); + echo "
Team name (plain-text version):

 
"; + echo "
This name will be print as-is"; + echo "
and is the name you should use when searching for your team."; + echo "
Team name (HTML version):

 
"; + echo "
This name will be printed as HTML source, so you may include any HTML"; + echo "
code that you want. This will only be displayed in your team's page."; + echo "
If you don't know HTML, just leave this box blank."; + echo "
URL of team web page, if any:
(without "http://")
"; + echo "
This page will be linked to from the project's team page."; + echo "
Description of team:"; + echo "
Type of team:"; + printf("Club
", ($team->type==4)?" checked":""); + printf("Small Company (< 50 employees)
", ($team->type==1)?" checked":""); + printf("Medium Company (50-1000 employees)
", ($team->type==2)?" checked":""); + printf("Large Company (> 1000 employees)
", ($team->type==3)?" checked":""); + printf("Primary School
", ($team->type==5)?" checked":""); + printf("Secondary School
", ($team->type==6)?" checked":""); + printf("Junior College
", ($team->type==8)?" checked":""); + printf("University or Department
", ($team->type==7)?" checked":""); + printf("Government Agency
"; + echo ""; + echo ""; + page_tail(); } function print_team_remove_inactive_form($id) { + $query = sprintf( + "select * from team where id = %d", + $id + ); + $result = mysql_query($query); + if ($result) { + $team = mysql_fetch_object($result); + mysql_free_result($result); + } + $team_name = $team->name; + $team_id = $team->id; + $nusers = $team->nusers; + page_head("Remove Members from $team_name"); + echo "

Remove members from $team_name

"; + echo ""; + echo "
"; + echo "

Please note:"; + echo "

    "; + echo "
  • Only the founder may remove members from a team"; + echo "
  • By removing a member, you will also remove their credit and CPU time "; + echo "contributions to the team."; + echo "
"; + echo "

"; + echo "
"; + echo "
"; + echo ""; + echo "
"; + echo ""; + echo ""; + echo ""; -$query = sprintf( - "select * from team where id = %d", - $id -); -$result = mysql_query($query); -if ($result) { - $team = mysql_fetch_object($result); - mysql_free_result($result); -} -$team_name = $team->name; -$team_id = $team->id; -$nusers = $team->nusers; -page_head("Remove Members from $team_name"); -echo "

Remove members from $team_name

"; -echo "
Remove?NameTotal
Credit
"; -echo "
"; -echo "

Please note:"; -echo "

    "; -echo "
  • Only the founder may remove members from a team"; -echo "
  • By removing a member, you will also remove their credit and CPU time "; -echo "contributions to the team."; -echo "
"; -echo "

"; -echo "
"; -echo ""; -echo ""; -echo "
"; -echo ""; -echo ""; -echo ""; + $query = sprintf( + "select * from user where teamid = %d", + $team_id + ); + $result = mysql_query($query); -$query = sprintf( - "select * from user where teamid = %d", - $team_id -); -$result = mysql_query($query); - -$ninactive_users = 0; -for ($i = 0; $i < $nusers; $i++) { - $user = mysql_fetch_object($result); - echo ""; - echo ""; - $ninactive_users++; -} -echo ""; -if ($result) { - mysql_free_result($result); -} -echo "
Remove?NameTotal
Credit
id>"; - echo "$user->name$user->total_credit
"; -echo ""; -echo ""; -page_tail(); + $ninactive_users = 0; + for ($i = 0; $i < $nusers; $i++) { + $user = mysql_fetch_object($result); + echo "id>"; + echo "$user->name"; + echo "$user->total_credit"; + $ninactive_users++; + } + echo ""; + if ($result) { + mysql_free_result($result); + } + echo ""; + echo ""; + echo ""; + page_tail(); } function print_team_disband_form($id) { - -$query = sprintf( - "select * from team where id = %d", - $id -); -$result = mysql_query($query); -if ($result) { - $team = mysql_fetch_object($result); - mysql_free_result($result); -} -$team_name = $team->name; -$team_id = $team->id; -page_head("Disband $team_name"); -echo "

Disband $team_name

"; -echo ""; -echo "
"; -echo "

Please note:"; -echo "

    "; -echo "
  • Only the found may disband a team."; -echo "
  • Only teams with no members may be disbanded. The founder of a team "; -echo "may email the members of a team to inform them of the disbanding of the team."; -echo "
  • After a team is disbanded, all members will no longer belong to a team, "; -echo "though they may join another team if desired."; -echo "
  • Disbanding a team is permanent, make sure you know what you're doing!"; -echo "
"; -echo "

"; -echo "Press "Disband Team" when you're ready."; -echo "
"; -echo "
"; -echo ""; -echo ""; -echo "
"; -echo "
"; -page_tail(); + $query = sprintf( + "select * from team where id = %d", + $id + ); + $result = mysql_query($query); + if ($result) { + $team = mysql_fetch_object($result); + mysql_free_result($result); + } + $team_name = $team->name; + $team_id = $team->id; + page_head("Disband $team_name"); + echo "

Disband $team_name

"; + echo ""; + echo "
"; + echo "

Please note:"; + echo "

    "; + echo "
  • Only the found may disband a team."; + echo "
  • Only teams with no members may be disbanded. The founder of a team "; + echo "may email the members of a team to inform them of the disbanding of the team."; + echo "
  • After a team is disbanded, all members will no longer belong to a team, "; + echo "though they may join another team if desired."; + echo "
  • Disbanding a team is permanent, make sure you know what you're doing!"; + echo "
"; + echo "

"; + echo "Press "Disband Team" when you're ready."; + echo "
"; + echo "
"; + echo ""; + echo ""; + echo "
"; + echo "
"; + page_tail(); } ?> diff --git a/html/user/this_user.php b/html/user/this_user.php deleted file mode 100644 index 478804015b..0000000000 --- a/html/user/this_user.php +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/html/user/top_users.php b/html/user/top_users.php new file mode 100644 index 0000000000..d9dee9f5b7 --- /dev/null +++ b/html/user/top_users.php @@ -0,0 +1,14 @@ +\n"; + page_tail(); +?> diff --git a/html/user/user.inc b/html/user/user.inc index e1bddd464a..4cf8a5fcea 100644 --- a/html/user/user.inc +++ b/html/user/user.inc @@ -1,5 +1,35 @@ ".TD2.LG_FONT."User Stats:\n"; + row("User ID: ", $user->id); + $row = sprintf("%s user since: ", $project); + row($row, time_str($user->create_time)); + row("Total credit: ", $user->total_credit); + row("Recent averaged credit: ", $user->expavg_credit); + if ($user->teamid) { + $result = mysql_query("select * from team where id = $user->teamid"); + $team = mysql_fetch_object($result); + row("Team: ", "id>$team->name"); + } else { + row("Team: ", "None"); + } + echo "\n"; +} + +function show_user_profile($user) { + echo TABLE2."\n"; + echo "".TD2.LG_FONT."User Information:\n"; + row("User name: ", $user->name); + row("Email address: ", $user->email_addr); + row("Country: ", $user->country); + row("Postal (ZIP) code: ", $user->postal_code); + echo "Edit User Information\n"; + echo "Change Password\n"; + echo "\n"; +} + function show_hosts($user) { $result = mysql_query("select * from host where userid=$user->id"); while ($host = mysql_fetch_object($result)) { @@ -9,12 +39,16 @@ function show_hosts($user) { mysql_free_result($result); } -function show_user_page($user, $project) { - echo "

Welcome, $user->name!

\n"; +// show a summary of the user. +// NOTE: This is intended to be shown only to that user. +// it has info that other users aren't supposed to see + +function show_user_page_private($user) { + echo "

$user->name

\n"; start_table(); show_user_profile($user); echo "

\n"; - show_user_stats($user, $project); + show_user_stats($user); echo "

\n"; echo "

    "; echo "
  • Host info
  • "; @@ -23,4 +57,20 @@ function show_user_page($user, $project) { echo "
"; } + +function user_table_start() { + echo TABLE." + NameAverage creditTotal credit + Participant since"; +} + +function show_user_row($user) { + echo " + $user->name + $user->expavg_credit + $user->total_credit + ".time_str($user->create_time)." + \n"; +} + ?> diff --git a/html/user/util.inc b/html/user/util.inc index 3d6ffd5dc5..82f8416a41 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -23,7 +23,7 @@ define("BODY_COLOR", " bgcolor=ffffff "); define("NOLOGIN", "Not logged in. Click here to login.\n"); define("BADPASS", "The password you entered is incorrect. Click the Back button on your browser to re-enter your password or try again later."); define("DIFFPASS", "You've typed two different passwords. Click the Back button on your browser to edit your information, making sure you type the same password in both password fields."); -define("PROJECT", "SAMPLE_PROJECT"); +define("PROJECT", "Sample project"); function get_user_from_cookie() { @@ -39,20 +39,25 @@ function show_login($user) { if ($user) { printf("Logged in as %s.\n", $user->name); printf("
Log in as someone else.\n"); - printf("
My %s\n", PROJECT); } else { echo NOLOGIN; } } function page_head($title) { - echo "$title\n"; - echo TABLE."".TITLE_FONT."".PROJECT.": $title\n"; + echo "$title\n"; + + // Put your project title and logo here + + echo "

Sample Project

\n"; + echo "

$title

\n"; } function page_tail() { - echo "
| Create New Account | Login \n"; - echo "| User Page | Teams | Main Project Page |
\n"; + + // put your copyright notice etc. here + + echo "
Copyright (c) 2002 Sample Project\n"; } function date_str($when) { @@ -92,17 +97,4 @@ function print_country_select() { PassThru("/disks/milkyway/a/users/anderson/boinc_cvs/boinc/tools/country_select"); } -function print_page_header($title) { - echo "\n"; - echo "\n"; - echo "$title\n"; - echo "\n"; - echo "\n"; - echo "

\n"; -} - -function print_page_end() { - echo ""; -} - ?>