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

File resource: Option to display file size, type

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3
    • 2.3
    • Resource
    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • MDL-31121-master
    • Hide

      NOTE: The precise display of sizes (101.4KB) and types (PDF document) is not a part of this change. These strings are generated by existing standard Moodle code which has not been changed and is already used elsewhere in Moodle. For instance, if during testing you decide the size format is not really appropriate (it should have a space, or use KiB, or something), that is not a bug with this system.

      1. Add a new File item. Type a name and upload a PDF file. Type some basic text for the intro. Leave other options at default; save and display.
      + On the resulting page, the PDF displays (embedded) just as it always did.
      + The intro box should show the text you typed as usual.
      2. Return to the course page.
      + The link to the PDF should also be unchanged.
      3. Edit the File item. Turn on the 'Show size' and 'Show type' options; save and display.
      + Below your text in the intro box there should be a paragraph of small grey text such as '114.2KB PDF document'
      4. Visit the course page.
      + Next to the link to the PDF, the same information '114.2KB PDF document' should display.
      5. Edit the File item. Turn off 'Show type' so that it only shows the size. Save it; look at the PDF page and the course page again.
      + In both places, the text should now read only '114.2KB'.
      6. Edit it again; turn 'Show type' on, and 'Show size' off. Check both pages.
      + In both pages, the text should now read only 'PDF document'.
      7. Site administration / Plugins / Activity modules / File.
      + Page should now include options for 'Show size' and 'Show type'.
      8. Turn on all four checkboxes next to 'Show size' and 'Show type', and save changes.
      9. Go back to a course page and choose Add a resources... / File.
      + Toggle the 'Show/Hide advanced' button and check that the 'Show size' and 'Show type' options now appear/disappear.
      + Verify that both options are now ticked by default.
      10. Add 3 files of different types to the new resource. Set one of the files as the main file. Save and return to course.
      + Check that the size displayed by the file is equal to the sum total of the size of all 3 files.
      + Check that the type displayed by the file is the correct type for the main file.
      11. On your computer, create an .xqq file (made-up extension) and a .flv file (real extension that has MIME type but no description).
      12. Create a new File item for each file. In both cases leave the 'show size' and 'show type' enabled.
      + Verify that both files display on the course with size only (not type) even though the type option was checked, because there is no type description available.

      Show
      NOTE: The precise display of sizes (101.4KB) and types (PDF document) is not a part of this change. These strings are generated by existing standard Moodle code which has not been changed and is already used elsewhere in Moodle. For instance, if during testing you decide the size format is not really appropriate (it should have a space, or use KiB, or something), that is not a bug with this system. 1. Add a new File item. Type a name and upload a PDF file. Type some basic text for the intro. Leave other options at default; save and display. + On the resulting page, the PDF displays (embedded) just as it always did. + The intro box should show the text you typed as usual. 2. Return to the course page. + The link to the PDF should also be unchanged. 3. Edit the File item. Turn on the 'Show size' and 'Show type' options; save and display. + Below your text in the intro box there should be a paragraph of small grey text such as '114.2KB PDF document' 4. Visit the course page. + Next to the link to the PDF, the same information '114.2KB PDF document' should display. 5. Edit the File item. Turn off 'Show type' so that it only shows the size. Save it; look at the PDF page and the course page again. + In both places, the text should now read only '114.2KB'. 6. Edit it again; turn 'Show type' on, and 'Show size' off. Check both pages. + In both pages, the text should now read only 'PDF document'. 7. Site administration / Plugins / Activity modules / File. + Page should now include options for 'Show size' and 'Show type'. 8. Turn on all four checkboxes next to 'Show size' and 'Show type', and save changes. 9. Go back to a course page and choose Add a resources... / File. + Toggle the 'Show/Hide advanced' button and check that the 'Show size' and 'Show type' options now appear/disappear. + Verify that both options are now ticked by default. 10. Add 3 files of different types to the new resource. Set one of the files as the main file. Save and return to course. + Check that the size displayed by the file is equal to the sum total of the size of all 3 files. + Check that the type displayed by the file is the correct type for the main file. 11. On your computer, create an .xqq file (made-up extension) and a .flv file (real extension that has MIME type but no description). 12. Create a new File item for each file. In both cases leave the 'show size' and 'show type' enabled. + Verify that both files display on the course with size only (not type) even though the type option was checked, because there is no type description available.

      The file resource should have an option to display the file size and/or type. For example, a link might currently display as:

      Book 1

      We would like options so that it can display as:

      Book 1 (4.7MB)

      or

      Book 1 (4.7MB PDF document)

      The reason for this feature are as follows.

      File size: Students have a better user experience if they can see how large a file is before they start to download it (especially when using slow broadband connections or even, in certain rural areas, old-fashioned dialup; or when files are very large). For example, if they can see that the file is moderately large, they might decide not to download it until after an existing large download completes.

      Type: It is also a better user experience if you know what program is used to open the file. For example, if a file is an Excel spreadsheet and you are currently using a netbook which does not have MS Office installed, you might decide to switch to your main desktop computer and download the file there instead. (You can guess the file type from the icon, but spelling it out in visible text helps. And it's more efficient and more consistent if we have an automated way to display this information rather than expecting teachers to type it in as part of the name of the file.)

      I have coded this feature, and will submit it for review shortly.

        1. file.details.display.png
          42 kB
          Sam Marshall
        2. file.details.edit.png
          31 kB
          Sam Marshall

            quen Sam Marshall
            quen Sam Marshall
            Sam Hemelryk Sam Hemelryk
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rossiani Wijaya Rossiani Wijaya
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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