Hello I'm new here and my company chose this system to replace the old. I took a PERL class once many, many years ago so please be patient with me.
Here goes...
I am transferring data from a helpdesk system we are currently on. The body of the message is stored in HTML so when I transfer it to OTRS it displays with all the HTML tags. How can I get the system to process the HTML and display as a normal message?
View Article from stored HTML
Moderator: crythias
Re: View Article from stored HTML
Hi,
I think a possible easier way would be to strip all of the HTML tags from the imported text so it displays as a normal article would. There is a perl module specifically for this: http://search.cpan.org/~kilinrax/HTML-Strip-1.06/
Assuming you are using a script (or commands that could be scripted) to import the old data directly into the database, you could use this module to strip the text before it is inserted.
I think a possible easier way would be to strip all of the HTML tags from the imported text so it displays as a normal article would. There is a perl module specifically for this: http://search.cpan.org/~kilinrax/HTML-Strip-1.06/
Assuming you are using a script (or commands that could be scripted) to import the old data directly into the database, you could use this module to strip the text before it is inserted.
Backend: OTRS 3.0.11 RedHat Enterprise Linux 6.2, Apache, MySQL with replication
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
-
- Znuny newbie
- Posts: 3
- Joined: 23 Apr 2012, 22:13
- Znuny Version: 3.1.1
- Real Name: Nathaniel Hawthorne
Re: View Article from stored HTML
Thanks for your response!
Unfortunately stripping out the html will mess up the data pretty bad. I wish there was a way to let the browser run that part of the text and process the html.
Any other suggestion?
Unfortunately stripping out the html will mess up the data pretty bad. I wish there was a way to let the browser run that part of the text and process the html.
Any other suggestion?
Re: View Article from stored HTML
I'm not sure if you'll be able to do that without messing up the article display for all non-html formatted articles. I'm assuming you are importing html formatted articles, and will then be using the system as normal from that point onwards.
You may be able to edit the dtl file that controls ticket display (/opt/otrs/Kernel/Output/HTML/Standard/AgentTicketZoom.dtl I think), so that it doesn't quote (escape) the data using the $QData{"ArticleID"} placeholder, and instead change it to just $Data{"ArticleID"}. This is pretty much ideas and speculation but I think it could work. This represents a pretty big additional security risk though, as you will be allowing raw html from the database to run on client machines if you do this.
As for where in that file to change this, I'd recommend using an html inspection tool (like firebug for firefox) to inspect the ticket zoom view and to try to locate the article display area inside the file.
You may be able to edit the dtl file that controls ticket display (/opt/otrs/Kernel/Output/HTML/Standard/AgentTicketZoom.dtl I think), so that it doesn't quote (escape) the data using the $QData{"ArticleID"} placeholder, and instead change it to just $Data{"ArticleID"}. This is pretty much ideas and speculation but I think it could work. This represents a pretty big additional security risk though, as you will be allowing raw html from the database to run on client machines if you do this.
As for where in that file to change this, I'd recommend using an html inspection tool (like firebug for firefox) to inspect the ticket zoom view and to try to locate the article display area inside the file.
Backend: OTRS 3.0.11 RedHat Enterprise Linux 6.2, Apache, MySQL with replication
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
-
- Znuny newbie
- Posts: 3
- Joined: 23 Apr 2012, 22:13
- Znuny Version: 3.1.1
- Real Name: Nathaniel Hawthorne
Re: View Article from stored HTML
So after digging and digging and trying some of the suggestions in this thread I ended up commenting out these lines of code that were in Kernel\Modules\AgentTicketZoom.pm.
# html quoting
$Article{Body} = $Self->{LayoutObject}->Ascii2Html(
NewLine => $Self->{ConfigObject}->Get('DefaultViewNewLine'),
Text => $Article{Body},
VMax => $Self->{ConfigObject}->Get('DefaultViewLines') || 5000,
HTMLResultMode => 1,
LinkFeature => 1,
);
Some say this poses a security risk but it was in our old system this way and if I would have stripped out all the HTML we would have lost all formatting and references to images.
I don't know if it will break something else but I have been trying to figure this out for about a week. I'm on a deadline so this will have to do for now.
# html quoting
$Article{Body} = $Self->{LayoutObject}->Ascii2Html(
NewLine => $Self->{ConfigObject}->Get('DefaultViewNewLine'),
Text => $Article{Body},
VMax => $Self->{ConfigObject}->Get('DefaultViewLines') || 5000,
HTMLResultMode => 1,
LinkFeature => 1,
);
Some say this poses a security risk but it was in our old system this way and if I would have stripped out all the HTML we would have lost all formatting and references to images.
I don't know if it will break something else but I have been trying to figure this out for about a week. I'm on a deadline so this will have to do for now.