From abd356127418ef2fdde8bc141b13d9edad9c1a3c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Feb 2004 07:02:38 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2983 --- checkin_notes | 25 +++ html/inc/gallery.inc | 30 +-- html/inc/profile.inc | 8 +- html/inc/util.inc | 8 +- html/ops/gallery.inc | 363 -------------------------------- html/project.sample/project.inc | 5 +- html/user/debug.php | 4 +- html/user/profile_menu.php | 9 +- html/user/project.inc.sample | 7 +- sched/handle_request.C | 1 + 10 files changed, 63 insertions(+), 397 deletions(-) delete mode 100644 html/ops/gallery.inc diff --git a/checkin_notes b/checkin_notes index 823ec8e2af..e26a58344c 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9971,3 +9971,28 @@ David Feb 8 2004 tools_work.php validate.php web_site.php (removed) + +David Feb 9 2004 + - Scheduler: when last work request was too recent, + send request_delay to tell client to wait + - code that generates user profile gallery pages (inc/gallery.inc) + has a nightmare of hardwired URL and path names. + I unraveled things enough to make them work again. + Should revisit at some point. + - page_tail() wasn't working when writing to files + + html/ + inc/ + gallery.inc + profile.inc + util.inc + ops/ + gallery.inc (removed) + project.sample/ + project.inc + user/ + debug.php + profile_menu.php + project.inc.sample + sched/ + handle_request.C diff --git a/html/inc/gallery.inc b/html/inc/gallery.inc index 0becedd7f5..b3a53eab5b 100644 --- a/html/inc/gallery.inc +++ b/html/inc/gallery.inc @@ -56,7 +56,7 @@ function build_picture_pages($width, $height) { $count = 0; for ($page = 1; $page <= $numPages; $page++) { - $file = "../html_user/" . PROFILE_PATH . "user_gallery_" . $page . ".html"; + $file = PROFILE_PATH . "user_gallery_" . $page . ".html"; $descriptor = fopen($file, "w"); page_head("User Picture Gallery: Page $page of $numPages", null, $descriptor); @@ -77,8 +77,8 @@ function build_picture_pages($width, $height) { fwrite($descriptor, "" ); $count++; @@ -96,13 +96,13 @@ function build_picture_pages($width, $height) { write_page_links("user_gallery", $page, $numPages, $descriptor); - page_tail($descriptor); + page_tail(false, $descriptor); fclose($descriptor); } - //echo "

Go to the first generated page."; + //echo "

Go to the first generated page."; } // Creates pages grouping user profiles by country. Filenames are of the @@ -147,11 +147,11 @@ function build_country_pages() { foreach ($countries as $country) { $baseFileName = "profile_country_" . get_legal_filename($country); - $filePath = "../html_user/" . PROFILE_PATH; + $filePath = PROFILE_PATH; build_profile_pages( $countryMembers[$country], "User Profiles from $country", $country, 5, 2, - $filePath, $baseFileName, "../html_user/" + $filePath, $baseFileName, "../html/" ); } @@ -159,7 +159,7 @@ function build_country_pages() { build_country_summary_page($countryMembers); - //echo "
View Summary Page"; + //echo "
View Summary Page"; //echo "

