View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
09409Bug reportsImport/Exportpublic2015-03-21 11:20
Reporteryurj Assigned Toaesteban  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09409: PDF export by user contains html tag
Description

Hi!

when a user submit a survey and want to get the pdf version of the answers, the pdf shows the description of the questions in html (<span>this is a question, for example). The question description is created with the html editor in 2.05+, but when using formatting (span, colors, strong) the pdf report it as html tag instead of a textual (or rendered) version.

Steps To Reproduce

create a survey
describe the question with the editor, using bold, colors and so on

Additional Information

I've searched trought the code but I'm unable to find how to fix it.

TagsNo tags attached.
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)Version 2.05+ Build 141210
I will donate to the project if issue is resolvedNo
BrowserFirefox 34.0.5
Database type & versionmysql
Server OS (if known)linux
Webserver software & version (if known)apache
PHP Version5.4

Relationships

related to 09576 closedaesteban PDF print survey reslts 

Users monitoring this issue

aesteban

Activities

DenisChenu

DenisChenu

2014-12-15 15:54

developer   ~31253

@aesteban : it's a child of https://github.com/LimeSurvey/LimeSurvey/commit/cb5228c0065095953438029b5bc832d3a1f16525

tcpddf can use some HTML with writeHTML (http://www.tcpdf.org/doc/code/classTCPDF.html#ac3fdf25fcd36f1dce04f92187c621407) but need:

  • To be used
  • To filter question text before ?
  • To allow only some tag ?
DenisChenu

DenisChenu

2014-12-15 16:19

developer   ~31254

You can use $this->delete_html for starting, but : remind to remove script too :)

DenisChenu

DenisChenu

2014-12-15 16:51

developer   ~31256

@aesteban : Expression manager in question text are not replaced too.

aesteban

aesteban

2014-12-16 02:31

developer   ~31257

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14741

aesteban

aesteban

2014-12-16 02:32

developer   ~31258

Fixed:

https://github.com/LimeSurvey/LimeSurvey/commit/d94715ba9ae43a08258b0473e86d6c722d09d41d

aesteban

aesteban

2014-12-16 02:41

developer   ~31259

Fix committed to 2.06 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14742

DenisChenu

DenisChenu

2014-12-16 08:56

developer   ~31262

Last edited: 2014-12-16 09:02

Thanks, great for HTML part in question : some bug at github and another here:

  • Answer part : great for text, but with included survey : picture at end show encoded HTML (see ligther included lss)

PS: realky great for HTML \o/ . I just think we need to filter it before (CHtmlPurifier with a lot of option)

PS2: another litle issue, maybe can be fixed with HTML purifier or some baseurl : relative URL are not updated to absolute url : but this one must be in dev, not in bug.

yurj

yurj

2014-12-16 10:44

reporter   ~31263

Thanks for the quick fix :-D

I don't know how to apply it or if I can. Should I wait the next update? Thanks again!

aesteban

aesteban

2014-12-16 15:24

developer   ~31267

@DenisChenu : Thanks a lot for your comments, I'm already writing the code. I have a doubt: In my opinion, answers text from users should be managed as plain text, like in "Question 1" in you survey example. However, if we replace links in picture question as you suggest, aren't we doing contradictory things? Which would be the criteria?

@yurj : If you don't want/can to wait for next release, you can take the patch from git repo with "git diff" and apply it to your code with "patch -p1"

DenisChenu

DenisChenu

2014-12-16 15:32

developer   ~31268

@aesteban : the problem is:

  • With Question text we MUST return encoded html (like in the example) <strong>strong</strong>
  • With some other question (single choice) : we can return HTML : like in the example <img src='preview.png' />

BUT : we need to know what is the question type ..... Before we allways return filtered HTML (for example <img src='png.png' alt='png picture' /> return empty string.

I don't know actually how is the better way to fix it. But it's better than before.

aesteban

aesteban

2014-12-16 15:51

developer   ~31269

@DenisChenu : We could open another bug for questions similar to single choice (a complex issue) and for the moment return HTML tags as plain text (i.e. keep current behaviour). Is this ok for you?

DenisChenu

DenisChenu

2014-12-16 16:40

developer   ~31270

I think it's better to use flattenText to don't change precedent behaviour https://github.com/LimeSurvey/LimeSurvey/commit/cb5228c0065095953438029b5bc832d3a1f16525#diff-48eb7edba3e2af076bba04777db710deL159

You can open a new bug, i try to have a look :)

