mirror of https://github.com/BOINC/boinc.git
web: make badge display configurable
See http://boinc.berkeley.edu/trac/wiki/BadgeDoc
This commit is contained in:
parent
20234a4a55
commit
efa6f4e3d6
|
@ -539,7 +539,6 @@ function show_post(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Print the special user lines, if any
|
||||
//
|
||||
global $special_user_bitfield;
|
||||
|
@ -567,7 +566,7 @@ function show_post(
|
|||
<div class=\"authorcol\">
|
||||
";
|
||||
|
||||
echo user_links($user);
|
||||
echo user_links($user, BADGE_HEIGHT_SMALL);
|
||||
echo "<br>";
|
||||
if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>";
|
||||
if ($fstatus) echo "<font size=\"-2\">$fstatus</font>";
|
||||
|
|
|
@ -102,7 +102,7 @@ function show_host($host, $user, $ipprivate) {
|
|||
} else {
|
||||
$owner = BoincUser::lookup_id($host->userid);
|
||||
if ($owner && $owner->show_hosts) {
|
||||
row2(tra("Owner"), user_links($owner));
|
||||
row2(tra("Owner"), user_links($owner, BADGE_HEIGHT_MEDIUM));
|
||||
} else {
|
||||
row2(tra("Owner"), tra("Anonymous"));
|
||||
$anonymous = true;
|
||||
|
@ -359,7 +359,7 @@ function show_host_row($host, $i, $private, $show_owner, $any_product_name) {
|
|||
if ($anonymous) {
|
||||
echo "<td>".tra("Anonymous")."</td>\n";
|
||||
} else {
|
||||
echo "<td>", user_links($user), "</td>\n";
|
||||
echo "<td>", user_links($user, BADGE_HEIGHT_MEDIUM), "</td>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ function display_team_page($team, $user) {
|
|||
}
|
||||
}
|
||||
row1(tra('Members'));
|
||||
row2(tra('Founder'), user_links($team->founder));
|
||||
row2(tra('Founder'), user_links($team->founder, BADGE_HEIGHT_MEDIUM));
|
||||
if (count($team->admins)) {
|
||||
$first = true;
|
||||
$x = "";
|
||||
|
@ -171,7 +171,7 @@ function display_team_page($team, $user) {
|
|||
} else {
|
||||
$x .= " · ";
|
||||
}
|
||||
$x .= user_links($a);
|
||||
$x .= user_links($a, BADGE_HEIGHT_MEDIUM);
|
||||
}
|
||||
row2(tra('Admins'), $x);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ function display_team_page($team, $user) {
|
|||
} else {
|
||||
$x .= " · ";
|
||||
}
|
||||
$x .= user_links($a);
|
||||
$x .= user_links($a, BADGE_HEIGHT_MEDIUM);
|
||||
}
|
||||
}
|
||||
row2(tra('New members in last day'), $x);
|
||||
|
@ -256,7 +256,7 @@ function display_team_members($team, $offset, $sort_by) {
|
|||
foreach ($users as $user) {
|
||||
$user_total_credit = format_credit_large($user->total_credit);
|
||||
$user_expavg_credit = format_credit($user->expavg_credit);
|
||||
$x = user_links($user);
|
||||
$x = user_links($user, BADGE_HEIGHT_MEDIUM);
|
||||
if ($user->id == $team->userid) {
|
||||
$x .= ' ['.tra('Founder').']';
|
||||
} else if (is_team_admin_aux($user, $admins)) {
|
||||
|
@ -387,7 +387,7 @@ function show_team_row($team, $i) {
|
|||
$team_expavg_credit = format_credit_large($team->expavg_credit);
|
||||
$team_total_credit = format_credit_large($team->total_credit);
|
||||
$j = $i % 2;
|
||||
$b = badges_string(false, $team, 24);
|
||||
$b = badges_string(false, $team, BADGE_HEIGHT_MEDIUM);
|
||||
echo"<tr class=row$j>
|
||||
<td>$i</td>
|
||||
<td><a href=team_display.php?teamid=$team->id>$team->name</a> $b</td>
|
||||
|
|
|
@ -38,7 +38,7 @@ function uotd_thumbnail($profile, $user) {
|
|||
function show_uotd($profile) {
|
||||
$user = BoincUser::lookup_id($profile->userid);
|
||||
echo uotd_thumbnail($profile, $user);
|
||||
echo user_links($user, true)."<br>";
|
||||
echo user_links($user, BADGE_HEIGHT_MEDIUM)."<br>";
|
||||
$x = output_transform($profile->response1);
|
||||
$x = sanitize_tags($x);
|
||||
echo sub_sentence($x, ' ', 150, true);
|
||||
|
@ -178,7 +178,7 @@ function generate_uotd_gadget($profile, $user) {
|
|||
echo "age: $age";
|
||||
if($age <= 86400+3600) { // allow for slop
|
||||
$x .= uotd_thumbnail($profile, $user);
|
||||
$x .= user_links($user);
|
||||
$x .= user_links($user, BADGE_HEIGHT_MEDIUM);
|
||||
$resp = sanitize_tags(output_transform($profile->response1));
|
||||
$x .= " ". sub_sentence($resp, ' ', 250, true);
|
||||
}
|
||||
|
|
|
@ -262,7 +262,10 @@ function friend_links($user) {
|
|||
return $x;
|
||||
}
|
||||
|
||||
function user_links($user) {
|
||||
// show user name, with links to profile if present.
|
||||
// if $badge_height is > 0, show badges
|
||||
//
|
||||
function user_links($user, $badge_height=0) {
|
||||
BoincForumPrefs::lookup($user);
|
||||
if (is_banished($user)) {
|
||||
return "(banished: ID $user->id)";
|
||||
|
@ -277,7 +280,9 @@ function user_links($user) {
|
|||
require_once("../project/donations.inc");
|
||||
$x .= DONATION_LINK;
|
||||
}
|
||||
$x .= badges_string(true, $user, 24);
|
||||
if ($badge_height) {
|
||||
$x .= badges_string(true, $user, $badge_height);
|
||||
}
|
||||
if (function_exists("project_user_links")){
|
||||
$x .= project_user_links($user);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,15 @@ if (!defined('DISABLE_TEAMS')) {
|
|||
if (!defined('DISABLE_BADGES')) {
|
||||
define('DISABLE_BADGES', false);
|
||||
}
|
||||
if (!defined('BADGE_HEIGHT_SMALL')) {
|
||||
define('BADGE_HEIGHT_SMALL', 20);
|
||||
}
|
||||
if (!defined('BADGE_HEIGHT_MEDIUM')) {
|
||||
define('BADGE_HEIGHT_MEDIUM', 24);
|
||||
}
|
||||
if (!defined('BADGE_HEIGHT_LARGE')) {
|
||||
define('BADGE_HEIGHT_LARGE', 56);
|
||||
}
|
||||
|
||||
$caching = false;
|
||||
// if set, we're writing to a file rather than to client
|
||||
|
@ -909,7 +918,8 @@ function badges_string($is_user, $item, $height) {
|
|||
}
|
||||
|
||||
function show_badges_row($is_user, $item) {
|
||||
$x = badges_string($is_user, $item, 48);
|
||||
if (BADGE_HEIGHT_LARGE == 0) return;
|
||||
$x = badges_string($is_user, $item, BADGE_HEIGHT_LARGE);
|
||||
if ($x) {
|
||||
row2("Badges", $x);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ function show_forum($forum, $start, $sort_style, $user) {
|
|||
|
||||
echo '
|
||||
<td class="numbers">'.($thread->replies+1).'</td>
|
||||
<td>'.user_links($owner).'</td>
|
||||
<td>'.user_links($owner, BADGE_HEIGHT_SMALL).'</td>
|
||||
<td class="numbers">'.$thread->views.'</td>
|
||||
<td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td>
|
||||
</tr>
|
||||
|
|
|
@ -139,7 +139,7 @@ function handle_query($user) {
|
|||
if (!$friend) error_page("Request not found");
|
||||
page_head(tra("Friend request"));
|
||||
echo time_str($friend->create_time)."<p>\n";
|
||||
$x = user_links($srcuser, true);
|
||||
$x = user_links($srcuser, BADGE_HEIGHT_MEDIUM);
|
||||
echo tra("%1 has requested friendship with you.", $x);
|
||||
if (strlen($friend->message)) {
|
||||
echo "<p>".tra("%1 says: %2", $srcuser->name, $friend->message)."</p>";
|
||||
|
|
|
@ -103,7 +103,7 @@ function do_inbox($logged_in_user) {
|
|||
$msg->update("opened=1");
|
||||
}
|
||||
echo "<td valign=top> $checkbox $msg->subject </td>\n";
|
||||
echo "<td valign=top>".user_links($sender);
|
||||
echo "<td valign=top>".user_links($sender, BADGE_HEIGHT_SMALL);
|
||||
show_block_link($msg->senderid);
|
||||
echo "<br>".time_str($msg->date)."</td>\n";
|
||||
echo "<td valign=top>".output_transform($msg->content, $options)."<p>";
|
||||
|
@ -142,7 +142,7 @@ function do_read($logged_in_user) {
|
|||
|
||||
start_table();
|
||||
echo "<tr><th>".tra("Subject")."</th><td>".$message->subject."</td></tr>";
|
||||
echo "<tr><th>".tra("Sender")."</th><td>".user_links($sender);
|
||||
echo "<tr><th>".tra("Sender")."</th><td>".user_links($sender, BADGE_HEIGHT_SMALL);
|
||||
show_block_link($message->senderid);
|
||||
echo "</td></tr>";
|
||||
echo "<tr><th>".tra("Date")."</th><td>".time_str($message->date)."</td></tr>";
|
||||
|
|
|
@ -48,7 +48,7 @@ echo "<tr><td>";
|
|||
if ($profile) {
|
||||
$user = BoincUser::lookup_id($profile->userid);
|
||||
echo uotd_thumbnail($profile, $user);
|
||||
echo user_links($user)."<br>";
|
||||
echo user_links($user, BADGE_HEIGHT_MEDIUM)."<br>";
|
||||
$resp = output_transform($profile->response1);
|
||||
$resp = sanitize_tags($resp);
|
||||
echo sub_sentence($resp, ' ', 150, true);
|
||||
|
|
|
@ -25,7 +25,7 @@ check_get_args(array("search_string", "offset"));
|
|||
|
||||
function show_profile_link2($profile, $n) {
|
||||
$user = BoincUser::lookup_id($profile->userid);
|
||||
echo "<tr><td>".user_links($user)."</td><td>".date_str($user->create_time)."</td><td>$user->country</td><td>".(int)$user->total_credit."</td><td>".(int)$user->expavg_credit."</td></tr>\n";
|
||||
echo "<tr><td>".user_links($user, BADGE_HEIGHT_SMALL)."</td><td>".date_str($user->create_time)."</td><td>$user->country</td><td>".(int)$user->total_credit."</td><td>".(int)$user->expavg_credit."</td></tr>\n";
|
||||
}
|
||||
|
||||
$search_string = get_str('search_string');
|
||||
|
|
|
@ -29,7 +29,7 @@ function show_admin($user, $admin) {
|
|||
$tokens = url_tokens($user->authenticator);
|
||||
$date = date_str($admin->create_time);
|
||||
echo "<tr>
|
||||
<td>".user_links($admin_user)."</td>
|
||||
<td>".user_links($admin_user, BADGE_HEIGHT_MEDIUM)."</td>
|
||||
<td>$date</td>
|
||||
<td>
|
||||
";
|
||||
|
|
|
@ -43,7 +43,7 @@ function show_delta($delta) {
|
|||
} else {
|
||||
echo "<tr>
|
||||
<td>$when</td>
|
||||
<td>",user_links($user)," (ID $user->id)</td>
|
||||
<td>",user_links($user, BADGE_HEIGHT_MEDIUM)," (ID $user->id)</td>
|
||||
<td>$what</td>
|
||||
<td>$delta->total_credit</td>
|
||||
</tr>
|
||||
|
|
|
@ -79,7 +79,7 @@ foreach($users as $user) {
|
|||
echo "$user->name $e\n";
|
||||
} else {
|
||||
$e = $user->send_email?"$user->email_addr":"";
|
||||
table_row(user_links($user), $e, format_credit($user->total_credit), format_credit($user->expavg_credit), $user->country);
|
||||
table_row(user_links($user, BADGE_HEIGHT_MEDIUM), $e, format_credit($user->total_credit), format_credit($user->expavg_credit), $user->country);
|
||||
}
|
||||
}
|
||||
if (!$plain) {
|
||||
|
|
|
@ -55,7 +55,7 @@ foreach($users as $user) {
|
|||
echo "
|
||||
<tr>
|
||||
<td align=center><input type=checkbox name=remove_$ninactive_users value=$user->id>
|
||||
<td>".user_links($user)." ($user->id)</td>
|
||||
<td>".user_links($user, BADGE_HEIGHT_MEDIUM)." ($user->id)</td>
|
||||
<td>$user_total_credit</td>
|
||||
<td>$user_expavg_credit</td>
|
||||
</tr>
|
||||
|
|
|
@ -71,7 +71,7 @@ function show_user_row($user, $i) {
|
|||
echo "
|
||||
<tr class=row$j>
|
||||
<td>$i</td>
|
||||
<td>", user_links($user), "</td>
|
||||
<td>", user_links($user, BADGE_HEIGHT_MEDIUM), "</td>
|
||||
<td align=right>", format_credit_large($user->expavg_credit), "</td>
|
||||
<td align=right>", format_credit_large($user->total_credit), "</td>
|
||||
<td>", $user->country, "</td>
|
||||
|
|
|
@ -23,7 +23,7 @@ require_once("../inc/user.inc");
|
|||
function show_user($user) {
|
||||
echo "
|
||||
<tr class=row1>
|
||||
<td>", user_links($user), " (ID $user->id)</td>
|
||||
<td>", user_links($user, BADGE_HEIGHT_MEDIUM), " (ID $user->id)</td>
|
||||
";
|
||||
if ($user->teamid) {
|
||||
$team = BoincTeam::lookup_id($user->teamid);
|
||||
|
|
Loading…
Reference in New Issue