Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

How to allow rich text, bold text and colored text incoming ticket??

Recently running the great program OSticket.
All works great and have used already some mods from this amazing forum.:)

Still one very important mod (for us), i did not got to work...:confused:

Does someone know "how to" and if it`s possible to allow rich text format on incoming emailed tickets???

It seems to be stripped.

My clients very often copy text from word (or other app) and paste this in their emails.
These texts contains bold text and colored text which is meant for us.
When the email is fetched into osticket it changes the bold text and colored texts into normal text.
It`s important that the staff can see this (bold or colored) text in the ticket in other to do their work ..


Does someone know how to implement this allowing rich text into osticket?

Thanks a lot for your help so far!!!

Comments

  • Search the forum for FCK editor. :D
  • Dear Teryakisan,

    Thanks for your reply. It is highly appreciated.
    I have seen your solution on the FCKeditor post. U r good..:D
    I have managed to get your FCKEditor solution working on the staff side.
    HTML is going out all fine which is great.
    Accept one thing, i cannot add the canned premade response. It doesn`t show in the FCK editor.
    Maybe i did something wrong..:confused:
    ( i am not a programmer, but learning)

    I have also added the FCK editor on the client side. It shows fine before sending.
    The only thing is, when the HTML ticket is send from open.php it shows as text (the html code) (like viewing the source) on the tickthread in the staffside. This means html is not stripped out, which is good, but it doesnt shows the actual html view.

    Do i have to insert the FCK editor also for the ticketthread (customermessage) itself?
    I yes , how can i manage this?

    I think i am almost there, but some small things left to be adjusted.
    Your help is needed, thanks!!
  • The problem with the canned responses is that the selects onchange event is pointed at your textarea, which no longer exists after the javascript for CKEditor takes over. I can get it to almost work by replacing the selects onchange event to..

    onChange=\"getCannedResponse(this.options[this.selectedIndex].value,this.form,'response');this.selectedIndex='0';CKEDITOR.instances.response.setData();


    BUT......you have to click the entry twice to get it to display in the editor, and it still acts kinda crazy after that. It seems like the first click is storing the data somewhere, then the second click is actually posting it to the editor. I'm trying to figure it out.

    To get HTML from the client side to display properly in viewticket.inc.php youll need to add some more code...

    Giving your clients access to DOMDocument() is extremely dangerous. I accept no responsibility if someone takes advantage of this fact.

    Find the code...

    //get messages


    also find the code...

    //get answers for messages


    BETWEEN those two, make the code like this...

    $sql='SELECT msg.msg_id,msg.created,msg.message,count(attach_id) as attachments FROM '.TICKET_MESSAGE_TABLE.' msg '.

    ' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.\" attach ON msg.ticket_id=attach.ticket_id AND msg.msg_id=attach.ref_id AND ref_type='M' \".

    ' WHERE msg.ticket_id='.db_input($id).

    ' GROUP BY msg.msg_id ORDER BY created';

    $msgres =db_query($sql);

    while ($msg_row = db_fetch_array($msgres)) {

    ?>

    <table align=\"center\" class=\"message\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>

    <tr><th><?=Format::db_daydatetime($msg_row['created'])?>&nbsp;-&nbsp;<?=Format::htmlchars($ticket->getName())?> </th></tr>

    <?if($msg_row['attachments']>0){ ?>

    <tr class=\"header\"><td><?=$ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td></tr>

    <?}?>

    <tr><td>

    <?php
    $doc = new DOMDocument();
    $doc->loadHTML($msg_row['message']);
    echo $doc->saveHTML();
    ?>

    &nbsp;</td></tr>

    </table>

    <?



    GOOD LUCK! :cool:
  • Dear Teryakisan,
    Thank you so much for your fast reply and support!!!

    The canned response adjustment works!! Great, great ,great, thank you so much. You are right about the fact that the premade response has to be clicked twice, but it works for now:)

    About the html view on the ticketthread staff side, i included the code you mentioned, but it is not working yet in my code..
    I have modded the files also from other posts about html, so maybe it is messed up a little somewhere. I will try to start to implement your post about the FCK editor another time starting with default clean php files....
    Maybe that will do the job...


    I am aware about the risk, but without the HTML part, i have frustrated colleagues:D....


    Along with this post i have added a picture to show how the ticketthread looks like before sending and after.
    I also added some of the responsible php files, maybe you can have (when you have time) a look what i did wrong...

    In the meantime i am trying to solve the last pieces of this HTML puzzle before adding other nice mods...:)


    *** By the way i have also added your mod "simple status"...this mod is brilliant and perfect for our ticketsystem..!:cool: ****

    [ATTACH]389[/ATTACH]

    [ATTACH]390[/ATTACH]

    [ATTACH]392[/ATTACH]
    client - all input shows fine in message field before sending.jpg
    788 x 469 - 31K
    ticketthread staffside.jpg
    1135 x 400 - 66K
    Allow HTML(not working example).zip
    30K
  • Please try the include/staff/viewticket.inc.php that I have attached. Let me know how it goes.
    Allow HTML( (maybe) working example).zip
    30K
  • Thanks again for your help!!!:D

    I have replaced the include/staff/viewticket.inc.php, but no luck yet in the HTML view on the ticketthread...
    One thing that got my attention today is that in the admin area, i could not save the auto response templates when adjusting the auto reponses to HTML.
    I did not have tested this so far, when i applied the FCK editor post and the HTML mods.

    The body messages made in the staff side with the FCK editor are sent nicely in html by the way, so i assumed after adjusting the autoreplies to html this would work as well.

    Maybe the problem with the saving is somehow related to the fact HTML is not shown in the ticketthread.

    Are there other files i should have a look at which are important?

    p.s.
    The premade replies are saved in the database right? I did not made any adjustments in the database for the HTML mod...

    Any ideas?

    Greetings!!:)

    in the meantime trying to get this work ....:cool:
  • yes, yes, yes, it is working... well...i had it working for some minutes...:cool::confused:

    I took a clean class.format.php and removed the striptags again.
    Also i took a clean class.ticket.php and removed the striptags...

    in class.format.php:

    Around line 79 below //Format text for display..
    i removed: ($text)


    function display($text) {
    global $cfg;


    now its diplaying the html in color etc in the ticketthread..so far i have tested..

    But it is bad coding, because when replying a internal note or replying to client, parts are blank of the page... when i undo this, it works again smooth, but showing as html code again..

    Maybe this gives you an idea...

    Many thanks!
  • CannedResponse fix

    Go to scp.js and edit function "setCannedResponse" to this:
    function setCannedResponse(xmlreply,fObj,target)
    {
    if (xmlreply.status == Http.Status.OK)
    {
    var resp=xmlreply.responseText;
    iObj=fObj.elements[target];
    if(iObj && resp){
    iObj.value=(fObj.append && fObj.append.checked)? CKEDITOR.instances[target].insertHtml(resp) && trim(iObj.value+\"\n\n\"+resp):trim(resp)+\"\n\n\" && CKEDITOR.instances[target].setData(resp);
    }else {
    alert(\"Invalid form or tag\");
    }
    }
    else{
    alert(\"Cannot handle the AJAX call. Error#\"+ xmlreply.status);
    }
    }


    Now you dont need click twice to get it to display, and Append checkBox should work. The reason that your solution dint work is because this function use Asynchronous ajax.
    teryakisan;23206 said:
    The problem with the canned responses is that the selects onchange event is pointed at your textarea, which no longer exists after the javascript for CKEditor takes over. I can get it to almost work by replacing the selects onchange event to..

    onChange=\"getCannedResponse(this.options[this.selectedIndex].value,this.form,'response');this.selectedIndex='0';CKEDITOR.instances.response.setData();


    BUT......you have to click the entry twice to get it to display in the editor, and it still acts kinda crazy after that. It seems like the first click is storing the data somewhere, then the second click is actually posting it to the editor. I'm trying to figure it out.

    To get HTML from the client side to display properly in viewticket.inc.php youll need to add some more code...

    Giving your clients access to DOMDocument() is extremely dangerous. I accept no responsibility if someone takes advantage of this fact.

    Find the code...

    //get messages


    also find the code...

    //get answers for messages


    BETWEEN those two, make the code like this...

    $sql='SELECT msg.msg_id,msg.created,msg.message,count(attach_id) as attachments FROM '.TICKET_MESSAGE_TABLE.' msg '.

    ' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.\" attach ON msg.ticket_id=attach.ticket_id AND msg.msg_id=attach.ref_id AND ref_type='M' \".

    ' WHERE msg.ticket_id='.db_input($id).

    ' GROUP BY msg.msg_id ORDER BY created';

    $msgres =db_query($sql);

    while ($msg_row = db_fetch_array($msgres)) {

    ?>

    <table align=\"center\" class=\"message\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=0>

    <tr><th><?=Format::db_daydatetime($msg_row['created'])?>&nbsp;-&nbsp;<?=Format::htmlchars($ticket->getName())?> </th></tr>

    <?if($msg_row['attachments']>0){ ?>

    <tr class=\"header\"><td><?=$ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td></tr>

    <?}?>

    <tr><td>

    <?php
    $doc = new DOMDocument();
    $doc->loadHTML($msg_row['message']);
    echo $doc->saveHTML();
    ?>

    &nbsp;</td></tr>

    </table>

    <?



    GOOD LUCK! :cool:
  • Outstanding!
  • Great work here!!!:)

    All working now!! Thanks guys....!
  • leonardo;23256 said:
    Go to scp.js and edit function "setCannedResponse" to this:
    function setCannedResponse(xmlreply,fObj,target)
    {
    if (xmlreply.status == Http.Status.OK)
    {
    var resp=xmlreply.responseText;
    iObj=fObj.elements[target];
    if(iObj && resp){
    iObj.value=(fObj.append && fObj.append.checked)? CKEDITOR.instances[target].insertHtml(resp) && trim(iObj.value+\"\n\n\"+resp):trim(resp)+\"\n\n\" && CKEDITOR.instances[target].setData(resp);
    }else {
    alert(\"Invalid form or tag\");
    }
    }
    else{
    alert(\"Cannot handle the AJAX call. Error#\"+ xmlreply.status);
    }
    }
    Now you dont need click twice to get it to display, and Append checkBox should work. The reason that your solution dint work is because this function use Asynchronous ajax.
    There is an issue with the 'append' checkbox. Choosing any option after any option replaces the previous option and all text in the text area. Append checkbox appears to do nothing. :confused:
  • Unble to post response.
    teryakisan;23257 said:
    Outstanding!
    Hi teryakisan,


    Can you Please help me?

    I have small mistake in CKeditor (rich text ,bold ,colourfull ) we have successfully done POST REPLY Tab on osticket staff pannel with CKeditor opions(rich text ,bold ,colourfull ).But problem is that ,when we were submit post reply on any open ticket.show error Unble to post the response.

    Please give me solution.its urgent
  • Bold colored and tables on post reply from ckeditor loose there format

    messages containing (Bold and coloured,tables etc)send from ckeditor on post reply is shown as text message without those bold colored and tables .kindly provide me with a solution
  • Try this...
    abhinav;23367 said:
    messages containing (Bold and coloured,tables etc)send from ckeditor on post reply is shown as text message without those bold colored and tables .kindly provide me with a solution
    One of two things can be happening here...

    PHP is stripping out the generated HTML tags, in which case make sure you have done this...

    http://osticket.com/forums/showpost.php?p=22583&postcount=11

    either that or the generated HTML is not being parsed, in which case youll want to look here...

    http://osticket.com/forums/showpost.php?p=22581&postcount=10

    Good luck. ;)
  • Double Check
    abhishek kumar raghubansi;23361 said:
    Hi teryakisan,


    Can you Please help me?

    I have small mistake in CKeditor (rich text ,bold ,colourfull ) we have successfully done POST REPLY Tab on osticket staff pannel with CKeditor opions(rich text ,bold ,colourfull ).But problem is that ,when we were submit post reply on any open ticket.show error Unble to post the response.

    Please give me solution.its urgent
    Make sure the name of your ckeditor instance is the same as the original textarea instance that it is replacing. If ckeditor has a different name than the original, the value will not be passed, and the system will think it is blank, thus, resulting in an "Unable to post response" message.

    Make sure that you did not change the original name of the textarea instance, as the associated variables will also cease to function in that particular instance.

    Good Luck.
  • <?=Format::htmlchars($resp_row['response'])?>

    Hi I can not find This code <?=Format::htmlchars($resp_row['response'])?> or

    <?php
    $doc = new DOMDocument();
    $doc->loadHTML(($resp_row['response']));
    echo $doc->saveHTML();
    ?>

    in my include/staff/viewticket.inc.php .is there something wrong Kindly revert and tell where to keep these file if necessary
  • um...

    You should not be LOOKING for that code, you should be TYPING that code.

    It simply DOES NOT EXIST until YOU add it.

    Go back to the beginning of the original thread (that was for CKEditor on backend) and start over, this time, reading it all as you go along.

    Here's the link to the original thread.

    http://osticket.com/forums/showthread.php?t=5967&highlight=editor

    :rolleyes:
  • <?=Format::htmlchars($resp_row['response'])?>

    This is what been given there
    m unsure if I can help with the email, but I can (kinda) guide you in the right direction..

    open up include/staff/viewticket.inc.php

    find this code...

    PHP Code:
    <?=Format::htmlchars($resp_row['response'])?>
    replace it with this code...

    PHP Code:
    <?php
    $doc = new DOMDocument();
    $doc->loadHTML(($resp_row['response']));
    echo $doc->saveHTML();
    ?>

    but i couldn't find <?=Format::htmlchars($resp_row['response'])?> so how i could replace it with another code.Please help me
  • Hi ...

    i am install CKeditor ....but when we post rply through editor..send html msg format..


    but i couldn't find <?=Format::htmlchars($resp_row['response'])?> so how i could replace it with another code.Please help me




    teryakisan;23368 said:
    One of two things can be happening here...

    PHP is stripping out the generated HTML tags, in which case make sure you have done this...

    http://osticket.com/forums/showpost.php?p=22583&postcount=11

    either that or the generated HTML is not being parsed, in which case youll want to look here...

    http://osticket.com/forums/showpost.php?p=22581&postcount=10

    Good luck. ;)
  • oops.

    My bad, the line is #262 in ... include/staff/viewticket.inc.php

    <?=Format::display($resp_row['response'])?>


    I'll fix it in the original post.
  • thanks a lot

    its working fine Thanks for ur support
Sign In or Register to comment.