mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-35290-master' of https://github.com/snake/moodle
This commit is contained in:
commit
d3e6c398f4
@ -506,6 +506,7 @@ $string['statsnodata'] = 'There is no available data for that combination of cou
|
||||
$string['storedfilecannotcreatefile'] = 'Can not create local file pool file, please verify permissions in dataroot and available disk space.';
|
||||
$string['storedfilecannotcreatefiledirs'] = 'Can not create local file pool directories, please verify permissions in dataroot.';
|
||||
$string['storedfilecannotread'] = 'Cannot read file. Either the file does not exist or there is a permission problem.';
|
||||
$string['storedfilecannotreadfile'] = 'Cannot read file \'{$a}\'. Either the file does not exist or there is a permission problem.';
|
||||
$string['storedfilenotcreated'] = 'Can not create file "{$a->contextid}/{$a->component}/{$a->filearea}/{$a->itemid}{$a->filepath}{$a->filename}"';
|
||||
$string['storedfileproblem'] = 'Unknown exception related to local files ({$a})';
|
||||
$string['tagdisabled'] = 'Tags are disabled!';
|
||||
|
@ -731,11 +731,22 @@ function file_get_drafarea_files($draftitemid, $filepath = '/') {
|
||||
$item->url = $itemurl->out();
|
||||
$item->icon = $OUTPUT->image_url(file_file_icon($file, 24))->out(false);
|
||||
$item->thumbnail = $OUTPUT->image_url(file_file_icon($file, 90))->out(false);
|
||||
if ($imageinfo = $file->get_imageinfo()) {
|
||||
$item->realthumbnail = $itemurl->out(false, array('preview' => 'thumb', 'oid' => $file->get_timemodified()));
|
||||
$item->realicon = $itemurl->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
|
||||
$item->image_width = $imageinfo['width'];
|
||||
$item->image_height = $imageinfo['height'];
|
||||
|
||||
// The call to $file->get_imageinfo() fails with an exception if the file can't be read on the file system.
|
||||
// We still want to add such files to the list, so the owner can view and delete them if needed. So, we only call
|
||||
// get_imageinfo() on files that can be read, and we also spoof the file status based on whether it was found.
|
||||
// We'll use the same status types used by stored_file->get_status(), where 0 = OK. 1 = problem, as these will be
|
||||
// used by the widget to display a warning about the problem files.
|
||||
// The value of stored_file->get_status(), and the file record are unaffected by this. It's only superficially set.
|
||||
$item->status = $fs->get_file_system()->is_file_readable_remotely_by_storedfile($file) ? 0 : 1;
|
||||
if ($item->status == 0) {
|
||||
if ($imageinfo = $file->get_imageinfo()) {
|
||||
$item->realthumbnail = $itemurl->out(false, array('preview' => 'thumb',
|
||||
'oid' => $file->get_timemodified()));
|
||||
$item->realicon = $itemurl->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
|
||||
$item->image_width = $imageinfo['width'];
|
||||
$item->image_height = $imageinfo['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$list[] = $item;
|
||||
|
@ -427,6 +427,27 @@ YUI.add('moodle-core_filepicker', function(Y) {
|
||||
}
|
||||
}
|
||||
|
||||
// Notify the user if any of the files has a problem status.
|
||||
var problemFiles = [];
|
||||
fileslist.forEach(function(file) {
|
||||
if (!file_is_folder(file) && file.hasOwnProperty('status') && file.status != 0) {
|
||||
problemFiles.push(file);
|
||||
}
|
||||
});
|
||||
if (problemFiles.length > 0) {
|
||||
require(["core/notification", "core/str"], function(Notification, Str) {
|
||||
problemFiles.forEach(function(problemFile) {
|
||||
Str.get_string('storedfilecannotreadfile', 'error', problemFile.fullname).then(function(string) {
|
||||
Notification.addNotification({
|
||||
message: string,
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}).catch(Notification.exception);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// If table view, need some additional properties
|
||||
// before passing fileslist to the YUI tableview
|
||||
if (options.viewmode == 3) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user