From f125e7e2dec82234d6e2f2a946defd562f88a172 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 24 Dec 2007 21:34:21 +0000 Subject: [PATCH] - web: don't require login for show_user.php - web: add app selection to example project-specific prefs (commented out by default) - web: in prefs, flag too-low numeric values as errors, rather than just setting to min value - web: fix bug when add new venue from "columns" view svn path=/trunk/boinc/; revision=14442 --- checkin_notes | 22 ++ html/inc/prefs.inc | 4 +- html/inc/uotd.inc | 11 +- html/inc/util.inc | 10 +- html/ops/sample_server_status.php | 12 +- .../project.sample/project_specific_prefs.inc | 197 +++++++++++++----- html/user/show_user.php | 2 +- sched/sched_send.C | 7 +- 8 files changed, 194 insertions(+), 71 deletions(-) diff --git a/checkin_notes b/checkin_notes index 7ca547689c..02ef1b1253 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12498,3 +12498,25 @@ David 24 Dec 2007 team_export.php py/Boinc/ setup_project.py + +David 24 Dec 2007 + - web: don't require login for show_user.php + - web: add app selection to example project-specific prefs + (commented out by default) + - web: in prefs, flag too-low numeric values as errors, + rather than just setting to min value + - web: fix bug when add new venue from "columns" view + + html/ + inc/ + prefs.inc + uotd.inc + util.inc + ops/ + sample_server_status.php + project.sample/ + project_specific_prefs.php + user/ + show_user.php + sched/ + sched_send.C diff --git a/html/inc/prefs.inc b/html/inc/prefs.inc index f024e7c69c..9f4dcba2e6 100644 --- a/html/inc/prefs.inc +++ b/html/inc/prefs.inc @@ -122,7 +122,7 @@ define("ALLOW_BETA_WORK", // These texts are used in multiple places in prefs_edit.php and add_venue.php define("PREFS_FORM_DESC1", "These preferences apply to all the BOINC projects in which you participate.

"); -define("PREFS_FORM_ERROR_DESC", "Unable to update preferences. Some values (marked in red below) were out of range or not numeric.

"); +define("PREFS_FORM_ERROR_DESC", "Unable to update preferences. The values marked in red below were out of range or not numeric.

"); global $text; global $parse_result; @@ -613,7 +613,7 @@ function row_field($value, $type) { function row_links($subset, $prefs) { global $g_logged_in_user; $tokens = url_tokens($g_logged_in_user->authenticator); - $pre_add = "userid); - echo user_links($user)."
"; - echo sub_sentence(strip_tags(output_transform($profile->response1)), ' ', 150, true); - } +function show_uotd($profile) { + $user = lookup_user_id($profile->userid); + echo user_links($user)."
"; + echo sub_sentence(strip_tags(output_transform($profile->response1)), ' ', 150, true); } // return the last UOTD profile, or null diff --git a/html/inc/util.inc b/html/inc/util.inc index 4dc2605e5d..75db41106e 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -700,7 +700,8 @@ function link_with_GET_variables($text, $baseurl, $variable_name, $variable_valu // @param string &$value reference to the value that should be verified // @param double $low the lowest number of value if verified // @param double $high the highest number of value if verified -// @return bool true if $value is numeric and within the defined borders, false if $value is not numeric, no changes were made in this case +// @return bool true if $value is numeric and within the defined borders, +// false if $value is not numeric, no changes were made in this case // function verify_numeric(&$value, $low, $high = false) { $number = trim($value); @@ -714,9 +715,12 @@ function verify_numeric(&$value, $low, $high = false) { // the supplied value contains alphabetic characters if (!is_numeric($number)) return false; - if ($number < $low) $number = $low; + //if ($number < $low) $number = $low; + if ($number < $low) return false; + if ($high) { - if ($number > $high) $number = $high; + //if ($number > $high) $number = $high; + if ($number > $high) return false; } $value = (double)$number; return true; diff --git a/html/ops/sample_server_status.php b/html/ops/sample_server_status.php index bfcefa0e49..f68be1886b 100644 --- a/html/ops/sample_server_status.php +++ b/html/ops/sample_server_status.php @@ -227,14 +227,20 @@ show_status($sched_host, "scheduler", $sched_running); $cursor = 0; while ($thisxml = trim(parse_next_element($config_xml,"",$cursor))) { $host = parse_element($thisxml,""); - if ($host == "") { $host = $project_host; } + if ($host == "") { + $host = $project_host; + } $cmd = parse_element($thisxml,""); list($ncmd) = explode(" ",$cmd); $log = parse_element($thisxml,""); - if (!$log) { $log = $ncmd . ".log"; } + if (!$log) { + $log = $ncmd . ".log"; + } list($nlog) = explode(".log",$log); $pid = parse_element($thisxml,""); - if (!$pid) { $pid = $ncmd . ".pid"; } + if (!$pid) { + $pid = $ncmd . ".pid"; + } $disabled = parse_element($thisxml,""); show_daemon_status($host, $nlog, $ncmd, $disabled); } diff --git a/html/project.sample/project_specific_prefs.inc b/html/project.sample/project_specific_prefs.inc index e9e24fa7d5..dbf234e1ba 100644 --- a/html/project.sample/project_specific_prefs.inc +++ b/html/project.sample/project_specific_prefs.inc @@ -1,85 +1,178 @@ X is set) +// project_specific_prefs_parse_form(&$error) +// Parse form variables into XML, and return it. +// Also error-check values, and return errors in $errors->* + +// Place your version in html/project_specific/project_specific_prefs.inc function option($name, $val) { - if ($name == $val) { - $x = "selected"; - } else { - $x = ""; - } + $x = ($name == $val) ? "selected" : ""; return "