[Erp5-report] r36122 nicolas.dumazet - /erp5/trunk/products/ERP5Form/dtml/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 9 09:01:10 CEST 2010


Author: nicolas.dumazet
Date: Wed Jun  9 09:01:10 2010
New Revision: 36122

URL: http://svn.erp5.org?rev=36122&view=rev
Log:
toggle all children of a delegated node

This fixes display of DateTime fields, that have several inputs.

Modified:
    erp5/trunk/products/ERP5Form/dtml/proxyFieldEdit.dtml
    erp5/trunk/products/ERP5Form/dtml/proxyFieldTales.dtml

Modified: erp5/trunk/products/ERP5Form/dtml/proxyFieldEdit.dtml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/dtml/proxyFieldEdit.dtml?rev=36122&r1=36121&r2=36122&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/dtml/proxyFieldEdit.dtml [utf8] (original)
+++ erp5/trunk/products/ERP5Form/dtml/proxyFieldEdit.dtml [utf8] Wed Jun  9 09:01:10 2010
@@ -160,13 +160,16 @@
 
 var class_deletaged_list = GetElementsWithClassName('td','delegated');
 for(var i=0; i<class_deletaged_list.length; i++) {
-  element = class_deletaged_list[i].childNodes[1];
-  if (element.type == 'hidden'){
-    element = element.nextSibling;
-  }
-  element.readOnly = true;
-  if (element.type == 'checkbox'){
-    element.onclick = ignoreEvent;
+  var disable_children = class_deletaged_list[i].childNodes;
+  for (var j=0; j<disable_children.length; j++) {
+    var element = disable_children[j];
+    if (element.type == 'hidden'){
+      continue;
+    }
+    element.readOnly = true;
+    if (element.type == 'checkbox'){
+      element.onclick = ignoreEvent;
+    }
   }
 }
 
@@ -177,20 +180,23 @@
   allElements = tr_parent.childNodes;
   for (i=0; i<allElements.length; i++) {
     if (isClass(allElements[i], 'to_disable')) {
-      field = allElements[i].childNodes[1];
-      if (field.type == 'hidden'){
-        field = field.nextSibling;
-      }
-      if (field.readOnly){
-        field.readOnly = false;
-        if (field.type == 'checkbox'){
-          field.onclick = normalEvent;
-        }
-      }
-      else{
-        field.readOnly = true;
-        if (field.type == 'checkbox'){
-          field.onclick = ignoreEvent;
+      var disable_children = allElements[i].childNodes;
+      for (var j=0; j<disable_children.length; j++) {
+        var field = disable_children[j];
+        if (field.type == 'hidden'){
+          continue;
+        }
+        if (field.readOnly){
+          field.readOnly = false;
+          if (field.type == 'checkbox'){
+            field.onclick = normalEvent;
+          }
+        }
+        else{
+          field.readOnly = true;
+          if (field.type == 'checkbox'){
+            field.onclick = ignoreEvent;
+          }
         }
       }
     }

Modified: erp5/trunk/products/ERP5Form/dtml/proxyFieldTales.dtml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/dtml/proxyFieldTales.dtml?rev=36122&r1=36121&r2=36122&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/dtml/proxyFieldTales.dtml [utf8] (original)
+++ erp5/trunk/products/ERP5Form/dtml/proxyFieldTales.dtml [utf8] Wed Jun  9 09:01:10 2010
@@ -160,13 +160,16 @@
 
 var class_deletaged_list = GetElementsWithClassName('td','delegated');
 for(var i=0; i<class_deletaged_list.length; i++) {
-  element = class_deletaged_list[i].childNodes[1];
-  if (element.type == 'hidden'){
-    element = element.nextSibling;
-  }
-  element.readOnly = true;
-  if (element.type == 'checkbox'){
-    element.onclick = ignoreEvent;
+  var disable_children = class_deletaged_list[i].childNodes;
+  for (var j=0; j<disable_children.length; j++) {
+    var element = disable_children[j];
+    if (element.type == 'hidden'){
+      continue;
+    }
+    element.readOnly = true;
+    if (element.type == 'checkbox'){
+      element.onclick = ignoreEvent;
+    }
   }
 }
 
@@ -177,20 +180,23 @@
   allElements = tr_parent.childNodes;
   for (i=0; i<allElements.length; i++) {
     if (isClass(allElements[i], 'to_disable')) {
-      field = allElements[i].childNodes[1];
-      if (field.type == 'hidden'){
-        field = field.nextSibling;
-      }
-      if (field.readOnly){
-        field.readOnly = false;
-        if (field.type == 'checkbox'){
-          field.onclick = normalEvent;
-        }
-      }
-      else{
-        field.readOnly = true;
-        if (field.type == 'checkbox'){
-          field.onclick = ignoreEvent;
+      var disable_children = allElements[i].childNodes;
+      for (var j=0; j<disable_children.length; j++) {
+        var field = disable_children[j];
+        if (field.type == 'hidden'){
+          continue;
+        }
+        if (field.readOnly){
+          field.readOnly = false;
+          if (field.type == 'checkbox'){
+            field.onclick = normalEvent;
+          }
+        }
+        else{
+          field.readOnly = true;
+          if (field.type == 'checkbox'){
+            field.onclick = ignoreEvent;
+          }
         }
       }
     }




More information about the Erp5-report mailing list