mirror of
https://github.com/moodle/moodle.git
synced 2025-04-06 08:52:46 +02:00
MDL-46500 filepicker: prevent error when element does not exist
This commit is contained in:
parent
32a69a7d7a
commit
848e04183f
@ -88,6 +88,9 @@ M.form_filemanager.init = function(Y, options) {
|
||||
}
|
||||
// prepare filemanager for drag-and-drop upload
|
||||
this.filemanager = Y.one('#filemanager-'+options.client_id);
|
||||
if (!this.filemanager) {
|
||||
return;
|
||||
}
|
||||
if (this.filemanager.hasClass('filemanager-container') || !this.filemanager.one('.filemanager-container')) {
|
||||
this.dndcontainer = this.filemanager;
|
||||
} else {
|
||||
@ -434,6 +437,9 @@ M.form_filemanager.init = function(Y, options) {
|
||||
|
||||
print_path: function() {
|
||||
var p = this.options.path;
|
||||
if (!this.pathbar) {
|
||||
return;
|
||||
}
|
||||
this.pathbar.setContent('').addClass('empty');
|
||||
if (p && p.length!=0 && this.viewmode != 2) {
|
||||
for(var i = 0; i < p.length; i++) {
|
||||
@ -1053,6 +1059,9 @@ M.form_filemanager.init = function(Y, options) {
|
||||
// finally init everything needed
|
||||
// hide loading picture, display filemanager interface
|
||||
var filemanager = Y.one('#filemanager-'+options.client_id);
|
||||
if (!filemanager) {
|
||||
return;
|
||||
}
|
||||
filemanager.removeClass('fm-loading').addClass('fm-loaded');
|
||||
|
||||
var manager = new FileManagerHelper(options);
|
||||
|
@ -298,10 +298,12 @@ if ($data->addtemplate){
|
||||
///then we generate strings to replace
|
||||
foreach ($possiblefields as $eachfield){
|
||||
$field = data_get_field($eachfield, $data);
|
||||
$patterns[]="[[".$field->field->name."]]";
|
||||
$replacements[] = $field->display_add_field($rid);
|
||||
$patterns[]="[[".$field->field->name."#id]]";
|
||||
$replacements[] = 'field_'.$field->field->id;
|
||||
if (strpos($data->addtemplate, "[[".$field->field->name."]]") !== false) {
|
||||
$patterns[] = "[[".$field->field->name."]]";
|
||||
$replacements[] = $field->display_add_field($rid);
|
||||
$patterns[] = "[[".$field->field->name."#id]]";
|
||||
$replacements[] = 'field_'.$field->field->id;
|
||||
}
|
||||
}
|
||||
$newtext = str_ireplace($patterns, $replacements, $data->{$mode});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user