From 3641a319fceb0c7026f7ac289dd32baecd34e49b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Dec 2016 18:17:57 -0800 Subject: [PATCH] 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. --- html/inc/bootstrap.inc | 2 +- html/inc/forum.inc | 11 ++++++++--- html/inc/util.inc | 11 ++++++----- html/user/forum_forum.php | 2 +- html/user/pm.php | 5 ++++- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/html/inc/bootstrap.inc b/html/inc/bootstrap.inc index bf96ebc0a6..7d3e694d7c 100644 --- a/html/inc/bootstrap.inc +++ b/html/inc/bootstrap.inc @@ -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"); } } diff --git a/html/inc/forum.inc b/html/inc/forum.inc index b452c0e1b9..361ef94c44 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -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 " - + id\"> "; diff --git a/html/inc/util.inc b/html/inc/util.inc index be06be39b8..9dbd38a15a 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -232,7 +232,7 @@ function page_head( echo "$t\n"; echo ' - + '; 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 '
- +
'; } -function start_table($class="") { - echo start_table_str($class); +function start_table($class="", $style="") { + echo start_table_str($class, $style); } function end_table_str() { diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index 139f6b2d31..7a7fac0ac1 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -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 ''; + echo ''; } else { // Just a standard thread. echo ''; diff --git a/html/user/pm.php b/html/user/pm.php index 2ca0e55bc4..867e286183 100644 --- a/html/user/pm.php +++ b/html/user/pm.php @@ -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) {