account creation

svn path=/trunk/boinc/; revision=879
This commit is contained in:
David Anderson 2003-02-07 09:00:35 +00:00
parent 52935e6e03
commit 93b816cb77
22 changed files with 539 additions and 276 deletions

View File

@ -3115,3 +3115,11 @@ David Feb 4 2003
participate.html
sched/
db_dump.C
David Feb 7 2003
- Changed account creation features quite a bit.
It now bifurcates according to whether this is first project.
Asks for preferences and offers download accordingly.
html_user/
account_setup* (new)

View File

@ -2,25 +2,24 @@
include_once("util.inc");
parse_str(getenv("QUERY_STRING"));
page_head("Account created");
echo "Your account has been created,
and an <b>account key</b> is being emailed to you.
echo "
<h3>Congratulations - your ".PROJECT." account has been created</h3>
<p>
<b>If you are already running the BOINC client:</b>
<blockquote>
Select the <b>Add Project</b> command in the BOINC client.
Enter the project URL and your account key.
</blockquote>
<b>If you aren't running the BOINC client:</b>
<blockquote>
<a href=download.php>Download the BOINC client</a>.
Install and run the client.
Enter the project URL and your account key.
</blockquote>
<p>
Your account initially has default <b>preferences</b>
(limits on CPU, disk and network usage).
<a href=prefs.php>View or edit these preferences</a>.
Your <b>account key</b> has been emailed to $email_addr.
<br>
Please wait until you receive this email (it may take a minute or two).
<form method=post action=login_action.php>
<input type=hidden name=url value=account_setup.php>
<table cellpadding=8>
<tr><td align=right>Copy and paste the account key here:</td>
<td><input name=authenticator size=40></td>
</tr><tr>
<td align=right>and click here:</td>
<td><input type=submit value='OK'></td>
</tr></table>
</form>
";
page_tail();

View File

@ -0,0 +1,27 @@
<?php
require_once("db.inc");
require_once("util.inc");
require_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
require_login($user);
page_head("Account configuration");
echo "
<h3>Account configuration</h3>
".PROJECT." uses the BOINC software system.
<br>BOINC lets you divide your computer time between several
distributed computing projects.
<br>Are you currently participating in other projects that use BOINC?
<p>
<a href=account_setup_nonfirst.php>Yes</a>
<p>
<a href=account_setup_first.php>No</a>
";
page_tail();
?>

View File

@ -0,0 +1,33 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Account configuration");
echo "
<h3>Account configuration</h3>
Thank you for allowing ".PROJECT." to use part of your computer power.
<br>
You control when and how your computer is used.
<br>
We suggest using the defaults -
just go to the bottom and click OK.
";
$prefs = default_prefs();
global_prefs_update($user, $prefs);
project_prefs_update($user, $prefs);
prefs_form_global($user, $prefs, "account_setup_first_project.php");
page_tail();
?>

View File

@ -0,0 +1,56 @@
<?php
require_once("db.inc");
require_once("util.inc");
require_once("download.inc");
db_init();
$authenticator = init_session();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Download BOINC software");
echo "
Your account is now configured according to your preferences
(you can return to our web site to change your preferences later).
<p>
The next step is to download the BOINC software.
Click on the kind of computer that you have to download
the appropriate version of BOINC.
<p>
";
print_download_links();
echo "
<p>
After the download is finished:
<ul>
<li><b>Windows users</b>:
double-click on the downloaded file.
This will install BOINC on your computer.
<li><b>Macintosh OS/X users</b>: xxx
<li><b>Unix and Linux users</b>:
Use gunzip and tar to extract BOINC.
</ul>
When the BOINC software first runs,
it will ask you for a project URL and an account key.
Copy and paste the following:
<ul>
<li>Project URL: <b>".MASTER_URL."</b>
<li>Account key: $user->authenticator
</ul>
That's it - you're done.
Thanks for participating in ".PROJECT.".
Visit our main page for more information.
";
page_tail();
?>

View File

@ -0,0 +1,25 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Account configuration: graphics");
echo "
<h3>Account configuration: graphics</h3>
<br>
".PROJECT." lets you control the following properties of its graphics.
";
$prefs = null;
prefs_form_project($prefs, "account_setup_first_download.php");
page_tail();
?>