Done"; } @@ -194,7 +194,7 @@ function build_alpha_pages() { foreach ($letters as $letter) { // NOTE: Array indexing is case sensitive. - $filePath = "../html_user/" . PROFILE_PATH; + $filePath = PROFILE_PATH; if (in_array($letter, $alphabet)) { build_profile_pages( $members[$letter], @@ -242,7 +242,7 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col write_page_links($baseFileName, $page, $numPages, $descriptor); - page_tail($descriptor); + page_tail(false, $descriptor); fclose($descriptor); } @@ -251,7 +251,7 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col function build_country_summary_page($countryMembers) { $countries = array_keys($countryMembers); - $filename = "../html_user/" . PROFILE_PATH . "profile_country.html"; + $filename = PROFILE_PATH . "profile_country.html"; $descriptor = fopen($filename, "w"); page_head("User Profiles by Country", null, $descriptor); @@ -271,7 +271,7 @@ function build_country_summary_page($countryMembers) { } fwrite($descriptor, ""); - page_tail($descriptor); + page_tail(false, $descriptor); fclose($descriptor); } @@ -279,7 +279,7 @@ function build_country_summary_page($countryMembers) { function build_alpha_summary_page($characters) { global $alphabet; - $filename = "../html_user/profile_alpha.html"; + $filename = PROFILE_PATH."profile_alpha.html"; $descriptor = fopen($filename, "w"); foreach ($alphabet as $character) { @@ -299,12 +299,12 @@ function build_alpha_summary_page($characters) { } function generate_uod_page($profile, $user) { - $filename = "../html_user/uotd.html"; + $filename = PROFILE_PATH."uotd.html"; $descriptor = fopen($filename, "w"); if ($profile->has_picture) { fwrite($descriptor, - "id>" + "id>" ); } $x = user_links($user); diff --git a/html/inc/profile.inc b/html/inc/profile.inc index b596af1d21..2e0c3aad8b 100644 --- a/html/inc/profile.inc +++ b/html/inc/profile.inc @@ -104,7 +104,7 @@ function show_picture_option() { -"; rowify("
"); row1("User Profile Explorer"); echo "

+

Delete

You have previously uploaded a picture of yourself @@ -380,7 +380,7 @@ function show_user_table( $profile = mysql_fetch_assoc($result); if ($profile['has_picture']) { - write_fd($descriptor, ""); + write_fd($descriptor, ""); } else { write_fd($descriptor, " "); @@ -486,8 +486,8 @@ function show_profile_summary($user, $profile_info, $can_edit, $verify_mode) { // Only display an image if the user has uploaded one; if ($profile_info['has_picture']) { - //echo "id , '.jpg' . "\">id , '_sm.jpg' . "\">\n"; - echo "
id , '.jpg' . "\">\n"; + //echo "id , '.jpg' . "\">id , '_sm.jpg' . "\">\n"; + echo "
id , '.jpg' . "\">\n"; } echo " diff --git a/html/inc/util.inc b/html/inc/util.inc index a59b2d6050..efa9b028b6 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -134,15 +134,15 @@ function page_head($title, $user=null, $fd=null, $styleSheet=null) { project_banner($user, $fd); } -function page_tail($is_main=false) { - echo "

"; +function page_tail($is_main=false, $fd=null) { + write_fd($fd, "

"); if (!$is_main) { - echo "Return to ".PROJECT." main page
\n"; + write_fd($fd, "Return to ".PROJECT." main page
\n"); } // put your copyright notice etc. here - echo "

Copyright © 2004 ".COPYRIGHT_HOLDER."
\n\n"; + write_fd($fd, "

Copyright © 2004 ".COPYRIGHT_HOLDER."
\n\n"); } function db_error_page() { diff --git a/html/ops/gallery.inc b/html/ops/gallery.inc deleted file mode 100644 index c42439a7b7..0000000000 --- a/html/ops/gallery.inc +++ /dev/null @@ -1,363 +0,0 @@ -"; - - // Build an array of IDs of all users with pictures in their profiles. - while ($row = mysql_fetch_array($result, MYSQL_NUM)) { - $userIds[] = $row[0]; - } - - mysql_free_result($result); - - if (count($userIds) > 0) { - // Randomize the ordering of users. - shuffle($userIds); - } - - $numPages = ceil(count($userIds)/($width * $height)); - - // Make sure that a page is generated even when no profiles with pictures - // exist in order to avoid 404 errors from the profile_menu page. - - if ($numPages == 0) { - $numPages = 1; - } - - //echo "Generating $numPages pages.
"; - - $count = 0; - - for ($page = 1; $page <= $numPages; $page++) { - $file = "../html_user/" . PROFILE_PATH . "user_gallery_" . $page . ".html"; - $descriptor = fopen($file, "w"); - - page_head("User Picture Gallery: Page $page of $numPages", null, $descriptor); - - fwrite($descriptor, - "

User Profile Pictures

Last updated " - . pretty_time_str(time()) - . "\n

Browse the user profiles by picture. - Only user profiles with pictures are listed here." - ); - - fwrite($descriptor, "\n"); - - for ($row = 0; $row < $height; $row++) { - fwrite($descriptor, ""); - for ($col = 0; $col < $width; $col++) { - if ($count < $numIds) { - fwrite($descriptor, - "" - ); - $count++; - } - } - fwrite($descriptor, "\n"); - if ($count == $numIds) { - break; - } - } - - fwrite($descriptor, "
\n"); - - // Previous and Next links - - write_page_links("user_gallery", $page, $numPages, $descriptor); - - page_tail($descriptor); - - fclose($descriptor); - - } - - //echo "

Go to the first generated page."; -} - -// Creates pages grouping user profiles by country. Filenames are of the -// format "profile_country__.html" -// Also creates a summary page listing all countries which have profiled -// members, the number of such members, and links to the created pages for -// each country. - -function build_country_pages() { - $query = "SELECT * FROM profile"; - $result = mysql_query($query); - $numIds = 0; - - // Build a multi-dimensional array of countries, - // each element of which contains an array - // of the userids who belong to those countries. - // Format: array[country][index] = userid. - - while ($profile = mysql_fetch_object($result)) { - $query2 = "SELECT * FROM user WHERE id=$profile->userid"; - $result2 = mysql_query($query2); - $row2 = mysql_fetch_object($result2); - - if ($row2->country) { - $countryMembers[$row2->country][] = $row2->id; - $numIds++; - } else { - $countryMembers['Other'][] = $row2->id; - } - } - - mysql_free_result($result); - mysql_free_result($result2); - - //echo "$numIds users have profiles AND non-null country entries.
"; - - $countries = array_keys($countryMembers); - sort($countries); - - // Build the pages. - // TODO: Define a constant for the desired number of rows per page. - - foreach ($countries as $country) { - $baseFileName = "profile_country_" . get_legal_filename($country); - $filePath = "../html_user/" . PROFILE_PATH; - build_profile_pages( - $countryMembers[$country], - "User Profiles from $country", $country, 5, 2, - $filePath, $baseFileName, "../html_user/" - ); - } - - // Build the summary page linking to the individual country pages. - - build_country_summary_page($countryMembers); - - //echo "
View Summary Page"; - //echo "

Done"; - -} - -// Creates pages grouping users by the first letter of their names. - -function build_alpha_pages() { - global $alphabet; - - $query = "SELECT * FROM profile"; - $result = mysql_query($query); - $numIds = 0; - - while ($row = mysql_fetch_assoc($result)) { - $query2 = "SELECT * FROM user WHERE id = " . $row['userid']; - $result2 = mysql_query($query2); - $row2 = mysql_fetch_assoc($result2); - - if ($row2['name']) { - $name = ltrim($row2['name']); - $members[strtoupper($name[0])][] = $row2['id']; - $numIds++; - } - } - - mysql_free_result($result); - mysql_free_result($result2); - - //echo "$numIds users have profiles AND non-null country entries.
"; - - $letters = array_keys($members); - - foreach ($letters as $letter) { - // NOTE: Array indexing is case sensitive. - $filePath = "../html_user/" . PROFILE_PATH; - if (in_array($letter, $alphabet)) { - build_profile_pages( - $members[$letter], - "User Profiles - Names beginning with $letter", - "Names beginning with $letter", 5, 2, $filePath, - "profile_$letter" - ); - } else { - build_profile_pages( - $members[$letter], - "User Profiles - Names beginning with other characters", - "Names beginning with other characters", 5, 2, $filePath, - "profile_other" - ); - } - } - - build_alpha_summary_page($letters); -} - -// A generalized function to produce some number of pages summarizing a -// set of user profiles. - -function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $colsPerPage, $filePath, $baseFileName) { - $numMembers = count($members); - $numPerPage = $rowsPerPage * $colsPerPage; - $numPages = ceil(count($members) / $numPerPage); - - $count = 0; - - for ($page = 1; $page <= $numPages; $page++) { - - $filename = $filePath . $baseFileName . "_" . $page . ".html"; - $descriptor = fopen($filename, "w"); - - $head = $pageHead . ": Page $page of $numPages"; - page_head($pageHead, null, $descriptor); - - fwrite($descriptor, "

$pageTitle

\n"); - fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "

\n"); - - $offset = (($page-1) * $rowsPerPage * $colsPerPage); - - show_user_table($members, $offset, $numPerPage, $colsPerPage, $descriptor); - - write_page_links($baseFileName, $page, $numPages, $descriptor); - - page_tail($descriptor); - fclose($descriptor); - } - -} - -function build_country_summary_page($countryMembers) { - $countries = array_keys($countryMembers); - - $filename = "../html_user/" . PROFILE_PATH . "profile_country.html"; - $descriptor = fopen($filename, "w"); - - page_head("User Profiles by Country", null, $descriptor); - fwrite($descriptor, "

User Profiles by Country

Last updated " . pretty_time_str(time()) . "

"); - - fwrite($descriptor, "\n"); - fwrite($descriptor, "\n"); - - foreach ($countries as $country) { - $numMembers = count($countryMembers[$country]); - $name = get_legal_filename($country); - - fwrite($descriptor, - "\n\n" - ); - } - - fwrite($descriptor, "
CountryProfiles
$country$numMembers
"); - page_tail($descriptor); - - fclose($descriptor); -} - -function build_alpha_summary_page($characters) { - global $alphabet; - - $filename = "../html_user/profile_alpha.html"; - $descriptor = fopen($filename, "w"); - - foreach ($alphabet as $character) { - if (in_array($character, $characters)) { - fwrite($descriptor, "$character "); - unset($characters[$character]); - } else { - fwrite($descriptor, "$character "); - } - } - - // Link to the 'Other' page if necessary. - if (!empty($characters)) { - fwrite($descriptor, "Other "); - } - fclose($descriptor); -} - -function generate_uod_page($profile, $user) { - $filename = "../html_user/uotd.html"; - $descriptor = fopen($filename, "w"); - - if ($profile->has_picture) { - fwrite($descriptor, - "id>" - ); - } - $x = user_links($user); - fwrite($descriptor, "The " . PROJECT . " User of the Day is $x"); - fclose($descriptor); -} - -// see if it's time to pick a new UOD. -// Either way, generate the UOD page -// -function build_uotd_page() { - // Check if the current UOTD has had their 24 hours of fame - if so, pick a new one. - - $result = mysql_query("SELECT * FROM profile ORDER BY uotd_time DESC LIMIT 1"); - if (mysql_num_rows($result) > 0) { - $current_uotd = mysql_fetch_object($result); - $assigned = getdate($current_uotd->uotd_time); - $now = getdate(time()); - if ($assigned['mday'] == $now['mday']) { - $user = lookup_user_id($current_uotd->userid); - generate_uod_page($current_uotd, $user); - exit(); - } - } - // TODO: Verify that adding RAND() didn't screw this up. - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 AND uotd_time IS NULL ORDER BY RAND()"); - - // If the number of approved profiles dips below a threshold, email the sys admin every time we pick a new one. - if ($result && mysql_num_rows($result) < UOTD_THRESHOLD) { - mail(SYS_ADMIN_EMAIL, PROJECT . ": User of the Day pool is running low!", "The pool of approved candidates for User of the Day has reached your assigned threshold: there are now only " . mysql_num_rows($result) . " approved users.\n\nTo approve more candidates for User of the Day, direct your web browser to the " . PROJECT . " administration page and click \"Unrated profile\""); - } - - if ($result && mysql_num_rows($result) == 0) { - // If all verified profiles have been selected as UOTD, reshow the one that was shown least recently. - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 ORDER BY uotd_time ASC LIMIT 1"); - } - - if (!$result || mysql_num_rows($result) == 0) { - // No valid users of the day - do something. - exit(); - } - $profile = mysql_fetch_object($result); - $user = lookup_user_id($profile->userid); - generate_uod_page($profile); - - $sql = "UPDATE profile SET uotd_time = " . time() . " WHERE userid=$user->id"; - mysql_query($sql); - - mail($user->email_addr, - "You're the " . PROJECT . " user of the day!", - "Congratulations!\n\nYou've been chosen as the " - . PROJECT . " user of the day! Your profile will be featured on the " . PROJECT . " website for the next 24 hours. Thanks again for supporting us- it's members like you that make distributed computing projects like ours such a success.\n\nBest regards and much thanks,\n\nThe " . PROJECT . " team." - ); -} - -?> diff --git a/html/project.sample/project.inc b/html/project.sample/project.inc index 8e61082033..6d5f7d3f0f 100644 --- a/html/project.sample/project.inc +++ b/html/project.sample/project.inc @@ -1,4 +1,5 @@ BOINC core client

- The zipped symbol file(s) are for the BOINC core client 2.24 + The zipped symbol file(s) are for the BOINC core client 2.25 (both GUI and CLI versions) are here: - boinc_224_pdb.zip + boinc_225_pdb.zip

Place the extracted file(s) in the same directory as the executable(s) (usually C:/Program Files/BOINC). diff --git a/html/user/profile_menu.php b/html/user/profile_menu.php index b5fa4eeb9e..d42240125c 100644 --- a/html/user/profile_menu.php +++ b/html/user/profile_menu.php @@ -6,7 +6,6 @@ require_once("../inc/profile.inc"); db_init(); -page_head("Profile Zone"); $cmd = $_GET['cmd']; if ($cmd) { @@ -14,6 +13,8 @@ if ($cmd) { exit(); } +page_head("Profile Zone"); + start_table_noborder(); rowify(" @@ -32,15 +33,15 @@ $today = getdate(time()); $UOTD_heading = "User of the Day -- " . $today['month'] . " " . $today['mday'] . ", " . $today['year']; row1($UOTD_heading); echo "

"; -include("uotd.html"); +include("user_profile/uotd.html"); echo "
    -
  • View the User Picture Gallery. -
  • Browse profiles by country. +
  • View the User Picture Gallery. +
  • Browse profiles by country.
  • Browse profiles at random, at random with pictures, or at random without pictures. diff --git a/html/user/project.inc.sample b/html/user/project.inc.sample index 75f478e9c8..f9ccea0700 100644 --- a/html/user/project.inc.sample +++ b/html/user/project.inc.sample @@ -4,13 +4,14 @@ // Modify it to suit your project. // Put your version in html_user/project_specific/project.inc -require_once("util.inc"); +require_once("../inc/util.inc"); define("PROJECT", "Test Project"); define("MASTER_URL", "http://boinc.berkeley.edu/"); define("URL_BASE", ""); -define('IMAGE_PATH', 'images/user_profile/'); -define('PROFILE_PATH', 'user_profile/'); +define('IMAGE_PATH', '../user_profile/images/'); +define('PROFILE_PATH', '../user_profile/'); +define('PROFILE_URL', 'user_profile/'); define('LANGUAGE_FILE', 'languages.txt'); define('STYLESHEET', 'white.css'); define('COPYRIGHT_HOLDER', 'Test Group'); diff --git a/sched/handle_request.C b/sched/handle_request.C index 6dc1c81d41..2aec3dd505 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -1126,6 +1126,7 @@ void process_request( "Not sending work - last RPC too recent: %d sec", (int)diff ); strcpy(reply.message_priority, "low"); + reply.request_delay = config.min_sendwork_interval; } } if (ok_to_send) {