[javascript] move CubicWeb object declaration to cubicweb.js, remove CubicWeb.provide/require, use cw instead of CubicWeb
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 09 Jun 2010 12:43:21 +0200
changeset 5699 f4f6ee3af50b
parent 5698 5c8fa1650299
child 5700 2b2d8c2310aa
[javascript] move CubicWeb object declaration to cubicweb.js, remove CubicWeb.provide/require, use cw instead of CubicWeb
web/data/cubicweb.ajax.js
web/data/cubicweb.calendar.js
web/data/cubicweb.compat.js
web/data/cubicweb.edition.js
web/data/cubicweb.facets.js
web/data/cubicweb.htmlhelpers.js
web/data/cubicweb.js
web/data/cubicweb.widgets.js
--- a/web/data/cubicweb.ajax.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Wed Jun 09 12:43:21 2010 +0200
@@ -553,8 +553,6 @@
     children));
 }
 
-CubicWeb.provide('ajax.js');
-
 /* DEPRECATED *****************************************************************/
 
 preprocessAjaxLoad = cw.utils.deprecatedFunction(
@@ -663,4 +661,3 @@
         return deferred;
     }
 );
-
--- a/web/data/cubicweb.calendar.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.calendar.js	Wed Jun 09 12:43:21 2010 +0200
@@ -5,9 +5,6 @@
  *  :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
  */
 
-CubicWeb.require('python.js');
-CubicWeb.require('ajax.js');
-
 // IMPORTANT NOTE: the variables DAYNAMES AND MONTHNAMES will be added
 //                 by cubicweb automatically
 // dynamically computed (and cached)
@@ -54,7 +51,7 @@
         'onmouseout': function() {
             this.style.fontWeight = 'normal';
         }
