Moodle
  1. Moodle
  2. MDL-30709

Recent files option does not work

    Details

    • Testing Instructions:
      Hide
      1. Create an upload assignment (type = uploadsingle)
      2. Login as student
      3. Upload a file to the assignment
      4. Go someplace else and attempt to choose that uploaded file in the file picker under recent files.
      5. Should be able to successfully use the recent file.
      1. Create an upload assignment (type = upload)
      2. Login as student
      3. Upload a file to the assignment
      4. Go someplace else and attempt to choose that uploaded file in the file picker under recent files.
      5. Should be able to successfully use the recent file.
      Show
      Create an upload assignment (type = uploadsingle) Login as student Upload a file to the assignment Go someplace else and attempt to choose that uploaded file in the file picker under recent files. Should be able to successfully use the recent file. Create an upload assignment (type = upload) Login as student Upload a file to the assignment Go someplace else and attempt to choose that uploaded file in the file picker under recent files. Should be able to successfully use the recent file.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
      git@github.com:marinaglancy/moodle.git
    • Pull Master Branch:
      wip-MDL-30709-master
    • Rank:
      33550

      Description

      This appears to be the exact same problem as MDL-30214, but for Assignment. Most likely have to create an assignment_get_file_info() method.

      Other modules should be tested to see if they must implement MODNAME_get_file_info() method as well.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting that.

          Feel free to help us work on the issue.

          Show
          Michael de Raadt added a comment - Thanks for reporting that. Feel free to help us work on the issue.
          Hide
          Michael de Raadt added a comment -

          Marina, it would be good if you could have a look at this.

          Show
          Michael de Raadt added a comment - Marina, it would be good if you could have a look at this.
          Hide
          Marina Glancy added a comment - - edited

          Fixed bug with inserting files from Recent files repository

          Two parts of changes: in assignment module function assignment_get_file_info was missing;
          and when populating the list of recent files the function get_file_info was not called, which caused populating the list of recent files with the files that could not later be inserted

          Show
          Marina Glancy added a comment - - edited Fixed bug with inserting files from Recent files repository Two parts of changes: in assignment module function assignment_get_file_info was missing; and when populating the list of recent files the function get_file_info was not called, which caused populating the list of recent files with the files that could not later be inserted
          Hide
          Sam Hemelryk added a comment -

          Thanks Marina this has been integrated now.

          I did make one more commit to fix up the phpdocs for the new function however.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Thanks Marina this has been integrated now. I did make one more commit to fix up the phpdocs for the new function however. Cheers Sam
          Hide
          Andrew Nicols added a comment -

          Just a point I came across whilst investigating this issue, it looks like the function should really be named mod_MODNAME_get_file_info - I assume that the MODNAME_get_file_info option will be deprecated at some point given the variable name, but there's not comment to that effect.

                  $functionname     = 'mod_'.$this->modname.'_get_file_info';
                  $functionname_old = $this->modname.'_get_file_info';
          
                  if (function_exists($functionname)) {
                      return $functionname($this->browser, $this->areas, $this->course, $this->cm, $this->context, $filearea, $itemid, $filepath, $filename);
                  } else if (function_exists($functionname_old)) {
                      return $functionname_old($this->browser, $this->areas, $this->course, $this->cm, $this->context, $filearea, $itemid, $filepath, $filename);
                  }   
          

          Might require another issue after testing is complete

          Show
          Andrew Nicols added a comment - Just a point I came across whilst investigating this issue, it looks like the function should really be named mod_MODNAME_get_file_info - I assume that the MODNAME_get_file_info option will be deprecated at some point given the variable name, but there's not comment to that effect. $functionname = 'mod_'.$ this ->modname.'_get_file_info'; $functionname_old = $ this ->modname.'_get_file_info'; if (function_exists($functionname)) { return $functionname($ this ->browser, $ this ->areas, $ this ->course, $ this ->cm, $ this ->context, $filearea, $itemid, $filepath, $filename); } else if (function_exists($functionname_old)) { return $functionname_old($ this ->browser, $ this ->areas, $ this ->course, $ this ->cm, $ this ->context, $filearea, $itemid, $filepath, $filename); } Might require another issue after testing is complete
          Hide
          Sam Hemelryk added a comment -

          Thanks for spotting that Andrew, given this is going into stable branches I am going to make an additional commit now to rename the function to mod_assignment_get_file_info.
          Indeed we are trying to break the habit of not prefixing module callbacks with mod_, good catch!

          Show
          Sam Hemelryk added a comment - Thanks for spotting that Andrew, given this is going into stable branches I am going to make an additional commit now to rename the function to mod_assignment_get_file_info. Indeed we are trying to break the habit of not prefixing module callbacks with mod_, good catch!
          Hide
          Sam Hemelryk added a comment -

          OK all branches updated with the renamed function: ready for testing

          Show
          Sam Hemelryk added a comment - OK all branches updated with the renamed function: ready for testing
          Hide
          Rajesh Taneja added a comment -

          Thanks Andrew, Sam and Marina.
          Works great.

          Show
          Rajesh Taneja added a comment - Thanks Andrew, Sam and Marina. Works great.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          It is late here and I'm very tired but I didn't want to go to sleep before expressing my admiration for your amazing collaboration. Thanks!

          Closing as fixed, heading to zzzZZZzzz, niao

          Show
          Eloy Lafuente (stronk7) added a comment - It is late here and I'm very tired but I didn't want to go to sleep before expressing my admiration for your amazing collaboration. Thanks! Closing as fixed, heading to zzzZZZzzz, niao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: