diff --git a/lib/upgrade.txt b/lib/upgrade.txt
index f20bbf09ba2..e8665c8b693 100644
--- a/lib/upgrade.txt
+++ b/lib/upgrade.txt
@@ -60,6 +60,8 @@ information provided here is intended especially for developers.
* The $required parameter for \core_external\external_description is now being validated in order to prevent
unintentionally passing incorrect parameters to the external_description's (and its subclasses') constructors (e.g. the parameter
description being incorrectly passed for the $required parameter). A debugging notice will be shown when such cases occur.
+* The moodle-core-popuphelp YUI modal has been removed. It has not been actively used in Moodle since 3.3. It should be replaced with appropriate ESM/AMD JavaScript.
+* The moodle-core-tooltip YUI modal has been removed. It should be replaced with appropriate ESM/AMD JavaScript.
=== 4.1 ===
diff --git a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-debug.js b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-debug.js
deleted file mode 100644
index feeac36d3e2..00000000000
--- a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-debug.js
+++ /dev/null
@@ -1,111 +0,0 @@
-YUI.add('moodle-core-popuphelp', function (Y, NAME) {
-
-/**
- * A popup help dialogue for Moodle.
- *
- * @module moodle-core-popuphelp
- */
-
-/**
- * A popup help dialogue for Moodle.
- *
- * @class M.core.popuphelp
- * @constructor
- */
-
-function POPUPHELP() {
- POPUPHELP.superclass.constructor.apply(this, arguments);
-}
-
-var SELECTORS = {
- CLICKABLELINKS: 'span.helptooltip > a',
- FOOTER: 'div.moodle-dialogue-ft'
- },
-
- CSS = {
- ICON: 'icon',
- ICONPRE: 'icon-pre'
- },
- ATTRS = {};
-
-// Set the modules base properties.
-POPUPHELP.NAME = 'moodle-core-popuphelp';
-POPUPHELP.ATTRS = ATTRS;
-
-Y.extend(POPUPHELP, Y.Base, {
- panel: null,
-
- /**
- * Setup the popuphelp.
- *
- * @method initializer
- */
- initializer: function() {
- Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
- },
-
- /**
- * Display the help tooltip.
- *
- * @method display_panel
- * @param {EventFacade} e
- */
- display_panel: function(e) {
- if (!this.panel) {
- this.panel = new M.core.tooltip({
- bodyhandler: this.set_body_content,
- footerhandler: this.set_footer,
- initialheadertext: M.util.get_string('loadinghelp', 'moodle'),
- initialfootertext: ''
- });
- }
-
- // Call the tooltip setup.
- this.panel.display_panel(e);
- },
-
- /**
- * Override the footer handler to add a 'More help' link where relevant.
- *
- * @method set_footer
- * @param {Object} helpobject The object returned from the AJAX call.
- */
- set_footer: function(helpobject) {
- // Check for an optional link to documentation on moodle.org.
- if (helpobject.doclink) {
- // Wrap a help icon and the morehelp text in an anchor. The class of the anchor should
- // determine whether it's opened in a new window or not.
- var doclink = Y.Node.create('')
- .setAttrs({
- 'href': helpobject.doclink.link
- })
- .addClass(helpobject.doclink['class']);
- var helpicon = Y.Node.create('
')
- .setAttrs({
- 'src': M.util.image_url('docs', 'core')
- })
- .addClass(CSS.ICON)
- .addClass(CSS.ICONPRE);
- doclink.appendChild(helpicon);
- doclink.appendChild(helpobject.doclink.linktext);
-
- // Set the footerContent to the contents of the doclink.
- this.set('footerContent', doclink);
- this.bb.one(SELECTORS.FOOTER).show();
- } else {
- this.bb.one(SELECTORS.FOOTER).hide();
- }
- }
-});
-M.core = M.core || {};
-M.core.popuphelp = M.core.popuphelp || null;
-M.core.init_popuphelp = M.core.init_popuphelp || function(config) {
- // Only set up a single instance of the popuphelp.
- if (!M.core.popuphelp) {
- M.core.popuphelp = new POPUPHELP(config);
- }
- return M.core.popuphelp;
-};
-
-
-}, '@VERSION@', {"requires": ["moodle-core-tooltip"]});
diff --git a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-min.js b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-min.js
deleted file mode 100644
index 4d8003c318c..00000000000
--- a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-min.js
+++ /dev/null
@@ -1 +0,0 @@
-YUI.add("moodle-core-popuphelp",function(p,e){function o(){o.superclass.constructor.apply(this,arguments)}var t="span.helptooltip > a",l="div.moodle-dialogue-ft",i="icon",n="icon-pre";o.NAME="moodle-core-popuphelp",o.ATTRS={},p.extend(o,p.Base,{panel:null,initializer:function(){p.one("body").delegate("click",this.display_panel,t,this)},display_panel:function(e){this.panel||(this.panel=new M.core.tooltip({bodyhandler:this.set_body_content,footerhandler:this.set_footer,initialheadertext:M.util.get_string("loadinghelp","moodle"),initialfootertext:""})),this.panel.display_panel(e)},set_footer:function(e){var o,t;e.doclink?(o=p.Node.create("").setAttrs({href:e.doclink.link}).addClass(e.doclink["class"]),t=p.Node.create("
").setAttrs({src:M.util.image_url("docs","core")}).addClass(i).addClass(n),o.appendChild(t),o.appendChild(e.doclink.linktext),this.set("footerContent",o),this.bb.one(l).show()):this.bb.one(l).hide()}}),M.core=M.core||{},M.core.popuphelp=M.core.popuphelp||null,M.core.init_popuphelp=M.core.init_popuphelp||function(e){return M.core.popuphelp||(M.core.popuphelp=new o(e)),M.core.popuphelp}},"@VERSION@",{requires:["moodle-core-tooltip"]});
\ No newline at end of file
diff --git a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js
deleted file mode 100644
index feeac36d3e2..00000000000
--- a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js
+++ /dev/null
@@ -1,111 +0,0 @@
-YUI.add('moodle-core-popuphelp', function (Y, NAME) {
-
-/**
- * A popup help dialogue for Moodle.
- *
- * @module moodle-core-popuphelp
- */
-
-/**
- * A popup help dialogue for Moodle.
- *
- * @class M.core.popuphelp
- * @constructor
- */
-
-function POPUPHELP() {
- POPUPHELP.superclass.constructor.apply(this, arguments);
-}
-
-var SELECTORS = {
- CLICKABLELINKS: 'span.helptooltip > a',
- FOOTER: 'div.moodle-dialogue-ft'
- },
-
- CSS = {
- ICON: 'icon',
- ICONPRE: 'icon-pre'
- },
- ATTRS = {};
-
-// Set the modules base properties.
-POPUPHELP.NAME = 'moodle-core-popuphelp';
-POPUPHELP.ATTRS = ATTRS;
-
-Y.extend(POPUPHELP, Y.Base, {
- panel: null,
-
- /**
- * Setup the popuphelp.
- *
- * @method initializer
- */
- initializer: function() {
- Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
- },
-
- /**
- * Display the help tooltip.
- *
- * @method display_panel
- * @param {EventFacade} e
- */
- display_panel: function(e) {
- if (!this.panel) {
- this.panel = new M.core.tooltip({
- bodyhandler: this.set_body_content,
- footerhandler: this.set_footer,
- initialheadertext: M.util.get_string('loadinghelp', 'moodle'),
- initialfootertext: ''
- });
- }
-
- // Call the tooltip setup.
- this.panel.display_panel(e);
- },
-
- /**
- * Override the footer handler to add a 'More help' link where relevant.
- *
- * @method set_footer
- * @param {Object} helpobject The object returned from the AJAX call.
- */
- set_footer: function(helpobject) {
- // Check for an optional link to documentation on moodle.org.
- if (helpobject.doclink) {
- // Wrap a help icon and the morehelp text in an anchor. The class of the anchor should
- // determine whether it's opened in a new window or not.
- var doclink = Y.Node.create('')
- .setAttrs({
- 'href': helpobject.doclink.link
- })
- .addClass(helpobject.doclink['class']);
- var helpicon = Y.Node.create('
')
- .setAttrs({
- 'src': M.util.image_url('docs', 'core')
- })
- .addClass(CSS.ICON)
- .addClass(CSS.ICONPRE);
- doclink.appendChild(helpicon);
- doclink.appendChild(helpobject.doclink.linktext);
-
- // Set the footerContent to the contents of the doclink.
- this.set('footerContent', doclink);
- this.bb.one(SELECTORS.FOOTER).show();
- } else {
- this.bb.one(SELECTORS.FOOTER).hide();
- }
- }
-});
-M.core = M.core || {};
-M.core.popuphelp = M.core.popuphelp || null;
-M.core.init_popuphelp = M.core.init_popuphelp || function(config) {
- // Only set up a single instance of the popuphelp.
- if (!M.core.popuphelp) {
- M.core.popuphelp = new POPUPHELP(config);
- }
- return M.core.popuphelp;
-};
-
-
-}, '@VERSION@', {"requires": ["moodle-core-tooltip"]});
diff --git a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-debug.js b/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-debug.js
deleted file mode 100644
index 43ad70ed27d..00000000000
--- a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-debug.js
+++ /dev/null
@@ -1,482 +0,0 @@
-YUI.add('moodle-core-tooltip', function (Y, NAME) {
-
-/**
- * Provides the base tooltip class.
- *
- * @module moodle-core-tooltip
- */
-
-/**
- * A base class for a tooltip.
- *
- * @param {Object} config Object literal specifying tooltip configuration properties.
- * @class M.core.tooltip
- * @constructor
- * @extends M.core.dialogue
- */
-function TOOLTIP(config) {
- if (!config) {
- config = {};
- }
-
- // Override the default options provided by the parent class.
- if (typeof config.draggable === 'undefined') {
- config.draggable = true;
- }
-
- if (typeof config.constrain === 'undefined') {
- config.constrain = true;
- }
-
- TOOLTIP.superclass.constructor.apply(this, [config]);
-}
-
-var SELECTORS = {
- CLOSEBUTTON: '.closebutton'
- },
-
- CSS = {
- PANELTEXT: 'tooltiptext'
- },
- RESOURCES = {
- WAITICON: {
- pix: 'i/loading_small',
- component: 'moodle'
- }
- },
- ATTRS = {};
-
-/**
- * Static property provides a string to identify the JavaScript class.
- *
- * @property NAME
- * @type String
- * @static
- */
-TOOLTIP.NAME = 'moodle-core-tooltip';
-
-/**
- * Static property used to define the CSS prefix applied to tooltip dialogues.
- *
- * @property CSS_PREFIX
- * @type String
- * @static
- */
-TOOLTIP.CSS_PREFIX = 'moodle-dialogue';
-
-/**
- * Static property used to define the default attribute configuration for the Tooltip.
- *
- * @property ATTRS
- * @type String
- * @static
- */
-TOOLTIP.ATTRS = ATTRS;
-
-/**
- * The initial value of the header region before the content finishes loading.
- *
- * @attribute initialheadertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialheadertext = {
- value: ''
-};
-
-/**
- * The initial value of the body region before the content finishes loading.
- *
- * The supplid string will be wrapped in a div with the CSS.PANELTEXT class and a standard Moodle spinner
- * appended.
- *
- * @attribute initialbodytext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialbodytext = {
- value: '',
- setter: function(content) {
- var parentnode,
- spinner;
- parentnode = Y.Node.create('
first.
- *
- * @attribute initialfootertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialfootertext = {
- value: null,
- setter: function(content) {
- if (content) {
- return Y.Node.create('
')
- .set('text', content);
- }
- }
-};
-
-/**
- * The function which handles setting the content of the title region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the title to object.heading as returned by the AJAX call.
- *
- * @attribute headerhandler
- * @type Function|String|null
- * @default set_header_content
- */
-ATTRS.headerhandler = {
- value: 'set_header_content'
-};
-
-/**
- * The function which handles setting the content of the body region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the body area to a div containing object.text as returned
- * by the AJAX call.
- *
- * @attribute bodyhandler
- * @type Function|String|null
- * @default set_body_content
- */
-ATTRS.bodyhandler = {
- value: 'set_body_content'
-};
-
-/**
- * The function which handles setting the content of the footer region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * By default, the footer is not set.
- *
- * @attribute footerhandler
- * @type Function|String|null
- * @default null
- */
-ATTRS.footerhandler = {
- value: null
-};
-
-/**
- * The function which handles modifying the URL that was clicked on.
- *
- * The default function rewrites '.php' to '_ajax.php'.
- *
- * @attribute urlmodifier
- * @type Function|String|null
- * @default null
- */
-ATTRS.urlmodifier = {
- value: null
-};
-
-/**
- * Set the Y.Cache object to use.
- *
- * By default a new Y.Cache object will be created for each instance of the tooltip.
- *
- * In certain situations, where multiple tooltips may share the same cache, it may be preferable to
- * seed this cache from the calling method.
- *
- * @attribute textcache
- * @type Y.Cache|null
- * @default null
- */
-ATTRS.textcache = {
- value: null
-};
-
-/**
- * Set the default size of the Y.Cache object.
- *
- * This is only used if no textcache is specified.
- *
- * @attribute textcachesize
- * @type Number
- * @default 10
- */
-ATTRS.textcachesize = {
- value: 10
-};
-
-Y.extend(TOOLTIP, M.core.dialogue, {
- // The bounding box.
- bb: null,
-
- // Any event listeners we may need to cancel later.
- listenevents: [],
-
- // Cache of objects we've already retrieved.
- textcache: null,
-
- // The align position. This differs for RTL languages so we calculate once and store.
- alignpoints: [
- Y.WidgetPositionAlign.TL,
- Y.WidgetPositionAlign.RC
- ],
-
- initializer: function() {
- // Set the initial values for the handlers.
- // These cannot be set in the attributes section as context isn't present at that time.
- if (!this.get('headerhandler')) {
- this.set('headerhandler', this.set_header_content);
- }
- if (!this.get('bodyhandler')) {
- this.set('bodyhandler', this.set_body_content);
- }
- if (!this.get('footerhandler')) {
- this.set('footerhandler', function() {});
- }
- if (!this.get('urlmodifier')) {
- this.set('urlmodifier', this.modify_url);
- }
-
- // Set up the dialogue with initial content.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Hide and then render the dialogue.
- this.hide();
- this.render();
-
- // Hook into a few useful areas.
- this.bb = this.get('boundingBox');
-
- // Add an additional class to the boundingbox to allow tooltip-specific style to be
- // set.
- this.bb.addClass('moodle-dialogue-tooltip');
-
- // Change the alignment if this is an RTL language.
- if (window.right_to_left()) {
- this.alignpoints = [
- Y.WidgetPositionAlign.TR,
- Y.WidgetPositionAlign.LC
- ];
- }
-
- // Set up the text cache if it's not set up already.
- if (!this.get('textcache')) {
- this.set('textcache', new Y.Cache({
- // Set a reasonable maximum cache size to prevent memory growth.
- max: this.get('textcachesize')
- }));
- }
-
- // Disable the textcache when in developerdebug.
- if (M.cfg.developerdebug) {
- this.get('textcache').set('max', 0);
- }
-
- return this;
- },
-
- /**
- * Display the tooltip for the clicked link.
- *
- * The anchor for the clicked link is used.
- *
- * @method display_panel
- * @param {EventFacade} e The event from the clicked link. This is used to determine the clicked URL.
- */
- display_panel: function(e) {
- var clickedlink, thisevent, ajaxurl, config, cacheentry;
-
- // Prevent the default click action and prevent the event triggering anything else.
- e.preventDefault();
-
- // Cancel any existing listeners and close the panel if it's already open.
- this.cancel_events();
-
- // Grab the clickedlink - this contains the URL we fetch and we align the panel to it.
- clickedlink = e.target.ancestor('a', true);
-
- // Reset the initial text to a spinner while we retrieve the text.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Now that initial setup has begun, show the panel.
- this.show(e);
-
- // Align with the link that was clicked.
- this.align(clickedlink, this.alignpoints);
-
- // Add some listen events to close on.
- thisevent = this.bb.delegate('click', this.close_panel, SELECTORS.CLOSEBUTTON, this);
- this.listenevents.push(thisevent);
-
- thisevent = Y.one('body').on('key', this.close_panel, 'esc', this);
- this.listenevents.push(thisevent);
-
- // Listen for mousedownoutside events - clickoutside is broken on IE.
- thisevent = this.bb.on('mousedownoutside', this.close_panel, this);
- this.listenevents.push(thisevent);
-
- // Modify the URL as required.
- ajaxurl = Y.bind(this.get('urlmodifier'), this, clickedlink.get('href'))();
-
- cacheentry = this.get('textcache').retrieve(ajaxurl);
- if (cacheentry) {
- // The data from this help call was already cached so use that and avoid an AJAX call.
- this._set_panel_contents(cacheentry.response);
- } else {
- // Retrieve the actual help text we should use.
- config = {
- method: 'get',
- context: this,
- sync: false,
- on: {
- complete: function(tid, response) {
- this._set_panel_contents(response.responseText, ajaxurl);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- }
- },
-
- _set_panel_contents: function(response, ajaxurl) {
- var responseobject;
-
- // Attempt to parse the response into an object.
- try {
- responseobject = Y.JSON.parse(response);
- if (responseobject.error) {
- this.close_panel();
- Y.use('moodle-core-notification-ajaxexception', function() {
- return new M.core.ajaxException(responseobject).show();
- });
- return this;
- }
- } catch (error) {
- this.close_panel();
- Y.use('moodle-core-notification-exception', function() {
- return new M.core.exception(error).show();
- });
- return this;
- }
-
- // Set the contents using various handlers.
- // We must use Y.bind to ensure that the correct context is used when the default handlers are overridden.
- Y.bind(this.get('headerhandler'), this, responseobject)();
- Y.bind(this.get('bodyhandler'), this, responseobject)();
- Y.bind(this.get('footerhandler'), this, responseobject)();
-
- if (ajaxurl) {
- // Ensure that this data is added to the cache.
- this.get('textcache').add(ajaxurl, response);
- }
-
- this.get('buttons').header[0].focus();
- },
-
- set_header_content: function(responseobject) {
- this.set('headerContent', responseobject.heading);
- },
-
- set_body_content: function(responseobject) {
- var bodycontent = Y.Node.create('
')
- .set('innerHTML', responseobject.text)
- .setAttribute('role', 'alert')
- .addClass(CSS.PANELTEXT);
- this.set('bodyContent', bodycontent);
- },
-
- modify_url: function(url) {
- return url.replace(/\.php\?/, '_ajax.php?');
- },
-
- close_panel: function(e) {
- // Hide the panel first.
- this.hide(e);
-
- // Cancel the listeners that we added in display_panel.
- this.cancel_events();
-
- // Prevent any default click that the close button may have.
- if (e) {
- e.preventDefault();
- }
- },
-
- cancel_events: function() {
- // Detach all listen events to prevent duplicate triggers.
- var thisevent;
- while (this.listenevents.length) {
- thisevent = this.listenevents.shift();
- thisevent.detach();
- }
- }
-});
-
-Y.Base.modifyAttrs(TOOLTIP, {
- /**
- * Whether the widget should be modal or not.
- *
- * Moodle override: We override this for tooltip to default it to false.
- *
- * @attribute Modal
- * @type Boolean
- * @default false
- */
- modal: {
- value: false
- },
-
- focusOnPreviousTargetAfterHide: {
- value: true
- }
-});
-
-M.core = M.core || {};
-M.core.tooltip = M.core.tooltip = TOOLTIP;
-
-
-}, '@VERSION@', {
- "requires": [
- "base",
- "node",
- "io-base",
- "moodle-core-notification-dialogue",
- "json-parse",
- "widget-position",
- "widget-position-align",
- "event-outside",
- "cache-base"
- ]
-});
diff --git a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-min.js b/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-min.js
deleted file mode 100644
index 052d95171ab..00000000000
--- a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip-min.js
+++ /dev/null
@@ -1 +0,0 @@
-YUI.add("moodle-core-tooltip",function(o,e){function t(e){"undefined"==typeof(e=e||{}).draggable&&(e.draggable=!0),"undefined"==typeof e.constrain&&(e.constrain=!0),t.superclass.constructor.apply(this,[e])}var n=".closebutton",s="tooltiptext",a={pix:"i/loading_small",component:"moodle"},i={};t.NAME="moodle-core-tooltip",t.CSS_PREFIX="moodle-dialogue",(t.ATTRS=i).initialheadertext={value:""},i.initialbodytext={value:"",setter:function(e){var t=o.Node.create("
").addClass(s),i=o.Node.create("
![]()
").setAttribute("src",M.util.image_url(a.pix,a.component)).addClass("spinner");return e?(t.set("text",e),i.addClass("iconsmall")):t.addClass("content-lightbox"),t.append(i),t}},i.initialfootertext={value:null,setter:function(e){if(e)return o.Node.create("
").set("text",e)}},i.headerhandler={value:"set_header_content"},i.bodyhandler={value:"set_body_content"},i.footerhandler={value:null},i.urlmodifier={value:null},i.textcache={value:null},i.textcachesize={value:10},o.extend(t,M.core.dialogue,{bb:null,listenevents:[],textcache:null,alignpoints:[o.WidgetPositionAlign.TL,o.WidgetPositionAlign.RC],initializer:function(){return this.get("headerhandler")||this.set("headerhandler",this.set_header_content),this.get("bodyhandler")||this.set("bodyhandler",this.set_body_content),this.get("footerhandler")||this.set("footerhandler",function(){}),this.get("urlmodifier")||this.set("urlmodifier",this.modify_url),this.setAttrs({headerContent:this.get("initialheadertext"),bodyContent:this.get("initialbodytext"),footerContent:this.get("initialfootertext")}),this.hide(),this.render(),this.bb=this.get("boundingBox"),this.bb.addClass("moodle-dialogue-tooltip"),window.right_to_left()&&(this.alignpoints=[o.WidgetPositionAlign.TR,o.WidgetPositionAlign.LC]),this.get("textcache")||this.set("textcache",new o.Cache({max:this.get("textcachesize")})),M.cfg.developerdebug&&this.get("textcache").set("max",0),this},display_panel:function(e){var t,i;e.preventDefault(),this.cancel_events(),t=e.target.ancestor("a",!0),this.setAttrs({headerContent:this.get("initialheadertext"),bodyContent:this.get("initialbodytext"),footerContent:this.get("initialfootertext")}),this.show(e),this.align(t,this.alignpoints),e=this.bb.delegate("click",this.close_panel,n,this),this.listenevents.push(e),e=o.one("body").on("key",this.close_panel,"esc",this),this.listenevents.push(e),e=this.bb.on("mousedownoutside",this.close_panel,this),this.listenevents.push(e),i=o.bind(this.get("urlmodifier"),this,t.get("href"))(),(e=this.get("textcache").retrieve(i))?this._set_panel_contents(e.response):o.io(i,{method:"get",context:this,sync:!1,on:{complete:function(e,t){this._set_panel_contents(t.responseText,i)}}})},_set_panel_contents:function(e,t){var i;try{if((i=o.JSON.parse(e)).error)return this.close_panel(),o.use("moodle-core-notification-ajaxexception",function(){return new M.core.ajaxException(i).show()}),this}catch(n){return this.close_panel(),o.use("moodle-core-notification-exception",function(){return new M.core.exception(n).show()}),this}o.bind(this.get("headerhandler"),this,i)(),o.bind(this.get("bodyhandler"),this,i)(),o.bind(this.get("footerhandler"),this,i)(),t&&this.get("textcache").add(t,e),this.get("buttons").header[0].focus()},set_header_content:function(e){this.set("headerContent",e.heading)},set_body_content:function(e){e=o.Node.create("
").set("innerHTML",e.text).setAttribute("role","alert").addClass(s);this.set("bodyContent",e)},modify_url:function(e){return e.replace(/\.php\?/,"_ajax.php?")},close_panel:function(e){this.hide(e),this.cancel_events(),e&&e.preventDefault()},cancel_events:function(){for(;this.listenevents.length;)this.listenevents.shift().detach()}}),o.Base.modifyAttrs(t,{modal:{value:!1},focusOnPreviousTargetAfterHide:{value:!0}}),M.core=M.core||{},M.core.tooltip=M.core.tooltip=t},"@VERSION@",{requires:["base","node","io-base","moodle-core-notification-dialogue","json-parse","widget-position","widget-position-align","event-outside","cache-base"]});
\ No newline at end of file
diff --git a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip.js b/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip.js
deleted file mode 100644
index 43ad70ed27d..00000000000
--- a/lib/yui/build/moodle-core-tooltip/moodle-core-tooltip.js
+++ /dev/null
@@ -1,482 +0,0 @@
-YUI.add('moodle-core-tooltip', function (Y, NAME) {
-
-/**
- * Provides the base tooltip class.
- *
- * @module moodle-core-tooltip
- */
-
-/**
- * A base class for a tooltip.
- *
- * @param {Object} config Object literal specifying tooltip configuration properties.
- * @class M.core.tooltip
- * @constructor
- * @extends M.core.dialogue
- */
-function TOOLTIP(config) {
- if (!config) {
- config = {};
- }
-
- // Override the default options provided by the parent class.
- if (typeof config.draggable === 'undefined') {
- config.draggable = true;
- }
-
- if (typeof config.constrain === 'undefined') {
- config.constrain = true;
- }
-
- TOOLTIP.superclass.constructor.apply(this, [config]);
-}
-
-var SELECTORS = {
- CLOSEBUTTON: '.closebutton'
- },
-
- CSS = {
- PANELTEXT: 'tooltiptext'
- },
- RESOURCES = {
- WAITICON: {
- pix: 'i/loading_small',
- component: 'moodle'
- }
- },
- ATTRS = {};
-
-/**
- * Static property provides a string to identify the JavaScript class.
- *
- * @property NAME
- * @type String
- * @static
- */
-TOOLTIP.NAME = 'moodle-core-tooltip';
-
-/**
- * Static property used to define the CSS prefix applied to tooltip dialogues.
- *
- * @property CSS_PREFIX
- * @type String
- * @static
- */
-TOOLTIP.CSS_PREFIX = 'moodle-dialogue';
-
-/**
- * Static property used to define the default attribute configuration for the Tooltip.
- *
- * @property ATTRS
- * @type String
- * @static
- */
-TOOLTIP.ATTRS = ATTRS;
-
-/**
- * The initial value of the header region before the content finishes loading.
- *
- * @attribute initialheadertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialheadertext = {
- value: ''
-};
-
-/**
- * The initial value of the body region before the content finishes loading.
- *
- * The supplid string will be wrapped in a div with the CSS.PANELTEXT class and a standard Moodle spinner
- * appended.
- *
- * @attribute initialbodytext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialbodytext = {
- value: '',
- setter: function(content) {
- var parentnode,
- spinner;
- parentnode = Y.Node.create('
')
- .addClass(CSS.PANELTEXT);
-
- spinner = Y.Node.create('
![]()
')
- .setAttribute('src', M.util.image_url(RESOURCES.WAITICON.pix, RESOURCES.WAITICON.component))
- .addClass('spinner');
-
- if (content) {
- // If we have been provided with content, add it to the parent and make
- // the spinner appear correctly inline
- parentnode.set('text', content);
- spinner.addClass('iconsmall');
- } else {
- // If there is no loading message, just make the parent node a lightbox
- parentnode.addClass('content-lightbox');
- }
-
- parentnode.append(spinner);
- return parentnode;
- }
-};
-
-/**
- * The initial value of the footer region before the content finishes loading.
- *
- * If a value is supplied, it will be wrapped in a
first.
- *
- * @attribute initialfootertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialfootertext = {
- value: null,
- setter: function(content) {
- if (content) {
- return Y.Node.create('
')
- .set('text', content);
- }
- }
-};
-
-/**
- * The function which handles setting the content of the title region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the title to object.heading as returned by the AJAX call.
- *
- * @attribute headerhandler
- * @type Function|String|null
- * @default set_header_content
- */
-ATTRS.headerhandler = {
- value: 'set_header_content'
-};
-
-/**
- * The function which handles setting the content of the body region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the body area to a div containing object.text as returned
- * by the AJAX call.
- *
- * @attribute bodyhandler
- * @type Function|String|null
- * @default set_body_content
- */
-ATTRS.bodyhandler = {
- value: 'set_body_content'
-};
-
-/**
- * The function which handles setting the content of the footer region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * By default, the footer is not set.
- *
- * @attribute footerhandler
- * @type Function|String|null
- * @default null
- */
-ATTRS.footerhandler = {
- value: null
-};
-
-/**
- * The function which handles modifying the URL that was clicked on.
- *
- * The default function rewrites '.php' to '_ajax.php'.
- *
- * @attribute urlmodifier
- * @type Function|String|null
- * @default null
- */
-ATTRS.urlmodifier = {
- value: null
-};
-
-/**
- * Set the Y.Cache object to use.
- *
- * By default a new Y.Cache object will be created for each instance of the tooltip.
- *
- * In certain situations, where multiple tooltips may share the same cache, it may be preferable to
- * seed this cache from the calling method.
- *
- * @attribute textcache
- * @type Y.Cache|null
- * @default null
- */
-ATTRS.textcache = {
- value: null
-};
-
-/**
- * Set the default size of the Y.Cache object.
- *
- * This is only used if no textcache is specified.
- *
- * @attribute textcachesize
- * @type Number
- * @default 10
- */
-ATTRS.textcachesize = {
- value: 10
-};
-
-Y.extend(TOOLTIP, M.core.dialogue, {
- // The bounding box.
- bb: null,
-
- // Any event listeners we may need to cancel later.
- listenevents: [],
-
- // Cache of objects we've already retrieved.
- textcache: null,
-
- // The align position. This differs for RTL languages so we calculate once and store.
- alignpoints: [
- Y.WidgetPositionAlign.TL,
- Y.WidgetPositionAlign.RC
- ],
-
- initializer: function() {
- // Set the initial values for the handlers.
- // These cannot be set in the attributes section as context isn't present at that time.
- if (!this.get('headerhandler')) {
- this.set('headerhandler', this.set_header_content);
- }
- if (!this.get('bodyhandler')) {
- this.set('bodyhandler', this.set_body_content);
- }
- if (!this.get('footerhandler')) {
- this.set('footerhandler', function() {});
- }
- if (!this.get('urlmodifier')) {
- this.set('urlmodifier', this.modify_url);
- }
-
- // Set up the dialogue with initial content.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Hide and then render the dialogue.
- this.hide();
- this.render();
-
- // Hook into a few useful areas.
- this.bb = this.get('boundingBox');
-
- // Add an additional class to the boundingbox to allow tooltip-specific style to be
- // set.
- this.bb.addClass('moodle-dialogue-tooltip');
-
- // Change the alignment if this is an RTL language.
- if (window.right_to_left()) {
- this.alignpoints = [
- Y.WidgetPositionAlign.TR,
- Y.WidgetPositionAlign.LC
- ];
- }
-
- // Set up the text cache if it's not set up already.
- if (!this.get('textcache')) {
- this.set('textcache', new Y.Cache({
- // Set a reasonable maximum cache size to prevent memory growth.
- max: this.get('textcachesize')
- }));
- }
-
- // Disable the textcache when in developerdebug.
- if (M.cfg.developerdebug) {
- this.get('textcache').set('max', 0);
- }
-
- return this;
- },
-
- /**
- * Display the tooltip for the clicked link.
- *
- * The anchor for the clicked link is used.
- *
- * @method display_panel
- * @param {EventFacade} e The event from the clicked link. This is used to determine the clicked URL.
- */
- display_panel: function(e) {
- var clickedlink, thisevent, ajaxurl, config, cacheentry;
-
- // Prevent the default click action and prevent the event triggering anything else.
- e.preventDefault();
-
- // Cancel any existing listeners and close the panel if it's already open.
- this.cancel_events();
-
- // Grab the clickedlink - this contains the URL we fetch and we align the panel to it.
- clickedlink = e.target.ancestor('a', true);
-
- // Reset the initial text to a spinner while we retrieve the text.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Now that initial setup has begun, show the panel.
- this.show(e);
-
- // Align with the link that was clicked.
- this.align(clickedlink, this.alignpoints);
-
- // Add some listen events to close on.
- thisevent = this.bb.delegate('click', this.close_panel, SELECTORS.CLOSEBUTTON, this);
- this.listenevents.push(thisevent);
-
- thisevent = Y.one('body').on('key', this.close_panel, 'esc', this);
- this.listenevents.push(thisevent);
-
- // Listen for mousedownoutside events - clickoutside is broken on IE.
- thisevent = this.bb.on('mousedownoutside', this.close_panel, this);
- this.listenevents.push(thisevent);
-
- // Modify the URL as required.
- ajaxurl = Y.bind(this.get('urlmodifier'), this, clickedlink.get('href'))();
-
- cacheentry = this.get('textcache').retrieve(ajaxurl);
- if (cacheentry) {
- // The data from this help call was already cached so use that and avoid an AJAX call.
- this._set_panel_contents(cacheentry.response);
- } else {
- // Retrieve the actual help text we should use.
- config = {
- method: 'get',
- context: this,
- sync: false,
- on: {
- complete: function(tid, response) {
- this._set_panel_contents(response.responseText, ajaxurl);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- }
- },
-
- _set_panel_contents: function(response, ajaxurl) {
- var responseobject;
-
- // Attempt to parse the response into an object.
- try {
- responseobject = Y.JSON.parse(response);
- if (responseobject.error) {
- this.close_panel();
- Y.use('moodle-core-notification-ajaxexception', function() {
- return new M.core.ajaxException(responseobject).show();
- });
- return this;
- }
- } catch (error) {
- this.close_panel();
- Y.use('moodle-core-notification-exception', function() {
- return new M.core.exception(error).show();
- });
- return this;
- }
-
- // Set the contents using various handlers.
- // We must use Y.bind to ensure that the correct context is used when the default handlers are overridden.
- Y.bind(this.get('headerhandler'), this, responseobject)();
- Y.bind(this.get('bodyhandler'), this, responseobject)();
- Y.bind(this.get('footerhandler'), this, responseobject)();
-
- if (ajaxurl) {
- // Ensure that this data is added to the cache.
- this.get('textcache').add(ajaxurl, response);
- }
-
- this.get('buttons').header[0].focus();
- },
-
- set_header_content: function(responseobject) {
- this.set('headerContent', responseobject.heading);
- },
-
- set_body_content: function(responseobject) {
- var bodycontent = Y.Node.create('
')
- .set('innerHTML', responseobject.text)
- .setAttribute('role', 'alert')
- .addClass(CSS.PANELTEXT);
- this.set('bodyContent', bodycontent);
- },
-
- modify_url: function(url) {
- return url.replace(/\.php\?/, '_ajax.php?');
- },
-
- close_panel: function(e) {
- // Hide the panel first.
- this.hide(e);
-
- // Cancel the listeners that we added in display_panel.
- this.cancel_events();
-
- // Prevent any default click that the close button may have.
- if (e) {
- e.preventDefault();
- }
- },
-
- cancel_events: function() {
- // Detach all listen events to prevent duplicate triggers.
- var thisevent;
- while (this.listenevents.length) {
- thisevent = this.listenevents.shift();
- thisevent.detach();
- }
- }
-});
-
-Y.Base.modifyAttrs(TOOLTIP, {
- /**
- * Whether the widget should be modal or not.
- *
- * Moodle override: We override this for tooltip to default it to false.
- *
- * @attribute Modal
- * @type Boolean
- * @default false
- */
- modal: {
- value: false
- },
-
- focusOnPreviousTargetAfterHide: {
- value: true
- }
-});
-
-M.core = M.core || {};
-M.core.tooltip = M.core.tooltip = TOOLTIP;
-
-
-}, '@VERSION@', {
- "requires": [
- "base",
- "node",
- "io-base",
- "moodle-core-notification-dialogue",
- "json-parse",
- "widget-position",
- "widget-position-align",
- "event-outside",
- "cache-base"
- ]
-});
diff --git a/lib/yui/src/popuphelp/build.json b/lib/yui/src/popuphelp/build.json
deleted file mode 100644
index 4be9e69451c..00000000000
--- a/lib/yui/src/popuphelp/build.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "name": "moodle-core-popuphelp",
- "builds": {
- "moodle-core-popuphelp": {
- "jsfiles": [
- "popuphelp.js"
- ]
- }
- }
-}
diff --git a/lib/yui/src/popuphelp/js/popuphelp.js b/lib/yui/src/popuphelp/js/popuphelp.js
deleted file mode 100644
index 8c241f57f6c..00000000000
--- a/lib/yui/src/popuphelp/js/popuphelp.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * A popup help dialogue for Moodle.
- *
- * @module moodle-core-popuphelp
- */
-
-/**
- * A popup help dialogue for Moodle.
- *
- * @class M.core.popuphelp
- * @constructor
- */
-
-function POPUPHELP() {
- POPUPHELP.superclass.constructor.apply(this, arguments);
-}
-
-var SELECTORS = {
- CLICKABLELINKS: 'span.helptooltip > a',
- FOOTER: 'div.moodle-dialogue-ft'
- },
-
- CSS = {
- ICON: 'icon',
- ICONPRE: 'icon-pre'
- },
- ATTRS = {};
-
-// Set the modules base properties.
-POPUPHELP.NAME = 'moodle-core-popuphelp';
-POPUPHELP.ATTRS = ATTRS;
-
-Y.extend(POPUPHELP, Y.Base, {
- panel: null,
-
- /**
- * Setup the popuphelp.
- *
- * @method initializer
- */
- initializer: function() {
- Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
- },
-
- /**
- * Display the help tooltip.
- *
- * @method display_panel
- * @param {EventFacade} e
- */
- display_panel: function(e) {
- if (!this.panel) {
- this.panel = new M.core.tooltip({
- bodyhandler: this.set_body_content,
- footerhandler: this.set_footer,
- initialheadertext: M.util.get_string('loadinghelp', 'moodle'),
- initialfootertext: ''
- });
- }
-
- // Call the tooltip setup.
- this.panel.display_panel(e);
- },
-
- /**
- * Override the footer handler to add a 'More help' link where relevant.
- *
- * @method set_footer
- * @param {Object} helpobject The object returned from the AJAX call.
- */
- set_footer: function(helpobject) {
- // Check for an optional link to documentation on moodle.org.
- if (helpobject.doclink) {
- // Wrap a help icon and the morehelp text in an anchor. The class of the anchor should
- // determine whether it's opened in a new window or not.
- var doclink = Y.Node.create('
')
- .setAttrs({
- 'href': helpobject.doclink.link
- })
- .addClass(helpobject.doclink['class']);
- var helpicon = Y.Node.create('
![]()
')
- .setAttrs({
- 'src': M.util.image_url('docs', 'core')
- })
- .addClass(CSS.ICON)
- .addClass(CSS.ICONPRE);
- doclink.appendChild(helpicon);
- doclink.appendChild(helpobject.doclink.linktext);
-
- // Set the footerContent to the contents of the doclink.
- this.set('footerContent', doclink);
- this.bb.one(SELECTORS.FOOTER).show();
- } else {
- this.bb.one(SELECTORS.FOOTER).hide();
- }
- }
-});
-M.core = M.core || {};
-M.core.popuphelp = M.core.popuphelp || null;
-M.core.init_popuphelp = M.core.init_popuphelp || function(config) {
- // Only set up a single instance of the popuphelp.
- if (!M.core.popuphelp) {
- M.core.popuphelp = new POPUPHELP(config);
- }
- return M.core.popuphelp;
-};
diff --git a/lib/yui/src/popuphelp/meta/popuphelp.json b/lib/yui/src/popuphelp/meta/popuphelp.json
deleted file mode 100644
index 6df06f92b4c..00000000000
--- a/lib/yui/src/popuphelp/meta/popuphelp.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "moodle-core-popuphelp": {
- "requires": [
- "moodle-core-tooltip"
- ]
- }
-}
diff --git a/lib/yui/src/tooltip/build.json b/lib/yui/src/tooltip/build.json
deleted file mode 100644
index bb3ed16a438..00000000000
--- a/lib/yui/src/tooltip/build.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "name": "moodle-core-tooltip",
- "builds": {
- "moodle-core-tooltip": {
- "jsfiles": [
- "tooltip.js"
- ]
- }
- }
-}
diff --git a/lib/yui/src/tooltip/js/tooltip.js b/lib/yui/src/tooltip/js/tooltip.js
deleted file mode 100644
index c3369412e59..00000000000
--- a/lib/yui/src/tooltip/js/tooltip.js
+++ /dev/null
@@ -1,465 +0,0 @@
-/**
- * Provides the base tooltip class.
- *
- * @module moodle-core-tooltip
- */
-
-/**
- * A base class for a tooltip.
- *
- * @param {Object} config Object literal specifying tooltip configuration properties.
- * @class M.core.tooltip
- * @constructor
- * @extends M.core.dialogue
- */
-function TOOLTIP(config) {
- if (!config) {
- config = {};
- }
-
- // Override the default options provided by the parent class.
- if (typeof config.draggable === 'undefined') {
- config.draggable = true;
- }
-
- if (typeof config.constrain === 'undefined') {
- config.constrain = true;
- }
-
- TOOLTIP.superclass.constructor.apply(this, [config]);
-}
-
-var SELECTORS = {
- CLOSEBUTTON: '.closebutton'
- },
-
- CSS = {
- PANELTEXT: 'tooltiptext'
- },
- RESOURCES = {
- WAITICON: {
- pix: 'i/loading_small',
- component: 'moodle'
- }
- },
- ATTRS = {};
-
-/**
- * Static property provides a string to identify the JavaScript class.
- *
- * @property NAME
- * @type String
- * @static
- */
-TOOLTIP.NAME = 'moodle-core-tooltip';
-
-/**
- * Static property used to define the CSS prefix applied to tooltip dialogues.
- *
- * @property CSS_PREFIX
- * @type String
- * @static
- */
-TOOLTIP.CSS_PREFIX = 'moodle-dialogue';
-
-/**
- * Static property used to define the default attribute configuration for the Tooltip.
- *
- * @property ATTRS
- * @type String
- * @static
- */
-TOOLTIP.ATTRS = ATTRS;
-
-/**
- * The initial value of the header region before the content finishes loading.
- *
- * @attribute initialheadertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialheadertext = {
- value: ''
-};
-
-/**
- * The initial value of the body region before the content finishes loading.
- *
- * The supplid string will be wrapped in a div with the CSS.PANELTEXT class and a standard Moodle spinner
- * appended.
- *
- * @attribute initialbodytext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialbodytext = {
- value: '',
- setter: function(content) {
- var parentnode,
- spinner;
- parentnode = Y.Node.create('
')
- .addClass(CSS.PANELTEXT);
-
- spinner = Y.Node.create('
![]()
')
- .setAttribute('src', M.util.image_url(RESOURCES.WAITICON.pix, RESOURCES.WAITICON.component))
- .addClass('spinner');
-
- if (content) {
- // If we have been provided with content, add it to the parent and make
- // the spinner appear correctly inline
- parentnode.set('text', content);
- spinner.addClass('iconsmall');
- } else {
- // If there is no loading message, just make the parent node a lightbox
- parentnode.addClass('content-lightbox');
- }
-
- parentnode.append(spinner);
- return parentnode;
- }
-};
-
-/**
- * The initial value of the footer region before the content finishes loading.
- *
- * If a value is supplied, it will be wrapped in a
first.
- *
- * @attribute initialfootertext
- * @type String
- * @default ''
- * @writeOnce
- */
-ATTRS.initialfootertext = {
- value: null,
- setter: function(content) {
- if (content) {
- return Y.Node.create('
')
- .set('text', content);
- }
- }
-};
-
-/**
- * The function which handles setting the content of the title region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the title to object.heading as returned by the AJAX call.
- *
- * @attribute headerhandler
- * @type Function|String|null
- * @default set_header_content
- */
-ATTRS.headerhandler = {
- value: 'set_header_content'
-};
-
-/**
- * The function which handles setting the content of the body region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * The default function will simply set the value of the body area to a div containing object.text as returned
- * by the AJAX call.
- *
- * @attribute bodyhandler
- * @type Function|String|null
- * @default set_body_content
- */
-ATTRS.bodyhandler = {
- value: 'set_body_content'
-};
-
-/**
- * The function which handles setting the content of the footer region.
- * The specified function will be called with a context of the tooltip instance.
- *
- * By default, the footer is not set.
- *
- * @attribute footerhandler
- * @type Function|String|null
- * @default null
- */
-ATTRS.footerhandler = {
- value: null
-};
-
-/**
- * The function which handles modifying the URL that was clicked on.
- *
- * The default function rewrites '.php' to '_ajax.php'.
- *
- * @attribute urlmodifier
- * @type Function|String|null
- * @default null
- */
-ATTRS.urlmodifier = {
- value: null
-};
-
-/**
- * Set the Y.Cache object to use.
- *
- * By default a new Y.Cache object will be created for each instance of the tooltip.
- *
- * In certain situations, where multiple tooltips may share the same cache, it may be preferable to
- * seed this cache from the calling method.
- *
- * @attribute textcache
- * @type Y.Cache|null
- * @default null
- */
-ATTRS.textcache = {
- value: null
-};
-
-/**
- * Set the default size of the Y.Cache object.
- *
- * This is only used if no textcache is specified.
- *
- * @attribute textcachesize
- * @type Number
- * @default 10
- */
-ATTRS.textcachesize = {
- value: 10
-};
-
-Y.extend(TOOLTIP, M.core.dialogue, {
- // The bounding box.
- bb: null,
-
- // Any event listeners we may need to cancel later.
- listenevents: [],
-
- // Cache of objects we've already retrieved.
- textcache: null,
-
- // The align position. This differs for RTL languages so we calculate once and store.
- alignpoints: [
- Y.WidgetPositionAlign.TL,
- Y.WidgetPositionAlign.RC
- ],
-
- initializer: function() {
- // Set the initial values for the handlers.
- // These cannot be set in the attributes section as context isn't present at that time.
- if (!this.get('headerhandler')) {
- this.set('headerhandler', this.set_header_content);
- }
- if (!this.get('bodyhandler')) {
- this.set('bodyhandler', this.set_body_content);
- }
- if (!this.get('footerhandler')) {
- this.set('footerhandler', function() {});
- }
- if (!this.get('urlmodifier')) {
- this.set('urlmodifier', this.modify_url);
- }
-
- // Set up the dialogue with initial content.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Hide and then render the dialogue.
- this.hide();
- this.render();
-
- // Hook into a few useful areas.
- this.bb = this.get('boundingBox');
-
- // Add an additional class to the boundingbox to allow tooltip-specific style to be
- // set.
- this.bb.addClass('moodle-dialogue-tooltip');
-
- // Change the alignment if this is an RTL language.
- if (window.right_to_left()) {
- this.alignpoints = [
- Y.WidgetPositionAlign.TR,
- Y.WidgetPositionAlign.LC
- ];
- }
-
- // Set up the text cache if it's not set up already.
- if (!this.get('textcache')) {
- this.set('textcache', new Y.Cache({
- // Set a reasonable maximum cache size to prevent memory growth.
- max: this.get('textcachesize')
- }));
- }
-
- // Disable the textcache when in developerdebug.
- if (M.cfg.developerdebug) {
- this.get('textcache').set('max', 0);
- }
-
- return this;
- },
-
- /**
- * Display the tooltip for the clicked link.
- *
- * The anchor for the clicked link is used.
- *
- * @method display_panel
- * @param {EventFacade} e The event from the clicked link. This is used to determine the clicked URL.
- */
- display_panel: function(e) {
- var clickedlink, thisevent, ajaxurl, config, cacheentry;
-
- // Prevent the default click action and prevent the event triggering anything else.
- e.preventDefault();
-
- // Cancel any existing listeners and close the panel if it's already open.
- this.cancel_events();
-
- // Grab the clickedlink - this contains the URL we fetch and we align the panel to it.
- clickedlink = e.target.ancestor('a', true);
-
- // Reset the initial text to a spinner while we retrieve the text.
- this.setAttrs({
- headerContent: this.get('initialheadertext'),
- bodyContent: this.get('initialbodytext'),
- footerContent: this.get('initialfootertext')
- });
-
- // Now that initial setup has begun, show the panel.
- this.show(e);
-
- // Align with the link that was clicked.
- this.align(clickedlink, this.alignpoints);
-
- // Add some listen events to close on.
- thisevent = this.bb.delegate('click', this.close_panel, SELECTORS.CLOSEBUTTON, this);
- this.listenevents.push(thisevent);
-
- thisevent = Y.one('body').on('key', this.close_panel, 'esc', this);
- this.listenevents.push(thisevent);
-
- // Listen for mousedownoutside events - clickoutside is broken on IE.
- thisevent = this.bb.on('mousedownoutside', this.close_panel, this);
- this.listenevents.push(thisevent);
-
- // Modify the URL as required.
- ajaxurl = Y.bind(this.get('urlmodifier'), this, clickedlink.get('href'))();
-
- cacheentry = this.get('textcache').retrieve(ajaxurl);
- if (cacheentry) {
- // The data from this help call was already cached so use that and avoid an AJAX call.
- this._set_panel_contents(cacheentry.response);
- } else {
- // Retrieve the actual help text we should use.
- config = {
- method: 'get',
- context: this,
- sync: false,
- on: {
- complete: function(tid, response) {
- this._set_panel_contents(response.responseText, ajaxurl);
- }
- }
- };
-
- Y.io(ajaxurl, config);
- }
- },
-
- _set_panel_contents: function(response, ajaxurl) {
- var responseobject;
-
- // Attempt to parse the response into an object.
- try {
- responseobject = Y.JSON.parse(response);
- if (responseobject.error) {
- this.close_panel();
- Y.use('moodle-core-notification-ajaxexception', function() {
- return new M.core.ajaxException(responseobject).show();
- });
- return this;
- }
- } catch (error) {
- this.close_panel();
- Y.use('moodle-core-notification-exception', function() {
- return new M.core.exception(error).show();
- });
- return this;
- }
-
- // Set the contents using various handlers.
- // We must use Y.bind to ensure that the correct context is used when the default handlers are overridden.
- Y.bind(this.get('headerhandler'), this, responseobject)();
- Y.bind(this.get('bodyhandler'), this, responseobject)();
- Y.bind(this.get('footerhandler'), this, responseobject)();
-
- if (ajaxurl) {
- // Ensure that this data is added to the cache.
- this.get('textcache').add(ajaxurl, response);
- }
-
- this.get('buttons').header[0].focus();
- },
-
- set_header_content: function(responseobject) {
- this.set('headerContent', responseobject.heading);
- },
-
- set_body_content: function(responseobject) {
- var bodycontent = Y.Node.create('
')
- .set('innerHTML', responseobject.text)
- .setAttribute('role', 'alert')
- .addClass(CSS.PANELTEXT);
- this.set('bodyContent', bodycontent);
- },
-
- modify_url: function(url) {
- return url.replace(/\.php\?/, '_ajax.php?');
- },
-
- close_panel: function(e) {
- // Hide the panel first.
- this.hide(e);
-
- // Cancel the listeners that we added in display_panel.
- this.cancel_events();
-
- // Prevent any default click that the close button may have.
- if (e) {
- e.preventDefault();
- }
- },
-
- cancel_events: function() {
- // Detach all listen events to prevent duplicate triggers.
- var thisevent;
- while (this.listenevents.length) {
- thisevent = this.listenevents.shift();
- thisevent.detach();
- }
- }
-});
-
-Y.Base.modifyAttrs(TOOLTIP, {
- /**
- * Whether the widget should be modal or not.
- *
- * Moodle override: We override this for tooltip to default it to false.
- *
- * @attribute Modal
- * @type Boolean
- * @default false
- */
- modal: {
- value: false
- },
-
- focusOnPreviousTargetAfterHide: {
- value: true
- }
-});
-
-M.core = M.core || {};
-M.core.tooltip = M.core.tooltip = TOOLTIP;
diff --git a/lib/yui/src/tooltip/meta/tooltip.json b/lib/yui/src/tooltip/meta/tooltip.json
deleted file mode 100644
index 5e3f97737d1..00000000000
--- a/lib/yui/src/tooltip/meta/tooltip.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "moodle-core-tooltip": {
- "requires": [
- "base",
- "node",
- "io-base",
- "moodle-core-notification-dialogue",
- "json-parse",
- "widget-position",
- "widget-position-align",
- "event-outside",
- "cache-base"
- ]
- }
-}
diff --git a/theme/upgrade.txt b/theme/upgrade.txt
index 0d325363a45..54913f88126 100644
--- a/theme/upgrade.txt
+++ b/theme/upgrade.txt
@@ -1,6 +1,10 @@
This files describes API changes in /theme/* themes,
information provided here is intended especially for theme designer.
+=== 4.2 ===
+* The moodle-core-popuphelp YUI modal has been removed. It has not been actively used in Moodle since 3.3. It should be replaced with appropriate ESM/AMD JavaScript.
+* The moodle-core-tooltip YUI modal has been removed. It should be replaced with appropriate ESM/AMD JavaScript.
+
=== 4.1 ===
* The function core_course_renderer::course_modchooser() has been finally deprecated and can not be used anymore.
Please use core_course_renderer::course_activitychooser() instead.
diff --git a/theme/yui_combo.php b/theme/yui_combo.php
index b74f3bd62c9..5ffe8a07bdc 100644
--- a/theme/yui_combo.php
+++ b/theme/yui_combo.php
@@ -194,9 +194,6 @@ while (count($parts)) {
'dd-ddm-base',
'dd-drag',
'dd-plugin',
-
- // Cache is used by moodle-core-tooltip which we include everywhere.
- 'cache-base',
);
// We need to add these new parts to the beginning of the $parts list, not the end.