Skip to content

Commit

Permalink
MDL-22574, use file picker to select user picture file
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Jun 8, 2010
1 parent 9880f02 commit 669a9e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions admin/uploadpicture.php
Expand Up @@ -78,7 +78,7 @@
// contents.
$zipdir = my_mktempdir($CFG->dataroot.'/temp/', 'usrpic');
$dstfile = $zipdir.'/images.zip';

if (!$mform->save_file('userpicturesfile', $dstfile, true)) {
echo $OUTPUT->notification(get_string('uploadpicture_cannotmovezip','admin'));
@remove_dir($zipdir);
Expand Down Expand Up @@ -198,7 +198,7 @@ function process_file ($file, $userfield, $overwrite) {
$path_parts = pathinfo(cleardoubleslashes($file));
$basename = $path_parts['basename'];
$extension = $path_parts['extension'];

// The picture file name (without extension) must match the
// userfield attribute.
$uservalue = substr($basename, 0,
Expand Down
7 changes: 4 additions & 3 deletions admin/uploadpicture_form.php
Expand Up @@ -12,11 +12,12 @@ function definition (){

$mform =& $this->_form;

$this->set_upload_manager(new upload_manager('userpicturesfile', false, false, null, false, 0, true, true, false));

$mform->addElement('header', 'settingsheader', get_string('upload'));

$mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');

$options = array();
$options['filetypes'] = array('archive');
$mform->addElement('filepicker', 'userpicturesfile', get_string('file'), 'size="40"', $options);
$mform->addRule('userpicturesfile', null, 'required');

$choices =& $this->_customdata;
Expand Down

0 comments on commit 669a9e5

Please sign in to comment.