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

File resource: Option to display file size, type

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Resource
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-31121-master

      Description

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12