Ticket #1396 (closed defect: fixed)

Opened 5 months ago

Last modified 3 months ago

Wordwrap in ticket system

Reported by: anonymous Assigned to:
Priority: minor Milestone: ispCP ω 1.0.0 - RC7
Component: Frontend (GUI) Version: ispCP ω 1.0.0 - RC6
Severity: Easy Keywords:
Cc:

Description

The wordwrap in the ticket display corrupts the text. Sometimes a <br /> is split before /> resulting in these two characters being displayed in the message.

My fix, reseller/view_ticket.php, line 137:

$tc = nl2br($rs->fields['ticket_message']);
$tc = preg_replace("/(\r\n|\n|\r)/", "", $tc);
$tc = preg_replace("=<br */?>=i", "\n", $tc);
$ftc = "";
foreach( preg_split( "/(\r\n|\n|\r)/", $tc ) as $line )
  $ftc .= wordwrap(html_entity_decode($line), round(($screenwidth-200) / 7), "\n", 1 )."\n";

then replace

'TICKET_CONTENT' => wordwrap(html_entity_decode(nl2br($rs->fields['ticket_message'])), round(($screenwidth-200) / 7), "<br>\n", 1),

below with

'TICKET_CONTENT' => nl2br($ftc),

The first step makes sure, that we only have <br>s in the text, the second step filters out "\n"s that might be introduced by nl2br, the third step filters out all possible types of <br> (in case the used added <br>s to the text himself). Then all this is splic on "\n"s and every line is wordwrapped.

I guess of the first three steps not every single one is required, but it doesn't hurt. Same goes for client/view_ticket.php

Attachments

Change History

07/09/08 14:09:25 changed by rats

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone changed from Working to ispCP ω 1.0.0 - RC6.

I got a easier solution:

nl2br(wordwrap(html_entity_decode($rs->fields['ticket_message']), round(($screenwidth-200) / 7), "\n"));

Here we create every ($screenwidth-200) / 7 a "\n" string. Before the whole string will parsed, all "\n" will be changed in "<br />".

You can find it in r1268

09/11/08 12:03:15 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

This doesn't seem to be in the Trunk. Must have been reverted...

09/11/08 21:52:37 changed by scitech

  • milestone changed from ispCP ω 1.0.0 - RC6 to Working.

09/14/08 21:32:36 changed by scitech

  • status changed from reopened to closed.
  • version changed from ispCP ω 1.0.0 - RC4 to ispCP ω 1.0.0 - RC6.
  • resolution set to fixed.
  • milestone changed from Working to ispCP ω 1.0.0.

Thank you. Fixed in r1349

09/15/08 09:21:11 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

The same problem exists for the admin and the clients. They seem to have been reverted as well.

09/15/08 11:15:32 changed by scitech

  • status changed from reopened to closed.
  • resolution set to fixed.

Thank you. Fixed in r1350.


Add/Change #1396 (Wordwrap in ticket system)




Action