look here...

(

http://osticket.com/forums/showpost.php?p=23256&postcount=9)

:
4 months later

I did everything in these steps and in http://osticket.com/forums/showthread.php?t=6865(http://osticket.com/forums/showthread.php?t=6865)

and the editor simply is not showing up.

I think what I am missing is "ckeditor=(response)?

I am not 100% sure what is supposed to go there.

Everyone is saying it is the name of the text area, but not sure how to find out what that is.

a month later

Im 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...

<?=Format:($resp_row)?>replace it with this code...

<?php

$doc = new DOMDocument();

$doc->loadHTML(($resp_row));

echo $doc->saveHTML();

?>Now you have the CKEditor HTML output being parsed by PHP's DOMDocument(). There is probably a way to make this work system wide. +1 for who ever figures it out.

blank

BTW, I had to add the and tags to the database entry myself, the editor did NOT enter the HTML into the database. I'm looking to figure this one out now.....

I have gotten it to work to show formatted text in viewticket. Now, how can I do it, so that the client will see the formatted text and NOT a bunch of HTML?

8 days later

Ticket Views

I have successfully added CKEditor and I have moded osticket so that outgoing messages are keeping the formatting (font type, color, etc) when a client gets a message. My problem is that the tickets in the staff view look like this:

This is a test

Green Text that is really big

What files do I change and with what code to solve this problem?

I have successfully added CKEditor and I have moded osticket so that outgoing messages are keeping the formatting (font type, color, etc) when a client gets a message. My problem is that the tickets in the staff view look like this:

What files do I change and with what code to solve this problem?

Can you provide the details on what you did to make osticket keep all the formatting when sending ticket replies to customers?

How I got CKEditor Working (somewhat)

Step 1:

Download the full package of CKEditor

(http://ckeditor.com/download)

Step 2:

Create a directory inside your OSTicket directory and name it "ckeditor." In my case my OSTicked directory was called "support" but maybe yours is called "helpdesk."

Step 3:

Uncompress the CKEditor zip file.

Step 4:

Copy all of the contents of the CKEditor file (Not the folder called "ckeditor" but the contents of that folder) and place them in the "ckeditor" file you created on your site (you know, the one you created in the "OSTicket" directory.

Follow these directions from teryakisan with some corrections/additions:

This method applies to CKEditor 3.X only. (as far as I know)

in your include/staff/header.inc.php

Find this code...

PHP Code:

Directly beneath it add this code...

PHP Code:

Your src will be wherever you put your ckeditor folder.

Then in include/staff/viewticket.inc.php

Find this line of code...

PHP Code:

<?=$info?>

Directly below that add this code...

Now this is the place where I left teryakisan's instructions and went with ootweb1's code:

PHP Code:

CKEDITOR.replace( 'response' ,

{

filebrowserBrowseUrl : '/helpdesk/ckfinder/ckfinder.html',

filebrowserImageBrowseUrl : '/helpdesk/ckfinder/ckfinder.html?Type=Images',

filebrowserFlashBrowseUrl : '/helpdesk/ckfinder/ckfinder.html?Type=Flash',

filebrowserUploadUrl : '/helpdesk/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',

filebrowserImageUploadUrl : '/helpdesk/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',

filebrowserFlashUploadUrl : '/helpdesk/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'

});

Note two things:

1. The textarea where you are making this last change is called "response" and you have just changed the script section for a response or reply message in OSTicket. Further along on the script are textarea for "note" and possibly other textarea headings. I just used "find" in Notepad (my editor) and plugged in the word "textarea" and then changed the ones I wanted. Just make sure that your title (in red here) "CKEDITOR.replace( 'whatever'" matches the title in the "

2. In this part of the changes (filebrowserBrowseUrl : '/helpdesk/ckfinder/ckfinder.html') I had to change the location to "filebrowserBrowseUrl : '/support/ckfinder/ckfinder.html' so that is matched the location of my file structure on my site. You will have to make sure all of the file paths on that part of the script match your setup to get it to work. I just changed it on my first text area modification and then copied the modified area to use further down the script. Paste it in and change textarea heading for the new area (see note #1 just above this one.)

Step 1:

Download the full package of CKEditor

(http://ckeditor.com/download)

Step 2:

Create a directory inside your OSTicket directory and name it "ckeditor." In my case my OSTicked directory was called "support" but maybe yours is called "helpdesk."

Step 3:

Uncompress the CKEditor zip file.

Step 4:

Copy all of the contents of the CKEditor file (Not the folder called "ckeditor" but the contents of that folder) and place them in the "ckeditor" file you created on your site (you know, the one you created in the "OSTicket" directory.

Follow these directions from teryakisan with some corrections/additions:

Now this is the place where I left teryakisan's instructions and went with ootweb1's code:

Note two things:

1. The textarea where you are making this last change is called "response" and you have just changed the script section for a response or reply message in OSTicket. Further along on the script are textarea for "note" and possibly other textarea headings. I just used "find" in Notepad (my editor) and plugged in the word "textarea" and then changed the ones I wanted. Just make sure that your title (in red here) "CKEDITOR.replace( 'whatever'" matches the title in the "

2. In this part of the changes (filebrowserBrowseUrl : '/helpdesk/ckfinder/ckfinder.html') I had to change the location to "filebrowserBrowseUrl : '/support/ckfinder/ckfinder.html' so that is matched the location of my file structure on my site. You will have to make sure all of the file paths on that part of the script match your setup to get it to work. I just changed it on my first text area modification and then copied the modified area to use further down the script. Paste it in and change textarea heading for the new area (see note #1 just above this one.)

I will try this soon. I got ckedit to work great, but it won't do the html output for me.

Internal Notes still not right

OK, I got the staff view for a reply on OSTicket looking good with this coding:

<?php

$doc = new DOMDocument();

$doc->loadHTML(($resp_row));

echo $doc->saveHTML();

?>

(Thanks to this thread :) )

The Internal Notes do not maintain their formatting. It's not a jumble of html code plus text. It's just text. It seems that something is stripping the code. Where would I look to stop that so that bold, underline, hyperlinks and everything works right?

I Quit

"Stick a fork in me I am done."

I installed ckeditor and got it working to send formatted (bold, underline, colored font, etc) messages to clients. The problem is that it royally screws up any canned messages (templates) to clients or staff. If I type HTML code into a template for a new ticket alert, for example, OSTicket strips it out. The explanations on this forum for dealing with this HTML problem are unclear and incomplete. (Trust me, I have spent two days searching and reading here and elsewhere on the net.)

As of right now, internal notes do not display correctly. I adapted some script and the codes are gone but the text does not display with special formatting in the staff ticket window.

I cannot figure out what to change to fix the problems. On top of that, I cannot remember what I have and have not changed in certain php files. Until someone who knows this better than I do figures this out I am not doing this mod. If someone else is up to the challenge, go for it!

4 months later

I added the php for ckeditor and nothing happened

here is the code

header.tpl.php--> the ckeditor is in the root directory

<? if(!defined('OSTSCPINC') || !is_object($thisuser) || !$thisuser->isStaff() || !is_object($nav)) die('Access Denied'); ?>

<?php

if(defined('AUTO_REFRESH') && is_numeric(AUTO_REFRESH_RATE) && AUTO_REFRESH_RATE>0){ //Refresh rate

echo '';

}

?>

osTicket :: Staff Control Panel

<?php

if($cfg && $cfg->getLockTime()) { //autoLocking enabled.?>

<?}?>

<?php

if($sysnotice){?>

<?php echo $sysnotice; ?>

<?php

}?>

Welcome back, <?=$thisuser->getUsername()?>

<?php

if($thisuser->isAdmin() && !defined('ADMINPAGE')) { ?>

| Admin Panel

<?}else{?>

| Staff Panel

<?}?>

| My Preference | Log Out

>

<?

if(($tabs=$nav->getTabs()) && is_array($tabs)){

foreach($tabs as $tab) { ?>

href="<?=$tab?>" title="<?=$tab?>"><?=$tab?>

<?}

}else{ //?? ?>

My Account

<?}?>

<?php

if(($subnav=$nav->getSubMenu()) && is_array($subnav)){

foreach($subnav as $item) { ?>

" href="<?=$item?>" title="<?=$item?>"><?=$item?>

<?}

}?>

viewticket.inc.php

<?php

//Note that ticket is initiated in tickets.php.

if(!defined('OSTSCPINC') || !@$thisuser->isStaff() || !is_object($ticket) ) die('Invalid path');

if(!$ticket->getId() or (!$thisuser->canAccessDept($ticket->getDeptId()) and $thisuser->getId()!=$ticket->getStaffId())) die('Access Denied');

$info=($_POST && $errors)?Format:($_POST)(); //Re-use the post info on error...savekeyboards.org

//Auto-lock the ticket if locking is enabled..if locked already simply renew it.

if($cfg->getLockTime() && !$ticket->acquireLock())

$warn.='Unable to obtain a lock on the ticket';

//We are ready baby...lets roll. Akon rocks!

$dept = $ticket->getDept(); //Dept

$staff = $ticket->getStaff(); //Assiged staff.

$lock = $ticket->getLock(); //Ticket lock obj

$id=$ticket->getId(); //Ticket ID.

if($staff)

$warn.='  Ticket is assigned to '.$staff->getName().'';

if(!$errors && ($lock && $lock->getStaffId()!=$thisuser->getId()))

$errors='This ticket is currently locked by another staff member!';

if(!$errors && ($emailBanned=BanList:($ticket->getEmail())))

$errors='Email is in banlist! Must be removed before any reply/response';

if($ticket->isOverdue())

$warn.='  Marked overdue!';

?>

Ticket #<?=$ticket->getExtId()?> " title="Reload"> 

<? if($thisuser->canEditTickets() || ($thisuser->isManager() && $dept->getId()==$thisuser->getDeptId())) { ?>

&a=edit" title="Edit Ticket" class="Icon editTicket">Edit Ticket

<?}?>

Status:

<?=$ticket->getStatus()?>

Priority:

<?=$ticket->getPriority()?>

Department:

<?=Format:($ticket->getDeptName())?>

Create Date:

<?=Format:($ticket->getCreateDate())?>

Name:

<?=Format:($ticket->getName())?>

Email:

<?php

echo $ticket->getEmail();

if(($related=$ticket->getRelatedTicketsCount())) {

echo sprintf('  (%d)',

urlencode($ticket->getEmail()),$related);

}

?>

Phone:

<?=Format:($ticket->getPhoneNumber())?>

Source:

<?=$ticket->getSource()?>

Subject: <?=Format:($ticket->getSubject())?>

Assigned Staff:

<?=$staff?Format:($staff->getName()):'- unassigned -'?>

Last Response:

<?=Format:($ticket->getLastResponseDate())?>

<?php

if($ticket->isOpen()){ ?>

Due Date:

<?=Format:($ticket->getDueDate())?>

<?php

}else { ?>

Close Date:

<?=Format:($ticket->getCloseDate())?>

<?php

}

?>

Help Topic:

<?

$ht=$ticket->getHelpTopic();

echo Format:($ht?$ht:'N/A');

?>

IP Address:

<?=$ticket->getIP()?>

Last Message:

<?=Format:($ticket->getLastMessageDate())?>

<?if($errors && $_POST=='process') {?>

<?=$errors?>

<?}elseif($msg && $_POST=='process' || $_POST=='update' ) {?>

<?=$msg?>

<?}elseif($warn) {?>

<?=$warn?>

<?}?>

<?

//Ticket adminstrative options...admin,managers and staff with manage perm allowed.

if($thisuser->canManageTickets() || $thisuser->isManager()){ ?>

' method=post class="inline" >

"/>

 Action:

onChange="this.form.ticket_priority.disabled=strcmp(this.options.value,'change_priority','reopen','overdue')?false;">

Select Action

>Change Priority

<?if(!$ticket->isoverdue()){ ?>

>Mark Overdue

<?}?>

<?if($ticket->isAssigned()){ ?>

>Release (unassign)

<?}?>

<?if($thisuser->canCloseTickets()){

//if you can close a ticket...reopening it is given.

if($ticket->isOpen()){?>

>Close Ticket

<?}else{?>

>Reopen Ticket

<?}

}?>

<?php

if($thisuser->canManageBanList()) {

if(!$emailBanned) {?>

Ban Email <?=$ticket->isOpen()?'& Close':''?>

<?}else{?>

Un-Ban Email

<?}

}?>

<?if($thisuser->canDeleteTickets()){ //oooh...fear the deleters! ?>

Delete Ticket

<?}?>

Priority:

>

-Unchanged-

<?

$priorityId=$ticket->getPriorityId();

$resp=db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE);

while($row=db_fetch_array($resp)){ ?>

" <?=$priorityId==$row?'disabled':''?> ><?=$row?>

<?}?>

  

<?}?>

<?

//Internal Notes

$sql ='SELECT note_id,title,note,source,created FROM '.TICKET_NOTE_TABLE.' WHERE ticket_id='.db_input($id).' ORDER BY created DESC';

if(($resp=db_query($sql)) && ($notes=db_num_rows($resp))){

$display=($notes>5)?'none':'block'; //Collapse internal notes if more than 5.

?>

Internal Notes (<?=$notes?>)

;text-align;">

<?

while($row=db_fetch_array($resp)) {?>

<?=Format:($row)?> -  posted by <?=$row?>

<? if($row) {?>

<?=Format:($row)?>

<?} ?>

<?=Format:($row)?>

<?} ?>

<?} ?>

Ticket Thread

<?

//get messages

$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)) {

?>

<?=Format:($msg_row)?>

<?if($msg_row>0){ ?>

<?=$ticket->getAttachmentStr($msg_row,'M')?>

<?}?>

<?=Format:($msg_row)?> 

<?

//get answers for messages

ckeditor

$sql='SELECT resp.*,count(attach_id) as attachments FROM '.TICKET_RESPONSE_TABLE.' resp '.

' LEFT JOIN '.TICKET_ATTACHMENT_TABLE." attach ON resp.ticket_id=attach.ticket_id AND resp.response_id=attach.ref_id AND ref_type='R' ".

' WHERE msg_id='.db_input($msg_row).' AND resp.ticket_id='.db_input($id).

' GROUP BY resp.response_id ORDER BY created';

$resp =db_query($sql);

while ($resp_row = db_fetch_array($resp)) {

$respID=$resp_row;

?>

<?=Format:($resp_row)?> - <?=$resp_row?>

<?if($resp_row>0){ ?>

<?=$ticket->getAttachmentStr($respID,'R')?>

<?}?>

<?=Format:($resp_row)?>

<?}

$msgid =$msg_row;

}?>

<?if($_POST!='process') {?>

<?if($errors) {?>

<?=$errors?>

<?}elseif($msg) {?>

<?=$msg?>

<?}?>

<?}?>

Post Reply

#reply" name="reply" id="replyform" method="post" enctype="multipart/form-data">

">

">

 <?=$errors?>

<?

$sql='SELECT premade_id,title FROM '.KB_PREMADE_TABLE.' WHERE isenabled=1 '.

' AND (dept_id=0 OR dept_id='.db_input($ticket->getDeptId()).')';

$canned=db_query($sql);

if($canned && db_num_rows($canned)) {

?>

Canned Response: 

onChange="getCannedResponse(this.options.value,this.form,'response');this.selectedIndex='0';" >

Select a premade reply

<?while(list($cannedId,$title)=db_fetch_row($canned)) { ?>

" ><?=Format:($title)?>

<?}?>

   Append

<?}?>

<?=$info?>

CKEDITOR.replace( 'response' );

<?php if($cfg->canUploadFiles()){ //TODO: may be allow anyways and simply email out attachment?? ?>

Attach File:

" />

 <?=$errors?>

<?php }?>

<?

$appendStaffSig=$thisuser->appendMySignature();

$appendDeptSig=$dept->canAppendSignature();

$info=!$info?'none':$info; //change 'none' to 'mine' to default to staff signature.

if($appendStaffSig || $appendDeptSig) { ?>

Append Signature:

None

<?if($appendStaffSig) {?>

> My signature

<?}?>

<?if($appendDeptSig) {?>

> Dept Signature

<?}?>

<?}?>

Ticket Status:

<?

$checked=isset($info)?'checked':''; //Staff must explicitly check the box to change status..

if($ticket->isOpen()){?>

> Close on Reply

<?}else{ ?>

> Reopen on Reply

<?}?>

Post Internal Note

#notes" name="notes" class="inline" method="post" enctype="multipart/form-data">

">

Note Title:

" size=30px />

* <?=$errors?>

Enter note content.

* <?=$errors?>

<?=$info?>

<?

//When the ticket is assigned Allow assignee, admin or ANY dept manager to close it

if(!$ticket->isAssigned() || $thisuser->isadmin() || $thisuser->isManager() || $thisuser->getId()==$ticket->getStaffId()) {

?>

Ticket Status:

<?

$checked=($info && isset($info))?'checked':''; //not selected by default.

if($ticket->isOpen()){?>

> Close Ticket

<?}else{ ?>

> Reopen Ticket

<?}?>

<?}?>

<?

if($thisuser->canTransferTickets()) {

?>

Dept. Transfer

#transfer" name="notes" method="post" enctype="multipart/form-data">

">

Department:

-Select Target Dept.-

<?

$depts= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE.' WHERE dept_id!='.db_input($ticket->getDeptId()));

while (list($deptId,$deptName) = db_fetch_row($depts)){

$selected = ($info==$deptId)?'selected':''; ?>

"<?=$selected?>><?=$deptName?> Department

<?

}?>

 *<?=$errors?>

Comments/Reasons for the transfer.  ()

 *<?=$errors?>

<?=$info?>

<?}?>

