Fixed bug 9297 9035: Now readonly value is properly set in IE while executing callouts
authorDavid Baz Fayos <david.baz@openbravo.com>
Tue, 02 Jun 2009 20:07:55 +0200
changeset 3954 2218dcf0b480
parent 3953 d2186c00f52e
child 3955 bf55034d6c62
Fixed bug 9297 9035: Now readonly value is properly set in IE while executing callouts
src/org/openbravo/erpCommon/security/Login_F1.html
web/js/utils.js
--- a/src/org/openbravo/erpCommon/security/Login_F1.html	Tue Jun 02 18:20:04 2009 +0200
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html	Tue Jun 02 20:07:55 2009 +0200
@@ -76,7 +76,7 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if (!revisionControl('3924')) alert("Your browser's cache has outdated files. Please clean it and reload the page.");
+    if (!revisionControl('3954')) alert("Your browser's cache has outdated files. Please clean it and reload the page.");
   }
 
   function onResizeDo() {
--- a/web/js/utils.js	Tue Jun 02 18:20:04 2009 +0200
+++ b/web/js/utils.js	Tue Jun 02 20:07:55 2009 +0200
@@ -62,7 +62,7 @@
 * Return a number that would be checked at the Login screen to know if the file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '3924';
+  var number = '3954';
   return number;
 }
 
@@ -2609,11 +2609,12 @@
     }
     var obj = eval("document." + form.name + "." + ElementName + ";");
     if (obj==null || !obj || !obj.type) return false;
