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

Remove HTML tags when exporting to Dataformats that don't support it

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • Hide

      Custom reports

      1. Log in as admin
      2. Edit your profile
        • City/town: Here & there
        • Save
      3. Navigate to Reports > Report builder > Custom reports in site administration
      4. Create a new report from Users report source
        • Ensure Include default setup is unchecked
      5. In report editor, add the following columns:
        • User > Full name with link
        • User > City/town
      6. Rename the City/town column to City & town
      7. Press Preview
      8. Download report as Portable Document Format (.pdf)
      9. Open downloaded PDF
      10. Confirm report shows content without HTML entity encoding:
        Full name with link City & town
        Admin User Hello & there
      1. Confirm the Full name with link column contains HTML tags (links to the user profile)
      2. Download report as Comma separated values (.csv)
      3. Open downloaded CSV
      4. Confirm report shows content without HTML entity encoding:
        Full name with link City & town
        Admin User Hello & there
      1. Confirm the Full name with link column does not contain HTML tags

      Custom report schedules

      Note: Requires working email configuration

      The easiest way is to use Mailhog:

      1. sudo apt-get -y install golang-go
        go get github.com/mailhog/MailHog
        

      2. Run mailhog

        ./go/bin/MailHog
        

      3. Copy '[HTTP] Binding to address:' to browser (smth like 0.0.0.0:8025) - it will open web interface
      4. In config.php paste '[SMTP] Binding to address:' will look smth like:

        $CFG->smtphosts = '0.0.0.0:1025';
        $CFG->smtpsecure = '';
        $CFG->smtpuser = '';
        $CFG->smtppass = '';
        

      1. Press Audience tab in editor
      2. Add Manually added users audience, select admin user
      3. Press Schedules tab in editor
      4. Create new schedule
        • Name: My PDF
        • Format: Portable Document Format (.pdf)
        • Starting from: 1 January 2030
        • Audience: Manually added users
        • Subject: My PDF report
        • Message: See attached PDF
        • Save
      5. Select Send schedule for the new My PDF schedule
        • Confirm you want to queue for sending
      6. Wait for cron to run (or manually execute), and report to arrive in email
      7. Confirm emailed report attachment shows content without HTML entity encoding:
        Full name with link City & town
        Admin User Hello & there
      1. Confirm the Full name with link column contains HTML tags (links to the user profile)
      2. Switch back to Schedules tab in report editor
      3. Create new schedule
        • Name: My CSV
        • Format: Comma separated values (.csv)
        • Starting from: 1 January 2030
        • Audience: Manually added users
        • Subject: My CSV report
        • Message: See attached CSV
        • Save
      4. Select Send schedule for the new My CSV schedule
        • Confirm you want to queue for sending
      5. Wait for cron to run (or manually execute), and report to arrive in email
      6. Confirm emailed report attachment shows content without HTML entity encoding:
        Full name with link City & town
        Admin User Hello & there
      1. Confirm the Full name with link column does not contain HTML tags

      System reports

      1. Log in as admin
      2. Navigate to Reports > Config changes in site administration
      3. Download report as Portable Document Format (.pdf)
      4. Open downloaded PDF
      5. Confirm the Full name with link column contains HTML tags (links to the user profile)
      6. Download report as Comma separated values (.csv)
      7. Open downloaded CSV
      8. Confirm the Full name with link column does not contain HTML tags
      Show
      Custom reports Log in as admin Edit your profile City/town: Here & there Save Navigate to Reports > Report builder > Custom reports in site administration Create a new report from Users report source Ensure Include default setup is unchecked In report editor, add the following columns: User > Full name with link User > City/town Rename the City/town column to City & town Press Preview Download report as Portable Document Format (.pdf) Open downloaded PDF Confirm report shows content without HTML entity encoding: Full name with link City & town Admin User Hello & there Confirm the Full name with link column contains HTML tags (links to the user profile) Download report as Comma separated values (.csv) Open downloaded CSV Confirm report shows content without HTML entity encoding: Full name with link City & town Admin User Hello & there Confirm the Full name with link column does not contain HTML tags Custom report schedules Note: Requires working email configuration The easiest way is to use Mailhog: sudo apt-get -y install golang-go go get github.com/mailhog/MailHog Run mailhog ./go/bin/MailHog Copy ' [HTTP] Binding to address:' to browser (smth like 0.0.0.0:8025) - it will open web interface In config.php paste ' [SMTP] Binding to address:' will look smth like: $CFG->smtphosts = '0.0.0.0:1025' ; $CFG->smtpsecure = '' ; $CFG->smtpuser = '' ; $CFG->smtppass = '' ; Press Audience tab in editor Add Manually added users audience, select admin user Press Schedules tab in editor Create new schedule Name: My PDF Format: Portable Document Format (.pdf) Starting from: 1 January 2030 Audience: Manually added users Subject: My PDF report Message: See attached PDF Save Select Send schedule for the new My PDF schedule Confirm you want to queue for sending Wait for cron to run (or manually execute), and report to arrive in email Confirm emailed report attachment shows content without HTML entity encoding: Full name with link City & town Admin User Hello & there Confirm the Full name with link column contains HTML tags (links to the user profile) Switch back to Schedules tab in report editor Create new schedule Name: My CSV Format: Comma separated values (.csv) Starting from: 1 January 2030 Audience: Manually added users Subject: My CSV report Message: See attached CSV Save Select Send schedule for the new My CSV schedule Confirm you want to queue for sending Wait for cron to run (or manually execute), and report to arrive in email Confirm emailed report attachment shows content without HTML entity encoding: Full name with link City & town Admin User Hello & there Confirm the Full name with link column does not contain HTML tags System reports Log in as admin Navigate to Reports > Config changes in site administration Download report as Portable Document Format (.pdf) Open downloaded PDF Confirm the Full name with link column contains HTML tags (links to the user profile) Download report as Comma separated values (.csv) Open downloaded CSV Confirm the Full name with link column does not contain HTML tags

    Description

      Since MDL-67547 dataformat writer classes can declare whether they support HTML rendering or not

      One of the comments from sarjona in her review of MDL-70794 regarding this:

      In reportbuilder/classes/output/dataformat_export_format.php there is a comment "Maybe this change should actually go in core.". Looking at the code in add_data method in lib/tablelib.php, it makes sense (although it seems that may impact in several places). I'm not an expert in table_dataformat_export_format so I can't evaluate how it will affect other places using it (probably third-party plugins). Thoughts?

      It makes sense in terms of consistency that a decision about this is taken for the whole of Moodle, rather than in just the Reportbuilder component, hence creating this issue

      Should dataformat writers that don't support rendering of HTML remove all HTML tags?

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              pholden Paul Holden
              Carlos Castillo Carlos Castillo
              Ilya Tregubov Ilya Tregubov
              Angelia Dela Cruz Angelia Dela Cruz
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours, 45 minutes
                  5h 45m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.