<?

//When the ticket is assigned Allow assignee, admin or ANY dept manager to reassign the ticket.

if(!$ticket->isAssigned() || $thisuser->isadmin() || $thisuser->isManager() || $thisuser->getId()==$ticket->getStaffId()) {

?>

<?=$staff?'Re Assign Ticket':'Assign to Staff'?>

#assign" name="notes" method="post" enctype="multipart/form-data">

">

Staff Member:

-Select Staff Member.-

<?

//TODO: make sure the user's group is also active....DO a join.

$sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name FROM '.STAFF_TABLE.

' WHERE isactive=1 AND onvacation=0 ';

if($ticket->isAssigned())

$sql.=' AND staff_id!='.db_input($ticket->getStaffId());

$depts= db_query($sql.' ORDER BY lastname,firstname ');

while (list($staffId,$staffName) = db_fetch_row($depts)){

$selected = ($info==$staffId)?'selected':''; ?>

"<?=$selected?>><?=$staffName?>

<?

}?>

 *<?=$errors?>

Comments/message for assignee.  ()

 *<?=$errors?>

wrap="soft" style="width%;"><?=$info?>

<?}?>

8 months later

i replaced but... any idea?

i replaced the skop like you guided but nothing happened, any idea?

Im 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...

<?=Format:($resp_row)?>replace it with this code...

<?php

$doc = new DOMDocument();

$doc->loadHTML(($resp_row));

echo $doc->saveHTML();

?>Now you have the CKEditor HTML output being parsed by PHP's DOMDocument(). There is probably a way to make this work system wide. +1 for who ever figures it out.

blank

BTW, I had to add the and tags to the database entry myself, the editor did NOT enter the HTML into the database. I'm looking to figure this one out now.....

Write a Reply...