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

core_files_renderer::fm_print_restrictions(): $options instead of $fm->options?

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.1
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      Edit a forum's setting and set "Maximum number of attachments" to a number greater than 0.

      As a student reply to a post in the forum. Above the attachments file picker business should be a message similar to "Maximum size for new files: 500KB, maximum attachments: 2 - drag and drop available"

      Check that the number of attachments matches the forum setting.

      Go to the students private files. The message should now be something like "Maximum size for new files: 2MB - drag and drop available". It shouldn't mention attachments.

      Show
      Edit a forum's setting and set "Maximum number of attachments" to a number greater than 0. As a student reply to a post in the forum. Above the attachments file picker business should be a message similar to "Maximum size for new files: 500KB, maximum attachments: 2 - drag and drop available" Check that the number of attachments matches the forum setting. Go to the students private files. The message should now be something like "Maximum size for new files: 2MB - drag and drop available". It shouldn't mention attachments.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-33686_options

      Description

      On searching for the string "dndupload" (details in http://tracker.moodle.org/browse/MDL-32937?focusedCommentId=163010&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-163010) I've also opened files/renderer.php in PhpStorm which claims for an undefined variable in fm_print_restrictions():

          /**
           * Displays restrictions for the file manager
           *
           * @param form_filemanager $fm
           * @return string
           */
          private function fm_print_restrictions($fm) {
              $maxbytes = display_size($fm->options->maxbytes);
              if (empty($options->maxfiles) || $options->maxfiles == -1) {
                  $maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
                  //$string['maxfilesize'] = 'Maximum size for new files: {$a}';
              } else {
                  $strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles);
                  $maxsize = get_string('maxsizeandattachments', 'moodle', $strparam);
                  //$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}';
              }
              // TODO MDL-32020 also should say about 'File types accepted'
              return '<span>'. $maxsize. '</span>';
          }

      Not sure what this missing could cause: it seems it could really be a minor issue, maybe important just for MDL-27156.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/12