Skip to content

Commit

Permalink
MDL-22281, fixed moodle form
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed May 4, 2010
1 parent f855a5d commit b01c3e8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mod/resource/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,21 @@ function definition() {

//-------------------------------------------------------
$mform->addElement('header', 'contentsection', get_string('contentheader', 'resource'));
$mainfile = 'mainfile';

$options = array('mainfile'=>$mainfile, 'subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>-1, 'filetypes'=>'*', 'returnvalue'=>'ref_id');
$filemanager_options = array();
$filemanager_options['accepted_types'] = '*';

// 3 == FILE_EXTERNAL & FILE_INTERNAL
// These two constant names are defined in repository/lib.php
$filemanager_options['return_types'] = 3;
$filemanager_options['maxbytes'] = 0;
$filemanager_options['maxfiles'] = -1;
$mainfile = 'mainfile';
$filemanager_options['mainfile'] = $mainfile;

$mform->addElement('hidden', $mainfile, '', array('id'=>$mainfile.'-id')); // TODO: what is this?
$mform->setType('mainfile', PARAM_PATH);
$mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $options);
$mform->addElement('static', '', get_string('selectedfile'), '<div id="'.$mainfile.'-label"></div>');
$mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $filemanager_options);
$mform->addElement('text', $mainfile, get_string('selectedfile'));
$mform->setType($mainfile, PARAM_PATH);

//-------------------------------------------------------
$mform->addElement('header', 'optionssection', get_string('optionsheader', 'resource'));
Expand Down

0 comments on commit b01c3e8

Please sign in to comment.