mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-70153-master' of git://github.com/dpalou/moodle
This commit is contained in:
commit
22388c9e7f
2 changed files with 17 additions and 7 deletions
|
@ -106,7 +106,7 @@ class qtype_essay_renderer extends qtype_renderer {
|
||||||
*/
|
*/
|
||||||
public function files_input(question_attempt $qa, $numallowed,
|
public function files_input(question_attempt $qa, $numallowed,
|
||||||
question_display_options $options) {
|
question_display_options $options) {
|
||||||
global $CFG;
|
global $CFG, $COURSE;
|
||||||
require_once($CFG->dirroot . '/lib/form/filemanager.php');
|
require_once($CFG->dirroot . '/lib/form/filemanager.php');
|
||||||
|
|
||||||
$pickeroptions = new stdClass();
|
$pickeroptions = new stdClass();
|
||||||
|
@ -122,7 +122,8 @@ class qtype_essay_renderer extends qtype_renderer {
|
||||||
$pickeroptions->accepted_types = $qa->get_question()->filetypeslist;
|
$pickeroptions->accepted_types = $qa->get_question()->filetypeslist;
|
||||||
|
|
||||||
$fm = new form_filemanager($pickeroptions);
|
$fm = new form_filemanager($pickeroptions);
|
||||||
$fm->options->maxbytes = $qa->get_question()->maxbytes;;
|
$fm->options->maxbytes = get_user_max_upload_file_size(
|
||||||
|
$this->page->context, $CFG->maxbytes, $COURSE->maxbytes, $qa->get_question()->maxbytes);
|
||||||
$filesrenderer = $this->page->get_renderer('core', 'files');
|
$filesrenderer = $this->page->get_renderer('core', 'files');
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
|
|
|
@ -8,8 +8,8 @@ I need to choose the appropriate maxbytes for attachments
|
||||||
| username | firstname | lastname | email |
|
| username | firstname | lastname | email |
|
||||||
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
|
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
|
||||||
And the following "courses" exist:
|
And the following "courses" exist:
|
||||||
| fullname | shortname | category |
|
| fullname | shortname | category | maxbytes |
|
||||||
| Course 1 | C1 | 0 |
|
| Course 1 | C1 | 0 | 1048576 |
|
||||||
And the following "course enrolments" exist:
|
And the following "course enrolments" exist:
|
||||||
| user | course | role |
|
| user | course | role |
|
||||||
| teacher1 | C1 | editingteacher |
|
| teacher1 | C1 | editingteacher |
|
||||||
|
@ -18,15 +18,24 @@ I need to choose the appropriate maxbytes for attachments
|
||||||
| Course | C1 | Test questions |
|
| Course | C1 | Test questions |
|
||||||
And the following "questions" exist:
|
And the following "questions" exist:
|
||||||
| questioncategory | qtype | name | template | attachments | maxbytes |
|
| questioncategory | qtype | name | template | attachments | maxbytes |
|
||||||
| Test questions | essay | essay-1-20MB | editor | 1 | 20971520 |
|
| Test questions | essay | essay-1-512KB | editor | 1 | 524288 |
|
||||||
|
| Test questions | essay | essay-1-max | editor | 1 | 0 |
|
||||||
Given I log in as "teacher1"
|
Given I log in as "teacher1"
|
||||||
And I am on "Course 1" course homepage
|
And I am on "Course 1" course homepage
|
||||||
And I navigate to "Question bank" in current page administration
|
And I navigate to "Question bank" in current page administration
|
||||||
|
|
||||||
@javascript @_switch_window
|
@javascript @_switch_window
|
||||||
Scenario: Preview an Essay question and see the allowed maximum file sizes and number of attachments.
|
Scenario: Preview an Essay question and see the allowed maximum file sizes and number of attachments.
|
||||||
When I choose "Preview" action for "essay-1-20MB" in the question bank
|
When I choose "Preview" action for "essay-1-512KB" in the question bank
|
||||||
And I switch to "questionpreview" window
|
And I switch to "questionpreview" window
|
||||||
And I should see "Please write a story about a frog."
|
And I should see "Please write a story about a frog."
|
||||||
And I should see "Maximum file size: 20MB, maximum number of files: 1"
|
And I should see "Maximum file size: 512KB, maximum number of files: 1"
|
||||||
|
And I switch to the main window
|
||||||
|
|
||||||
|
@javascript @_switch_window
|
||||||
|
Scenario: Preview an Essay question with Course upload limit and see the allowed maximum file size.
|
||||||
|
When I choose "Preview" action for "essay-1-max" in the question bank
|
||||||
|
And I switch to "questionpreview" window
|
||||||
|
And I should see "Please write a story about a frog."
|
||||||
|
And I should see "Maximum file size: 1MB, maximum number of files: 1"
|
||||||
And I switch to the main window
|
And I switch to the main window
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue