web/data/cubicweb.timeline-ext.js
changeset 5658 7b9553a9db65
parent 1156 4b920f836567
child 5774 0d792bceb25d
--- a/web/data/cubicweb.timeline-ext.js	Thu Jun 03 10:17:44 2010 +0200
+++ b/web/data/cubicweb.timeline-ext.js	Thu Jun 03 14:51:42 2010 +0200
@@ -1,49 +1,49 @@
-/*
+/**
  *  :organization: Logilab
- *  :copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+ *  :copyright: 2008-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
  *  :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
  *
  */
 
-
-/* provide our own custom date parser since the default
+/**
+ * provide our own custom date parser since the default
  * one only understands iso8601 and gregorian dates
  */
 SimileAjax.NativeDateUnit.getParser = Timeline.NativeDateUnit.getParser = function(format) {
     if (typeof format == "string") {
-	if (format.indexOf('%') != -1) {
-	    return function(datestring) {
-		if (datestring) {
-		    return strptime(datestring, format);
-		}
-		return null;
-	    };
-	}
+        if (format.indexOf('%') != - 1) {
+            return function(datestring) {
+                if (datestring) {
+                    return strptime(datestring, format);
+                }
+                return null;
+            };
+        }
         format = format.toLowerCase();
     }
     if (format == "iso8601" || format == "iso 8601") {
-	return Timeline.DateTime.parseIso8601DateTime;
+        return Timeline.DateTime.parseIso8601DateTime;
     }
     return Timeline.DateTime.parseGregorianDateTime;
 };
 
 /*** CUBICWEB EVENT PAINTER *****************************************************/
 Timeline.CubicWebEventPainter = function(params) {
-//  Timeline.OriginalEventPainter.apply(this, arguments);
-   this._params = params;
-   this._onSelectListeners = [];
+    //  Timeline.OriginalEventPainter.apply(this, arguments);
+    this._params = params;
+    this._onSelectListeners = [];
 
-   this._filterMatcher = null;
-   this._highlightMatcher = null;
-   this._frc = null;
+    this._filterMatcher = null;
+    this._highlightMatcher = null;
+    this._frc = null;
 
-   this._eventIdToElmt = {};
+    this._eventIdToElmt = {};
 };
 
 Timeline.CubicWebEventPainter.prototype = new Timeline.OriginalEventPainter();
 
 Timeline.CubicWebEventPainter.prototype._paintEventLabel = function(
-  evt, text, left, top, width, height, theme) {
+evt, text, left, top, width, height, theme) {
     var doc = this._timeline.getDocument();
 
     var labelDiv = doc.createElement("div");
@@ -54,15 +54,21 @@
     labelDiv.style.top = top + "px";
 
     if (evt._obj.onclick) {
-	labelDiv.appendChild(A({'href': evt._obj.onclick}, text));
+        labelDiv.appendChild(A({
+            'href': evt._obj.onclick
+        },
+        text));
     } else if (evt._obj.image) {
-      labelDiv.appendChild(IMG({src: evt._obj.image, width: '30px', height: '30px'}));
+        labelDiv.appendChild(IMG({
+            src: evt._obj.image,
+            width: '30px',
+            height: '30px'
+        }));
     } else {
-      labelDiv.innerHTML = text;
+        labelDiv.innerHTML = text;
     }
 
-    if(evt._title != null)
-        labelDiv.title = evt._title;
+    if (evt._title != null) labelDiv.title = evt._title;
 
     var color = evt.getTextColor();
     if (color == null) {
@@ -72,29 +78,31 @@
         labelDiv.style.color = color;
     }
     var classname = evt.getClassName();
-    if(classname) labelDiv.className +=' ' + classname;
+    if (classname) labelDiv.className += ' ' + classname;
 
     this._eventLayer.appendChild(labelDiv);
 
     return {
-        left:   left,
-        top:    top,
-        width:  width,
+        left: left,
+        top: top,
+        width: width,
         height: height,
-        elmt:   labelDiv
+        elmt: labelDiv
     };
 };
 
+Timeline.CubicWebEventPainter.prototype._showBubble = function(x, y, evt) {
+    var div = DIV({
+        id: 'xxx'
+    });
+    var width = this._params.theme.event.bubble.width;
+    if (!evt._obj.bubbleUrl) {
+        evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
+    }
+    SimileAjax.WindowManager.cancelPopups();
+    SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, width);
+    if (evt._obj.bubbleUrl) {
+        jQuery('#xxx').loadxhtml(evt._obj.bubbleUrl, null, 'post', 'replace');
+    }
+};
 
-Timeline.CubicWebEventPainter.prototype._showBubble = function(x, y, evt) {
-  var div = DIV({id: 'xxx'});
-  var width = this._params.theme.event.bubble.width;
-  if (!evt._obj.bubbleUrl) {
-    evt.fillInfoBubble(div, this._params.theme, this._band.getLabeller());
-  }
-  SimileAjax.WindowManager.cancelPopups();
-  SimileAjax.Graphics.createBubbleForContentAndPoint(div, x, y, width);
-  if (evt._obj.bubbleUrl) {
-    jQuery('#xxx').loadxhtml(evt._obj.bubbleUrl, null, 'post', 'replace');
-  }
-};