Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3619

Flashcard module fails to locate audio/image media, but instead displays a "No files available" message



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.2.1
    • None
    • Module: Flashcard
    • None


      Basic Info:

      $version = 2011120501.02
      $release = '2.2.1+ (Build: 20120119)'

      Flashcard Module:
      $module->version = 2012040100

      Server: standard LAMP configuration


      Steps to reproduce the problem:
      1) With standard Moodle 2 and Flashcard module installs, on a course home page, choose "Flash Card Set" from one of the "Add an Activity" drop-down menus

      (Optional step 1b: Manually create a moddata/flashcard directory inside the moodle/files directory: The problem summarized in the title of this post will occur with or without this step. I only mention it here because what I say regarding "Flashcard-module-provided access to the moddata/flashcard directory" later will only make sense if you know I tried this optional step.)

      2) Under "Adding a new flashcard set," set the question (or answer) media type as audio or image. All other settings can be left default.
      3) Click "Save and display" to get to the "No cards defined" screen
      4) Click the "Edit the cards" tab and then click "Add a new question"
      5) Click the "Choose" button to access audio/image files, at which point you should get a "No files available" screen with a URL like the following: http://mygenericserver.com/moodle/files/index.php?id=7&choose=editcard.q8&wdir=/moddata/flashcard/4

      What I'd expected: To be able to access my audio files. . .

      • via Flashcard-module-provided access to the moddata/flashcard directory that I had manually created inside the moodle/files directory. (After I realized from the "No files available" URL that I needed a moddata/flashcard directory, I manually created one (within which the Flashcard module then automatically created numbered directories-e.g."9"-for each new Flash Card Set activity I added). I therefore tried putting my audio (mp3 and wav) and image files into the module-created "moddata/flashcard/9" directory, but still continued to get the "No files available" message when trying to create flashcards using this audio. I then assumed my problem was that because I hadn't created the moddata/flashcard directory at the same time I originally installed the module, the Flashcard-module-generated, auto-incremented numeric naming of the "moddata/flashcard/9" directory was out-of-sync with the auto-incremented ID numbering (e.g."/moodle/mod/flashcard/view.php?id=46") of the Flash Card Set activity itself. I therefore tried manually creating a numbered directory inside the moddata/flashcard directory that DID match the ID number of its Flash Card Set activity, but I still got the "No files available" message. I therefore uninstalled the Flashcard module, purged the cache, and reinstalled it. After reinstallation, the Flashcard module no longer created numbered directories within moddata/flashcard at all.-FYI: The Flashcard module reinstall version may have been a later version than my original install, but I'm afraid I no longer have the original install's version number.)
      • via the standard Moodle 2 repositories accessed through the filepicker, or
      • via the legacy course files I've enabled and made visible (through the Moodle 2 filepicker or through the legacy course files link in the "Settings" block of the course homepage)


      I finally took my problem to the programmer/analyst in our department and he has replicated my install on another server to try to figure out what's going on. However, because he's not very familiar with Moodle, or of course, with your module, he finally asked me to contact you for help. Below is his description of the problem as he replicated it:

      "mod\flashcard\editview.php generates the buttons for the sound and picture selection. When pressing the button, a new File Selection window appears, and it runs $HTDOCS/files/index.php. Eventually, Moodle's File Browser class runs $HTDOCS\lib\filebrowser\file_browser.php. Currently, $HTDOCS\moodle\lib\filebrowser\file_info_context_system.php gets invoked (as the flash card audio/picture search believes it's running in System Context). The member function get_file_info() is called, but the system context's member function supports no components, so it returns nothing (ever).

      By comparison, $HTDOCS\moodle\lib\filebrowser\file_info_context_module.php's get_file_info() function is considerably longer (that is, if the file browser were in module context). That is, if you satisfy the "right" conditions, the function appears to be willing to return some sort of file information."




            tmuras Tomasz Muras
            monicagr Monica Richards
            Tomasz Muras
            0 Vote for this issue
            1 Start watching this issue