javascript MDL-22067 Fixed error where help icon id wasn't always in the page

This commit is contained in:
Sam Hemelryk 2010-05-04 09:43:29 +00:00
parent 276f590e11
commit f855a5d2d2

View File

@ -216,7 +216,7 @@ M.util.show_confirm_dialog = function(e, args) {
YUI(M.yui.loader).use('yui2-container', 'yui2-event', function(Y) {
var simpledialog = new YAHOO.widget.SimpleDialog('confirmdialog',
{ width: '300px',
{width: '300px',
fixedcenter: true,
modal: true,
visible: false,
@ -273,8 +273,8 @@ M.util.show_confirm_dialog = function(e, args) {
}
};
var buttons = [ { text: M.str.moodle.cancel, handler: handle_cancel, isDefault: true },
{ text: M.str.moodle.yes, handler: handle_yes } ];
var buttons = [ {text: M.str.moodle.cancel, handler: handle_cancel, isDefault: true},
{text: M.str.moodle.yes, handler: handle_yes} ];
simpledialog.cfg.queueProperty('buttons', buttons);
@ -538,18 +538,18 @@ function lockoptionsall(formid) {
var hide = false;
switch (condition) {
case 'notchecked':
lock = !form[dependon].checked; break;
lock = !form[dependon].checked;break;
case 'checked':
lock = form[dependon].checked; break;
lock = form[dependon].checked;break;
case 'noitemselected':
lock = form[dependon].selectedIndex == -1; break;
lock = form[dependon].selectedIndex == -1;break;
case 'eq':
lock = get_form_element_value(form, dependon) == value; break;
lock = get_form_element_value(form, dependon) == value;break;
case 'hide':
// hide as well as disable
hide = true; break;
hide = true;break;
default:
lock = get_form_element_value(form, dependon) != value; break;
lock = get_form_element_value(form, dependon) != value;break;
}
for (var ei in dependons[dependon][condition][value]) {
var eltolock = dependons[dependon][condition][value][ei];
@ -1408,7 +1408,10 @@ M.util.help_icon = {
instance : null,
add : function(Y, properties) {
this.Y = Y;
Y.one('#'+properties.id).on('click', this.display, this, properties);
var node = Y.one('#'+properties.id);
if (node) {
node.on('click', this.display, this, properties);
}
},
display : function(event, args) {
event.preventDefault();