Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30639

Lesson answers display HTML tags

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.4, 2.2.1
    • Component/s: Lesson
    • Labels:
    • Environment:
      Linux
    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. create lesson activity
      2. add essay question
      3. as student, attempt the lesson activity by putting the following answer:
        <p>test1</p>
        <p>test1</p>
        <p>test1</p>
      4. as teacher, select 'reports' tab
      5. select student's attempt

      Make sure the answer section doesn't contain any html tag

      Show
      create lesson activity add essay question as student, attempt the lesson activity by putting the following answer: <p>test1</p> <p>test1</p> <p>test1</p> as teacher, select 'reports' tab select student's attempt Make sure the answer section doesn't contain any html tag
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Student answers to lesson question pages display html tags. Please see screenshot for an example.

      Reproduction steps:

      1. Create a lesson which includes a question page.
      2. Log in as a student and submit an answer to the question page which includes some <p></p> tags in the HTML behind the answer.
      3. Log in as a teacher and view the answer from the student.

      The answer will include the <p></p> tags on the page.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              salvetore Michael de Raadt added a comment -

              Thanks for reporting this.

              I've put that on the backlog.

              In the meantime feel free to help us work on this issue. If you are able to provide a patch, please add a patch label so we will spot it.

              Show
              salvetore Michael de Raadt added a comment - Thanks for reporting this. I've put that on the backlog. In the meantime feel free to help us work on this issue. If you are able to provide a patch, please add a patch label so we will spot it.
              Hide
              abgreeve Adrian Greeve added a comment -

              The code looks good. Thanks Rosie

              Show
              abgreeve Adrian Greeve added a comment - The code looks good. Thanks Rosie
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Thanks Adrian.

              Submitting for integration review.

              Show
              rwijaya Rossiani Wijaya added a comment - Thanks Adrian. Submitting for integration review.
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Hi Rossi,

              I'm send thing back at the moment as it needs more work.
              There are two things wrong with this solution:

              1. All new calls to format_text or format_string must include the context option. In this case context is the module context. Easy.
              2. We can't assume FORMAT_MOODLE. A quick check and I see that if I add an essay question I get an editor which means we need to use what ever format the user used in their answer.

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Hi Rossi, I'm send thing back at the moment as it needs more work. There are two things wrong with this solution: All new calls to format_text or format_string must include the context option. In this case context is the module context. Easy. We can't assume FORMAT_MOODLE. A quick check and I see that if I add an essay question I get an editor which means we need to use what ever format the user used in their answer. Cheers Sam
              Hide
              rwijaya Rossiani Wijaya added a comment -

              Thanks Sam for the feedback.

              I updated the patch according to your suggestion.

              Re-submit for integration review.

              Show
              rwijaya Rossiani Wijaya added a comment - Thanks Sam for the feedback. I updated the patch according to your suggestion. Re-submit for integration review.
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Hi Rossi,

              I've just being looking at this now.
              You've used $answerdata->responseformat as the format for the format_text call, however following that back it looks like it is always just set to FORMAT_PLAIN in report.php.
              Are you sure that is the format for the users answer?

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Hi Rossi, I've just being looking at this now. You've used $answerdata->responseformat as the format for the format_text call, however following that back it looks like it is always just set to FORMAT_PLAIN in report.php. Are you sure that is the format for the users answer? Cheers Sam
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Hi Rossi,

              I've been having a good look at this this morning and I've chosen to integrate your fix with one small change.
              Rather than using the format you set it to I changed it to FORMAT_MOODLE.
              As we discussed yesterday the fact the essay isn't storing the format the user used is a huge bug.
              This morning I went through lesson code and noted that it uses FORMAT_MOODLE in some place (where it actually bothers to format) so I've gone with that.

              I've also opened MDL-30867 to see this fixed in the lesson module.

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Hi Rossi, I've been having a good look at this this morning and I've chosen to integrate your fix with one small change. Rather than using the format you set it to I changed it to FORMAT_MOODLE. As we discussed yesterday the fact the essay isn't storing the format the user used is a huge bug. This morning I went through lesson code and noted that it uses FORMAT_MOODLE in some place (where it actually bothers to format) so I've gone with that. I've also opened MDL-30867 to see this fixed in the lesson module. Cheers Sam
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Tested during integration. Still buggy however MDL-30867 will fix that!

              Show
              samhemelryk Sam Hemelryk added a comment - Tested during integration. Still buggy however MDL-30867 will fix that!
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks!

              Now... disconnect, relax and enjoy the next days, yay!

              Closing...ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks! Now... disconnect, relax and enjoy the next days, yay! Closing...ciao

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Jan/12