diff --git a/checkin_notes b/checkin_notes index edbc10c8a1..e885226f14 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12177,3 +12177,17 @@ David 8 Dec 07 en.po user/ weak_auth.php + +David 10 Dec 07 + - compile fixes + + sched/ + Makefile.am + wample_work_generator.C + html/ + inc/ + uotd.inc + user/ + account_finish_action.php + lib/ + util.C diff --git a/doc/index.php b/doc/index.php index 8978391e24..76d30ee68f 100644 --- a/doc/index.php +++ b/doc/index.php @@ -123,6 +123,8 @@ function show_other() {
  • Papers and talks on BOINC
  • Logos and graphics
  • Events +
  • Bolt (software for web-based education and training) +
  • Bossa (software for distributed thinking projects)
    diff --git a/html/inc/bolt.inc b/html/inc/bolt.inc index ac829d8242..4228252ff6 100644 --- a/html/inc/bolt.inc +++ b/html/inc/bolt.inc @@ -20,6 +20,7 @@ ini_set('display_startup_errors', true); abstract class BoltUnit { public $name; // logical name. + public $title; public $is_item; abstract function walk(&$iter, $incr, &$frac_done); @@ -149,17 +150,15 @@ class BoltSequence extends BoltUnit { class BoltItem extends BoltUnit { public $filename; - function __construct($name, $filename) { + function __construct($name, $title, $filename) { $this->filename = $filename; $this->name = $name; + $this->title = $title; $this->is_item = true; } function begin() { return array(new BoltFrame($this)); } - function unit_list() { - return array(&$this); - } function walk(&$iter, $incr, &$frac_done) { echo "SHOULDN'T BE HERE\n"; } @@ -177,20 +176,6 @@ class BoltExercise extends BoltItem { } } -class BoltName { - public $name; - function __construct($n) { - $this->name = $n; - } -} - -class BoltFileName { - public $fname; - function __construct($n) { - $this->fname = $n; - } -} - class BoltRefreshInterval { public $intervals; function __construct($i) { @@ -208,15 +193,19 @@ class BoltReview { } function name($n) { - return new BoltName($n); + return array('name', $n); +} + +function title($n) { + return array('title', $n); } function filename($n) { - return new BoltFileName($n); + return array('filename', $n); } function refresh_interval($i) { - return new BoltRefreshInterval($i); + return array('refresh_interval', $i); } function review($s, $u) { @@ -236,44 +225,57 @@ function refresh() { function lesson() { $name = ""; $file = ""; + $title = ""; $args = func_get_args(); foreach ($args as $arg) { - if (is_object($arg)) { - if (get_class($arg) == 'BoltName') { - $name = $arg->name; - } else if (get_class($arg) == 'BoltFileName') { - $fname = $arg->fname; - } else { - echo "unprocessed arg of class ".get_class($arg); + if (is_array($arg)) { + switch ($arg[0]) { + case 'name': $name = $arg[1]; break; + case 'title': $title = $arg[1]; break; + case 'filename': $file = $arg[1]; break; + default: echo "Unrecognized array arg: ", $arg[0], "\n"; break; + } + } else { + echo "unprocessed arg of class ".get_class($arg); + } + } + if (!$name) { + error_page("Missing name in lesson"); + } + if (!$title) { + $title = $name; + } + if (!$file) { + error_page("Missing filename in lesson"); + } + return new BoltLesson($name, $title, $file); +} + +function exercise() { + $name = ""; + $file = ""; + $title = ""; + $args = func_get_args(); + foreach ($args as $arg) { + if (is_array($arg)) { + switch ($arg[0]) { + case 'name': $name = $arg[1]; break; + case 'title': $title = $arg[1]; break; + case 'filename': $file = $arg[1]; break; + default: echo "Unrecognized array arg: ", $arg[0], "\n"; break; } } } if (!$name) { error_page("Missing name in lesson"); } - if (!$fname) { + if (!$title) { + $title = $name; + } + if (!$file) { error_page("Missing filename in lesson"); } - return new BoltLesson($name, $fname); -} - -function exercise() { - $name = ""; - $file = ""; - $args = func_get_args(); - foreach ($args as $arg) { - if (is_object($arg)) { - if (get_class($arg) == 'BoltName') { - $name = $arg->name; - } else if (get_class($arg) == 'BoltFileName') { - $fname = $arg->fname; - } - } - } - if (!$name || !$fname) { - error_page("Missing name or filename in exercise"); - } - return new BoltExercise($name, $fname); + return new BoltExercise($name, $title, $file); } function sequence() { @@ -281,11 +283,15 @@ function sequence() { $units = array(); $name = ""; foreach ($args as $arg) { - if (is_object($arg)) { + if (is_array($arg)) { + switch ($arg[0]) { + case 'name': $name = $arg[1]; break; + case 'title': $title = $arg[1]; break; + default: echo "Unrecognized array arg: ", $arg[0], "\n"; break; + } + } else if (is_object($arg)) { if (is_subclass_of($arg, "BoltUnit")) { $units[] = $arg; - } else if (get_class($arg) == "BoltName") { - $name = $arg->name; } else { echo "Unrecognized arg"; } diff --git a/html/inc/bolt_ex.inc b/html/inc/bolt_ex.inc index 6a49886ff9..980f715eb7 100644 --- a/html/inc/bolt_ex.inc +++ b/html/inc/bolt_ex.inc @@ -11,7 +11,6 @@ function bolt_exclusive_choice($choices) { global $bolt_ex_score; // output if SCORE global $bolt_ex_response; // output if SCORE - echo "mode: $bolt_ex_mode"; switch ($bolt_ex_mode) { case BOLT_MODE_SHOW: shuffle($choices); @@ -39,7 +38,6 @@ function bolt_exclusive_choice($choices) { shuffle($choices); $response = $_GET["q_$bolt_ex_index"]; $i = 0; - echo "response: $response"; start_table(); foreach ($choices as $choice) { $x = ""; @@ -54,6 +52,56 @@ function bolt_exclusive_choice($choices) { $bolt_ex_index++; } +function bolt_inclusive_choice($choices) { + global $bolt_ex_mode; // input + global $bolt_ex_index; // input + global $bolt_ex_score; // output if SCORE + global $bolt_ex_response; // output if SCORE + + switch ($bolt_ex_mode) { + case BOLT_MODE_SHOW: + shuffle($choices); + $i = 0; + start_table(); + foreach ($choices as $choice) { + $c = $choice[0]; + row2($c, ""); + $i++; + } + end_table(); + break; + case BOLT_MODE_SCORE: + $i = 0; + $n = count($choices); + $score = 0; + shuffle($choices); + foreach ($choices as $choice) { + $response = $_GET["q_".$bolt_ex_index."_$i"]; + $r = $choice[1]; + $correct = ($r && $response) || (!$r && !$response); + if ($correct) $score += 1./$n; + } + $bolt_ex_response = "$bolt_ex_index: $choices[$response]"; + break; + case BOLT_MODE_ANSWER: + $i = 0; + $n = count($choices); + shuffle($choices); + start_table(); + foreach ($choices as $choice) { + $c = $choice[0]; + $response = $_GET["q_$bolt_ex_index_$i"]; + $r = $choice[1]; + $correct = ($r && $response) || (!$r && !$response); + row2($c, $x); + $i++; + } + end_table(); + break; + } + $bolt_ex_index++; +} + function bolt_image_rect($img, $rect) { global $bolt_ex_mode; // input global $bolt_ex_index; // input diff --git a/html/inc/uotd.inc b/html/inc/uotd.inc index 3dca4d64ba..c09386a313 100644 --- a/html/inc/uotd.inc +++ b/html/inc/uotd.inc @@ -67,7 +67,7 @@ function select_uotd() { // if ($result && mysql_num_rows($result) < UOTD_THRESHOLD) { $u = new BoincUser; - $u->email_addr - UOTD_ADMIN_EMAIL; + $u->email_addr = UOTD_ADMIN_EMAIL; $u->name = "UOTD admin"; send_email($u, PROJECT . ": User of the Day pool is running low!", diff --git a/html/user/account_finish_action.php b/html/user/account_finish_action.php index 34bf481d37..52bd592668 100644 --- a/html/user/account_finish_action.php +++ b/html/user/account_finish_action.php @@ -2,7 +2,6 @@ include_once("../inc/boinc_db.inc"); include_once("../inc/util.inc"); -include_once("../inc/email.inc"); function show_error($str) { page_head("Can't update account"); diff --git a/html/user/bolt_sched.php b/html/user/bolt_sched.php index 3fe0d44dd8..1010b8f56f 100644 --- a/html/user/bolt_sched.php +++ b/html/user/bolt_sched.php @@ -183,6 +183,7 @@ case 'answer': // submit answer in exercise ob_start(); // turn on output buffering require($item->filename); ob_end_clean(); + $bolt_ex_response = BoltDb::escape_string($bolt_ex_response); $result_id = BoltResult::insert( "(view_id, score, response) diff --git a/lib/util.C b/lib/util.C index 0ec4b33faa..90a56bb9c7 100644 --- a/lib/util.C +++ b/lib/util.C @@ -461,6 +461,8 @@ void boinc_crash() { #endif } +#ifndef _USING_FCGI_ + // read file (at most max_len chars, if nonzero) into malloc'd buf // int read_file_malloc(const char* path, char*& buf, int max_len, bool tail) { @@ -488,6 +490,8 @@ int read_file_malloc(const char* path, char*& buf, int max_len, bool tail) { return 0; } +#endif + // read file (at most max_len chars, if nonzero) into string // int read_file_string(const char* path, string& result, int max_len, bool tail) { diff --git a/sched/Makefile.am b/sched/Makefile.am index 0f15701bfb..5323641aa5 100644 --- a/sched/Makefile.am +++ b/sched/Makefile.am @@ -209,7 +209,7 @@ fcgi_SOURCES = \ fcgi_DEPENDENCIES = $(LIB_SCHED) fcgi_CPPFLAGS = -include fcgi_stdio.h -D_USING_FCGI_ $(AM_CPPFLAGS) -fcgi_LDADD = $(LDADD) $(RSA_LIBS) -lfcgi $(MYSQL_LIBS) +fcgi_LDADD = $(RSA_LIBS) -lfcgi $(MYSQL_LIBS) fcgi_file_upload_handler_SOURCES = \ file_upload_handler.C \ diff --git a/sched/sample_work_generator.C b/sched/sample_work_generator.C index 8d58755b71..22ee3a4be5 100644 --- a/sched/sample_work_generator.C +++ b/sched/sample_work_generator.C @@ -29,6 +29,8 @@ // the file (and the workunit names) contain a timestamp // and sequence number, so that they're unique. +#include + #include "boinc_db.h" #include "error_numbers.h" #include "backend_lib.h"