MDL-24382, fixed display of file size limit in filepicker
authorDongsheng Cai <unoter@gmail.com>
Thu, 30 Sep 2010 03:36:38 +0000 (03:36 +0000)
committerDongsheng Cai <unoter@gmail.com>
Thu, 30 Sep 2010 03:36:38 +0000 (03:36 +0000)
lib/form/filepicker.php
lib/outputrenderers.php

index 1c59048..5dc2b31 100644 (file)
@@ -75,6 +75,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
         $args->accepted_types = $this->_options['accepted_types']?$this->_options['accepted_types']:'*';
         $args->return_types = FILE_INTERNAL;
         $args->itemid = $draftitemid;
+        $args->maxbytes = $this->_options['maxbytes'];
         $args->context = $PAGE->context;
 
         $html = $this->_getTabs();
index 0e5687b..3a3d7e4 100644 (file)
@@ -1914,7 +1914,12 @@ class core_renderer extends renderer_base {
         if (empty($currentfile)) {
             $currentfile = get_string('nofilesattached', 'repository');
         }
-        $maxsize = get_string('maxfilesize', 'moodle', display_size(get_max_upload_file_size()));
+        if ($options->maxbytes) {
+            $size = $options->maxbytes;
+        } else {
+            $size = get_max_upload_file_size();
+        }
+        $maxsize = get_string('maxfilesize', 'moodle', display_size($size));
         $html = <<<EOD
 <div class="filemanager-loading mdl-align" id='filepicker-loading-{$client_id}'>
 $icon_progress