Skip to content

Commit

Permalink
"MDL-13766, fix non-js filepicker"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Apr 29, 2010
1 parent 1fb0173 commit e5051df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function file_get_user_area_folders($draftitemid, $filepath, &$data, $filearea =
$item->fullname = trim(array_pop($foldername), '/');

$item->id = uniqid();
file_get_draft_area_folders($draftitemid, $item->filepath, $item);
file_get_user_area_folders($draftitemid, $item->filepath, $item);
$data->children[] = $item;
} else {
continue;
Expand Down
31 changes: 15 additions & 16 deletions repository/filepicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
$courseid = optional_param('course', SITEID, PARAM_INT); // course ID
$env = optional_param('env', 'filepicker', PARAM_ALPHA); // opened in file picker, file manager or html editor
$filename = optional_param('filename', '', PARAM_FILE);
$fileurl = optional_param('fileurl', '', PARAM_FILE);
$filearea = optional_param('filearea', '', PARAM_TEXT);
$fileurl = optional_param('fileurl', '', PARAM_RAW);
$filearea = optional_param('filearea', 'user_draft', PARAM_TEXT);
$thumbnail = optional_param('thumbnail', '', PARAM_RAW);
$targetpath = optional_param('targetpath', '', PARAM_PATH);
$repo_id = optional_param('repo_id', 0, PARAM_INT); // repository ID
Expand Down Expand Up @@ -241,17 +241,15 @@
case 'download':
$thefile = $repo->get_file($fileurl, $filename, $itemid);
if (!empty($thefile)) {
if (!is_array($thefile)) {
$record = new stdclass;
$record->filepath = $draftpath;
$record->filename = $filename;
$record->filearea = 'user_draft';
$record->itemid = $itemid;
$record->license = '';
$record->author = '';
$record->source = $fileurl;
$info = repository::move_to_filepool($thefile, $record);
}
$record = new stdclass;
$record->filepath = $draftpath;
$record->filename = $filename;
$record->filearea = 'user_draft';
$record->itemid = $itemid;
$record->license = '';
$record->author = '';
$record->source = $thefile['url'];
$info = repository::move_to_filepool($thefile['path'], $record);
redirect($url, get_string('downloadsucc','repository'));
} else {
print_error('cannotdownload', 'repository');
Expand Down Expand Up @@ -323,7 +321,9 @@
if ($env == 'filemanager' && $info->type == 'draft') {
continue;
}
echo '<li>' . $OUTPUT->action_icon($aurl, new pix_icon($info->icon, $info->name)) . '</li>'; // no hardcoded styles!
echo '<li>';
echo html_writer::link($aurl, $info->name);
echo '</li>';
}
echo '</ul>';
echo '</div>';
Expand Down Expand Up @@ -381,7 +381,7 @@
$url->param('action', 'movefile');
$url->param('draftpath', $draftpath);
$url->param('filename', $filename);
file_get_draft_area_folders($itemid, '/', $data);
file_get_user_area_folders($itemid, '/', $data);
print_draft_area_tree($data, true, $url);
echo $OUTPUT->footer();
break;
Expand Down Expand Up @@ -594,7 +594,6 @@ function print_draft_area_tree($tree, $root, $url) {
if ($root) {
echo '</ul>';
}

echo '</ul>';
}

0 comments on commit e5051df

Please sign in to comment.