"MDL-15405, fixed non-js filepicker url, need more work on nonjs version"

This commit is contained in:
Dongsheng Cai 2010-03-15 06:29:47 +00:00
parent 133fd70ba5
commit ad13710756
2 changed files with 7 additions and 5 deletions

View File

@ -2747,6 +2747,7 @@ function print_filemanager($options, $return = false) {
$client_id = $options->client_id;
$itemid = $options->itemid;
$filearea = $options->filearea ? $options->filearea : 'user_draft';
$html = '';
@ -2765,16 +2766,16 @@ function print_filemanager($options, $return = false) {
</div>
</div>
FMHTML;
// print out file entry template only one time
// print out file entry template only one time
if (empty($CFG->filemanagertemplateloaded)) {
$CFG->filemanagertemplateloaded = true;
$html .= <<<FMHTML
<div id="fm-template" style="display:none"><div class="fm-file-menu">___action___</div> <div class="fm-file-name">___fullname___</div></div>
FMHTML;
}
$filemanagerurl = "$CFG->wwwroot/repository/filepicker.php?env=filemanager&amp;action=embedded&amp;itemid=$itemid&amp;subdirs=/&amp;maxbytes=$options->maxbytes&amp;ctx_id=".$PAGE->context->id.'&amp;course='.$PAGE->course->id;
$filemanagerurl = "$CFG->wwwroot/repository/filepicker.php?filearea=$filearea&amp;env=filemanager&amp;action=embedded&amp;itemid=$itemid&amp;subdirs=/&amp;maxbytes=$options->maxbytes&amp;ctx_id=".$PAGE->context->id.'&amp;course='.$PAGE->course->id;
$html .= <<<NONJS
$html .= <<<NONJS
<div id="nonjs-filemanager-$client_id">
<object type="text/html" data="$filemanagerurl" height="160" width="600" style="border:1px solid #000">Error</object>
</div>

View File

@ -44,11 +44,12 @@ $itemid = optional_param('itemid', '', PARAM_INT);
// parameters for repository
$callback = optional_param('callback', '', PARAM_CLEANHTML);
$contextid = optional_param('ctx_id', SITEID, PARAM_INT); // context ID
$contextid = optional_param('ctx_id', SYSCONTEXTID, PARAM_INT); // context ID
$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);
$thumbnail = optional_param('thumbnail', '', PARAM_RAW);
$targetpath = optional_param('targetpath', '', PARAM_PATH);
$repo_id = optional_param('repo_id', 0, PARAM_INT); // repository ID
@ -450,7 +451,7 @@ default:
$params['returntypes'] = 2;
$repos = repository::get_instances($params);
$fs = get_file_storage();
$files = $fs->get_directory_files($user_context->id, 'user_draft', $itemid, $draftpath, false);
$files = $fs->get_directory_files($user_context->id, $filearea, $itemid, $draftpath, false);
echo $OUTPUT->header();
if ((!empty($files) or $draftpath != '/') and $env == 'filemanager') {