Kayako logo
Modifications & Addon Releases Modification guides and addons are posted here to share with the community. Do not post requests in here!

Notices

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
Thumbs up Display HTML ticket posts properly (without breaking text-only posts) - 26-03-2008, 02:49 PM

Here is a method of showing all the pretty formatting of Outlook , WITHOUT breaking the formatting of newlines on plaintext posts.

This requires an edit to modules/tickets/functions_ticketmain.php

Please do not attempt this if you are not familiar with PHP. YOU CAN BREAK YOUR ENTIRE HELPDESK IF YOU MESS THIS UP!

Here is how to make the mod:

Locate the function in this file called "getTicketPosts"

Look for the section in this function with the following code (mine was on line 537, yours will probably be different)

PHP Code:
if ($nobr == true)
{
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $dbCore->Record["contents"];
} else {
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $this->returnProcessedContent($dbCore->Record["contents"]);

Add the following code above it, and modify the if statement as follows. Yours should look the same as this:

PHP Code:
$ContentsCopy $dbCore->Record["contents"];  //make a copy of the contents
$OriginalLength strlen($ContentsCopy);  //get original length of the string
$NewLength strlen(strip_tags($ContentsCopy));  //get length after HTML tags are stripped
            
if ($OriginalLength != $NewLength || $nobr == true)
{
  
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $dbCore->Record["contents"];
} else {
    
$_posts[$dbCore->Record["ticketpostid"]]["contents"] = $this->returnProcessedContent($dbCore->Record["contents"]);
         } 
The logic here is to check for HTML tags before inserting a <BR> on every line. If there are any HTML or PHP tags present, the PHP function strip_tags will remove them, resulting in a different string length. If the length is different, HTML is present, so you do not want to insert the <BR> tags. Just display the HTML-formatted text as-is.

That's all it takes. You should be able to read ticket posts from Outlook in all their original HTML glory. This won't affent plain-text posts. They will still have the <BR> tags inserted so they display property. If this does not work for you, make sure your Admin control panel settings are set to parse and display HTML e-mails.

Enjoy!
   
Reply With Quote
  (#2) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 138
Join Date: Oct 2007
Location: Jakarta, Indonesia
01-04-2008, 02:24 PM

jenglish, I'm so glad you're working on this, and I wonder if you or someone else could help me out. Arggh! I'm frustrated by this!

My issue is not so much getting the Outlook client replies into Kayako with all their pretty formatting. I just want three (simple?) things:
  1. The tickets that originate in Outlook to not have extra line breaks all over the place.
  2. Staff replies to new ticket alerts, using Outlook, not coming back to the client missing ALL their line breaks and running together in a big mess.
  3. Our staff typically use the corporate logo in their signature, and I want that completely stripped out of there. What I get so far is the image coming in as an attachment (which I don't like but can live with) and the filename of the image inserted in the signature, which is ugly. Is there any way to get rid of that?
Please have a look at the attachment, which should clarify things a bit.

My settings are:
  • HTML Conversion: Strip Tags
  • Automatically Convert Encoding: Yes
  • Strip <Script>: Yes
  • Allow HTML: Yes
  • Valid tags: <b><i><u><font><hr><strong>
By the way, when I did try your mod, the menus of my staff CP always went funny when I was viewing a ticket, with hyperlink lines underneath. I had HTML Conversion set to 'No Processing'. I also had trouble getting my breaklines to work.
Attached Images
File Type: png mucked_ticket.png (75.6 KB, 32 views)


Matthew Arciniega
The Precision Group

+ Holiday schedules, attachable to work and staff schedules
+ No more HTML parsing bugs
   
Reply With Quote
  (#3) Old
jenglish Offline
New Member
 
jenglish's Avatar
 
Posts: 22
Join Date: Jan 2007
Location: Tyler, TX
01-04-2008, 05:04 PM

I don't have time now for a detailed reply, but I'll see if I can be of any help

The extra spaces come from Kayako inserting a <BR> at the end of every line of code in an HTML post (regardless of what the code already has). Outlook encloses each hard-returned line of text in <p> tags. So, when Kayako inserts another <BR>, viola! Extra line breaks!

The mod I posted SHOULD take out the extra space between lines (at least it did for me).

I also see the underlined hyperlinks when I view some ticket posts. The browser is picking up on the <style> tag from the Outlook post and applying it to the entire screen.

If anybody has a fix for this, please post it here. I will eventually get around to invesitgating this, but since it is a minor cosmetic annoyance, it's not exactly at the top of my to-do list right now.
   
Reply With Quote
Reply

Tags
breaking, display, html, posts, properly, textonly, ticket

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML ticket posts from Outlook butchered jenglish SupportSuite, eSupport and LiveResponse 10 26-03-2008 02:43 PM
Ticket text truncated because of HTML? PeteV How do I? 1 25-07-2007 06:17 PM
New Build: 3.10.02 STABLE Ryan Lederman News and Announcements 0 05-03-2007 09:53 PM
eSupport v2.2 RC1 Available in Members Area Varun Shoor Technical Chat 1 17-05-2004 01:28 PM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46