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

Run *.xhtml file through the text filters.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.2, 2.6.4, 2.7
    • Fix Version/s: 2.9
    • Component/s: Filters, Resource
    • Environment:
      All
    • Testing Instructions:
      Hide

      Pre-requisites

      1. Download the attached test_send_file.php file and place it at the root of the instance
      2. Enable the filter "Activity names auto-linking"
      3. Create a new course and add an activity named LINKED_ACTIVITY
        • Note down the ID of the course
      4. Create 3 files (a.html, a.xhtml, a.txt) with the following content:

        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
            <title>No title here...</title>
        </head>
        <body>
          Link to LINKED_ACTIVITY.
        </body>
        </html>
        

      5. Create a new file system repository in which you add those 3 files
      6. In the new course, create a file resource for each file
        • Set "Use filters on file content" to "None"
        • Set the display option to embed

      Test 1

      Testing send_stored_file()

      1. View each of the file resources
        • The content of the files should not have changed
      2. Change each file resources' filter option to All files
      3. View each of the file resources
        • All should link to the activity named LINKED_ACTIVITY
      4. Change each file resources' filter option to HTML files only
      5. View each of the file resources
        • The file resources containing the .html and .xhtml files should link to the activity named LINKED_ACTIVITY
        • The file resource containing the .txt file should not link to the activity named LINKED_ACTIVITY

      Test 2

      Testing send_file()

      1. Access the file test_send_file.php with ?courseid=COURSEID&ext=txt&filter=0
      2. Change the arguments one by one to all the combinations of:
        • ext: txt, html, xhtml
        • filter: 0, 1, 2
      3. Make sure that:
        • The txt ext only links to LINKED_ACTIVITY only with filter: 1
        • The html ext links to LINKED_ACTIVITY with filters: 1 and 2
        • The xhtml ext links to LINKED_ACTIVITY with filters: 1 and 2
      Show
      Pre-requisites Download the attached test_send_file.php file and place it at the root of the instance Enable the filter "Activity names auto-linking" Create a new course and add an activity named LINKED_ACTIVITY Note down the ID of the course Create 3 files (a.html, a.xhtml, a.txt) with the following content: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>No title here...</title> </head> <body> Link to LINKED_ACTIVITY. </body> </html> Create a new file system repository in which you add those 3 files In the new course, create a file resource for each file Set "Use filters on file content" to "None" Set the display option to embed Test 1 Testing send_stored_file() View each of the file resources The content of the files should not have changed Change each file resources' filter option to All files View each of the file resources All should link to the activity named LINKED_ACTIVITY Change each file resources' filter option to HTML files only View each of the file resources The file resources containing the .html and .xhtml files should link to the activity named LINKED_ACTIVITY The file resource containing the .txt file should not link to the activity named LINKED_ACTIVITY Test 2 Testing send_file() Access the file test_send_file.php with ?courseid=COURSEID&ext=txt&filter=0 Change the arguments one by one to all the combinations of: ext: txt, html, xhtml filter: 0, 1, 2 Make sure that: The txt ext only links to LINKED_ACTIVITY only with filter: 1 The html ext links to LINKED_ACTIVITY with filters: 1 and 2 The xhtml ext links to LINKED_ACTIVITY with filters: 1 and 2
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL9443_Filter_XHTML_files.2014-11-19
    • Sprint:
      BACKEND Sprint 18

      Description

      It should be possible to fun filters on XHTML files ("application/xhtml+xml" mime type, with extension ".xhtml").

      If there is concern about users depending on the existing non-filtering behaviour, a setting could be used to disable it by default.

        Attachments

        1. 0001-Enable-text-filtering-on-XHTML-files.patch
          4 kB
          Dave Balch
        2. backup-moodle2-course-3-xhtmlfilter-20140625-1606-nu.mbz
          16 kB
          Dave Balch
        3. M19_STABLE_0001-Run-xhtml-files-through-filters.patch
          3 kB
          Dave Balch
        4. M23_xhtml.patch
          2 kB
          Dave Balch
        5. test_send_file.php
          1 kB
          Frédéric Massart

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15