MDL-38471 JavaScript: Migrate moodle-core-notification to use Shifter
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Thu, 14 Mar 2013 00:40:34 +0000 (00:40 +0000)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Thu, 14 Mar 2013 00:52:32 +0000 (00:52 +0000)
lib/yui/build/moodle-core-notification/moodle-core-notification-coverage.js [new file with mode: 0644]
lib/yui/build/moodle-core-notification/moodle-core-notification-debug.js [new file with mode: 0644]
lib/yui/build/moodle-core-notification/moodle-core-notification-min.js [new file with mode: 0644]
lib/yui/build/moodle-core-notification/moodle-core-notification.js [new file with mode: 0644]
lib/yui/src/notification/build.json [new file with mode: 0644]
lib/yui/src/notification/js/notification.js [moved from lib/yui/notification/notification.js with 81% similarity]
lib/yui/src/notification/meta/notification.json [new file with mode: 0644]

diff --git a/lib/yui/build/moodle-core-notification/moodle-core-notification-coverage.js b/lib/yui/build/moodle-core-notification/moodle-core-notification-coverage.js
new file mode 100644 (file)
index 0000000..862ff70
Binary files /dev/null and b/lib/yui/build/moodle-core-notification/moodle-core-notification-coverage.js differ
diff --git a/lib/yui/build/moodle-core-notification/moodle-core-notification-debug.js b/lib/yui/build/moodle-core-notification/moodle-core-notification-debug.js
new file mode 100644 (file)
index 0000000..d12a077
Binary files /dev/null and b/lib/yui/build/moodle-core-notification/moodle-core-notification-debug.js differ
diff --git a/lib/yui/build/moodle-core-notification/moodle-core-notification-min.js b/lib/yui/build/moodle-core-notification/moodle-core-notification-min.js
new file mode 100644 (file)
index 0000000..738909e
Binary files /dev/null and b/lib/yui/build/moodle-core-notification/moodle-core-notification-min.js differ
diff --git a/lib/yui/build/moodle-core-notification/moodle-core-notification.js b/lib/yui/build/moodle-core-notification/moodle-core-notification.js
new file mode 100644 (file)
index 0000000..d12a077
Binary files /dev/null and b/lib/yui/build/moodle-core-notification/moodle-core-notification.js differ
diff --git a/lib/yui/src/notification/build.json b/lib/yui/src/notification/build.json
new file mode 100644 (file)
index 0000000..dfc25ad
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-core-notification",
+  "builds": {
+    "moodle-core-notification": {
+      "jsfiles": [
+        "notification.js"
+      ]
+    }
+  }
+}
similarity index 81%
rename from lib/yui/notification/notification.js
rename to lib/yui/src/notification/js/notification.js
index f7f3000..e15286d 100644 (file)
@@ -1,12 +1,9 @@
-YUI.add('moodle-core-notification', function(Y) {
-
 var DIALOGUE_NAME = 'Moodle dialogue',
     DIALOGUE_PREFIX = 'moodle-dialogue',
     CONFIRM_NAME = 'Moodle confirmation dialogue',
     EXCEPTION_NAME = 'Moodle exception',
     AJAXEXCEPTION_NAME = 'Moodle AJAX exception',
     ALERT_NAME = 'Moodle alert',
-    C = Y.Node.create,
     BASE = 'notificationBase',
     COUNT = 0,
     CONFIRMYES = 'yesLabel',
@@ -33,11 +30,11 @@ DIALOGUE = function(config) {
     COUNT++;
     var id = 'moodle-dialogue-'+COUNT;
     config.notificationBase =
-        new C('<div class="'+CSS.BASE+'">')
-              .append(new C('<div id="'+id+'" role="dialog" aria-labelledby="'+id+'-header-text" class="'+CSS.WRAP+'"></div>')
-              .append(new C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
-              .append(new C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
-              .append(new C('<div class="'+CSS.FOOTER+' yui3-widget-ft"></div>')));
+        Y.Node.create('<div class="'+CSS.BASE+'">')
+              .append(Y.Node.create('<div id="'+id+'" role="dialog" aria-labelledby="'+id+'-header-text" class="'+CSS.WRAP+'"></div>')
+              .append(Y.Node.create('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
+              .append(Y.Node.create('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
+              .append(Y.Node.create('<div class="'+CSS.FOOTER+' yui3-widget-ft"></div>')));
     Y.one(document.body).append(config.notificationBase);
     config.srcNode =    '#'+id;
     config.width =      config.width || '400px';
@@ -59,7 +56,7 @@ DIALOGUE = function(config) {
             {
                 section: Y.WidgetStdMod.HEADER,
                 classNames: 'closebutton',
-                action: function (e) {
+                action: function () {
                     this.hide();
                 }
             }
@@ -73,7 +70,7 @@ DIALOGUE = function(config) {
     }
 };
 Y.extend(DIALOGUE, Y.Panel, {
-    initializer : function(config) {
+    initializer : function() {
         this.after('visibleChange', this.visibilityChanged, this);
         this.render();
         this.show();
@@ -149,10 +146,10 @@ Y.extend(ALERT, DIALOGUE, {
     _enterKeypress : null,
     initializer : function() {
         this.publish('complete');
-        var yes = C('<input type="button" id="id_yuialertconfirm-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
-            content = C('<div class="confirmation-dialogue"></div>')
-                    .append(C('<div class="confirmation-message">'+this.get('message')+'</div>'))
-                    .append(C('<div class="confirmation-buttons"></div>')
+        var yes = Y.Node.create('<input type="button" id="id_yuialertconfirm-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
+            content = Y.Node.create('<div class="confirmation-dialogue"></div>')
+                    .append(Y.Node.create('<div class="confirmation-message">'+this.get('message')+'</div>'))
+                    .append(Y.Node.create('<div class="confirmation-buttons"></div>')
                             .append(yes));
         this.get(BASE).addClass('moodle-dialogue-confirm');
         this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
@@ -202,11 +199,11 @@ Y.extend(CONFIRM, DIALOGUE, {
         this.publish('complete');
         this.publish('complete-yes');
         this.publish('complete-no');
-        var yes = C('<input type="button" id="id_yuiconfirmyes-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
-            no = C('<input type="button" id="id_yuiconfirmno-' + this.COUNT + '" value="'+this.get(CONFIRMNO)+'" />'),
-            content = C('<div class="confirmation-dialogue"></div>')
-                        .append(C('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
-                        .append(C('<div class="confirmation-buttons"></div>')
+        var yes = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
+            no = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.COUNT + '" value="'+this.get(CONFIRMNO)+'" />'),
+            content = Y.Node.create('<div class="confirmation-dialogue"></div>')
+                        .append(Y.Node.create('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
+                        .append(Y.Node.create('<div class="confirmation-buttons"></div>')
                             .append(yes)
                             .append(no));
         this.get(BASE).addClass('moodle-dialogue-confirm');
@@ -268,11 +265,11 @@ Y.extend(EXCEPTION, DIALOGUE, {
             delay = this.get('hideTimeoutDelay');
         this.get(BASE).addClass('moodle-dialogue-exception');
         this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
-        content = C('<div class="moodle-exception"></div>')
-                .append(C('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '+this.get('lineNumber')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stack')+'</pre></div>'));
+        content = Y.Node.create('<div class="moodle-exception"></div>')
+                .append(Y.Node.create('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '+this.get('lineNumber')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stack')+'</pre></div>'));
         if (M.cfg.developerdebug) {
             content.all('.moodle-exception-param').removeClass('hidden');
         }
@@ -344,11 +341,11 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
             delay = this.get('hideTimeoutDelay');
         this.get(BASE).addClass('moodle-dialogue-exception');
         this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+COUNT+'-header-text">' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
-        content = C('<div class="moodle-ajaxexception"></div>')
-                .append(C('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '+this.get('debuginfo')+'</div>'))
-                .append(C('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stacktrace')+'</pre></div>'));
+        content = Y.Node.create('<div class="moodle-ajaxexception"></div>')
+                .append(Y.Node.create('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '+this.get('debuginfo')+'</div>'))
+                .append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'+this.get('stacktrace')+'</pre></div>'));
         if (M.cfg.developerdebug) {
             content.all('.moodle-exception-param').removeClass('hidden');
         }
@@ -404,5 +401,3 @@ M.core.alert = ALERT;
 M.core.confirm = CONFIRM;
 M.core.exception = EXCEPTION;
 M.core.ajaxException = AJAXEXCEPTION;
-
-}, '@VERSION@', {requires:['base','node','panel','event-key', 'dd-plugin']});
diff --git a/lib/yui/src/notification/meta/notification.json b/lib/yui/src/notification/meta/notification.json
new file mode 100644 (file)
index 0000000..739c827
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "moodle-core-notification": {
+    "requires": [
+        "base",
+        "node",
+        "panel",
+        "event-key",
+        "dd-plugin"
+    ]
+  }
+}