Author: jmorliaguet
Date: Mon Jan  2 01:06:40 2006
New Revision: 2114

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- saving work



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Jan  2 
01:06:40 2006
@@ -27,11 +27,11 @@
       if (!tag.match(/^cpsskins:/i)) continue;
       switch (tag.toLowerCase()) {
         case "cpsskins:contextmenu": {
-          Renderer.contextmenu(element);
+          Renderers.contextmenu(element);
           break;
         }
         case "cpsskins:tooltip": {
-          Renderer.tooltip(element);
+          Renderers.tooltip(element);
           break;
         }
       }
@@ -245,8 +245,8 @@
 }
 
 // Renderer: instanciate a widget.
-if (!window.Renderer) { var Renderer = new Object(); }
-Object.extend(Renderer, {
+if (!window.Renderers) { var Renderers = new Object(); }
+Object.extend(Renderers, {
 
   contextmenu: function(view) {
     var widget = Canvas.addNode(document.body, {
@@ -292,38 +292,40 @@
     var y = Event.pointerY(e);
 
     var widget = this.widget;
-    if (this.active) {
-      if (Position.within(widget, x, y)) {
-        if (element.getAttribute("disabled")) return;
-        var action = element.getAttribute("action");
-        if (!action) return;
-        var confirm = element.getAttribute("confirm");
-        if (confirm) {
-          if (!window.confirm(confirm)) return;
-        }
-        var choice = element.getAttribute("choice") || action;
-        var handler = this.handlers[action];
-        if (handler) {
-          handler(this.selected, choice);
-        }
-      }
-      new CPSSkins.Effect(widget, {
-        action: function(value) {
-          Canvas.setOpacity(widget, 1-value);
-        },
-        onComplete: function() {
-          Element.hide(widget);
-        }
-      });
+
+    if (document.getElementsByClassName("contextMenu", element)) {
+      this.call(element);
     } else {
-      this.selected = Identifiable.getIdentifiable(element);
-      if (Position.within(this.area, x, y)) {
+      Element.hide(widget);
+    };
+
+    if (Position.within(this.area, x, y)) {
+      if (this.active) {
+        Element.hide(widget)
+      } else {
+        this.selected = Identifiable.getIdentifiable(element);
         this.show(x, y);
       }
     }
     this.active = !this.active;
   },
 
+  call: function(element) {
+    if (element.getAttribute("disabled")) return;
+    var action = element.getAttribute("action");
+    if (!action) return;
+    var confirm = element.getAttribute("confirm");
+    if (confirm) {
+      if (!window.confirm(confirm)) return;
+    }
+    var choice = element.getAttribute("choice") || action;
+    var handler = this.handlers[action];
+    if (handler) {
+      handler(this.selected, choice);
+      Element.hide(this.widget);
+    }
+  },
+
   _getSubmenu: function(e) {
     var start = Event.element(e);
     if (!start) return null;
@@ -401,7 +403,7 @@
           }
 
           var icon = tag.getAttribute("icon");
-          if (icon) {
+          if (icon && visible) {
             options.style.backgroundImage = "url(" + icon + ")";
           }
 
@@ -420,7 +422,6 @@
           var choices = tag.getAttribute("choices");
           var items = data[choices] || [];
           for (var j=0;j<items.length;j++) {
-
             var options = {
               tag: "a",
               content: items[j].label,
@@ -431,10 +432,6 @@
                 href: "javascript:void(0)"
               }
             }
-            var icon = tag.getAttribute("icon");
-            if (icon) {
-              options.style.backgroundImage = "url(" + icon + ")";
-            }
             Canvas.addNode(container, options);
           };
           break;
@@ -453,8 +450,12 @@
           var submenu = Canvas.addNode(item, {
             tag: "div",
             class: "submenu",
-            style: {position: "absolute", left:this.submenuLeft + "px",
-                    display: "none", margin: "-20px 0 0 0"}
+            style: {
+              position: "absolute",
+              left:this.submenuLeft + "px",
+              display: "none",
+              margin: "-20px 0 0 0"
+            }
           });
 
           var mouseOverEvent = function(e) {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to