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

Allow dndupload to overwrite default (resource) file type

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Do
    • Affects Version/s: 3.6, 3.7
    • Fix Version/s: None
    • Component/s: Course
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE

      Description

      In core course we have a bespoke format that manages past exam papers and allows bulk upload via dndupload. These documents are bespoke file type mod_pastpaper rather than the default resource file type.

      Currently, if uploading to this past paper course format a popup appears asking to select format between resource and pastpaper as these are the 2 criteria that match.

      This is not suitable - especially for bulk uploads.

      To avoid this have added class 'modtype_pastpaper' to each section on course page. 

      Then add to handle_file function in dndupload.js:

      //Kent change start
      //New check for pastpapers etc, if section has modtype set_
      for (var i=0; i<handlers.length; i++) {
      if(section.hasClass("modtype" + handlers[i].module)) {_
      this.upload_file(file, section, sectionnumber, handlers[i].module);
      return;
      }
      }
      //Kent change end

      this.file_handler_dialog(handlers, extension, file, section, sectionnumber);

      This allows upload to know module and avoid opening dialogue to ask.

      As the css class modtype_<mod_name> is not used in current course formats, there should be no unwanted impact on the current Moodle.

      However, this should allow flexibility for future developments of course/format 

       

       

       

       

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danbart Dan Bartlett
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: