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

Database activity non-standard filepicker javascript does not include drag and drop upload

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Create a new mod_data instance
      2. Add a picture, file and url field to the database
        1. Click 'add entry'
        2. Check you can drag and drop files into the picture and file fields
        3. Check that pictures and files can be selected via the 'choose a file' button
        4. Check the entry is displayed as expected, once it has been saved (you will need to define a template before you can view the entry)
      3. Repeat with a mod_data with just a 'picture' field
      4. Repeat with a mod_data with just a 'file' field

      Note - drag and drop is supported in Firefox, Chrome, Safari and IE10.
      IE9 and below should display the filepicker elements as before this patch.

      Show
      Create a new mod_data instance Add a picture, file and url field to the database Click 'add entry' Check you can drag and drop files into the picture and file fields Check that pictures and files can be selected via the 'choose a file' button Check the entry is displayed as expected, once it has been saved (you will need to define a template before you can view the entry) Repeat with a mod_data with just a 'picture' field Repeat with a mod_data with just a 'file' field Note - drag and drop is supported in Firefox, Chrome, Safari and IE10. IE9 and below should display the filepicker elements as before this patch.
    • Affected Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-32456_database_dndupload

      Description

      The database activity module uses a non-standard filepicker element for uploading pictures.

      This means it hasn't picked up the new drag and drop upload code.

      I have not investigated enough to work out why it needs to use different code (and whether this it still needs to use separate code).

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            paaskynen Paul Nijbakker added a comment -

            I can confirm that this issue exists in Moodle 2.3.2. Drag and rop does not work in the database activity module and it appears to be causing empty entries that break the list view.

            Show
            paaskynen Paul Nijbakker added a comment - I can confirm that this issue exists in Moodle 2.3.2. Drag and rop does not work in the database activity module and it appears to be causing empty entries that break the list view.
            Hide
            itamart Itamar Tzadok added a comment -

            That's b/c the module's file and picture fields and respective js have not been updated to include the dndupload enhancement.

            Show
            itamart Itamar Tzadok added a comment - That's b/c the module's file and picture fields and respective js have not been updated to include the dndupload enhancement.
            Hide
            davosmith Davo Smith added a comment -

            This patch should enable drag and drop upload to mod_data fields

            Show
            davosmith Davo Smith added a comment - This patch should enable drag and drop upload to mod_data fields
            Hide
            paaskynen Paul Nijbakker added a comment -

            Thanks for the patch Davo,
            As far as we can tell, the patch has fixed the problem. We expect that the number of empty entries will now drop, but we noticed that the problem with empty entries (if the database has only a file upload field) breaking the list view still exists.

            Show
            paaskynen Paul Nijbakker added a comment - Thanks for the patch Davo, As far as we can tell, the patch has fixed the problem. We expect that the number of empty entries will now drop, but we noticed that the problem with empty entries (if the database has only a file upload field) breaking the list view still exists.
            Hide
            paaskynen Paul Nijbakker added a comment -

            Hi Davo,
            We discovered that while the drag and drop upload now works in the databases of our 2.3.3 installation, the Choose a file button, for the traditional upload via the filepicker does not work anymore. This stops IE9 (and older) users from using the database.

            Show
            paaskynen Paul Nijbakker added a comment - Hi Davo, We discovered that while the drag and drop upload now works in the databases of our 2.3.3 installation, the Choose a file button, for the traditional upload via the filepicker does not work anymore. This stops IE9 (and older) users from using the database.
            Hide
            davosmith Davo Smith added a comment -

            Thanks for the update - I'll try again locally and see if I can fix it.

            Show
            davosmith Davo Smith added a comment - Thanks for the update - I'll try again locally and see if I can fix it.
            Hide
            paaskynen Paul Nijbakker added a comment -

            We tried replacing in data.js line 77
            M.data_filepicker.instances[client_id].show();
            with
            M.core_filepicker.instances[client_id].show();

            This seems to fix the problem of the Choose a file button not working, but it will need more testing to make sure.

            Show
            paaskynen Paul Nijbakker added a comment - We tried replacing in data.js line 77 M.data_filepicker.instances [client_id] .show(); with M.core_filepicker.instances [client_id] .show(); This seems to fix the problem of the Choose a file button not working, but it will need more testing to make sure.
            Hide
            davosmith Davo Smith added a comment -

            Yes, that would be the correct fix - if you look at line 153, that contains the correct code.

            I've updated the patch.

            Show
            davosmith Davo Smith added a comment - Yes, that would be the correct fix - if you look at line 153, that contains the correct code. I've updated the patch.
            Hide
            damyon Damyon Wiese added a comment -

            Hi Davo,

            Adrians recent patch (master only) MDL-7660 changes the file picker for the file manager which allows deleting of files and drag and drop. This is a master only change as it is an improvement rather than a bug fix. If we did decide to backport to stable branches it would probably be better to backport that issue than to have a different patch for master/stables.

            Thanks for working on this - but I think we should close this issue as a duplicate.

            Regards, Damyon

            Show
            damyon Damyon Wiese added a comment - Hi Davo, Adrians recent patch (master only) MDL-7660 changes the file picker for the file manager which allows deleting of files and drag and drop. This is a master only change as it is an improvement rather than a bug fix. If we did decide to backport to stable branches it would probably be better to backport that issue than to have a different patch for master/stables. Thanks for working on this - but I think we should close this issue as a duplicate. Regards, Damyon
            Hide
            davosmith Davo Smith added a comment -

            Closing as duplicate, as suggested above.

            Show
            davosmith Davo Smith added a comment - Closing as duplicate, as suggested above.
            Hide
            paaskynen Paul Nijbakker added a comment -

            Hi, It may all be very well that this database bug will be fixed in version 2.5, but in the meantime, we have a database that does not work properly. Can't this temporary fix be maintained until the final solution arrives?

            Show
            paaskynen Paul Nijbakker added a comment - Hi, It may all be very well that this database bug will be fixed in version 2.5, but in the meantime, we have a database that does not work properly. Can't this temporary fix be maintained until the final solution arrives?

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: