From 661d90aa7aacc9375a7a2fdbea811b98f337172a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 7 Nov 2003 19:52:48 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2642 --- checkin_notes | 18 +++- html/ops/db_ops.inc | 3 + html/user/index.php | 5 +- html/user/login_action.php | 5 +- html/user/prefs.inc | 165 ++++++++++++++++++++++--------------- html/user/util.inc | 5 +- 6 files changed, 129 insertions(+), 72 deletions(-) diff --git a/checkin_notes b/checkin_notes index db04d76ee2..c7051b9b5f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7563,8 +7563,24 @@ Eric 7 Nov 2003 David 6 Nov 2003 (note: Eric's on the other side of the Int. Date Line) - Fixed bug that cause CPU time to jump whenever Get Preferences. It's because the app is getting a new aid.wu_cpu_time - as part of reread_prefs; this is incorrectly added to the thread's CPU time. + as part of reread_prefs; + this is incorrectly added to the thread's CPU time. Solution: make a copy of aid.wu_cpu_time at startup and use the copy. api/ boinc_api.C + +David 7 Nov 2003 + - Added "remember authenticator" checkbox to user login + (sends cookie with 1 year expiration) + - General preferences use defined symbols so field descriptions + are same in both display and edit versions + - In admin web interface, make SQL clauses feature work + + html_ops/ + db_ops.inc + html_user/ + index.php + login_action.php + prefs.inc + util.inc diff --git a/html/ops/db_ops.inc b/html/ops/db_ops.inc index 199f76c43a..deff75a5e1 100644 --- a/html/ops/db_ops.inc +++ b/html/ops/db_ops.inc @@ -136,6 +136,9 @@ function build_sql_query() { $q->addeqnz('server_state'); $q->addeqnz('outcome'); $q->addeqnz('client_state'); + if ($_GET['clauses']) { + $q->add($_GET['clauses']); + } $q->addsort('sort_by'); return $q; diff --git a/html/user/index.php b/html/user/index.php index 9ac08fc355..6844b5f1ab 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -3,8 +3,9 @@ require_once("util.inc"); require_once("project_specific/project.inc"); - init_session(); - page_head("Home page"); + db_init(); + $user = get_logged_in_user(false); + page_head("Home page", $user); project_intro(); diff --git a/html/user/login_action.php b/html/user/login_action.php index 33c569fbb6..e27a6df31c 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -26,9 +26,12 @@ if (split_munged_email_addr($user->email_addr, $authenticator, $email)) { mysql_query("update user set email_addr='$email' where id=$user->id"); } - $_SESSION["authenticator"] = $user->authenticator; + $_SESSION["authenticator"] = $authenticator; $next_url = $_POST["next_url"]; if (strlen($next_url) == 0) $next_url = "home.php"; + if ($_GET['send_cookie']) { + setcookie('auth', $authenticator, time()+3600*24*365); + } Header("Location: $next_url"); } ?> diff --git a/html/user/prefs.inc b/html/user/prefs.inc index 7ccc7fa601..4fdc7d92f1 100644 --- a/html/user/prefs.inc +++ b/html/user/prefs.inc @@ -5,7 +5,7 @@ // Preferences are represented in two ways: // - As a PHP structure (usually called $prefs) // This has fields run_on_batteries, etc. -// The fields "project_specific" is raw XML +// The fields "project_specific" is plain XML // - As XML (usually called $prefs_xml) // // This XML has the general structure @@ -40,6 +40,44 @@ include_once("project_specific/project_specific_prefs.inc"); +// strings describing various preference fields +// +define("RUN_ON_BATTERIES_DESC", + "Do work while computer is running on batteries? +
(matters only for portable computers)" +); +define("RUN_IF_USER_ACTIVE_DESC", + "Do work while computer is in use?" +); +define("IDLE_TIME_TO_RUN_DESC", "Do work only after computer is idle for"); +define("IDLE_TIME_TO_RUN_DESC2", "
(applies only if above is 'no')"); +define("START_END_DESC", "Do work only between the hours of"); +define("START_END_DESC2", "
(no restriction if equal)"); +define("CONFIRM_BEFORE_CONNECTING_DESC", + "Confirm before connecting to Internet? +
(matters only if you use a modem)" +); +define("HANGUP_IF_DIALED_DESC", + "Disconnect when done? +
(matters only if you use a modem)" +); +define("CONFIRM_EXECUTABLE_DESC", + "Confirm before accepting executable file? +
(currently implemented only on Unix/Linux)" +); +define("WORK_BUF_DESC", "Keep enough work on disk to last between"); +define("MAX_CPUS_DESC", "On multiprocessors, use at most"); +define("MAX_CPUS_DESC2", "processors"); +define("DISK_INTERVAL_DESC", "Write to disk at most every"); +define("DISK_LIMIT_DESC", "Limits on disk space used by BOINC:"); +define("DISK_MAX_USED_GB_DESC", "Use no more than"); +define("DISK_MIN_FREE_GB_DESC", "Leave at least"); +define("DISK_MAX_USED_PCT_DESC", "Use no more than"); +define("DISK_MAX_USED_PCT_DESC2", "% of total space"); +define("NETWORK_LIMIT_DESC", "Limits on network bandwidth used by BOINC:"); +define("MAX_BYTES_SEC_DOWN_DESC", "Maximum bytes/sec download:"); +define("MAX_BYTES_SEC_UP_DESC", "Maximum bytes/sec upload:"); + global $text; global $parse_result; global $top_parse_result; @@ -290,32 +328,34 @@ function hour_select($x, $name) { // display preference subsets // function prefs_show_global($prefs) { - row2("Do work if running on batteries?", $prefs->run_on_batteries?"Yes":"No"); - row2("Do work if computer in use?", $prefs->run_if_user_active?"Yes":"No"); + row2(RUN_ON_BATTERIES_DESC, $prefs->run_on_batteries?"yes":"no"); + row2(RUN_IF_USER_ACTIVE_DESC, $prefs->run_if_user_active?"yes":"no"); if (!$prefs->run_if_user_active) { - row2("Idle time before running", "$prefs->idle_time_to_run minutes"); + row2(IDLE_TIME_TO_RUN_DESC, "$prefs->idle_time_to_run minutes"); } if ($prefs->start_hour == $prefs->end_hour) { - $x = "no restriction"; + $x = "(no restriction)"; } else { $s = hour_str($prefs->start_hour); $e = hour_str($prefs->end_hour); $x = "$s and $e"; } - row2("Use my computer only between", $x); - row2("Confirm before connecting to network?", $prefs->confirm_before_connecting?"Yes":"No"); - row2("Disconnect when done?", $prefs->hangup_if_dialed?"Yes":"No"); - row2("Confirm before accepting executable?", $prefs->confirm_executable?"Yes":"No"); - row2("Amount of work to buffer:", "$prefs->work_buf_min_days to $prefs->work_buf_max_days days"); - row2("On multiprocessors, use at most", "$prefs->max_cpus processors"); - row2("Write to disk at most every", "$prefs->disk_interval seconds"); - row2("Maximum disk space to use:", "$prefs->disk_max_used_gb GB"); - row2("Minimum disk space to leave free:", "$prefs->disk_min_free_gb GB"); - row2("Maximum % of disk allowed to used:", "$prefs->disk_max_used_pct%"); + row2(START_END_DESC, $x); + row2(CONFIRM_BEFORE_CONNECTING_DESC, $prefs->confirm_before_connecting?"yes":"no"); + row2(HANGUP_IF_DIALED_DESC, $prefs->hangup_if_dialed?"yes":"no"); + row2(CONFIRM_EXECUTABLE_DESC, $prefs->confirm_executable?"yes":"no"); + row2(WORK_BUF_DESC, "$prefs->work_buf_min_days and $prefs->work_buf_max_days days"); + row2(MAX_CPUS_DESC, "$prefs->max_cpus ".MAX_CPUS_DESC2); + row2(DISK_INTERVAL_DESC, "$prefs->disk_interval seconds"); + row1(DISK_LIMIT_DESC); + row2(DISK_MAX_USED_GB_DESC, "$prefs->disk_max_used_gb GB"); + row2(DISK_MIN_FREE_GB_DESC, "$prefs->disk_min_free_gb GB"); + row2(DISK_MAX_USED_PCT_DESC, "$prefs->disk_max_used_pct".DISK_MAX_USED_PCT_DESC2); + row1(NETWORK_LIMIT_DESC); $x = $prefs->max_bytes_sec_down; - row2("Maximum bytes/sec download:", $x?"$x":"No limit"); + row2(MAX_BYTES_SEC_DOWN_DESC, $x?"$x":"no limit"); $x = $prefs->max_bytes_sec_up; - row2("Maximum bytes/sec upload:", $x?"$x":"No limit"); + row2(MAX_BYTES_SEC_UP_DESC, $x?"$x":"no limit"); } function prefs_show_resource($prefs) { @@ -327,8 +367,8 @@ function prefs_show_resource($prefs) { } function prefs_show_privacy($user) { - row2("Should ".PROJECT." send you email newsletters?", $user->send_email?"Yes":"No"); - row2("Should ".PROJECT." show your computers on its web site?", $user->show_hosts?"Yes":"No"); + row2("Should ".PROJECT." send you email newsletters?", $user->send_email?"yes":"no"); + row2("Should ".PROJECT." show your computers on its web site?", $user->show_hosts?"yes":"no"); } function prefs_show_project($prefs) { @@ -351,7 +391,7 @@ function prefs_display_venue($prefs, $venue, $subset) { prefs_show_resource($x); prefs_show_project($x); } - row2("
", "Edit | Remove"); + row2("
", "Edit preferences | Remove"); } else { $x = subset_name($subset); row1("Add separate $x preferences for $venue"); @@ -384,7 +424,7 @@ function print_prefs_display_global($user) { row1("Primary preferences"); } prefs_show_global($global_prefs); - row2("
", "Edit"); + row2("
", "Edit preferences"); prefs_display_venue($global_prefs, "home", "global"); prefs_display_venue($global_prefs, "school", "global"); @@ -403,117 +443,108 @@ function print_prefs_display($user) { // Functions to display preference subsets as forms // function prefs_form_global($user, $prefs) { - $x = "Do work while the computer is on battery power? -
(matters only for portable computers) - "; - $y = "Yes run_on_batteries?"checked":"") - ."> No no run_on_batteries?"":"checked") ."> "; - row2($x, $y); + row2(RUN_ON_BATTERIES_DESC, $y); - $x = "Do work while you're using the computer?"; - $y = "Yes run_if_user_active?"checked":"") - ."> No no run_if_user_active?"":"checked") ."> "; - row2($x, $y); + row2(RUN_IF_USER_ACTIVE_DESC, $y); - $x = "Do work after computer is idle for"; - $y = " - minutes (applies only if above is No)"; - row2($x, $y); + $y = " minutes "; + row2(IDLE_TIME_TO_RUN_DESC.IDLE_TIME_TO_RUN_DESC2, $y); - $x = "Do work only between the hours of -
(no restriction if same times)"; + $x = START_END_DESC.START_END_DESC2; $y = hour_select($prefs->start_hour, "start_hour")."and".hour_select($prefs->end_hour, "end_hour"); row2($x, $y); - $x = "Confirm before connecting to Internet? -
(matters only if you use a modem) - "; - $y = "Yes confirm_before_connecting?"checked":"") - ."> No no confirm_before_connecting?"":"checked") ."> "; row2($x, $y); - $x = "Disconnect when done? -
(matters only if you use a modem) - "; - $y = "Yes hangup_if_dialed?"checked":"") - ."> No no hangup_if_dialed?"":"checked") ."> "; row2($x, $y); - $x = "Confirm before accepting executable file? -
(currently implemented only on Unix/Linux) - "; - $y = "Yes confirm_executable?"checked":"") - ."> No no confirm_executable?"":"checked") ."> "; row2($x, $y); - $x = "Keep enough to work on disk to last between"; + $x = WORK_BUF_DESC; $y = " and days "; row2($x, $y); - row2("Use at most", "max_cpus> processors"); - row2("Write to disk at most every", "disk_interval> seconds"); + row2(MAX_CPUS_DESC, + "max_cpus> ".MAX_CPUS_DESC2 + ); + row2(DISK_INTERVAL_DESC, + "disk_interval> seconds" + ); - row1("Limit the disk space used by BOINC:"); + row1(DISK_LIMIT_DESC); - row2("Use no more than", + row2(DISK_MAX_USED_GB_DESC, " Gbytes" ); - row2("Leave at least", + row2(DISK_MIN_FREE_GB_DESC, " Gbytes free" ); - row2("Use no more than", - " % of total space" + row2(DISK_MAX_USED_PCT_DESC, + " ".DISK_MAX_USED_PCT_DESC2 ); - row1("Limit BOINC's network use:"); + row1(NETWORK_LIMIT_DESC); $d = $prefs->max_bytes_sec_down; $dt = $d?"$d":""; $u = $prefs->max_bytes_sec_up; $ut = $u?"$u":""; - row2("Maximum bytes/sec download", + row2(MAX_BYTES_SEC_DOWN_DESC, "" ); - row2("Maximum bytes/sec upload", + row2(MAX_BYTES_SEC_UP_DESC, "" ); } function prefs_form_privacy($user) { - $y = "Yes send_email?"checked":"") - ."> No no send_email?"":"checked") ."> "; row2("Should ".PROJECT." send you email newsletters?", $y); - $y = "Yes show_hosts?"checked":"") - ."> No no show_hosts?"":"checked") ."> "; diff --git a/html/user/util.inc b/html/user/util.inc index 77c593b7ce..0596d1f8cd 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -235,12 +235,15 @@ function print_login_form_aux($next_url, $user, $pathMod='') { start_table(); row1("Log in"); row2("Your account key: -
+
If you don't know your account key, click here. ", "" ); + row2("Remember account key on this computer", + "" + ); row2("", "" );