-    if (obj.getAttribute("readonly")=="true" || obj.readOnly || obj.getAttribute("readonly")=="") bolReadOnly=true;
+    if (obj.getAttribute("readonly")=="true" || obj.readOnly || (obj.getAttribute("readonly")=="" && navigator.userAgent.toUpperCase().indexOf("MSIE") == -1)) bolReadOnly=true;
     if (bolReadOnly) {
       if (obj.getAttribute("onChange")) {
         onChangeFunction = obj.getAttribute("onChange").toString();
         onChangeFunction = onChangeFunction.replace("function anonymous()\n","");
+        onChangeFunction = onChangeFunction.replace("function onchange()\n","");
         onChangeFunction = onChangeFunction.replace("{\n","");
         onChangeFunction = onChangeFunction.replace("\n}","");
       } else {
@@ -2727,38 +2728,40 @@
       var bolReadOnly = false;
       if (obj.onchange!=null && obj.onchange.toString().indexOf(calloutName)==-1) {
         if (obj.onchange.toString().indexOf("callout")!=-1 || obj.onchange.toString().indexOf("reload")!=-1) isReload=true;
-        if (obj.getAttribute("readonly")=="true" || obj.readOnly==true || obj.getAttribute("readonly")=="") {
+        if (obj.getAttribute("readonly")=="true" || obj.readOnly==true || (obj.getAttribute("readonly")=="" && navigator.userAgent.toUpperCase().indexOf("MSIE") == -1)) {
           bolReadOnly=true;
           obj.readOnly = false;
         }
 
-      if (obj.className.indexOf("Combo")!=-1) {
-        if (obj.getAttribute("onChange")) {
-          var onchange_combo = obj.getAttribute("onChange").toString();
-          onchange_combo = onchange_combo.replace("function anonymous()\n","");
-          onchange_combo = onchange_combo.replace("{\n","");
-          onchange_combo = onchange_combo.replace("\n}","");
+        if (obj.className.indexOf("Combo")!=-1) {
+          if (obj.getAttribute("onChange")) {
+            var onchange_combo = obj.getAttribute("onChange").toString();
+            onchange_combo = onchange_combo.replace("function anonymous()\n","");
+            onchange_combo = onchange_combo.replace("function onchange()\n","");
+            onchange_combo = onchange_combo.replace("{\n","");
+            onchange_combo = onchange_combo.replace("\n}","");
+          } else {
+            var onchange_combo = "";
+          }
+          if (onchange_combo.indexOf("selectCombo")!=-1) {
+            onchange_combo = onchange_combo.substring(0,onchange_combo.indexOf("selectCombo"))+onchange_combo.substring(onchange_combo.indexOf(";",onchange_combo.indexOf("selectCombo"))+1, onchange_combo.length);
+            var onchange_combo2 = onchange_combo;
+            onchange_combo = onchange_combo.substring(0,onchange_combo.indexOf("return"))+onchange_combo.substring(onchange_combo.indexOf(";",onchange_combo.indexOf("return"))+1, onchange_combo.length);
+            onchange_combo = onchange_combo.replace("(this)","(obj)");
+            onchange_combo = onchange_combo.replace("(this,","(obj,");
+            onchange_combo = onchange_combo.replace("(this ","(obj ");
+            onchange_combo = onchange_combo.replace(",this)",",obj)");
+            onchange_combo = onchange_combo.replace(" this)"," obj)");
+            eval(onchange_combo);
+            obj.setAttribute("onChange", "selectCombo(this, '" + obj.value + "');" + onchange_combo2);
+          } else {
+            obj.onchange();
+          }
         } else {
-          var onchange_combo = "";
+          if (obj.getAttribute('onchange') != '' && obj.getAttribute('onchange') != null && obj.getAttribute('onchange') != 'null') {
+            obj.onchange();
+          }
         }
-        if (onchange_combo.indexOf("selectCombo")!=-1) {
-          onchange_combo = onchange_combo.substring(0,onchange_combo.indexOf("selectCombo"))+onchange_combo.substring(onchange_combo.indexOf(";",onchange_combo.indexOf("selectCombo"))+1, onchange_combo.length);
-          var onchange_combo2 = onchange_combo;
-          onchange_combo = onchange_combo.substring(0,onchange_combo.indexOf("return"))+onchange_combo.substring(onchange_combo.indexOf(";",onchange_combo.indexOf("return"))+1, onchange_combo.length);
-          onchange_combo = onchange_combo.replace("(this)","(obj)");
-          onchange_combo = onchange_combo.replace("(this,","(obj,");
-          onchange_combo = onchange_combo.replace("(this ","(obj ");
-          onchange_combo = onchange_combo.replace(",this)",",obj)");
-          onchange_combo = onchange_combo.replace(" this)"," obj)");
-          eval(onchange_combo);
-          obj.setAttribute("onChange", "selectCombo(this, '"+obj.value+"');"+onchange_combo2);
-        } else obj.onchange();
-      } else {
-        if (obj.getAttribute('onchange') != '' && obj.getAttribute('onchange') != null && obj.getAttribute('onchange') != 'null') {
-          obj.onchange();
-        }
-      }
-
         if (bolReadOnly) obj.readOnly = true;
       }
     }
@@ -3010,6 +3013,7 @@
       if (obj.getAttribute("onChange")) {
         onchange_combo = obj.getAttribute("onChange").toString();
         onchange_combo = onchange_combo.replace("function anonymous()\n","");
+        onchange_combo = onchange_combo.replace("function onchange()\n","");
         onchange_combo = onchange_combo.replace("{\n","");
         onchange_combo = onchange_combo.replace("\n}","");
       } else {
@@ -3022,6 +3026,7 @@
       if (obj.getAttribute("onChange")) {
         onchange_combo = obj.getAttribute("onChange").toString();
         onchange_combo = onchange_combo.replace("function anonymous()\n","");
+        onchange_combo = onchange_combo.replace("function onchange()\n","");
         onchange_combo = onchange_combo.replace("{\n","");
         onchange_combo = onchange_combo.replace("\n}","");
       } else {
@@ -3042,6 +3047,7 @@
       if (obj.getAttribute("onChange")) {
         onchange_combo = obj.getAttribute("onChange").toString();
         onchange_combo = onchange_combo.replace("function anonymous()\n","");
+        onchange_combo = onchange_combo.replace("function onchange()\n","");
         onchange_combo = onchange_combo.replace("{\n","");
         onchange_combo = onchange_combo.replace("\n}","");
       } else {