mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-71814-master' of git://github.com/NashTechOpenUniversity/moodle
This commit is contained in:
commit
43ea2271eb
@ -223,7 +223,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.filemanager.removeClass('fm-maxfiles');
|
||||
}
|
||||
},
|
||||
refresh: function(filepath) {
|
||||
refresh: function(filepath, action) {
|
||||
var scope = this;
|
||||
this.currentpath = filepath;
|
||||
if (!filepath) {
|
||||
@ -240,7 +240,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
scope.options = obj;
|
||||
scope.lazyloading = {};
|
||||
scope.check_buttons();
|
||||
scope.render(obj);
|
||||
scope.render(obj, action);
|
||||
}
|
||||
}, true);
|
||||
},
|
||||
@ -463,7 +463,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
// Do something here
|
||||
args.scope.filecount -= params.length;
|
||||
if (obj && obj.length) {
|
||||
args.scope.refresh(obj[0]);
|
||||
args.scope.refresh(obj[0], {action: 'delete'});
|
||||
}
|
||||
M.form_filemanager.formChangeChecker.markFormChangedFromNode(this.scope.filemanager.getDOMNode());
|
||||
}
|
||||
@ -625,10 +625,14 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.processingimages = false;
|
||||
}, this), 200)
|
||||
},
|
||||
view_files: function(appendfiles) {
|
||||
view_files: function(appendfiles, actionfiles) {
|
||||
this.filemanager.removeClass('fm-updating').removeClass('fm-noitems');
|
||||
if ((appendfiles == null) && (!this.options.list || this.options.list.length == 0) && this.viewmode != 2) {
|
||||
this.filemanager.addClass('fm-noitems');
|
||||
// This is used to focus after refreshing the list files is empty by deletion file action.
|
||||
if (actionfiles !== undefined && actionfiles.action == 'delete') {
|
||||
this.filemanager.one('.fp-btn-add a').focus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
var list = (appendfiles != null) ? appendfiles : this.options.list;
|
||||
@ -656,6 +660,11 @@ M.form_filemanager.init = function(Y, options) {
|
||||
if (node.type == 'folder') {
|
||||
this.refresh(node.filepath);
|
||||
} else {
|
||||
// This is used to focus on file after dialogue closed.
|
||||
var previousActiveElement = e.target.ancestor('a', true);
|
||||
this.options.previousActiveElement = previousActiveElement;
|
||||
this.selectui.set('focusOnPreviousTargetAfterHide', true);
|
||||
this.selectui.set('focusAfterHide', previousActiveElement);
|
||||
this.select_file(node);
|
||||
}
|
||||
},
|
||||
@ -700,6 +709,10 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.print_path();
|
||||
}
|
||||
this.currentpath = node.filepath;
|
||||
var previousActiveElement = Y.Node(e.event.target).ancestor('a', true);
|
||||
this.options.previousActiveElement = previousActiveElement;
|
||||
this.selectui.set('focusOnPreviousTargetAfterHide', true);
|
||||
this.selectui.set('focusAfterHide', previousActiveElement);
|
||||
this.select_file(node);
|
||||
} else {
|
||||
// save current path and filelist (in case we want to jump to other viewmode)
|
||||
@ -715,7 +728,25 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.lazyloading={};
|
||||
}
|
||||
this.filemanager.one('.fp-content').fp_display_filelist(options, list, this.lazyloading);
|
||||
this.content_scrolled();
|
||||
if (this.viewmode != 2) {
|
||||
this.content_scrolled();
|
||||
}
|
||||
// This is used to focus after refreshing the list files by update file and set main file action.
|
||||
if (actionfiles !== undefined) {
|
||||
if (actionfiles.action == 'updatefile' || actionfiles.action == 'setmainfile') {
|
||||
var fileslist = this.filemanager.one('.fp-content');
|
||||
fileslist.all('a').each(function(parentnode) {
|
||||
parentnode.all('.fp-filename').each(function(childnode) {
|
||||
if (childnode.get('innerHTML') == actionfiles.newfilename) {
|
||||
parentnode.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (actionfiles.action == 'delete') {
|
||||
this.filemanager.one('.fp-btn-delete a').focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
populateLicensesSelect: function(licensenode, filenode) {
|
||||
if (!licensenode) {
|
||||
@ -855,7 +886,8 @@ M.form_filemanager.init = function(Y, options) {
|
||||
args.scope.print_msg(obj.error, 'error');
|
||||
} else {
|
||||
args.scope.selectui.hide();
|
||||
args.scope.refresh((obj && obj.filepath) ? obj.filepath : '/');
|
||||
var actionfile = {action: action, newfilename: newfilename};
|
||||
args.scope.refresh((obj && obj.filepath) ? obj.filepath : '/', actionfile);
|
||||
M.form_filemanager.formChangeChecker.markFormChangedFromNode(this.scope.filemanager.getDOMNode());
|
||||
}
|
||||
}
|
||||
@ -871,12 +903,6 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.confirm_dlg_node = Y.Node.create(M.form_filemanager.templates.confirmdialog);
|
||||
var node = this.confirm_dlg_node;
|
||||
node.generateID();
|
||||
|
||||
var previousActiveElement = null;
|
||||
if (typeof dialog_options.previousActiveElement != 'undefined') {
|
||||
previousActiveElement = dialog_options.previousActiveElement;
|
||||
}
|
||||
|
||||
this.confirm_dlg = new M.core.dialogue({
|
||||
draggable : true,
|
||||
bodyContent : node,
|
||||
@ -884,7 +910,6 @@ M.form_filemanager.init = function(Y, options) {
|
||||
modal : true,
|
||||
visible : false,
|
||||
buttons : {},
|
||||
focusAfterHide: previousActiveElement,
|
||||
});
|
||||
var handle_confirm = function(ev) {
|
||||
var dlgopt = this.confirm_dlg.dlgopt;
|
||||
@ -905,6 +930,10 @@ M.form_filemanager.init = function(Y, options) {
|
||||
node.one('.fp-dlg-butconfirm').on('click', handle_confirm, this);
|
||||
node.one('.fp-dlg-butcancel').on('click', handle_cancel, this);
|
||||
}
|
||||
// This used to focus on before active element after confirm dialogue closed.
|
||||
if (typeof dialog_options.previousActiveElement != 'undefined') {
|
||||
this.confirm_dlg.set('focusAfterHide', dialog_options.previousActiveElement);
|
||||
}
|
||||
this.confirm_dlg.dlgopt = dialog_options;
|
||||
if (typeof dialog_options.header != 'undefined') {
|
||||
this.confirm_dlg.set('headerContent', dialog_options.header);
|
||||
@ -970,12 +999,16 @@ M.form_filemanager.init = function(Y, options) {
|
||||
callback: function(id, obj, args) {
|
||||
//args.scope.selectui.hide();
|
||||
args.scope.filecount--;
|
||||
args.scope.refresh(obj.filepath);
|
||||
args.scope.refresh(obj.filepath, {action: 'delete'});
|
||||
M.form_filemanager.formChangeChecker.markFormChangedFromNode(this.scope.filemanager.getDOMNode());
|
||||
}
|
||||
});
|
||||
};
|
||||
this.selectui.hide(); // TODO remove this after confirm dialog is replaced with YUI3
|
||||
// This is used to focus on before active element after confirm dialogue closed.
|
||||
if (this.options.previousActiveElement !== undefined) {
|
||||
dialog_options.previousActiveElement = this.options.previousActiveElement;
|
||||
}
|
||||
this.show_confirm_dialog(dialog_options);
|
||||
}, this);
|
||||
selectnode.one('.fp-file-zip').on('click', function(e) {
|
||||
@ -1044,7 +1077,8 @@ M.form_filemanager.init = function(Y, options) {
|
||||
params: params,
|
||||
callback: function(id, obj, args) {
|
||||
args.scope.selectui.hide();
|
||||
args.scope.refresh(fileinfo.filepath);
|
||||
var actionfile = {action: 'setmainfile', newfilename: fileinfo.fullname};
|
||||
args.scope.refresh(fileinfo.filepath, actionfile);
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
@ -1180,9 +1214,9 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.selectui.show();
|
||||
Y.one('#'+selectnode.get('id')).focus();
|
||||
},
|
||||
render: function() {
|
||||
render: function(obj, action) {
|
||||
this.print_path();
|
||||
this.view_files();
|
||||
this.view_files(null, action);
|
||||
},
|
||||
has_folder: function(foldername) {
|
||||
var element;
|
||||
|
Loading…
x
Reference in New Issue
Block a user