- scheduler: change message if bad auth (fixes #685)

svn path=/trunk/boinc/; revision=15445
This commit is contained in:
David Anderson 2008-06-22 19:14:53 +00:00
parent 5a3d1fc0a5
commit e88e698106
5 changed files with 125 additions and 27 deletions

View File

@ -5036,3 +5036,11 @@ David 20 June 2008
lib/
proc_control.C
shmem.C,h
David 22 June 2008
- scheduler: change message if bad auth (fixes #685)
client/
hostinfo_unix.C
sched/
handle_request.C

View File

@ -216,8 +216,8 @@ bool HOST_INFO::host_is_running_on_batteries() {
bool retval = false;
FILE* fapm = fopen("/proc/apm", "r");
if (fapm) { // Then we're using APM! Yay.
if (fapm) {
// we're using APM
char apm_driver_version[11];
int apm_major_version;
int apm_minor_version;
@ -235,8 +235,7 @@ bool HOST_INFO::host_is_running_on_batteries() {
retval = (apm_ac_line_status == 0);
fclose(fapm);
} else {
// we try ACPI
// try ACPI
char buf[128];
char ac_state[64];
std::string ac_name;

View File

@ -62,7 +62,7 @@ function request_info($user, $course) {
// xset_result: the user's first completion of the xset
// select_finished: the user's last completion of the select before this
function write_snapshot($course_id, $select_name, $xset_name, $start) {
function write_compare_snapshot($course_id, $select_name, $xset_name, $start) {
$xrs = BoltXsetResult::enum(
"course_id=$course_id and name='$xset_name' and create_time >= $start"
);
@ -100,11 +100,13 @@ function write_snapshot($course_id, $select_name, $xset_name, $start) {
$f = fopen($filename, "w");
fwrite($f, json_encode($a));
fclose($f);
return $a;
}
function read_snapshot($course_id, $select_name, $xset_name) {
$filename = "compare_snapshot_$course_id_$select_name_$xset_name.json";
$f = fopen($filename, "r");
function read_compare_snapshot($course_id, $select_name, $xset_name) {
$filename = "compare_snapshot_".$course_id."_".$select_name."_".$xset_name.".json";
$f = @fopen($filename, "r");
if (!$f) return null;
$x = fread($f, filesize($filename));
fclose($f);
return json_decode($x);

View File

@ -1,7 +1,7 @@
<?php
// actions:
// none
// (none)
// form to choose select and xset; OK goes to:
// snap_form
// if have a snapshot, show its start/end times
@ -12,15 +12,15 @@
// show comparison.
// show form to set or change filter or breakdown.
require_once("../inc/util.inc");
require_once("../inc/bolt_db.inc");
require_once("../inc/bolt_util.inc");
// show comparison results for a given select/xset pair.
//
function show_comparison($ss, $filter, $breakdown) {
}
function show_form() {
choose_select();
choose_xset();
}
function show_results() {
}
@ -29,12 +29,12 @@ function show_results() {
function units_of_type($unit, $type) {
$names = array();
if (is_subclass_of($unit, $type)) {
if (get_class($unit) == $type) {
$names[] = $unit->name;
}
if (is_subclass_of($unit, "BoltSet")) {
foreach ($unit->units as $u) {
$n = units_of_type($u);
$n = units_of_type($u, $type);
$names = array_merge($names, $n);
}
}
@ -43,8 +43,10 @@ function units_of_type($unit, $type) {
// show a menu of select units
//
function select_menu($top_unit) {
echo "<select name=selects>";
function choose_select($top_unit) {
echo "<select name=select_name>
<option selected> ---
";
$names = units_of_type($top_unit, "BoltSelect");
foreach ($names as $n) {
echo "<option> $n";
@ -54,22 +56,109 @@ function select_menu($top_unit) {
// show a menu of exercise sets
//
function xset_menu($top_units) {
echo "<select name=xsets>";
$names = units_of_type($top_unit, "BoltExSet");
function choose_xset($top_unit) {
echo "<select name=xset_name>
<option selected> ---
";
$names = units_of_type($top_unit, "BoltExerciseSet");
foreach ($names as $n) {
echo "<option> $n";
}
echo "</select>";
}
function compare_aux($snap) {
// for each select alternative, build an array of xset scores
//
$a = array();
foreach ($snap as $x) {
//$a[$x->select_finished_name][] = $x->xset_result->score;
}
foreach ($a as $name => $scores) {
conf_int_90($scores, $lo, $hi);
$n = count($scores);
echo "
<br>$name: lo $lo hi $hi ($count results)
";
}
}
function compare($select_name, $exset_name) {
}
//if (get_str('submit', true)) {
// show_results();
//} else {
// show_form();
//}
function show_snap_form($top_unit) {
global $course_id;
$select_name = get_str('select_name');
$xset_name = get_str('xset_name');
page_head("Data snapshot");
$s = read_compare_snapshot($course_id, $select_name, $xset_name);
if ($s) {
$end = date_str($s->end);
echo "
A data snapshot exists for the $$s->dur days prior to $end.
";
button(
"bolt_compare.php?action=compare&course_id=$course_id",
"Use this snapshot"
);
}
echo "
<form action=bolt_compare.php>
<form type=hidden name=action value=snapshot_create>
<form type=hidden name=course_id value=$course_id>
Create a new snapshot using data from the last
<input name=dur> days.
<input type=submit value=OK>
</form>
";
page_tail();
}
function snap_action($select_name, $xset_name) {
$dur = get_int('dur');
$start = time() - $dur*86400;
$s = write_compare_snapshot($select_name, $xset_name, $start);
compare_aux($a);
}
function show_choice($top_unit) {
global $course_id;
page_head("Unit comparison");
echo "
<form action=bolt_compare.php>
<input type=hidden name=course_id value=$course_id>
This tool lets you compare alternative lessons.
These lessons must be included in a 'select' unit,
typically with a random selection function.
This must be followed by an exercise set
that tests for the concepts in the lessons.
<p>
Please choose a select unit
";
choose_select($top_unit);
echo "
and an exercise set
";
choose_xset($top_unit);
echo "
<input type=hidden name=action value=snap_form>
<p>
<input type=submit value=OK>
";
}
$course_id = get_int('course_id');
$course = BoltCourse::lookup_id($course_id);
$top_unit = require_once($course->doc_file);
$action = get_str('action', true);
switch ($action) {
case "": show_choice($top_unit); break;
case "snap_form": show_snap_form($top_unit); break;
case "snap_action": snap_action(); break;
case "compare": show_compare(); break;
default: error_page("Unknown action $action");
}
?>

View File

@ -290,7 +290,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
retval = user.lookup(buf);
if (retval) {
USER_MESSAGE um("Invalid or missing account key. "
"Visit this project's web site to get an account key.",
"Detach and reattach to this project to fix this.",
"high"
);
reply.insert_message(um);
@ -359,7 +359,7 @@ lookup_user_and_make_new_host:
if (retval) {
USER_MESSAGE um(
"Invalid or missing account key. "
"Visit this project's web site to get an account key.",
"Detach and reattach to this project to fix this.",
"low"
);
reply.insert_message(um);