[SOLVED] Print from CKEditor

Moderator: crythias

Locked
soth
Znuny newbie
Posts: 16
Joined: 22 Apr 2014, 14:45
Znuny Version: OTRS 3.3
Real Name: Marek Soth

[SOLVED] Print from CKEditor

Post by soth »

Hi,

I have been trying to figure this out for weeks and I am out of energy. I am surprised nobody has ever needed this, at least I haven't found a single forum nor google reference.

we are trying to configure a print plugin for CK editor.

As I have found out, the config.js file in CKEditor folder is ignored and used are internal otrs config files.

I believe it should be configured in Core.UI.RichTextEditor.js but I am not sure how.

I have downloaded the CKEditor print plugin and put it into Plugins folder.

How do we enable this plugin and how do we put an icon on the toolbar? I believe in RichTextEditor.dtl?

Thanks.
Last edited by soth on 04 Jun 2014, 15:23, edited 1 time in total.
OTRS 4.0.8, Virtual Appliance
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Print from CKEditor

Post by crythias »

Are you asking this because you need functionality within OTRS or because you can't ask this in the CK editor forum?

I can tell you why it's not been asked here: It's not relevant. That is to say, until the submit button is pressed, the data in rich text is not valid, and afterward, the print button for the ticket is what's used to print the result, because the ticketing system is not a word processor. Which means you could just as easily compose your ticket in word, print from that, and copy/paste to the ticket and get your result.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Print from CKEditor

Post by crythias »

But here's the solution:

download the print plugin for ckeditor 4.3 (if you're using OTRS 3.3) extract "print" to otrs/var/httpd/htdocs/js/thirdparty/ckeditor-4.3/plugins

edit var/httpd/htdocs/js/Core.UI.RichTextEditor.js:

Code: Select all

extraPlugins: Core.Config.Get('RichText.SpellChecker') ? 'print,aspell,onchange' : 'print,onchange',

You need to have a Print icon so...

Kernel/Output/HTML/Standard/RichTextEditor.dtl

Code: Select all

 if ( '$Config{"Frontend::RichText::EnhancedMode"}' === '1' ) {
        Core.Config.Set('RichText.Toolbar', [
            ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'NumberedList', 'BulletedList', 'Table', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Link', 'Unlink', 'Undo', 'Redo', 'SelectAll' ],
            '/',
            ['Print', 'Image', 'HorizontalRule', 'PasteText', 'PasteFromWord', '-', '-', 'Find', 'Replace', 'SpellCheck', 'TextColor', 'BGColor', 'RemoveFormat', '-', 'ShowBlocks', 'Source', 'SpecialChar', '-', 'Maximize'],
            ['Format', 'Font', 'FontSize' ]
        ]);
and there you are. Make sure 'Print' is somewhere in a toolbar.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
soth
Znuny newbie
Posts: 16
Joined: 22 Apr 2014, 14:45
Znuny Version: OTRS 3.3
Real Name: Marek Soth

Re: Print from CKEditor

Post by soth »

crythias wrote:Are you asking this because you need functionality within OTRS or because you can't ask this in the CK editor forum?

I can tell you why it's not been asked here: It's not relevant. That is to say, until the submit button is pressed, the data in rich text is not valid, and afterward, the print button for the ticket is what's used to print the result, because the ticketing system is not a word processor. Which means you could just as easily compose your ticket in word, print from that, and copy/paste to the ticket and get your result.
Hi crythias, well I am sorry if I asked wrong, I checked the CK Editor web site how to add the plugin of course but it is not relevant since it is not possible in such way so asking on their forums is also of no use.

The thing is, we use templates for Recieveing protocols, Hand out Protocols etc. and printing the ticket directly is not exactly what we need.

That's why I kindly asked if it would be a difficult task for us to add a print support for CK Editor.

If so, we must try another solution.
OTRS 4.0.8, Virtual Appliance
soth
Znuny newbie
Posts: 16
Joined: 22 Apr 2014, 14:45
Znuny Version: OTRS 3.3
Real Name: Marek Soth

Re: Print from CKEditor

Post by soth »

crythias wrote:But here's the solution:

download the print plugin for ckeditor 4.3 (if you're using OTRS 3.3) extract "print" to otrs/var/httpd/htdocs/js/thirdparty/ckeditor-4.3/plugins

edit var/httpd/htdocs/js/Core.UI.RichTextEditor.js:

Code: Select all

extraPlugins: Core.Config.Get('RichText.SpellChecker') ? 'print,aspell,onchange' : 'print,onchange',

You need to have a Print icon so...

Kernel/Output/HTML/Standard/RichTextEditor.dtl

Code: Select all

 if ( '$Config{"Frontend::RichText::EnhancedMode"}' === '1' ) {
        Core.Config.Set('RichText.Toolbar', [
            ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'NumberedList', 'BulletedList', 'Table', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Link', 'Unlink', 'Undo', 'Redo', 'SelectAll' ],
            '/',
            ['Print', 'Image', 'HorizontalRule', 'PasteText', 'PasteFromWord', '-', '-', 'Find', 'Replace', 'SpellCheck', 'TextColor', 'BGColor', 'RemoveFormat', '-', 'ShowBlocks', 'Source', 'SpecialChar', '-', 'Maximize'],
            ['Format', 'Font', 'FontSize' ]
        ]);
and there you are. Make sure 'Print' is somewhere in a toolbar.
Well, OK, thank you very much for this.

Best regards,

Soth
OTRS 4.0.8, Virtual Appliance
soth
Znuny newbie
Posts: 16
Joined: 22 Apr 2014, 14:45
Znuny Version: OTRS 3.3
Real Name: Marek Soth

Re: [SOLVED] Print from CKEditor

Post by soth »

Hello again after 1 year,

We have currently updated our beloved OTRS to version 4. Migration was smooth and went very well.

However the CK Editor toolbar is a pain to configure.

I again did everything as one year ago but the print button would not show up at all.

If I delete or add really any button from the toolbar in the Kernel/Output/HTML/Standard/RichTextEditor.tt there is no change.

Any clues would be much appritiated.
OTRS 4.0.8, Virtual Appliance
soth
Znuny newbie
Posts: 16
Joined: 22 Apr 2014, 14:45
Znuny Version: OTRS 3.3
Real Name: Marek Soth

Re: [SOLVED] Print from CKEditor

Post by soth »

soth wrote:Hello again after 1 year,

We have currently updated our beloved OTRS to version 4. Migration was smooth and went very well.

However the CK Editor toolbar is a pain to configure.

I again did everything as one year ago but the print button would not show up at all.

If I delete or add really any button from the toolbar in the Kernel/Output/HTML/Standard/RichTextEditor.tt there is no change.

Any clues would be much appritiated.
Ok I have figured it out. The cache needed to be deleted and everything worked out.
OTRS 4.0.8, Virtual Appliance
Locked