Closed Bug 153887 Opened 22 years ago Closed 22 years ago

long descriptions not wrapped in the browser window

Categories

(Bugzilla :: Bugzilla-General, defect)

2.14.1
All
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 11901

People

(Reporter: rcarter, Assigned: justdave)

Details

long descriptions not wrapped in the browser window

GetLongDescriptionAsHTML() in globals.pl returns preformatted text. This causes 
all the long descriptions for bugs I've ported into my 2.14.1 installation to 
over run the width of the page. This makes it difficult to read and impossible 
to print the full long description.

I'm mucked aroung with with this routine, adding width settings in the <PRE> 
tag, but preformatted text doesn't seem to have any mechanism to limit the 
width of the text, and wrap it at the browser window.

The text I have in the long description field was ported from a gnats database 
and a filemaker data base (painfull), and doesn't have any "\n"'s.

Any ideas on solving this?

Changing the tag to <P> isn't the answer.
Here is a hack that is somewhat sucessful, but can split in the middle of a
word.

sub GetLongDescriptionAsHTML {
    my ($id, $start, $end) = (@_);
    my $result = "";
    my $count = 0;
    my %knownattachments;
    SendSQL("SELECT attach_id FROM attachments WHERE bug_id = $id");
    while (MoreSQLData()) {
        $knownattachments{FetchOneColumn()} = 1;
    }

    my ($query) = ("SELECT profiles.realname, profiles.login_name,
longdescs.bug_when, " .
                   "       longdescs.thetext " .
                   "FROM longdescs, profiles " .
                   "WHERE profiles.userid = longdescs.who " .
                   "      AND longdescs.bug_id = $id ");

    if ($start && $start =~ /[1-9]/) {
        # If the start is all zeros, then don't do this (because we want to
        # not emit a leading "Additional Comments" line in that case.)
        $query .= "AND longdescs.bug_when > '$start'";
        $count = 1;
    }
    if ($end) {
        $query .= "AND longdescs.bug_when <= '$end'";
    }

    $query .= "ORDER BY longdescs.bug_when";
    SendSQL($query);
    while (MoreSQLData()) {
        my ($who, $email, $when, $text) = (FetchSQLData());
        $email .= Param('emailsuffix');
        if ($count) {
            $result .= "<BR><BR><I>------- Additional Comments From ";
              if ($who) {
                  $result .= qq{<A HREF="mailto:$email">$who</A> } .
                      time2str("%Y-%m-%d %H:%M", str2time($when)) .
                          " -------</I><BR>\n";
              } else {
                  $result .= qq{<A HREF="mailto:$email">$email</A> } .
                      time2str("%Y-%m-%d %H:%M", str2time($when)) .
                          " -------</I><BR>\n";
              }
        }
	my (@data) = split (/.$/gm, $text);
	$text = '';
	foreach my $line (@data) {
		if ((length($line)) >= 60) {
			my $new_line = "";
			my $length = length($line);
			my $i = 0;
			until (90*$i >= $length) {
		#	for (my $i = 0; $i<=$length; $i++) { 
				my $s = substr($line, ($i)*90, 90*(1+$i));
				$new_line .= "$s" . "\n";
				$i++
			}
			$line = $new_line;
		}
		$text .= $line; 
	}
        $result .= "<PRE>" . quoteUrls(\%knownattachments, $text) . "</PRE>\n";
        $count++;
    }

    return $result;
}
Dupe of bug 11901 - see the (long) discussion in there

*** This bug has been marked as a duplicate of 11901 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.