- web: default for user_links() is to not show profile pic.

Show the pic only in the context of friends list.

svn path=/trunk/boinc/; revision=14444
This commit is contained in:
David Anderson 2007-12-27 18:37:22 +00:00
parent 91b1186dcd
commit 55c0ee22a0
11 changed files with 213 additions and 26 deletions

View File

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

View File

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

View File

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

View File

@ -2,6 +2,10 @@
$project_news = array(
array("Dec 26, 2007",
"A story in the Chicago Tribune, \"<a href=http://www.chicagotribune.com/services/newspaper/printedition/tuesday/chi-computer_25dec25,0,2528641.story>Bit by bit, home computers aid science</a>\",
highlights <a href=http://www.cosmologyathome.org/>Cosmology@home</a>."
),
array("Dec 18, 2007",
"<a href=http://boinc.umiacs.umd.edu/>The Lattice Project</a>,
based at the University of Maryland

View File

@ -87,6 +87,7 @@ echo "
<li> <a href=#skins>Skins for the BOINC Manager</a>
<li> <a href=#sites>Other BOINC-related sites</a>
(Information, message boards, and teams)
<li> <a href=#video>BOINC-related videos</a>
</ul>
<a name=info></a>
<h3>Help and Information</h3>
@ -312,6 +313,14 @@ echo "
<p>
If you'd like to add a web site to this list, please
<a href=mailto:davea@ssl.berkeley.edu>contact us</a>.
<a name=video>
<h2>BOINC-related videos</h2>
<ul>
<li> <a href=http://www.youtube.com/watch?v=8iSRLIK-x6A>David Anderson talks about BOINC</a>
<li> <a href=http://www.youtube.com/watch?v=GzATbET3g54>David Baker talks about Rosetta@home</a>
</ul>
";
page_tail();
?>

View File

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

View File

@ -490,7 +490,7 @@ function show_post(
<td rowspan=\"3\"><a name=\"".$post->id."\"></a><div class=\"authorcol\">
";
echo user_links($user, false);
echo user_links($user);
echo "<br>";
// Print the special user lines, if any
@ -655,7 +655,7 @@ function show_post_and_context($post, $thread, $forum, $options, $n) {
echo "
(<a href=\"forum_thread.php?id=".$thread->id."&amp;nowrap=true#".$post->id."\">Message ".$post->id."</a>)
<br>
Posted $when by ".user_links($user, false)." $deleted
Posted $when by ".user_links($user)." $deleted
<hr>
$content
</td></tr>
@ -1034,7 +1034,7 @@ function show_thread_and_context($thread, $user) {
}
echo '
</td><td>'.($thread->replies+1).'</td>
<td align="left"><div class="authorcol">'.user_links($owner, false).'</div></td>
<td align="left"><div class="authorcol">'.user_links($owner).'</div></td>
<td>'.$thread->views.'</td>
<td style="text-align:right">'.time_diff_str($thread->timestamp, time()).'</td>
</tr>

View File

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

View File

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

View File

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

View File

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