Moodle
  1. Moodle
  2. MDL-33373

File resource duplication fails on course page

    Details

    • Rank:
      41244

      Description

      I duplicated a .xls file resource on the course page. Although a duplicate item was created it had the following problems:
      1. It had a blank icon.
      2. When the link is clicked a file not found page is displayed.

      Test 1:

      Test Pre-requisites:

      • This test must be performed using the Firefox web browser.
      • Enable ajax in Site administration > Appearance > Ajax and Javascript
      • Any course in Moodle that has the course format set to Topics.
      • Course administration > Course layout is set to "Show one section per page".

      Test Steps:
      1. Navigate the course index page.
      2. Move a section and verify that the section has been moved.
      3. Move a resource between sections, then turn editing off and verify that the resource has been moved.
      4. Indent a section, then turn editing off and verify that section appears indented and in the correct position.
      5. Edit a resource, then turn editing off and verify that the resource has been edited.
      6. Hide a resource, then turn editing off and verify that the resource is hidden.
      7. Delete a resource, then turn editing off and verify that the resource is deleted.
      8. Duplicate a resource, click 'Return to course' then turn editing off and verify that the resource has been duplicated.

      Expected Results:

      • The file resource that I want to duplicate is duplicated. The resource icon is the same as the original file.
      • A link to the file is added to the course page.

      Actual Result:

      • A new file resource is created.
      • There is no icon for the resource.
      • The link to the file resource is dead.

      Test 2:

      Test Pre-requisites:

      • This test must be performed using the Firefox web browser.
      • Enable ajax in Site administration > Appearance > Ajax and Javascript
      • Any course in Moodle that has the course format set to Topics.
      • Course administration > Course layout is set to "Show one section per page".

      Test Steps:
      1. Navigate the course index page.
      2. Move a section and verify that the section has been moved.
      3. Move a resource between sections, then turn editing off and verify that the resource has been moved.
      4. Indent a section, then turn editing off and verify that section appears indented and in the correct position.
      5. Edit a resource, then turn editing off and verify that the resource has been edited.
      6. Hide a resource, then turn editing off and verify that the resource is hidden.
      7. Delete a resource, then turn editing off and verify that the resource is deleted.
      8. Duplicate a resource, click 'Edit the new copy', edit the resource name and save your changes, then turn editing off and verify that the resource has been duplicated.

      Expected Results:

      • The file resource that I want to duplicate is duplicated. The resource icon is the same as the original file.
      • The file name is different.
      • A link to the file is added to the course page.

      Actual Result:

      • I cannot save changes in modedit.php because there is no file resource in the file manager form element to save.

      Initial testing was performed in Firefox 12 but I have since tested this in Opera and Google Chrome; it is a problem there too.

      1. Blank icons.jpg
        309 kB
      2. Dead Link.jpg
        220 kB

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          It would be good to see if this is a new problem or one that has been around for a while. If it's new, we need to check what caused this regression. You might want to test this with Ajax off to see if it behaves differently.\

          Show
          Michael de Raadt added a comment - It would be good to see if this is a new problem or one that has been around for a while. If it's new, we need to check what caused this regression. You might want to test this with Ajax off to see if it behaves differently.\
          Hide
          Rajesh Taneja added a comment - - edited

          It's only visible on master branch, seems to be some kind of regression with file changes.
          Any file attached to forum (into), or file resource is not duplicated.
          It's not even working for normal backup/restore operation.

          FYI:
          file folder is missing in backup.

          Show
          Rajesh Taneja added a comment - - edited It's only visible on master branch, seems to be some kind of regression with file changes. Any file attached to forum (into), or file resource is not duplicated. It's not even working for normal backup/restore operation. FYI: file folder is missing in backup.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Not sure if related or no, but yesterday, while fixing some automated backup issues I saw this error happening a lot of times:

          PHP Notice:  Undefined property: stdClass::$referencefileid in lib/filestorage/stored_file.php on line 258
          
          Show
          Eloy Lafuente (stronk7) added a comment - Not sure if related or no, but yesterday, while fixing some automated backup issues I saw this error happening a lot of times: PHP Notice: Undefined property: stdClass::$referencefileid in lib/filestorage/stored_file.php on line 258
          Hide
          Rajesh Taneja added a comment -

          Thanks Eloy,
          Currently, I am not getting any notice/warning/error while doing backup/restore. It seems to be bypassing files.
          looking further.

          Show
          Rajesh Taneja added a comment - Thanks Eloy, Currently, I am not getting any notice/warning/error while doing backup/restore. It seems to be bypassing files. looking further.
          Hide
          Rajesh Taneja added a comment -

          Marina said, she found the solution and will fix it tomorrow.
          So leaving this for now.

          Show
          Rajesh Taneja added a comment - Marina said, she found the solution and will fix it tomorrow. So leaving this for now.
          Hide
          Rajesh Taneja added a comment -

          Assigning this to Marina.

          Show
          Rajesh Taneja added a comment - Assigning this to Marina.
          Hide
          Dan Poltawski added a comment -

          Thanks Marina, i've integrated that now.

          Note that we have to be careful about those existing f.* selects when joining as they cause problems on oracle when sorting (and I introduced a private file_storage function to allow the correct fields to be selected explicitly in MDL-33172). However in this case we are not ordering so seems fine. (just fyi)

          Show
          Dan Poltawski added a comment - Thanks Marina, i've integrated that now. Note that we have to be careful about those existing f.* selects when joining as they cause problems on oracle when sorting (and I introduced a private file_storage function to allow the correct fields to be selected explicitly in MDL-33172 ). However in this case we are not ordering so seems fine. (just fyi)
          Hide
          Ankit Agarwal added a comment -

          tested with book, file and lesson.
          Works fine.
          All files where present in the copied instances.
          Passing
          Thanks

          Show
          Ankit Agarwal added a comment - tested with book, file and lesson. Works fine. All files where present in the copied instances. Passing Thanks
          Hide
          Dan Poltawski added a comment -

          Congratulations!

          Your work has made into the latest Moodle release!

          You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!

          Show
          Dan Poltawski added a comment - Congratulations! Your work has made into the latest Moodle release! You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: