mirror of
https://github.com/moodle/moodle.git
synced 2025-07-14 02:46:30 +02:00
Merge branch 'MDL-43240-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
@ -379,105 +379,6 @@ M.util.init_maximised_embed = function(Y, id) {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach handler to single_select
|
||||
*
|
||||
* This code was deprecated in Moodle 2.4 and will be removed in Moodle 2.6
|
||||
*
|
||||
* Please see lib/yui/formautosubmit/formautosubmit.js for its replacement
|
||||
*/
|
||||
M.util.init_select_autosubmit = function(Y, formid, selectid, nothing) {
|
||||
if (M.cfg.developerdebug) {
|
||||
Y.log("You are using a deprecated function call (M.util.init_select_autosubmit). Please look at rewriting your call to use moodle-core-formautosubmit");
|
||||
}
|
||||
Y.use('event-key', function() {
|
||||
var select = Y.one('#'+selectid);
|
||||
if (select) {
|
||||
// Try to get the form by id
|
||||
var form = Y.one('#'+formid) || (function(){
|
||||
// Hmmm the form's id may have been overriden by an internal input
|
||||
// with the name id which will KILL IE.
|
||||
// We need to manually iterate at this point because if the case
|
||||
// above is true YUI's ancestor method will also kill IE!
|
||||
var form = select;
|
||||
while (form && form.get('nodeName').toUpperCase() !== 'FORM') {
|
||||
form = form.ancestor();
|
||||
}
|
||||
return form;
|
||||
})();
|
||||
// Make sure we have the form
|
||||
if (form) {
|
||||
var buttonflag = 0;
|
||||
// Create a function to handle our change event
|
||||
var processchange = function(e, paramobject) {
|
||||
if ((nothing===false || select.get('value') != nothing) && paramobject.lastindex != select.get('selectedIndex')) {
|
||||
// chrome doesn't pick up on a click when selecting an element in a select menu, so we use
|
||||
// the on change event to fire this function. This just checks to see if a button was
|
||||
// first pressed before redirecting to the appropriate page.
|
||||
if (Y.UA.os == 'windows' && Y.UA.chrome){
|
||||
if (buttonflag == 1) {
|
||||
buttonflag = 0;
|
||||
this.submit();
|
||||
}
|
||||
} else {
|
||||
this.submit();
|
||||
}
|
||||
}
|
||||
if (e.button == 1) {
|
||||
buttonflag = 1;
|
||||
}
|
||||
paramobject.lastindex = select.get('selectedIndex');
|
||||
};
|
||||
|
||||
var changedown = function(e, paramobject) {
|
||||
if ((nothing===false || select.get('value') != nothing) && paramobject.lastindex != select.get('selectedIndex')) {
|
||||
if(e.keyCode == 13) {
|
||||
form.submit();
|
||||
}
|
||||
paramobject.lastindex = select.get('selectedIndex');
|
||||
}
|
||||
}
|
||||
|
||||
var paramobject = new Object();
|
||||
paramobject.lastindex = select.get('selectedIndex');
|
||||
paramobject.eventchangeorblur = select.on('click', processchange, form, paramobject);
|
||||
// Bad hack to circumvent problems with different browsers on different systems.
|
||||
if (Y.UA.os == 'macintosh') {
|
||||
if(Y.UA.webkit) {
|
||||
paramobject.eventchangeorblur = select.on('change', processchange, form, paramobject);
|
||||
}
|
||||
paramobject.eventkeypress = Y.on('key', processchange, select, 'press:13', form, paramobject);
|
||||
} else {
|
||||
if(Y.UA.os == 'windows' && Y.UA.chrome) {
|
||||
paramobject.eventchangeorblur = select.on('change', processchange, form, paramobject);
|
||||
}
|
||||
paramobject.eventkeypress = Y.on('keydown', changedown, select, '', form, paramobject);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Attach handler to url_select
|
||||
* Deprecated from 2.4 onwards.
|
||||
* Please use @see init_select_autosubmit() for redirecting to a url (above).
|
||||
* This function has accessability issues and also does not use the formid passed through as a parameter.
|
||||
*/
|
||||
M.util.init_url_select = function(Y, formid, selectid, nothing) {
|
||||
if (M.cfg.developerdebug) {
|
||||
Y.log("You are using a deprecated function call (M.util.init_url_select). Please look at rewriting your call to use moodle-core-formautosubmit");
|
||||
}
|
||||
YUI().use('node', function(Y) {
|
||||
Y.on('change', function() {
|
||||
if ((nothing == false && Y.Lang.isBoolean(nothing)) || Y.one('#'+selectid).get('value') != nothing) {
|
||||
window.location = M.cfg.wwwroot+Y.one('#'+selectid).get('value');
|
||||
}
|
||||
},
|
||||
'#'+selectid);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Breaks out all links to the top frame - used in frametop page layout.
|
||||
*/
|
||||
@ -1597,30 +1498,6 @@ M.util.help_popups = {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This code bas been deprecated and will be removed from Moodle 2.7
|
||||
*
|
||||
* Please see lib/yui/popuphelp/popuphelp.js for its replacement
|
||||
*/
|
||||
M.util.help_icon = {
|
||||
initialised : false,
|
||||
setup : function(Y, properties) {
|
||||
this.add(Y, properties);
|
||||
},
|
||||
add : function(Y) {
|
||||
if (M.cfg.developerdebug) {
|
||||
Y.log("You are using a deprecated function call (M.util.help_icon.add). " +
|
||||
"Please look at rewriting your call to support lib/yui/popuphelp/popuphelp.js");
|
||||
}
|
||||
if (!this.initialised) {
|
||||
YUI().use('moodle-core-popuphelp', function() {
|
||||
M.core.init_popuphelp([]);
|
||||
});
|
||||
}
|
||||
this.initialised = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom menu namespace
|
||||
*/
|
||||
|
Reference in New Issue
Block a user