-    }
+    };
 
     this.todayprops = jQuery.extend({},
     this.cellprops, {
@@ -79,7 +76,7 @@
      */
     this._uppercaseFirst = function(s) {
         return s.charAt(0).toUpperCase();
-    }
+    };
 
     /**
      * .. function:: Calendar._domForRows(rows)
@@ -118,7 +115,7 @@
         var stopdate = firstday.nextMonth();
         var curdate = firstday.sub(firstday.getRealDay());
         while (curdate.getTime() < stopdate) {
-            var row = []
+            var row = [];
             for (var i = 0; i < 7; i++) {
                 if (curdate.getMonth() == this.month) {
                     props = curdate.equals(TODAY) ? this.todayprops: this.cellprops;
@@ -131,7 +128,7 @@
             rows.push(row);
         }
         return rows;
-    }
+    };
 
     this._makecal = function() {
         var rows = this._getrows();
@@ -156,7 +153,7 @@
         },
         ">>")))), TBODY(null, this._headdisplay(), this._domForRows(rows)));
         return this.domtable;
-    }
+    };
 
     this._updateDiv = function() {
         if (!this.domtable) {
@@ -164,7 +161,7 @@
         }
         cw.jqNode(this.containerId).empty().append(this.domtable);
         // replaceChildNodes($(this.containerId), this.domtable);
-    }
+    };
 
     this.displayNextMonth = function() {
         this.domtable = null;
@@ -173,7 +170,7 @@
         }
         this.month = (this.month + 1) % 12;
         this._updateDiv();
-    }
+    };
 
     this.displayPreviousMonth = function() {
         this.domtable = null;
@@ -182,11 +179,11 @@
         }
         this.month = (this.month + 11) % 12;
         this._updateDiv();
-    }
+    };
 
     this.show = function() {
         if (!this.visible) {
-            container = cw.jqNode(this.containerId);
+            var container = cw.jqNode(this.containerId);
             if (!this.domtable) {
                 this._makecal();
             }
@@ -194,7 +191,7 @@
             toggleVisibility(container);
             this.visible = true;
         }
-    }
+    };
 
     this.hide = function(event) {
         var self;
@@ -207,7 +204,7 @@
             toggleVisibility(self.containerId);
             self.visible = false;
         }
-    }
+    };
 
     this.toggle = function() {
         if (this.visible) {
@@ -216,7 +213,7 @@
         else {
             this.show();
         }
-    }
+    };
 
     // call hide() when the user explicitly sets the focus on the matching input
     cw.jqNode(inputId).bind('focus', {
@@ -281,15 +278,14 @@
     //      the only way understood by both IE and Mozilla. Otherwise,
     //      IE accepts innerText and mozilla accepts textContent
     var selectedDate = new Date(cal.year, cal.month, cell.innerHTML, 12);
-    var xxx = remoteExec("format_date", cw.utils.toISOTimestamp(selectedDate));
-    input.value = xxx;
+    input.value = remoteExec("format_date", cw.utils.toISOTimestamp(selectedDate));
     cal.hide();
 }
 
 function whichElement(e) {
     var targ;
     if (!e) {
-        var e = window.event;
+        e = window.event;
     }
     if (e.target) {
         targ = e.target;
@@ -357,6 +353,3 @@
     event.cancelBubble = true;
     if (event.stopPropagation) event.stopPropagation();
 }
-
-CubicWeb.provide('calendar.js');
-
--- a/web/data/cubicweb.compat.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.compat.js	Wed Jun 09 12:43:21 2010 +0200
@@ -111,21 +111,3 @@
     KEY_ESC: 27,
     KEY_ENTER: 13
 };
-
-// XXX avoid crashes / backward compat
-CubicWeb = {
-    require: function(module) {},
-    provide: function(module) {}
-};
-
-jQuery(document).ready(function() {
-    jQuery(CubicWeb).trigger('server-response', [false, document]);
-});
-
-// XXX as of 2010-04-07, no known cube uses this
-jQuery(CubicWeb).bind('ajax-loaded', function() {
-    log('[3.7] "ajax-loaded" event is deprecated, use "server-response" instead');
-    jQuery(CubicWeb).trigger('server-response', [false, document]);
-});
-
-CubicWeb.provide('python.js');
--- a/web/data/cubicweb.edition.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.edition.js	Wed Jun 09 12:43:21 2010 +0200
@@ -7,10 +7,6 @@
  *
  */
 
-CubicWeb.require('python.js');
-CubicWeb.require('htmlhelpers.js');
-CubicWeb.require('ajax.js');
-
 //============= Eproperty form functions =====================================//
 /**
  * .. function:: setPropValueWidget(varname, tabindex)
--- a/web/data/cubicweb.facets.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.facets.js	Wed Jun 09 12:43:21 2010 +0200
@@ -4,9 +4,6 @@
  *  :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
  */
 
-CubicWeb.require('htmlhelpers.js');
-CubicWeb.require('ajax.js');
-
 //============= filter form functions ========================================//
 function copyParam(origparams, newparams, param) {
     var index = jQuery.inArray(param, origparams[0]);
@@ -240,6 +237,3 @@
 jQuery(document).ready(function() {
     initFacetBoxEvents();
 });
-
-CubicWeb.provide('facets.js');
-
--- a/web/data/cubicweb.htmlhelpers.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.htmlhelpers.js	Wed Jun 09 12:43:21 2010 +0200
@@ -1,6 +1,3 @@
-CubicWeb.require('python.js');
-CubicWeb.require('jquery.corner.js');
-
 /**
  * .. function:: baseuri()
  *
@@ -183,14 +180,14 @@
     }
 }
 //============= page loading events ==========================================//
-CubicWeb.rounded = [['div.sideBoxBody', 'bottom 6px'],
-                    ['div.boxTitle, div.sideBoxTitle, th.month', 'top 6px']];
+cw.rounded = [['div.sideBoxBody', 'bottom 6px'],
+              ['div.boxTitle, div.sideBoxTitle, th.month', 'top 6px']];
 
 function roundedCorners(node) {
     if (jQuery.fn.corner !== undefined) {
         node = jQuery(node);
-        for (var r = 0; r < CubicWeb.rounded.length; r++) {
-            node.find(CubicWeb.rounded[r][0]).corner(CubicWeb.rounded[r][1]);
+        for (var r = 0; r < cw.rounded.length; r++) {
+            node.find(cw.rounded[r][0]).corner(cw.rounded[r][1]);
         }
     }
 }
@@ -198,8 +195,3 @@
 jQuery(document).ready(function() {
     roundedCorners(this.body);
 });
-
-CubicWeb.provide('corners.js');
-
-CubicWeb.provide('htmlhelpers.js');
-
--- a/web/data/cubicweb.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.js	Wed Jun 09 12:43:21 2010 +0200
@@ -1,3 +1,4 @@
+
 cw = {};
 
 jQuery.extend(cw, {
@@ -368,3 +369,24 @@
     }
     return node;
 }
+
+// XXX avoid crashes / backward compat
+CubicWeb = {
+    require: cw.utils.deprecatedFunction(
+        '[3.9] CubicWeb.require() is not used anymore',
+        function(module) {}),
+    provide: cw.utils.deprecatedFunction(
+        '[3.9] CubicWeb.provide() is not used anymore',
+        function(module) {})
+};
+
+jQuery(document).ready(function() {
+    jQuery(CubicWeb).trigger('server-response', [false, document]);
+    jQuery(cw).trigger('server-response', [false, document]);
+});
+
+// XXX as of 2010-04-07, no known cube uses this
+jQuery(CubicWeb).bind('ajax-loaded', function() {
+    log('[3.7] "ajax-loaded" event is deprecated, use "server-response" instead');
+    jQuery(cw).trigger('server-response', [false, document]);
+});
--- a/web/data/cubicweb.widgets.js	Wed Jun 09 12:39:55 2010 +0200
+++ b/web/data/cubicweb.widgets.js	Wed Jun 09 12:43:21 2010 +0200
@@ -404,4 +404,4 @@
             textarea.value += text;
         }
     }
-};
\ No newline at end of file
+};