View File

@ -0,0 +1,31 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Account configuration");
echo "
<h3>Account configuration</h3>
<br>
You can control how your resources
(computer time and disk space) are divided
among ".PROJECT." and the other BOINC-based projects
in which you participate.
You do this by assigning a <b>resource share</b> to each project.
The resources allocated to a project are proportional to its resource share.
The default resource share is 100.
";
$prefs = prefs_parse($user->project_prefs);
prefs_form_resource($prefs, "account_setup_nonfirst_done.php");
page_tail();
?>

View File

@ -0,0 +1,49 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Account configuration: last step");
echo "
<h3>Account configuration: last step</h3>
Your ".PROJECT." account is now set up.
<br>Now you must tell your computer about it.
<ul>
<li><b>Windows users:</b>
Open the BOINC application window by
double-clicking the BOINC system tray icon.
Choose the 'Add Project' item in the Projects menu.
It will ask you for a project URL and an account key.
<li><b>Macintosh users:</b>
Open the BOINC application window by XXX.
Choose the 'Add Project' item in the Projects menu.
It will ask you for a project URL and an account key.
<li><b>Unix and Linux users:</b>
Quit the BOINC client.
Then run the BOINC client program with the -add_project option.
It will ask you for a project URL and an account key.
</ul>
In each case copy and paste the following:
<ul>
<li>Project URL: <b>".MASTER_URL."</b>
<li>Account key: $user->authenticator
</ul>
That's it - you're done.
Thanks for participating in ".PROJECT.".
Visit our main page for more information.
";
page_tail();
?>

View File

