diff --git a/lib/form/yui/shortforms/shortforms.js b/lib/form/yui/shortforms/shortforms.js index c874791f3f0..a14746dca11 100644 --- a/lib/form/yui/shortforms/shortforms.js +++ b/lib/form/yui/shortforms/shortforms.js @@ -84,7 +84,12 @@ YUI.add('moodle-form-shortforms', function(Y) { fieldset.toggleClass(CSS.COLLAPSED); // Get corresponding hidden variable // - and invert it. - var statuselement = new Y.one('input[name=mform_isexpanded_'+fieldset.get('id')+']'); + var statuselement = Y.one('input[name=mform_isexpanded_'+fieldset.get('id')+']'); + if (!statuselement) { + Y.log("M.form.shortforms::switch_state was called on an fieldset without a status field: '" + + fieldset.get('id') + "'", 'debug'); + return; + } statuselement.set('value', Math.abs(Number(statuselement.get('value'))-1)); } }); diff --git a/lib/form/yui/showadvanced/showadvanced.js b/lib/form/yui/showadvanced/showadvanced.js index 562e20e6bcd..f43e48f274a 100644 --- a/lib/form/yui/showadvanced/showadvanced.js +++ b/lib/form/yui/showadvanced/showadvanced.js @@ -67,7 +67,12 @@ YUI.add('moodle-form-showadvanced', function(Y) { Y.one('#'+this.get('formid')).delegate('click', this.switch_state, SELECTORS.FIELDSETCONTAINSADVANCED+' .'+CSS.MORELESSTOGGLER); }, process_fieldset : function(fieldset) { - var statuselement = new Y.one('input[name=mform_showmore_'+fieldset.get('id')+']'); + var statuselement = Y.one('input[name=mform_showmore_'+fieldset.get('id')+']'); + if (!statuselement) { + Y.log("M.form.showadvanced::process_fieldset was called on an fieldset without a status field: '" + + fieldset.get('id') + "'", 'debug'); + return; + } var morelesslink = Y.Node.create(''); morelesslink.addClass(CSS.MORELESSTOGGLER); if (statuselement.get('value') === '0') { diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 89d509f2fd9..484ac3c8293 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -155,12 +155,15 @@ class page_requirements_manager { $sep = empty($CFG->yuislasharguments) ? '?' : '/'; $this->yui3loader = new stdClass(); + $this->YUI_config = new stdClass(); // Set up some loader options. if (debugging('', DEBUG_DEVELOPER)) { $this->yui3loader->filter = 'RAW'; // For more detailed logging info use 'DEBUG' here. + $this->YUI_config->debug = true; } else { $this->yui3loader->filter = null; + $this->YUI_config->debug = false; } if (!empty($CFG->useexternalyui) and strpos($CFG->httpswwwroot, 'https:') !== 0) { $this->yui3loader->base = 'http://yui.yahooapis.com/' . $CFG->yui3version . '/build/'; @@ -182,7 +185,6 @@ class page_requirements_manager { } // Set up JS YUI loader helper object. - $this->YUI_config = new stdClass(); $this->YUI_config->base = $this->yui3loader->base; $this->YUI_config->comboBase = $this->yui3loader->comboBase; $this->YUI_config->combine = $this->yui3loader->combine;