MDL-38472 JavaScript: Migrate moodle-core-popuphelp to Shifter
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Thu, 14 Mar 2013 01:02:53 +0000 (01:02 +0000)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Thu, 14 Mar 2013 01:21:18 +0000 (01:21 +0000)
lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-coverage.js [new file with mode: 0644]
lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-debug.js [new file with mode: 0644]
lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-min.js [new file with mode: 0644]
lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js [new file with mode: 0644]
lib/yui/popuphelp/popuphelp.js [deleted file]
lib/yui/src/popuphelp/build.json [new file with mode: 0644]
lib/yui/src/popuphelp/js/popuphelp.js [new file with mode: 0644]
lib/yui/src/popuphelp/meta/popuphelp.json [new file with mode: 0644]

diff --git a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-coverage.js b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-coverage.js
new file mode 100644 (file)
index 0000000..796e492
Binary files /dev/null and b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-coverage.js differ
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
new file mode 100644 (file)
index 0000000..acefacb
Binary files /dev/null and b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-debug.js differ
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
new file mode 100644 (file)
index 0000000..0619adf
Binary files /dev/null and b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp-min.js differ
diff --git a/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js
new file mode 100644 (file)
index 0000000..acefacb
Binary files /dev/null and b/lib/yui/build/moodle-core-popuphelp/moodle-core-popuphelp.js differ
diff --git a/lib/yui/popuphelp/popuphelp.js b/lib/yui/popuphelp/popuphelp.js
deleted file mode 100644 (file)
index 6ef2710..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-YUI.add('moodle-core-popuphelp', function(Y) {
-    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,
-
-        initializer: function() {
-            Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
-        },
-
-        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.
-         *
-         * @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.
-                doclink = Y.Node.create('<a />')
-                    .setAttrs({
-                        'href': helpobject.doclink.link
-                    })
-                    .addClass(helpobject.doclink['class']);
-                helpicon = Y.Node.create('<img />')
-                    .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/src/popuphelp/build.json b/lib/yui/src/popuphelp/build.json
new file mode 100644 (file)
index 0000000..4be9e69
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "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
new file mode 100644 (file)
index 0000000..0be3efe
--- /dev/null
@@ -0,0 +1,81 @@
+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,
+
+    initializer: function() {
+        Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
+    },
+
+    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.
+      *
+      * @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.
+            doclink = Y.Node.create('<a />')
+                .setAttrs({
+                    'href': helpobject.doclink.link
+                })
+                .addClass(helpobject.doclink['class']);
+            helpicon = Y.Node.create('<img />')
+                .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
new file mode 100644 (file)
index 0000000..6df06f9
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "moodle-core-popuphelp": {
+    "requires": [
+        "moodle-core-tooltip"
+    ]
+  }
+}