@ -58,4 +58,4 @@ function show_error($str) {
// return to it without getting "Repost form data" stuff
send_auth_email($new_email_addr, $authenticator);
Header("Location: account_created.php");
Header("Location: account_created.php?email_addr=$new_email_addr");

View File

@ -5,19 +5,26 @@ include_once("util.inc");
page_head("Create account");
?>
<h3>Create an account</h3>
<form method=post action=create_account_action.php>
<table cellpadding=8>
<tr><td align=right>
<b>Name or nickname:</b>
<br><font size=-1> Your identifier on our web site. Use your real name or a nickname.</font>
<b>Name:</b>
<br><font size=-1>
This will identify you on our web site.
Use your real name or a nickname.
</font>
</td><td>
<input name=new_name size=30>
</td></tr>
<tr><td align=right>
<b>Email address:</b>
<br><font size=-1>Your <b>account key</b> will be emailed to this address.</font>
<br><font size=-1>
Must be a valid address.
</font>
</td><td>
<input name=new_email_addr size=50>
</td></tr>
@ -38,7 +45,7 @@ page_head("Create account");
<tr><td align=right>
<b>Country:</b>
<br><font size=-1>select the country you wish to represent, if any.</font>
<br><font size=-1>Select the country you wish to represent, if any.</font>
</td><td>
<select name=country>
@ -50,7 +57,8 @@ print_country_select();
</td></tr>
<tr><td align=right>
<b>Postal (ZIP) code:</b>
<b>Postal or ZIP code:</b>
<br><font size=-1>Optional</font>
</td><td>
<input name=postal_code size=20>
</td></tr>

46
html/user/download.inc Normal file
View File

@ -0,0 +1,46 @@
<?php
function platform_downloads($platform, $core_app) {
$result = mysql_query("select * from app_version where platformid=$platform->id and appid=$core_app->id order by version_num desc");
if (!$result) return;
$found = false;
$download_url = parse_config("<download_url>");
echo "<tr><td><b>$platform->name</b></td></tr>\n";
if ($app_version = mysql_fetch_object($result)) {
$filename = parse_element($app_version->xml_doc, "<name>");
if (!$filename) { echo "CAN'T FIND FILENAMEn $app_version->xml_doc\n";}
$version = sprintf(
"<a href=$download_url/$filename>BOINC core client, <b>version %s %.2f</b></a>",
$platform->name,
$app_version->version_num/100
);
echo "<tr><td>$version</td></tr>\n";
//$app_version->md5_cksum";
$found = true;
}
if (!$found)
echo "<tr><td>No version found</td></tr>";
mysql_free_result($result);
}
function print_download_links() {
start_table();
$result = mysql_query("select * from app where name='core client'");
$core_app = mysql_fetch_object($result);
mysql_free_result($result);
$result = mysql_query("select * from platform");
while ($platform = mysql_fetch_object($result)) {
platform_downloads($platform, $core_app);
}
echo "<tr><td><a href=foo.exe>foobar</a></td></tr>";
mysql_free_result($result);
echo "</table>\n";
}
?>

View File

@ -3,49 +3,26 @@
require_once("db.inc");
require_once("util.inc");
function platform_downloads($platform, $core_app) {
$result = mysql_query("select * from app_version where platformid=$platform->id and appid=$core_app->id order by version_num desc");
if (!$result) return;
$found = false;
$download_url = parse_config("<download_url>");
echo "<tr><td><b>$platform->name</b></td></tr>\n";
if ($app_version = mysql_fetch_object($result)) {
$filename = parse_element($app_version->xml_doc, "<name>");
if (!$filename) { echo "CAN'T FIND FILENAMEn $app_version->xml_doc\n";}
$version = sprintf(
"<a href=$download_url/$filename>BOINC core client, <b>version %s %.2f</b></a>",
$platform->name,
$app_version->version_num/100
);
echo "<tr><td>$version</td></tr>\n";
//$app_version->md5_cksum";
$found = true;
}
if (!$found)
echo "<tr><td>No version found</td></tr>";
mysql_free_result($result);
}
$authenticator = init_session();
db_init();
page_head("Download the BOINC client");
start_table();
$result = mysql_query("select * from app where name='core client'");
$core_app = mysql_fetch_object($result);
mysql_free_result($result);
$result = mysql_query("select * from platform");
while ($platform = mysql_fetch_object($result)) {
platform_downloads($platform, $core_app);
}
mysql_free_result($result);
echo "</table>\n<p>\n";
echo "
To participate in ".PROJECT." you must
install BOINC* software on your computer.
<p>
If BOINC is already installed on your computer,
<a href=prefs_edit_form.php>finish setting up your account</a>.
<p>
Otherwise <a href=download.php>download BOINC</a>.
<p>
<font size=-1>
*BOINC is distributed computing software
developed at the University of California by
the SETI@home project.
</font>
";
print_download_links();
page_tail();
?>

View File

@ -6,22 +6,6 @@ require_once("user.inc");
page_head("Account key");
echo "<h2>Get your ".PROJECT." account key</h2>
<p>
<b>
In order to protect your account from modification by others,
we require both your account key for access.
</b>
<ul>
<li>Do not give this account key out to anybody! If you get an
e-mail requesting your account key, please ignore it - it's not from us.
<li>The e-mail address you enter below is where we'll send the
account key. It should be the same address you enter to log into
".PROJECT.". If they aren't the same, we cannot send the account
key for both security and administrative reasons.
<li>If your BOINC login is not a valid email address, we
unfortunately cannot help you access your account or your credits.
You will need to create a new account with a valid e-mail address
to access any future credit.
</ul>
<br clear=all>
<table width=600 border=0 cellpadding=0 cellspacing=0><tr><td>
@ -31,8 +15,8 @@ echo "<h2>Get your ".PROJECT." account key</h2>
</form>
</table>
<p>
Your account key will be sent by e-mail to the address you
entered - you should receive it in a few minutes.<p>";
Your account key will be emailed to this address.
You should receive it in a few minutes.<p>";
page_tail();

View File

@ -6,58 +6,16 @@
page_head("Home page");
?>
<h3>What we're doing</h3>
The Astropulse project, based at UC Berkeley,
uses the idle time of thousands of computers to
analyze radio telescope signals.
Astropulse uses <a href=http://boinc.berkeley.edu>BOINC</a>,
which allows you to participate in other
distributed computing projects at the same time.
<h3>How to join Astropulse</h3>
<ul>
<li>
First, <a href=create_account_form.php>create an account</a>.
You will be asked for your email address.
An <b>account key</b> will be emailed to you.
<li> If you don't already have it,
<a href=download.php>download the BOINC client</a>.
Install and run the client, and give it your account key.
<li> If you're already running the BOINC client,
select the <b>Add project</b> command
and give it your account key.
<p>
<a href=create_account_form.php>Create an account</a>.
</ul>
<h3>Instructions for beta testers</h3>
When you install and run the BOINC client,
it will ask you for a project URL and account key.
Then it should download two work units,
process them, upload the results,
and continue doing this forever.
<p>
If at any point BOINC is neither computing nor transferring files,
something is probably wrong;
submit a bug report (see below).
<p>
<b>Windows users</b>:
The BOINC core client (accessable via its system tray icon)
has tabs that let you see projects, file transfers,
work in progress, and messages.
If you experience bugs, look at the file <b>stderr.txt</b>
in the BOINC directory.
If it's nonempty please include it in your bug report.
<p>
<b>Unix and Mac OS/X users</b>:
This version of the client has no GUI,
and writes to stderr and stdout.
Please include any suspicious-looking text in your bug reports.
<p>
Please report bugs by sending email to the boinc-beta
mailing list on SourceForge.net.
To join this list, go to
<a href=http://lists.sourceforge.net/lists/listinfo/boinc-beta>http://lists.sourceforge.net/lists/listinfo/boinc-beta</a>.
<h3>Returning participants</h3>
<ul>
<li><a href=login_form.php>Log in</a>

View File

@ -6,14 +6,14 @@
$authenticator = init_session();
db_init();
$authenticator = $HTTP_POST_VARS["authenticator"];
$email_addr = $HTTP_POST_VARS["email_addr"];
$password = $HTTP_POST_VARS["password"];
//$email_addr = $HTTP_POST_VARS["email_addr"];
//$password = $HTTP_POST_VARS["password"];
if (strlen($authenticator)) {
$query = "select * from user where authenticator='$authenticator'";
} else if (strlen($email_addr)) {
$query = "select * from user where email_addr='$email_addr'";
} else {
echo "NO SELECTION";
//} else if (strlen($email_addr)) {
// $query = "select * from user where email_addr='$email_addr'";
//} else {
// echo "NO SELECTION";
}
$result = mysql_query($query);
if ($result) {
@ -22,17 +22,21 @@
}
if (!$user) {
page_head("Log in");
echo "There is no account with the account key or email address you have entered.\n";
echo "<b>Click <b>Back</b> to try again.\n";
} else if (strlen($password)) {
page_head("Log in");
if ($user->web_password != $HTTP_POST_VARS["existing_password"]) {
echo "Bad password.";
}
echo "
We have no account with the account key '$authenticator'.
<br>Click <b>Back</b> to try again.
";
page_tail();
//} else if (strlen($password)) {
// page_head("Log in");
// if ($user->web_password != $HTTP_POST_VARS["existing_password"]) {
// echo "Bad password.";
// }
} else {
$_SESSION["authenticator"] = $user->authenticator;
page_head("User Page");
show_user_page_private($user);
$url = $HTTP_POST_VARS["url"];
Header("Location: $url");
//page_head("User Page");
//show_user_page_private($user);
}
page_tail();
?>

View File

@ -78,12 +78,6 @@ function element_end($parser, $name) {
case "confirm_before_connecting":
$parse_result->confirm_before_connecting = 1;
break;
case "run_minimized":
$parse_result->run_minimized = 1;
break;
case "run_on_startup":
$parse_result->run_on_startup = 1;
break;
case "low_water_days":
$parse_result->low_water_days = $text;
break;
@ -129,24 +123,27 @@ function char_handler($parser, $x) {
$text = $text.$x;
}
function default_prefs() {
$p = null;
$p->dont_run_on_batteries = 1;
$p->dont_run_if_user_active = 1;
$p->confirm_before_connecting = 0;
$p->low_water_days = 1;
$p->high_water_days = 3;
$p->disk_max_used_gb = 1000;
$p->disk_max_used_pct = 50;
$p->disk_min_free_gb = 1;
$p->resource_share = 100;
$p->show_email = 0;
$p->send_email = 1;
return $p;
}
function prefs_parse($prefs_xml) {
global $parse_result;
$parse_result = null;
$parse_result->dont_run_on_batteries = 0;
$parse_result->dont_run_if_user_active = 0;
$parse_result->confirm_before_connecting = 0;
$parse_result->run_minimized = 0;
$parse_result->run_on_startup = 0;
$parse_result->low_water_days = 1;
$parse_result->high_water_days = 3;
$parse_result->disk_max_used_gb = 1000;
$parse_result->disk_max_used_pct = 50;
$parse_result->disk_min_free_gb = 1;
$parse_result->resource_share = 1;
$parse_result->show_email = 1;
$parse_result->send_email = 1;
$parse_result = default_prefs();
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
@ -166,17 +163,24 @@ function prefs_show_global($prefs) {
echo "<table width=580 cellpadding=4>\n";
echo "<tr>".TD2.LG_FONT."<b>Global preferences</b></font>
<br><font size=-1>These apply to all BOINC projects in which you participate</font></td></tr>\n";
$batteries = $prefs->dont_run_on_batteries?"No":"Yes";
$in_use = $prefs->dont_run_if_user_active?"No":"Yes";
$confirm = $prefs->confirm_before_connecting?"Yes":"No";
$minimized = $prefs->run_minimized?"Yes":"No";
$startup = $prefs->run_on_startup?"Yes":"No";
if ($prefs->dont_run_on_batteries) {
$batteries = "No";
} else {
$batteries = "Yes";
}
if ($prefs->dont_run_if_user_active) {
$in_use = "No";
} else {
$in_use = "Yes";
}
if ($prefs->confirm_before_connecting) {
$confirm = "Yes";
} else {
$confirm = "No";
}
row2a("<b>Work if computer on batteries: </b>", $batteries);
row2a("<b>Work if computer in use: </b>", $in_use);
row2a("<b>Confirm before connecting to network: </b>", $confirm);
row2a("<b>Run minimized: </b>", $minimized);
row2a("<b>Run on startup: </b>", $startup);
row2a("<b>Minimum amount of work to buffer: </b>", "$prefs->low_water_days days");
row2a("<b>Maximum amount of work to buffer: </b>", "$prefs->high_water_days days");
@ -195,86 +199,104 @@ function prefs_show_project($prefs) {
echo "<tr>".TD2.LG_FONT."<b>Project preferences</b></font>
<br><font size=-1>These apply only to this project</font></td></tr>\n";
row2a("<b>Resource Share: </b>", $prefs->resource_share);
$prefs = project_specific_prefs_parse($prefs);
$prefs = project_specific_prefs_parse($prefs->project_specific);
project_specific_prefs_show($prefs);
echo "<tr><td><a href=prefs_edit_project_form.php>Edit project preferences</a></td></tr>\n";
echo "</table>";
}
function print_prefs_display($user) {
prefs_show_global(prefs_parse($user->global_prefs));
prefs_show_project(prefs_parse($user->project_prefs));
prefs_show_resource(prefs_parse($user->project_prefs));
prefs_show_global(prefs_parse($user->global_prefs));
}
////////////////////////////////////////////
//
// Functions to display preference subsets as forms
//
function prefs_form_global($user, $prefs) {
echo "<form action=prefs_edit_global_action.php>\n
<table cellpadding=6>\n
<tr>\n
<td align=right>Don't run if computer is on batteries</td>\n";
printf(" <td><input type=checkbox name=dont_run_on_batteries %s></td>\n", $prefs->dont_run_on_batteries?"checked":"");
echo " </tr>\n
<tr>\n
<td align=right>Don't run if user is active</td>\n";
printf(" <td><input type=checkbox name=dont_run_if_user_active %s></td>\n", $prefs->dont_run_if_user_active?"checked":"");
echo " </tr>\n
<tr>\n
<td align=right>Confirm before connecting</td>\n";
printf(" <td><input type=checkbox name=confirm_before_connecting %s></td>\n", $prefs->confirm_before_connecting?"checked":"");
echo " </tr>\n
<tr>\n
<td align=right>Run minimized</td>\n";
printf(" <td><input type=checkbox name=run_minimized %s></td>\n", $prefs->run_minimized?"checked":"");
echo " </tr>\n
<tr>\n
<td align=right>Run on startup</td>\n";
printf(" <td><input type=checkbox name=run_on_startup %s></td>\n", $prefs->run_on_startup?"checked":"");
echo " </tr>\n
<tr>\n
<td align=right>Minimum amount of work to buffer</td>\n";
printf(" <td><input size=5 name=low_water_days value='$prefs->low_water_days'> days</td>\n");
echo " </tr>\n
<tr>\n
<td align=right>Maximum amount of work to buffer</td>\n";
printf(" <td><input size=5 name=high_water_days value='$prefs->high_water_days'> days</td>\n");
echo " </tr>\n
<tr>\n
<td align=right>Maximum disk space allowed<br>to be used for BOINC</td>\n
<td><input size=7 name=disk_max_used_gb value='$prefs->disk_max_used_gb'> Gbytes</td>\n
</tr>\n
<tr>\n
<td align=right>Minimum disk space to leave free</td>\n
<td><input size=7 name=disk_min_free_gb value='$prefs->disk_min_free_gb'> Gbytes</td>\n
</tr>\n
<tr>\n
<td align=right>Maximum % of disk space to<br>use for BOINC</td>\n
<td><input size=5 name=disk_max_used_pct value='$prefs->disk_max_used_pct'></td>\n
</tr>\n
</table>\n
<input type=submit value=\"Edit Preferences\">\n
</form>\n";
function prefs_form_global($user, $prefs, $next_url) {
echo "<form action=prefs_edit_global_action.php>
<input type=hidden name=next_url value=$next_url>
<table cellpadding=6>
<tr>
<td align=right>Should ".PROJECT." run while computer is on batteries?
<br><font size=-1>(This matters only for portable computers)</font>
</td><td valign=top>
";
printf("Yes <input type=radio name=dont_run_on_batteries %s>\n", $prefs->dont_run_on_batteries?"":"checked");
printf("No <input type=radio name=dont_run_on_batteries %s>\n", $prefs->dont_run_on_batteries?"checked":"");
echo "</td></tr>
<tr>
<td align=right>Should ".PROJECT." run while you're using the computer?
</td><td valign=top>
";
printf("Yes <input type=radio name=dont_run_if_user_active %s>\n", $prefs->dont_run_if_user_active?"":"checked");
printf("No <input type=radio name=dont_run_if_user_active %s>\n", $prefs->dont_run_if_user_active?"checked":"");
echo "</td></tr>
<tr>
<td align=right>Wait for your OK before connecting to Internet?
<br><font size=-1>(This matters only if you use a modem)</font>
</td><td valign=top>
";
printf("Yes <input type=radio name=confirm_before_connecting %s>\n", $prefs->confirm_before_connecting?"checked":"");
printf("No <input type=radio name=confirm_before_connecting %s>\n", $prefs->confirm_before_connecting?"":"checked");
echo "</td></tr>
<tr>
<td align=right>Keep enough to work on disk to last between
</td><td>
<input size=5 name=low_water_days value='$prefs->low_water_days'>
and
<input size=5 name=high_water_days value='$prefs->high_water_days'> days
</td></tr>
<tr><td colspan=2>
You can limit the disk space used by ".PROJECT." in three different ways:
</td></tr>
<tr>
<td align=right valign=top>Use no more than</td>
<td><input size=7 name=disk_max_used_gb value='$prefs->disk_max_used_gb'> Gbytes</td>
</tr>
<tr>
<td align=right valign=top>Leave at least</td>
<td><input size=7 name=disk_min_free_gb value='$prefs->disk_min_free_gb'> Gbytes free</td>
</tr>
<tr>
<td align=right valign=top>Use no more than</td>
<td><input size=5 name=disk_max_used_pct value='$prefs->disk_max_used_pct'> % of total space</td>
</tr>
<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
</table>
</form>
";
}
function prefs_form_project($prefs) {
echo "<form action=prefs_edit_project_action.php>\n
<table cellpadding=6>\n
<tr>\n
<td align=right><b>Resource share:</b><br><font size=-1>
If you participate in multiple projects,
<br>this is the proportion of resources
<br>allocated to this project.
</font></td>\n
<td><input name=resource_share value='$prefs->resource_share'></td>\n
</tr>\n";
$prefs = project_specific_prefs_parse($prefs);
project_specific_prefs_edit($prefs);
echo "
<tr><td><br></td><td><input type=submit value=OK></td></tr>\n
</table>\n
</form>\n";
function prefs_form_resource($prefs_xml, $next_url) {
$prefs = project_specific_prefs_parse($prefs_xml);
echo "<form action=prefs_edit_resource_action.php>
<input type=hidden name=next_url value=$next_url>
<table cellpadding=6>
<tr>
<td align=right><b>Resource share:</b>
<font size=-1><br>The proportion of your resources
<br>allocated to ".PROJECT.".</font></td>
<td><input name=resource_share value='$prefs->resource_share'></td>
<tr><td><br></td><td><input type=submit value=OK></td></tr>
</tr></table></form>
";
}
function prefs_form_project($prefs_xml, $next_url) {
$prefs = project_specific_prefs_parse($prefs_xml);
echo "<form action=prefs_edit_project_action.php>
<input type=hidden name=next_url value=$next_url>
<table cellpadding=6>
";
project_specific_prefs_edit($prefs);
echo "
<tr><td><br></td><td><input type=submit value=OK></td></tr>
</table>
</form>
";
}
////////////////////////////////////////////
@ -286,8 +308,6 @@ function prefs_global_parse_form(&$prefs) {
$prefs->dont_run_on_batteries = isset($dont_run_on_batteries)?1:0;
$prefs->dont_run_if_user_active = isset($dont_run_if_user_active)?1:0;
$prefs->confirm_before_connecting = isset($confirm_before_connecting)?1:0;
$prefs->run_minimized = isset($run_minimized)?1:0;
$prefs->run_on_startup = isset($run_on_startup)?1:0;
$prefs->low_water_days = $low_water_days;
$prefs->high_water_days = $high_water_days;
$prefs->disk_max_used_gb = $disk_max_used_gb;
@ -295,12 +315,16 @@ function prefs_global_parse_form(&$prefs) {
$prefs->disk_min_free_gb = $disk_min_free_gb;
}
function prefs_project_parse_form(&$prefs) {
function prefs_resource_parse_form(&$prefs) {
parse_str(getenv("QUERY_STRING"));
$prefs->resource_share = $resource_share;
}
function prefs_project_parse_form(&$prefs) {
$prefs->project_specific = project_specific_prefs_parse_form();
}
////////////////////////////////////////////
//
// convert prefs from structure to XML
@ -308,29 +332,23 @@ function prefs_project_parse_form(&$prefs) {
function global_prefs_make_xml($prefs) {
$xml = "<global_preferences>\n";
$now = time();
$xml = $xml." <mod_time>$now</mod_time>\n";
$xml = $xml."<mod_time>$now</mod_time>\n";
if ($prefs->dont_run_on_batteries) {
$xml = $xml." <dont_run_on_batteries/>\n";
$xml = $xml."<dont_run_on_batteries/>\n";
}
if ($prefs->dont_run_if_user_active) {
$xml = $xml." <dont_run_if_user_active/>\n";
$xml = $xml."<dont_run_if_user_active/>\n";
}
if ($prefs->confirm_before_connecting) {
$xml = $xml." <confirm_before_connecting/>\n";
$xml = $xml."<confirm_before_connecting/>\n";
}
if ($prefs->run_minimized) {
$xml = $xml." <run_minimized/>\n";
}
if ($prefs->run_on_startup) {
$xml = $xml." <run_on_startup/>\n";
}
$xml = $xml
." <low_water_days>$prefs->low_water_days</low_water_days>\n"
." <high_water_days>$prefs->high_water_days</high_water_days>\n";
$xml = $xml
." <disk_max_used_gb>$prefs->disk_max_used_gb</disk_max_used_gb>\n"
." <disk_max_used_pct>$prefs->disk_max_used_pct</disk_max_used_pct>\n"
." <disk_min_free_gb>$prefs->disk_min_free_gb</disk_min_free_gb>\n";
$xml = $xml."<low_water_days>$prefs->low_water_days</low_water_days>
<high_water_days>$prefs->high_water_days</high_water_days>
";
$xml = $xml."<disk_max_used_gb>$prefs->disk_max_used_gb</disk_max_used_gb>
<disk_max_used_pct>$prefs->disk_max_used_pct</disk_max_used_pct>
<disk_min_free_gb>$prefs->disk_min_free_gb</disk_min_free_gb>
";
$xml = $xml."</global_preferences>\n";
return $xml;
}

View File

@ -0,0 +1,24 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
page_head("Edit preferences");
parse_str(getenv("QUERY_STRING"));
$prefs = prefs_parse($user->project_prefs);
prefs_form_project($prefs);
$prefs = prefs_parse($user->global_prefs);
prefs_form_global($user, $prefs);
echo "<p>\n";
page_tail();
?>

View File

@ -4,23 +4,19 @@ include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
$authenticator = init_session();
db_init();
$authenticator = init_session();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
parse_str(getenv("QUERY_STRING"));
page_head("Preferences");
$prefs = prefs_parse($user->prefs);
prefs_global_parse_form($prefs);
global_prefs_update($user, $prefs);
echo "<table width=780><tr><td>";
echo "</td></tr></table>";
print_prefs_display($user);
echo "<p>\n";
page_tail();
Header("Location: $next_url");
?>

View File

@ -4,6 +4,8 @@ include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
parse_str(getenv("QUERY_STRING"));
$authenticator = init_session();
db_init();
@ -14,12 +16,9 @@ if ($user == NULL) {
}
no_cache();
page_head("Preferences");
$prefs = prefs_parse($user->project_prefs);
prefs_project_parse_form($prefs);
project_prefs_update($user, $prefs);
print_prefs_display($user);
echo "<p>\n";
page_tail();
Header("Location: $next_url");
?>

View File

@ -0,0 +1,24 @@
<?php
include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
parse_str(getenv("QUERY_STRING"));
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
if ($user == NULL) {
print_login_form();
exit();
}
no_cache();
$prefs = prefs_parse($user->project_prefs);
prefs_resource_parse_form($prefs);
project_prefs_update($user, $prefs);
Header("Location: $next_url");
?>

View File

@ -48,8 +48,7 @@ function project_specific_prefs_show($prefs) {
// parse XML, fill in struct
//
function project_specific_prefs_parse($prefs) {
$xml = $prefs->project_specific;
$prefs->color_scheme = parse_element($xml, "<color_scheme>");
function project_specific_prefs_parse($prefs_xml) {
$prefs->color_scheme = parse_element($prefs_xml, "<color_scheme>");
return $prefs;
}

View File

@ -28,11 +28,9 @@ define("MASTER_URL", "http://maggie.ssl.berkeley.edu/ap/");
//
function send_auth_email($email_addr, $auth) {
mail($email_addr, PROJECT." new account confirmation",
"This email confirms the creation of your account with ".PROJECT.",
a distributed computing project based on BOINC.\n
The URL for this project: ".MASTER_URL."
"This email confirms the creation of your ".PROJECT." account.
".PROJECT." URL: ".MASTER_URL."
Your account key: $auth\n
Copy and paste these into the BOINC client when prompted.\n
Please save this email, as you will need the account key
to access your account on the ".PROJECT." web site."
);
@ -87,16 +85,16 @@ function page_head($title) {
// Put your project title and logo here
echo "<h2>".PROJECT."</h2><hr>\n";
echo "<h3>$title</h3>\n";
//echo "<h3>$title</h3>\n";
}
function page_tail() {
echo "<br><hr><center><a href=index.php>Return to main ".PROJECT." page</a><br>\n";
echo "<br><hr><center><a href=index.php>Return to ".PROJECT." main page</a><br>\n";
// put your copyright notice etc. here
echo "<br><br>Copyright (c) 2002 ".PROJECT."</center>\n";
echo "<br><br>Copyright (c) 2003 ".PROJECT."</center>\n";
}
function date_str($when) {