diff --git a/checkin_notes b/checkin_notes index 1e495349b8..c6faa9107c 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2707,3 +2707,23 @@ Seth Dec 18 2002 wingui_listctrl.cpp,h (new) wingui_pictrl.cpp,h (new) +David Dec 18 2002 + - Have account create action redirect to a different page + so you don't get "Repost form data" if you go back to it + - Added full support for project-specific preferences. + Logic is encapsulated in project_specific_prefs.inc. + The example lets you choose color scheme + (Tahiti Sunset, Desert Sands) + + html_user/ + account_created.php (new) + project_specific_prefs.inc (new) + create_account_action.php + prefs.inc + prefs.php + prefs_edit_global_form.php + prefs_edit_project_action.php + prefs_edit_project_form.php + util.inc + lib/ + countries.C,h diff --git a/html/user/account_created.php b/html/user/account_created.php new file mode 100644 index 0000000000..638d73d19c --- /dev/null +++ b/html/user/account_created.php @@ -0,0 +1,30 @@ +account key is being emailed to you. +
+ If you are already running the BOINC client: +
+ Select the Add Project command in the BOINC client. + Enter the project URL and your account key. ++ If you aren't running the BOINC client: +
+ Download the BOINC client. + Install and run the client. + Enter the project URL and your account key. ++
+ Your account initially has default preferences + (limits on CPU, disk and network usage). + View or edit these preferences. + "; + + send_auth_email($new_email_addr, $authenticator); + + page_tail(); + +?> diff --git a/html/user/create_account_action.php b/html/user/create_account_action.php index d666b4418e..b8d2feb223 100644 --- a/html/user/create_account_action.php +++ b/html/user/create_account_action.php @@ -53,19 +53,8 @@ function show_error($str) { if (!$result) { show_error("Couldn't create account"); } - page_head("Account created"); - echo "Your account has been created, - and an account key is being emailed to you. -
- If you don't already have it, - download the BOINC client. - Install and run the client, and give it your account key. -
- If you're already running the BOINC client, - select the Add Project command - and give it your account key. -
";
- send_auth_email($new_email_addr, $authenticator);
+ // In success case, redirect to a fixed page so that user can
+ // return to it without getting "Repost form data" stuff
- page_tail();
+ Header("Location: account_created.php");
diff --git a/html/user/prefs.inc b/html/user/prefs.inc
index ee5f17226f..0a705751a9 100644
--- a/html/user/prefs.inc
+++ b/html/user/prefs.inc
@@ -4,11 +4,9 @@
// preferences (global and project).
// Preferences are represented in two ways:
// - As a PHP structure (usually called $prefs)
+// This has fields dont_run_on_batteries, etc.
+// The fields "project_specific" is raw XML
// - As XML (usually called $prefs_xml)
-// Various functions are defined below for converting between these forms,
-// and also to/from HTML form elements
-
-// functions to parse preferences XML into a struct
//
// This XML has the general structure
// ";
echo " ";
echo " \n";
diff --git a/html/user/prefs_edit_project_action.php b/html/user/prefs_edit_project_action.php
index d1d48ef17c..e42b1ff62a 100644
--- a/html/user/prefs_edit_project_action.php
+++ b/html/user/prefs_edit_project_action.php
@@ -13,6 +13,7 @@ if ($user == NULL) {
exit();
}
+no_cache();
page_head("Preferences");
$prefs = prefs_parse($user->project_prefs);
prefs_project_parse_form($prefs);
diff --git a/html/user/prefs_edit_project_form.php b/html/user/prefs_edit_project_form.php
index f2d636b748..b4390aa36b 100644
--- a/html/user/prefs_edit_project_form.php
+++ b/html/user/prefs_edit_project_form.php
@@ -14,8 +14,8 @@ if ($user == NULL) {
}
page_head("Edit project preferences");
parse_str(getenv("QUERY_STRING"));
-$prefs = prefs_parse($user->prefs);
-prefs_form_project($prefs->project, "prefs_edit_project_action.php");
+$prefs = prefs_parse($user->project_prefs);
+prefs_form_project($prefs);
echo " \n";
page_tail();
diff --git a/html/user/project_specific_prefs.inc b/html/user/project_specific_prefs.inc
new file mode 100644
index 0000000000..daf6e8d8bd
--- /dev/null
+++ b/html/user/project_specific_prefs.inc
@@ -0,0 +1,55 @@
+$name\n";
+}
+
+// given struct, show form for editing
+//
+function project_specific_prefs_edit($prefs) {
+ $x = $prefs->color_scheme;
+ echo "\n";
- echo "
".TD2.LG_FONT."Global preferences: \n";
+ echo "".TD2.LG_FONT."Global preferences
+ \n";
if ($prefs->dont_run_on_batteries) {
$batteries = "No";
} else {
@@ -182,9 +191,11 @@ function prefs_show_global($prefs) {
function prefs_show_project($prefs) {
echo "
These apply to all BOINC projects in which you participate\n";
- echo "
";
}
@@ -199,63 +210,62 @@ function print_prefs_display($user) {
// Functions to display preference subsets as forms
//
function prefs_form_global($user, $prefs) {
- echo "\n";
}
function prefs_form_project($prefs) {
- echo "".TD2.LG_FONT."Project preferences: \n";
+ echo "".TD2.LG_FONT."Project preferences
+ \n";
row2a("Resource Share: ", $prefs->resource_share);
- row2a("Project Specific Preferences: ", htmlspecialchars($prefs->project_specific));
+ $prefs = project_specific_prefs_parse($prefs);
+ project_specific_prefs_show($prefs);
echo "
These apply only to this project \n";
echo "Edit project preferences \n";
- echo "
\n";
- echo " \n";
-
- echo " \n";
- echo " Resource share: \n";
-
- echo "
(If projects";
- echo " compete for resources,
this is the fraction of resources you
choose to";
- echo " allocate to this project.)\n";
- echo " \n";
- echo " \n";
- echo " Project-specific preferences: \n";
- echo " \n";
- echo " \n";
- echo " \n
+
\n
+ \n
+ \n";
+ $prefs = project_specific_prefs_parse($prefs);
+ project_specific_prefs_edit($prefs);
+ echo "
+ Resource share: \n
+
+ If you participate in multiple projects,
+
this is the proportion of resources
+
allocated to this project.
+ \n
+ \n
+ \n
+ ";
+}
+
+// QUERY_STRING has already been parsed into variables.
+// Return XML version of project-specific prefs
+//
+function project_specific_prefs_parse_form() {
+ parse_str(getenv("QUERY_STRING"));
+ return "Color scheme: \n
+ \n
+ \n
+ \n
+ \n
+ \n";
+}
+
+// parse XML, fill in struct
+//
+function project_specific_prefs_parse($prefs) {
+ $xml = $prefs->project_specific;
+ $prefs->color_scheme = parse_element($xml, "Color scheme: \n
+ $prefs->color_scheme \n
+
Return to main ".PROJECT." page
\n";
+ echo "
\n";
// put your copyright notice etc. here
- echo "
Copyright (c) 2002 Sample Project\n";
+ echo "
Copyright (c) 2002 ".PROJECT."