diff --git a/checkin_notes b/checkin_notes index 02ef1b1253..7623503fc4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -12520,3 +12520,15 @@ David 24 Dec 2007 show_user.php sched/ sched_send.C + +David 24 Dec 2007 + - web: default for user_links() is to not show profile pic. + Show the pic only in the context of friends list. + + html/ + inc/ + forum.inc + util.inc + user.inc + user/ + friend.php diff --git a/db/bolt_schema.sql b/db/bolt_schema.sql index 6f57166ec2..91f273d5da 100644 --- a/db/bolt_schema.sql +++ b/db/bolt_schema.sql @@ -72,14 +72,18 @@ create table bolt_exercise_result ( create table bolt_exercise_set_result ( id integer not null auto_increment, score double not null, + view_id integer not null, + -- the answer page of last exercise in set + name varchar(255) not null, + -- logical name of result set unit primary key(id) ); create table bolt_refresh ( id integer not null auto_increment, - view_id integer not null, + set_result_id integer not null, + -- most recent result for this set due_time integer not null, - name varchar(255) not null, - state text not null, + -- when to trigger review primary key (id) ); diff --git a/doc/addon_data.php b/doc/addon_data.php index 4cc41e21f3..291471f172 100644 --- a/doc/addon_data.php +++ b/doc/addon_data.php @@ -475,6 +475,15 @@ array('http://download.conmunix.net/pub/boinc_lcs/boinc_lcs_3.0_beta.tar.gz', 'Boinc LCS is a free PHP based script, that allows you to monitor the current state (and other information) from each of your connected BOINC clients. It runs on a simple webserver and since version 2.1 it is also platform independent. Boinc LCS is released under the GNU/GPL license. You can modify and redistribute or just using it!', '1193023938' ), +array('b-sig.zip', + 'Forum signature showing jobs in progress', + '', + 'A PHP script that generates a forum signature showing jobs in progress', + '', + 'Apache, PHP, and GD', + 'A PHP script that generates an image, appropriate for use as a forum signature, showing BOINC jobs in progress on the server computer', + 1198534706 +), array('boincphpgui-2.3.tar.gz', 'BoincPHP5-GUI', '2.3', diff --git a/doc/boinc_news.php b/doc/boinc_news.php index 9a54e3ac95..e77ab28f05 100644 --- a/doc/boinc_news.php +++ b/doc/boinc_news.php @@ -2,6 +2,10 @@ $project_news = array( +array("Dec 26, 2007", + "A story in the Chicago Tribune, \"Bit by bit, home computers aid science\", + highlights Cosmology@home." +), array("Dec 18, 2007", "The Lattice Project, based at the University of Maryland diff --git a/doc/links.php b/doc/links.php index 2b3baef4cc..06631c0abb 100644 --- a/doc/links.php +++ b/doc/links.php @@ -87,6 +87,7 @@ echo "
  • Skins for the BOINC Manager
  • Other BOINC-related sites (Information, message boards, and teams) +
  • BOINC-related videos

    Help and Information

    @@ -312,6 +313,14 @@ echo "

    If you'd like to add a web site to this list, please contact us. + + +

    BOINC-related videos

    + + "; page_tail(); ?> diff --git a/html/inc/bolt.inc b/html/inc/bolt.inc index 4228252ff6..5d160cbfbf 100644 --- a/html/inc/bolt.inc +++ b/html/inc/bolt.inc @@ -82,7 +82,6 @@ class BoltSequence extends BoltUnit { } function walk(&$iter, $incr, &$frac_done) { - //echo "call to walk() for $this->name: next: $next\n"; $n = count($this->units); if (array_key_exists($this->name, $iter->state)) { $state_rec = $iter->state[$this->name]; @@ -125,6 +124,7 @@ class BoltSequence extends BoltUnit { if ($i == $n) { $frac_done = 1; $state_rec['i'] = 0; + $state_rec['child_name'] = null; $iter->state[$this->name] = $state_rec; return true; } @@ -136,8 +136,8 @@ class BoltSequence extends BoltUnit { $child = $this->units[$i]; $frac_done = $i/$n; $state_rec = null; - $state_rec->i = $i; - $state_rec->child_name = $child->name; + $state_rec['i'] = $i; + $state_rec['child_name'] = $child->name; $iter->state[$this->name] = $state_rec; if ($child->is_item) { $iter->item = $child; @@ -148,6 +148,103 @@ class BoltSequence extends BoltUnit { } } +// state for random unit is: +// seed The RNG seed used to shuffle +// i index of current child +// number_shown number of units shown so far (not necessarily the +// same as i on 2nd and later pass through this unit) +// child_name name of current child +class BoltRandom extends BoltUnit { + public $units; + function __construct($n, $u, $n) { + $this->name = $n; + $this->units = $u; + $this->is_item = false; + $this->number = $n; + $this->shuffled = false; + } + + function walk(&$iter, $incr, &$frac_done) { + $n = count($this->units); + if (array_key_exists($this->name, $iter->state)) { + $state_rec = $iter->state[$this->name]; + $child_name = $state_rec['child_name']; + $number_shown = $state_rec['number_shown']; + if (!$this->shuffled) { + srand($state_rec['seed']); + shuffle($this->units); + $this->shuffled = true; + } + + // look up unit by name + // + $child = null; + for ($i=0; $i<$n; $i++) { + $c = $this->units[$i]; + if ($c->name == $child_name) { + $child = $c; + break; + } + } + + // if not there, look up by index + // + if (!$child) { + $i = $state_rec['i']; + if ($i >= $n) { + // and if index is too big, use last unit + // + $i = $n-1; + } + $child = $this->units[$i]; + } + + // at this point, $child is the current unit, and $i is its index + // + if ($incr) { + $my_inc = false; + if ($child->is_item) { + $my_inc = true; + } else { + $my_inc = $child->walk($iter, $incr, $frac_done); + } + if ($my_inc) { + $i = ($i+1)%$n; + $number_shown++; + if ($number_shown >= $this->number) { + $frac_done = 1; + $state_rec['i'] = $i; + $state_rec['number_shown'] = 0; + $state_rec['child_name'] = null; + $iter->state[$this->name] = $state_rec; + return true; + } + } + } + } else { + $i = 0; + $number_shown = 0; + $state_rec = null; + $seed = ((double)microtime()*1000000); + srand($seed); + shuffle($this->units); + $state_rec['seed'] = $seed; + } + $child = $this->units[$i]; + $frac_done = $number_shown/$this->number; + $state_rec['i'] = $i; + $state_rec['number_shown'] = $number_shown; + $state_rec['child_name'] = $child->name; + $iter->state[$this->name] = $state_rec; + if ($child->is_item) { + $iter->item = $child; + } else { + $child->walk($iter, false, $f); + $frac_done += $f*(1/$number); + } + } +} + class BoltItem extends BoltUnit { public $filename; function __construct($name, $title, $filename) { @@ -200,6 +297,10 @@ function title($n) { return array('title', $n); } +function number($n) { + return array('number', $n); +} + function filename($n) { return array('filename', $n); } @@ -212,13 +313,6 @@ function review($s, $u) { return new BoltReview($s, $u); } -function exercise_set() { - $args = func_get_args(); - foreach ($args as $arg) { - return $arg; - } -} - function refresh() { } @@ -300,6 +394,53 @@ function sequence() { return new BoltSequence($name, $units); } +function random() { + $args = func_get_args(); + $units = array(); + $name = ""; + $number = 1; + foreach ($args as $arg) { + if (is_array($arg)) { + switch ($arg[0]) { + case 'name': $name = $arg[1]; break; + case 'title': $title = $arg[1]; break; + case 'number': $number = $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 { + echo "Unrecognized arg"; + } + } + } + return new BoltRandom($name, $units, $number); +} + +function exercise_set() { + $args = func_get_args(); + $units = array(); + $name = ""; + foreach ($args as $arg) { + if (is_array($arg)) { + switch ($arg[0]) { + case 'name': $name = $arg[1]; break; + case 'title': $title = $arg[1]; break; + case 'number': $number = $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 { + echo "Unrecognized arg"; + } + } + } + return new BoltExerciseSet($name, $units, $number); +} + function enum_course($course) { $iter = new BoltIter($course); while (1) { diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 66101cc7b1..a831751956 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -490,7 +490,7 @@ function show_post( id."\">
    "; - echo user_links($user, false); + echo user_links($user); echo "
    "; // Print the special user lines, if any @@ -655,7 +655,7 @@ function show_post_and_context($post, $thread, $forum, $options, $n) { echo " (id."&nowrap=true#".$post->id."\">Message ".$post->id.")
    - Posted $when by ".user_links($user, false)." $deleted + Posted $when by ".user_links($user)." $deleted
    $content @@ -1034,7 +1034,7 @@ function show_thread_and_context($thread, $user) { } echo ' '.($thread->replies+1).' -
    '.user_links($owner, false).'
    +
    '.user_links($owner).'
    '.$thread->views.' '.time_diff_str($thread->timestamp, time()).' diff --git a/html/inc/user.inc b/html/inc/user.inc index 4dfbdb85e7..40495c211f 100644 --- a/html/inc/user.inc +++ b/html/inc/user.inc @@ -308,7 +308,7 @@ function show_user_summary_public($user) { $x = ""; foreach($friends as $friend) { $fuser = BoincUser::lookup_id($friend->user_dest); - $x .= " ".user_links($fuser); + $x .= " ".user_links($fuser, true); } row2("Friends", $x); } diff --git a/html/inc/util.inc b/html/inc/util.inc index 75db41106e..ebb62124c8 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -543,7 +543,7 @@ function sched_stopped() { return file_exists("../../stop_sched"); } -function user_links($user, $show_profile_pic=true) { +function user_links($user, $show_profile_pic=false) { BoincForumPrefs::lookup($user); if (is_banished($user)) { return "(banished: ID $user->id)"; diff --git a/html/user/bolt_course_sample.php b/html/user/bolt_course_sample.php index 005728e4eb..dbb74456a3 100644 --- a/html/user/bolt_course_sample.php +++ b/html/user/bolt_course_sample.php @@ -34,13 +34,21 @@ function int_review() { return sequence( name('course'), - lesson( - name('lesson 1'), - filename('bolt_sample_lesson1.php') - ), - lesson( - name('lesson 2'), - filename('bolt_sample_lesson2.php') + random( + name('first lessons'), + number(2), + lesson( + name('lesson 1'), + filename('bolt_sample_lesson1.php') + ), + lesson( + name('lesson 2'), + filename('bolt_sample_lesson2.php') + ), + lesson( + name('lesson 3'), + filename('bolt_sample_lesson3.php') + ) ), exercise_set( exercise( diff --git a/html/user/friend.php b/html/user/friend.php index eb3fecc95c..2e974d97c4 100644 --- a/html/user/friend.php +++ b/html/user/friend.php @@ -102,7 +102,7 @@ function handle_query($user) { $friend = BoincFriend::lookup($srcid, $user->id); if (!$friend) error_page("Request not found"); page_head("Friend request"); - $x = user_links($srcuser); + $x = user_links($srcuser, true); echo " $x has added you as a friend. If $srcuser->name is in fact your friend, please click Accept.