web: improve message display

In messages (forum or PM) a [pre] section with a long line
would stretch the table cell,
causing that message and others to run off the edge of the window.

The solution, as Juha pointed out, is to use table-layout:fixed
for those tables, and to explicitly set the width of the other columns.
This causes the long lines to be put in boxes with a horizontal scrollbar,
and nothing overflows.
This commit is contained in:
David Anderson 2016-12-07 18:17:57 -08:00
parent 5136e65719
commit 3641a319fc
5 changed files with 20 additions and 11 deletions

View File

@ -168,7 +168,7 @@ function sample_navbar(
);
if (defined('REMOTE_JOB_SUBMISSION') && REMOTE_JOB_SUBMISSION) {
require_once("../inc/submit_db.inc");
if (BoincUserSubmit::lookup_userid($user->id)) {
if ($user && BoincUserSubmit::lookup_userid($user->id)) {
$x[] = array("Job submission", $url_prefix."submit.php");
}
}

View File

@ -205,8 +205,13 @@ function show_team_forum_title($forum, $thread=null, $link_thread=false) {
}
function start_forum_table($headings) {
start_table('table-striped');
row_heading_array($headings);
$a = array();
foreach ($headings as $h) {
$a[] = null;
}
$a[0] = 'style="width: 10em;"';
start_table('table-striped', 'table-layout:fixed');
row_heading_array($headings, $a);
}
function page_link($url, $page_num, $items_per_page, $text) {
@ -556,7 +561,7 @@ function show_post(
echo "
<tr>
<td $class rowspan=\"3\" class=\"col-sm-2\">
<td $class rowspan=\"3\">
<a name=\"$post->id\"></a>
";

View File

@ -232,7 +232,7 @@ function page_head(
echo "<title>$t</title>\n";
echo '
<meta charset="utf-8">
<link rel="stylesheet" href="'.secure_url_base().'/bootstrap.min.css" media="all">
<link type="text/css" rel="stylesheet" href="'.secure_url_base().'/bootstrap.min.css" media="all">
';
if (defined('STYLESHEET')) {
$stylesheet = $url_base.STYLESHEET;
@ -371,14 +371,15 @@ function pretty_time_str($x) {
return time_str($x);
}
function start_table_str($class="") {
function start_table_str($class="", $style="") {
$s = $style?'style="'.$style.'"':'';
return '<div class="table">
<table width="100%" class="table table-condensed '.$class.'" >
<table '.$s.' width="100%" class="table table-condensed '.$class.'" >
';
}
function start_table($class="") {
echo start_table_str($class);
function start_table($class="", $style="") {
echo start_table_str($class, $style);
}
function end_table_str() {

View File

@ -167,7 +167,7 @@ function show_forum($forum, $start, $sort_style, $user) {
//if ($thread->status==1){
// This is an answered helpdesk thread
if ($user && is_subscribed($thread, $subs)) {
echo '<tr class="bg-success">';
echo '<tr class="bg-info">';
} else {
// Just a standard thread.
echo '<tr>';

View File

@ -75,7 +75,10 @@ function do_inbox($logged_in_user) {
";
echo form_tokens($logged_in_user->authenticator);
start_table('table-striped');
row_heading_array(array(tra("Subject"), tra("Sender and date"), tra("Message")));
row_heading_array(
array(tra("Subject"), tra("Sender and date"), tra("Message")),
array('style="width: 12em;"', 'style="width: 10em;"', "")
);
foreach($msgs as $msg) {
$sender = BoincUser::lookup_id($msg->senderid);
if (!$sender) {