diff --git a/checkin_notes b/checkin_notes
index 198b58b2a3..17b9bdf736 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -6047,3 +6047,19 @@ David 22 Sept 2012
cs_statefile.cpp
script/
boinc-client.in
+
+David 23 Sept 2012
+ - web: add global prefs reset button
+ - change default disk prefs to:
+ - no absolute limit on disk usage (we need to work with future disks)
+ - keep 100 MB min free space
+ - use up to 90% of total space
+
+ html/
+ user/
+ prefs_default.php (new)
+ prefs.php
+ inc/
+ prefs.inc
+ lib/
+ prefs.cpp
diff --git a/html/inc/prefs.inc b/html/inc/prefs.inc
index a3ba79ece5..74c295bf2c 100644
--- a/html/inc/prefs.inc
+++ b/html/inc/prefs.inc
@@ -408,9 +408,9 @@ function get_disk_space_config() {
$dp->disk_max_used_pct = parse_config($config, "
", "".tra("Edit preferences")." | ".tra("Remove")."");
+ row2("
",
+ "".tra("Edit preferences")."
+ | ".tra("Remove")."
+ ");
end_table();
echo "\n";
} else {
@@ -889,7 +892,9 @@ function print_prefs_display_global($user, $columns=false) {
start_table();
prefs_show_global($global_prefs);
$tokens = url_tokens($user->authenticator);
- row2("
", "".tra("Edit preferences")."");
+ row2("
",
+ "".tra("Edit preferences")."
+ ");
end_table();
echo "\n";
@@ -1170,12 +1175,10 @@ function global_prefs_update(&$user, $prefs) {
$query = "update user set global_prefs='$prefs_xml' where id=$user->id";
$retval = mysql_query($query);
if (!$retval) {
- echo tra("Update failed: ").htmlspecialchars($query)."\n";
- echo mysql_error();
- exit();
+ return 1;
}
$user->global_prefs = $prefs_xml;
- return $retval;
+ return 0;
}
function project_prefs_update(&$user, $prefs) {
@@ -1184,8 +1187,11 @@ function project_prefs_update(&$user, $prefs) {
$show_hosts = $user->show_hosts?1:0;
$query = "update user set project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts where id=$user->id";
$retval = mysql_query($query);
+ if (!$retval) {
+ return 1;
+ }
$user->project_prefs = $prefs_xml;
- return $retval;
+ return 0;
}
?>
diff --git a/html/user/prefs.php b/html/user/prefs.php
index bd055e6d0a..f94017d1b7 100644
--- a/html/user/prefs.php
+++ b/html/user/prefs.php
@@ -20,8 +20,6 @@ require_once("../inc/db.inc");
require_once("../inc/util.inc");
require_once("../inc/prefs.inc");
-check_get_args(array("subset", "cols", "updated"));
-
db_init();
$user = get_logged_in_user();
@@ -29,6 +27,7 @@ $user = get_logged_in_user();
$subset = get_str("subset");
$columns = get_int("cols", true);
$updated = get_int("updated", true);
+$defaults = get_int("defaults", true);
page_head(tra("%1 preferences", subset_name($subset)));
if (isset($updated)) {
@@ -40,11 +39,28 @@ if (isset($updated)) {
+ ".tra("Your preferences have been reset to the defaults, and + will take effect when your computer communicates with %1 + or you issue the %2Update%3 command from the BOINC Manager.", + PROJECT, "", "")." +
+ "; +} if ($subset == "global") { print_prefs_display_global($user, $columns); + if (!$defaults) { + show_button( + "prefs_default.php", + "Restore defaults", + "Restore default preferences" + ); + } } else { print_prefs_display_project($user, $columns); } + page_tail(); $cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit diff --git a/html/user/prefs_default.php b/html/user/prefs_default.php new file mode 100644 index 0000000000..5cdf8a62b7 --- /dev/null +++ b/html/user/prefs_default.php @@ -0,0 +1,49 @@ +. + +// reset user's preferences to the defaults + +require_once("../inc/util.inc"); +require_once("../inc/prefs.inc"); + +$confirmed = get_int("confirmed", true); +$user = get_logged_in_user(); + +if (!$confirmed) { + page_head("Confirm reset preferences"); + echo " + You have requested restoring your computing preferences + to the default settings. + Your current preferences will be discarded. + Do you really want to do this? +