aesteban

aesteban

2014-12-16 18:38

developer   ~31273

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14745

aesteban

aesteban

2014-12-16 18:39

developer   ~31274

Fix committed to 2.06 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14746

DenisChenu

DenisChenu

2014-12-16 19:13

developer   ~31275

Thank you !!

Do you think we can use EM in header title and text ?
I make a test

c_schmitz

c_schmitz

2014-12-29 15:33

administrator   ~31376

Version 2.05 Build 141229 released

Related Changesets

LimeSurvey: master d94715ba

2014-12-16 01:30:44

aesteban

Details Diff
Fixed issue 09409 : PDF export by user contains html tag Affected Issues
09409
mod - application/controllers/PrintanswersController.php Diff File
mod - application/libraries/admin/pdf.php Diff File

LimeSurvey: 2.06 4c18d76a

2014-12-16 01:41:20

aesteban

Details Diff
Fixed issue 09409 : PDF export by user contains html tag Affected Issues
09409
mod - application/controllers/PrintanswersController.php Diff File
mod - application/libraries/admin/pdf.php Diff File

LimeSurvey: master a48b8288

2014-12-16 17:37:25

aesteban

Details Diff
Fixed issue 09409 : PDF export by user contains html tag
Dev : Purifying HTML code
Dev : flattenText is back to answer texts
Dev : Fix wrong variable aSurveyInfo
Affected Issues
09409
mod - application/libraries/admin/pdf.php Diff File

LimeSurvey: 2.06 53e01789

2014-12-16 17:39:16

aesteban

Details Diff
Fixed issue 09409 : PDF export by user contains html tag
Dev : Purifying HTML code
Dev : flattenText is back to answer texts
Dev : Fix wrong variable aSurveyInfo
Affected Issues
09409
mod - application/libraries/admin/pdf.php Diff File

Issue History

Date Modified Username Field Change
2014-12-15 14:36 yurj New Issue
2014-12-15 15:46 DenisChenu Assigned To => aesteban
2014-12-15 15:46 DenisChenu Status new => assigned
2014-12-15 15:54 DenisChenu Note Added: 31253
2014-12-15 16:19 DenisChenu File Added: limesurvey_survey_09409.lss
2014-12-15 16:19 DenisChenu Note Added: 31254
2014-12-15 16:51 DenisChenu Note Added: 31256
2014-12-16 02:31 aesteban Changeset attached => LimeSurvey master d94715ba
2014-12-16 02:31 aesteban Note Added: 31257
2014-12-16 02:31 aesteban Resolution open => fixed
2014-12-16 02:32 aesteban Note Added: 31258
2014-12-16 02:39 aesteban Status assigned => resolved
2014-12-16 02:39 aesteban Fixed in Version => 2.05+
2014-12-16 02:39 aesteban Issue Monitored: aesteban
2014-12-16 02:41 aesteban Changeset attached => LimeSurvey 2.06 4c18d76a
2014-12-16 02:41 aesteban Note Added: 31259
2014-12-16 08:56 DenisChenu Note Added: 31262
2014-12-16 08:56 DenisChenu File Added: limesurvey_survey_print2.lss
2014-12-16 08:59 DenisChenu Note Edited: 31262
2014-12-16 09:02 DenisChenu Note Edited: 31262
2014-12-16 10:44 yurj Note Added: 31263
2014-12-16 15:24 aesteban Note Added: 31267
2014-12-16 15:32 DenisChenu Note Added: 31268
2014-12-16 15:51 aesteban Note Added: 31269
2014-12-16 16:40 DenisChenu Note Added: 31270
2014-12-16 18:38 aesteban Changeset attached => LimeSurvey master a48b8288
2014-12-16 18:38 aesteban Note Added: 31273
2014-12-16 18:39 aesteban Changeset attached => LimeSurvey 2.06 53e01789
2014-12-16 18:39 aesteban Note Added: 31274
2014-12-16 19:13 DenisChenu Note Added: 31275
2014-12-29 15:33 c_schmitz Note Added: 31376
2014-12-29 15:33 c_schmitz Status resolved => closed
2015-03-21 11:20 DenisChenu Relationship added related to 09576
2021-08-03 03:21 guest Bug heat 8 => 10