Moodle
  1. Moodle
  2. MDL-36609

Cannot upload html or txt files to lesson activities

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.6, 2.3.3
    • Fix Version/s: 2.2.7, 2.3.4
    • Component/s: Filepicker, Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Visit a course and create a lesson activity.
      2. In the settings attach a plain .txt file that contains a lot of text.
      3. Add a question to the lesson activity.
      4. Log in as a student and click on the lesson activity.
      5. Click on the link 'Linked media' to view the attached file - the link is located on a block on the page.
      6. Ensure you can see the text in the file on the next page.
      Show
      Visit a course and create a lesson activity. In the settings attach a plain .txt file that contains a lot of text. Add a question to the lesson activity. Log in as a student and click on the lesson activity. Click on the link 'Linked media' to view the attached file - the link is located on a block on the page. Ensure you can see the text in the file on the next page.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-36609_master
    • Rank:
      46101

      Description

      See MDLQA-5047. Uploading HTML files, text files, etc. do not work. This requires investigation, bug fixing and possibly the QA testing instructions need updating as they are pretty vague.

        Issue Links

          Activity

          Hide
          Mark Nelson added a comment -

          Hi Joseph, I was able to upload a .txt file without any issues. Is there any more details you can provide, such as browser you are using etc? The lesson module uses the file element 'filepicker' which is used throughout Moodle, so this issue should not be limited to the Lesson module, but be present throughout Moodle where the 'filepicker' is used (note, not 'filemanager').

          Show
          Mark Nelson added a comment - Hi Joseph, I was able to upload a .txt file without any issues. Is there any more details you can provide, such as browser you are using etc? The lesson module uses the file element 'filepicker' which is used throughout Moodle, so this issue should not be limited to the Lesson module, but be present throughout Moodle where the 'filepicker' is used (note, not 'filemanager').
          Hide
          Joseph Rézeau added a comment -

          @Mark,

          Yes, you can upload a .txt file but... when taking the lesson, if you click the Click here to view link, that text is not displayed! Same for HTML files, PDF, etc.
          The fundamental flaw of this feature is that it enables you to upload certain file types which will not be displayed later on, which is confusing to the end-user...

          The more I think about it the more I am inclined to definitely remove that "Pop-up to file or web page" feature from Lesson and invite users to use an HTML block instead.

          Show
          Joseph Rézeau added a comment - @Mark, Yes, you can upload a .txt file but... when taking the lesson, if you click the Click here to view link, that text is not displayed! Same for HTML files, PDF, etc. The fundamental flaw of this feature is that it enables you to upload certain file types which will not be displayed later on, which is confusing to the end-user... The more I think about it the more I am inclined to definitely remove that "Pop-up to file or web page" feature from Lesson and invite users to use an HTML block instead.
          Hide
          Mark Nelson added a comment -

          Hi Joseph, I can confirm this is an issue in 2.2, 2.3 and 2.4. Thanks for reporting. I was however able to see the contents for PDF, just not a .txt file. Will create a fix now.

          Show
          Mark Nelson added a comment - Hi Joseph, I can confirm this is an issue in 2.2, 2.3 and 2.4. Thanks for reporting. I was however able to see the contents for PDF, just not a .txt file. Will create a fix now.
          Hide
          Mark Nelson added a comment -

          Hi Joseph, I found the issue.

          The text is being rendered but the window displaying the text is not large enough to actually show the text. JavaScript is used to work out the dimensions of this box. However, the JS is failing in lib/javascript-static.js when retrieving the size for the HTML element 'page-footer' as it does not exist on these pages, so it never ends up setting the appropriate size of the box. I have created a fix that checks to ensure the element exists before performing any JS.

          Show
          Mark Nelson added a comment - Hi Joseph, I found the issue. The text is being rendered but the window displaying the text is not large enough to actually show the text. JavaScript is used to work out the dimensions of this box. However, the JS is failing in lib/javascript-static.js when retrieving the size for the HTML element 'page-footer' as it does not exist on these pages, so it never ends up setting the appropriate size of the box. I have created a fix that checks to ensure the element exists before performing any JS.
          Hide
          Mark Nelson added a comment -

          Strange, as I get a download link to view it (I just re-checked then). Which browser are you using? Can you try in another browser? Thanks!

          Show
          Mark Nelson added a comment - Strange, as I get a download link to view it (I just re-checked then). Which browser are you using? Can you try in another browser? Thanks!
          Hide
          Joseph Rézeau added a comment - - edited

          Oops, just deleted my previous comment before reading your latest one!
          OK, now things are getting better...
          I have switched to your moodle github, branch MDL-36609_master and am able to view the following in the popup window:
          text, PDF, jpeg, mp3.
          So your fix does work, thanks!

          There remain 2 problems:
          1. It's not possible to "empty" the "Pop-up to file or web page" in Lesson settings once you have put a file into it. I see you are considering this in another bug issue: MDL-25552.
          2.- Maybe related to the above issue: when you put a different file in that setting and save the Lesson settings, it works OK but... if you edit the Lesson again, the contents of the "Pop-up to file or web page" in the settings revert to the very first file you put it in!?

          Show
          Joseph Rézeau added a comment - - edited Oops, just deleted my previous comment before reading your latest one! OK, now things are getting better... I have switched to your moodle github, branch MDL-36609 _master and am able to view the following in the popup window: text, PDF, jpeg, mp3. So your fix does work, thanks! There remain 2 problems: 1. It's not possible to "empty" the "Pop-up to file or web page" in Lesson settings once you have put a file into it. I see you are considering this in another bug issue: MDL-25552 . 2.- Maybe related to the above issue: when you put a different file in that setting and save the Lesson settings, it works OK but... if you edit the Lesson again, the contents of the "Pop-up to file or web page" in the settings revert to the very first file you put it in!?
          Hide
          Frédéric Massart added a comment -

          Thanks Mark, the patch makes sense to me. Could you add in the test instructions that the link to the media is in the block bar? It took me ages to find out! Also, please have a look at Joseph comments.

          Cheers!
          Fred

          Show
          Frédéric Massart added a comment - Thanks Mark, the patch makes sense to me. Could you add in the test instructions that the link to the media is in the block bar? It took me ages to find out! Also, please have a look at Joseph comments. Cheers! Fred
          Hide
          Mark Nelson added a comment -

          Thanks Fred.

          Joseph -

          1) Yep, that has been addressed in that tracker issue.
          2) This is in no way related to this fix. This fix is a simple JS check. Please let me know if this happens after MDL-25552 gets put into stable master.

          Thanks for your help.

          Show
          Mark Nelson added a comment - Thanks Fred. Joseph - 1) Yep, that has been addressed in that tracker issue. 2) This is in no way related to this fix. This fix is a simple JS check. Please let me know if this happens after MDL-25552 gets put into stable master. Thanks for your help.
          Hide
          Sam Hemelryk added a comment -

          Thanks Mark this has been integrated now.

          Testing required for the stable branches, MDLQA-5046 and MDLQA-5047 will see this tested in master.

          Show
          Sam Hemelryk added a comment - Thanks Mark this has been integrated now. Testing required for the stable branches, MDLQA-5046 and MDLQA-5047 will see this tested in master.
          Hide
          Rossiani Wijaya added a comment -

          This works as expected.

          Thanks for fixing this Mark.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This works as expected. Thanks for fixing this Mark. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Y E S !

          Closing as fixed, many thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Y E S ! Closing as fixed, many thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: