- compile fixes

svn path=/trunk/boinc/; revision=14373
This commit is contained in:
David Anderson 2007-12-10 22:13:48 +00:00
parent 4e9fa4f0c6
commit 820eb30596
10 changed files with 133 additions and 57 deletions

View File

@ -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

View File

@ -123,6 +123,8 @@ function show_other() {
<li> <a href=http://boinc.berkeley.edu/trac/wiki/BoincPapers>Papers and talks</a> on BOINC
<li> <a href=logo.php>Logos and graphics</a>
<li> <a href=trac/wiki/BoincEvents>Events</a>
<li> <a href=trac/wiki/BoltIntro>Bolt</a> (software for web-based education and training)</a>
<li> <a href=trac/wiki/BossaIntro>Bossa</a> (software for distributed thinking projects)</a>
</ul>
<br>
</td></tr>

View File

@ -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";
}

View File

@ -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, "<input name=q_".$bolt_ex_index."_$i type=checkbox>");
$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

View File

@ -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!",

View File

@ -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");

View File

@ -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)

View File

@ -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) {

View File

@ -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 \

View File

@ -29,6 +29,8 @@
// the file (and the workunit names) contain a timestamp
// and sequence number, so that they're unique.
#include <unistd.h>
#include "boinc_db.h"
#include "error_numbers.h"
#include "backend_lib.h"