Author: jmorliaguet
Date: Sat Dec 17 14:43:21 2005
New Revision: 2045

Modified:
   cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js
   cpsskins/branches/jmo-perspectives/ui/authoring/authoring_macros.pt
   cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js
   cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.pt
   cpsskins/branches/jmo-perspectives/ui/framework/utils.js
Log:

- getEventTarget() is Event.element() in prototype.js



Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/authoring.js        Sat Dec 
17 14:43:21 2005
@@ -184,7 +184,7 @@
   if (pd_selected_item == null) 
     return;
   if (!e) e = event;
-  var target = getEventTarget(e);
+  var target = Event.element(e);
   if (!target) return;
   var confirm = target.getAttribute("confirm");
   if (confirm) {
@@ -334,7 +334,7 @@
   var moving = pd_selected_item;
   if (moving == el) return;
   if (moving.className.indexOf('draggable') < 0) return;
-  var target = getEventTarget(e);
+  var target = Event.element(e);
   if (target.className.indexOf('container') < 0) return;
   if (!isNodeEmpty(target)) return;
   target.appendChild(moving);
@@ -388,7 +388,7 @@
   pd_setupDragUI(mo);
   mo.onmousedown = function(e) {
     drag_destination = mo.getAttribute("destination");
-    var target = getEventTarget(e);
+    var target = Event.element(e);
     if (!target) return;
     if (target.getAttribute("grip") || mo.getAttribute("grip")) {
       moved = new Element(mo);
@@ -448,7 +448,7 @@
       if (isNodeEmpty(mo)) {
         var el = null; 
       } else {
-        var target = getEventTarget(e);
+        var target = Event.element(e);
         var el = getTargetElement(target);
       }
       add_element(mo, el, type_name);
@@ -460,17 +460,17 @@
 
 function setupEditable(mo) {
   mo.onmousedown = function(e) {
-    var target = getEventTarget(e);
+    var target = Event.element(e);
     var className = target.className;
     if (className.indexOf('editable') >= 0) return;
   }
   mo.onchange = function(e) {
-    var target = getEventTarget(e);
+    var target = Event.element(e);
     edit_element(target, target.name, target.value);
     pd_stopEvent(e);
   }
   mo.oncontextmenu = function(e) {
-    var target = getEventTarget(e);
+    var target = Event.element(e);
     var className = target.className;
     if (className.indexOf('editable') >= 0 || !moved) {
       return pd_stopEvent(e);
@@ -484,7 +484,7 @@
 
 function setupTooltip(mo) {
   mo.onmouseover = function(e) {
-    var target = getEventTarget(e);
+    var target = Event.element(e);
     tooltip_box.style.top = '' + (getMouseY(e) + 20) + 'px';
     tooltip_box.style.left = '' + (getMouseX(e)) + 'px';
     tooltip_box.innerHTML = target.getAttribute('hint');

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/authoring_macros.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/authoring_macros.pt 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/authoring_macros.pt Sat Dec 
17 14:43:21 2005
@@ -160,6 +160,8 @@
 
     <metal:block define-slot="javascript" />
     <script type="text/javascript"
+            src="/++skin++cpsskins/@@/++resource++prototype.js"></script>
+    <script type="text/javascript"
             src="/@@/jsolait/init.js"></script>
     <script type="text/javascript"
             src="/++skin++cpsskins/@@/++resource++utils.js"></script>

Modified: 
cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.js 
Sat Dec 17 14:43:21 2005
@@ -99,7 +99,7 @@
 
 function show_tooltip(e) {
   if (!e) e = event;
-  var elem = getEventTarget(e);
+  var elem = Event.element(e);
   var label = elem.getAttribute("label");
   if (!label) {
       label = 'unknown label';
@@ -205,7 +205,7 @@
 function change_style_property(e) {
   if (!e) e = event;
   var field, value;
-  field = getEventTarget(e);
+  field = Event.element(e);
 
   // Update the model on the client
   var attrs = new Object();
@@ -221,7 +221,7 @@
 
 // Edit the element.
 function edit_widget_area(evt) {
-  var elem = getEventTarget(evt);
+  var elem = Event.element(evt);
 
   // ignore inactive elements
   if (is_inactive(elem)) return;
@@ -241,7 +241,7 @@
 
 // Select another new widget
 function select_widget(evt) {
-  var elem = getEventTarget(evt);
+  var elem = Event.element(evt);
   create_preview(elem.value);
 }
 

Modified: 
cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.pt 
(original)
+++ cpsskins/branches/jmo-perspectives/ui/default/filters/style/style_editor.pt 
Sat Dec 17 14:43:21 2005
@@ -8,6 +8,8 @@
     </tal:style>
     <tal:script metal:fill-slot="script">
       <script type="text/javascript"
+              src="/++skin++cpsskins/@@/++resource++prototype.js"></script>
+      <script type="text/javascript"
               src="/@@/jsolait/init.js"></script>
       <script type="text/javascript"
               src="/++skin++cpsskins/@@/++resource++style_editor.js"></script>

Modified: cpsskins/branches/jmo-perspectives/ui/framework/utils.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/utils.js    (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/utils.js    Sat Dec 17 
14:43:21 2005
@@ -54,21 +54,6 @@
 
 /* DOM ELEMENTS */
 
-// Return the element targeted by the event.
-function getEventTarget(evt) {
-  evt = (evt) ? evt : ((event) ? event : null);
-  if (evt) {
-    var elem = (evt.target) ? evt.target : 
-               ((evt.srcElement) ? evt.srcElement : null);
-    if (elem) {
-      elem = (elem.nodeType == 1 || elem.nodeType == 9) ? elem : 
-              elem.parentNode;
-      return elem;
-    }
-  }
-  return false;
-}
-
 // Replace the element's html
 function replaceHTML(elem, html) {
   if (elem.nodeName == "TEXTAREA" || elem.nodeName == "INPUT") {
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to