diff --git a/bolt_checkin_notes.txt b/bolt_checkin_notes.txt index 5aebbfab84..cfe412185e 100644 --- a/bolt_checkin_notes.txt +++ b/bolt_checkin_notes.txt @@ -146,3 +146,22 @@ David June 26 2008 - snapshots (makes it fast) - filtering and breakdown Also revisited Maps, and started redoing them along the same lines + +David August 14 2008 + - remove "doc_file" field; use short_name.inc + - fix tabl_exists() + - fix bugs when return to answer page + - create bolt_result records correctly + + db/ + bolt_schema.sql + html/ + inc/ + db_conn.inc + bolt_db.inc + ops/ + bolt_map.php + bolt_admin.php + user/ + bolt_sched.php + bolt_compare.php diff --git a/checkin_notes b/checkin_notes index dda593faf0..86544167ff 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6479,6 +6479,22 @@ David 13 Aug 2008 db_purge.C server_types.C +David 13 Aug 2008 + - client and server: add "len" arg to xml_escape() and xml_unescape() + (prevent buffer overrun). + Also remove 1024 char limit for team description in db_dump. + + client/ + client_types.C + lib/ + app_ipc.C + parse.C,h + proxy_info.C + sched/ + db_dump.C + db_purge.C + server_types.C + Rom 13 Aug 2008 - SAMPLES: Add all the samples to the BOINC solution and delete the old solution. diff --git a/db/bolt_schema.sql b/db/bolt_schema.sql index 00b49d6832..37e5bee249 100644 --- a/db/bolt_schema.sql +++ b/db/bolt_schema.sql @@ -14,7 +14,6 @@ create table bolt_course ( short_name varchar(255) not null, name varchar(255) not null, description text not null, - doc_file varchar(255) not null, hidden tinyint not null, bossa_app_id integer not null, -- on completion, go to this Bossa app diff --git a/html/inc/bolt_db.inc b/html/inc/bolt_db.inc index d4c2d791ad..77aed15256 100644 --- a/html/inc/bolt_db.inc +++ b/html/inc/bolt_db.inc @@ -149,6 +149,10 @@ class BoltCourse { $db = BoltDb::get(); return $db->update($this, 'bolt_course', $clause); } + function doc_file() { + $sn = $this->short_name; + return "../inc/$sn.inc"; + } } class BoltEnrollment { diff --git a/html/inc/db_conn.inc b/html/inc/db_conn.inc index dc9443a687..b07d881526 100644 --- a/html/inc/db_conn.inc +++ b/html/inc/db_conn.inc @@ -150,10 +150,10 @@ class DbConn { return mysql_error($this->db_conn); } function table_exists($table_name) { - $result = $this->do_query("show tables like '$table_name'"); - $t = mysql_fetch_object($result); + $result = $this->do_query("show tables from DBNAME like '$table_name'"); + $t = mysql_fetch_array($result); mysql_free_result($result); - if ($t == "$table_name") return true; + if ($t[0] == "$table_name") return true; return false; } } diff --git a/html/inc/util.inc b/html/inc/util.inc index 6ddd88f37c..8d9281bfea 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -72,7 +72,7 @@ function get_logged_in_user($must_be_logged_in=true) { $x = ereg( "curl|wget|libww|lwp::simple|lwp-trivial|fetch|rufusbot|java/|microsoft url control|webreaper", - strtolower($_SERVER[HTTP_USER_AGENT]) + strtolower($_SERVER["HTTP_USER_AGENT"]) ); if ($x > 0) { error_page("bad user agent"); diff --git a/html/ops/bolt_admin.php b/html/ops/bolt_admin.php index f19ea697d0..9e12416abf 100644 --- a/html/ops/bolt_admin.php +++ b/html/ops/bolt_admin.php @@ -23,7 +23,6 @@ function show_course($course) { $x = "$course->name
Description: $course->description
Created: ".date_str($course->create_time)." -
Course document: $course->doc_file "; $y = "id>Course map
id>Lesson compare @@ -58,7 +57,6 @@ function add_course_form() { row2("Course name
Visible to users
", ""); row2("Internal name
Not visible to users; used as a directory name, so no spaces or special chars
", ""); row2("Description
Visible to users
", ""); - row2("Course document", ""); row2("", ""); end_table(); echo ""; @@ -127,9 +125,8 @@ case 'add_course': $short_name = BoltDb::escape_string(get_str('short_name')); $name = BoltDb::escape_string(get_str('course_name')); $description = BoltDb::escape_string(get_str('description')); - $doc_file = get_str('doc_file'); $now = time(); - BoltCourse::insert("(create_time, short_name, name, description, doc_file) values ($now, '$short_name', '$name', '$description', '$doc_file')"); + BoltCourse::insert("(create_time, short_name, name, description) values ($now, '$short_name', '$name', '$description')"); Header('Location: bolt_admin.php'); break; case 'update_user_form': diff --git a/html/ops/bolt_map.php b/html/ops/bolt_map.php index add077b868..101f8fa11e 100644 --- a/html/ops/bolt_map.php +++ b/html/ops/bolt_map.php @@ -189,6 +189,7 @@ function get_views($unit, $mode) { function get_results($unit) { global $snap; + print_r($snap->results); if (array_key_exists($unit->name, $snap->results)) { return filter_array($snap->results[$unit->name]); } @@ -389,7 +390,7 @@ function show_map() { $course_id = get_int('course_id'); $course = BoltCourse::lookup_id($course_id); if (!$course) error_page("no course"); -$top_unit = require_once("../user/$course->doc_file"); +$top_unit = require_once($course->doc_file()); $action = get_str('action', true); switch ($action) { diff --git a/html/user/bolt_compare.php b/html/user/bolt_compare.php index 8212223ad9..d6278f134c 100644 --- a/html/user/bolt_compare.php +++ b/html/user/bolt_compare.php @@ -224,7 +224,7 @@ function show_choice($top_unit) { $course_id = get_int('course_id'); $course = BoltCourse::lookup_id($course_id); -$top_unit = require_once($course->doc_file); +$top_unit = require_once($course->doc_file()); $action = get_str('action', true); switch ($action) { diff --git a/html/user/bolt_sched.php b/html/user/bolt_sched.php index a36faa9297..e76b4ebab7 100644 --- a/html/user/bolt_sched.php +++ b/html/user/bolt_sched.php @@ -317,7 +317,7 @@ if (!$course) { } $view_id = get_int('view_id', true); $action = get_str('action', true); -$course_doc = require_once($course->doc_file); +$course_doc = require_once($course->doc_file()); switch ($action) { case 'start': @@ -369,6 +369,8 @@ case 'prev': if ($mode == BOLT_MODE_ANSWER) { $v2 = BoltView::lookup_id($view->prev_view_id); $result = BoltResult::lookup_id($v2->result_id); + srand($v2->id); + $bolt_ex_score = $result->score; $bolt_ex_query_string = $result->response; } $view_id = create_view($iter, $mode, $view->prev_view_id); @@ -448,9 +450,10 @@ case 'answer': // submit answer in exercise // make a record of the result $qs = BoltDb::escape_string($_SERVER['QUERY_STRING']); + $now = time(); $result_id = BoltResult::insert( - "(view_id, item_name, score, response) - values ($view->id, '$view->item_name', $bolt_ex_score, '$qs')" + "(create_time, user_id, course_id, view_id, item_name, score, response) + values ($now, $user->id, $course->id, $view->id, '$view->item_name', $bolt_ex_score, '$qs')" ); $view->update("result_id=$result_id");