Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

web: fix layout problem with forum tables #2743

Merged
merged 9 commits into from
Mar 5, 2019
14 changes: 6 additions & 8 deletions html/inc/forum.inc
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,15 @@ function show_team_forum_title($forum, $thread=null, $link_thread=false) {
echo "</span>";
}

// start a table containing messages, where the layout is fixed
// (to accommodate long [pre] lines)
// and the left column (author info) has fixed size
// start a table of forum posts
//
function start_forum_table($headings) {
$a = array();
foreach ($headings as $h) {
$a[] = null;
}
$a[0] = 'style="width: 10em;"';
start_table('table-striped', 'table-layout:fixed');
$a[1] = 'style="width: 100%"';
start_table('table-striped');
row_heading_array($headings, $a);
}

Expand Down Expand Up @@ -566,7 +564,7 @@ function show_post(
$is_posted_by_special = false;
for ($i=0; $i<sizeof($special_user_bitfield);$i++) {
if ($user->prefs && $user->prefs->privilege($keys[$i])) {
$fstatus.=$special_user_bitfield[$keys[$i]]."<br>";
$fstatus.="<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>";
$is_posted_by_special = true;
}
}
Expand All @@ -588,7 +586,7 @@ function show_post(
<a name=\"$post->id\"></a>
";

echo user_links($user, 0);
echo user_links($user, 0, 30);
echo "<br>";
if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>";
echo "<span class=\"small\">";
Expand Down Expand Up @@ -698,7 +696,7 @@ function show_post(

// show message in a panel
//
echo '<div class="panel panel-default">
echo '<div class="panel panel-default" style="word-break: break-word;">
<div class="panel-body">'
.$posttext
.'</div></div>
Expand Down
6 changes: 3 additions & 3 deletions html/inc/text_transform.inc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function replace_pre_code($text, $export) {
$x = remove_br(substr($matches[0], 5, -6));
$x = htmlspecialchars($x, ENT_COMPAT, "UTF-8", false);
$x = str_replace("[", "&#91;", $x);
return "<pre>$x</pre>";
return "<pre style=\"white-space:pre-wrap; \">$x</pre>";
},
$text
);
Expand Down Expand Up @@ -241,8 +241,8 @@ function bb2html($text, $export=false) {
"<a href=\"http://\\2\" rel=\"nofollow\">http://\\2</a>",
"<em>\\1 wrote:</em><blockquote>\\2</blockquote>",
"<blockquote>\\1</blockquote>",
"<ul>\\1</ul><p>",
"<ol>\\1</ol><p>",
"<ul style=\"word-break:break-word;\">\\1</ul><p>",
"<ol style=\"word-break:break-word;\">\\1</ol><p>",
"<img hspace=\"8\" class=\"img-responsive\" src=\"\\1\\2\"> ",
"<img hspace=\"8\" width=400 src=\"\\1\\2\"> ",
"<font color=\"\\1\">\\2</font>",
Expand Down
11 changes: 8 additions & 3 deletions html/inc/user.inc
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ function friend_links($user) {

// show user name, with links to profile if present.
// if $badge_height is > 0, show badges
// if $name_limit, limit name to N chars
//
function user_links($user, $badge_height=0) {
function user_links($user, $badge_height=0, $name_limit=0) {
BoincForumPrefs::lookup($user);
if (is_banished($user)) {
return "(banished: ID $user->id)";
Expand All @@ -337,14 +338,18 @@ function user_links($user, $badge_height=0) {
$img_url = url_base()."img/head_20.png";
$x .= ' <a href="'.url_base().'view_profile.php?userid='.$user->id.'"><img title="View the profile of '.$user->name.'" src="'.$img_url.'" alt="Profile"></a>';
}
$x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$user->name."</a>";
$name = $user->name;
if ($name_limit && strlen($name) > $name_limit) {
$name = substr($name, 0, $name_limit)."...";
}
$x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>";
if (function_exists("project_user_links")){
$x .= project_user_links($user);
}
if ($badge_height) {
$x .= badges_string(true, $user, $badge_height);
}
return $x;
return $name_limit?"<nobr>$x</nobr>":$x;
}

function show_community_private($user) {
Expand Down