details:   https://code.openbravo.com/erp/devel/pi/rev/d9063574a9ef
changeset: 16448:d9063574a9ef
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Tue May 08 19:15:57 2012 +0200
summary:   Related to issue 20207: Updated classic functions to proper HTML5 
operation

diffstat:

 web/js/genericTree.js    |   2 +-
 web/js/menuKeyboard.js   |   2 +-
 web/js/utils.js          |  50 ++++++++++++++++++++++++++++-------------------
 web/js/windowKeyboard.js |   2 +-
 4 files changed, 33 insertions(+), 23 deletions(-)

diffs (184 lines):

diff -r 8f9bfd7b3d7f -r d9063574a9ef web/js/genericTree.js
--- a/web/js/genericTree.js     Mon May 07 17:15:04 2012 +0200
+++ b/web/js/genericTree.js     Tue May 08 19:15:57 2012 +0200
@@ -421,7 +421,7 @@
     if (typeof node != "undefined") {
       var nodeId = node.getAttribute('id').replace('node_','');
       if (document.getElementById('inpNodes_' + nodeId)) {
-        if (isClick == true && 
navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
+        if (isClick == true && 
navigator.userAgent.toUpperCase().indexOf("MSIE") != -1 && !isIE8Strict) {
           gt_setActiveUninstall('buttonUninstall');
           gt_setActiveUninstall('buttonDisable');
         } else if (isClick == true) {
diff -r 8f9bfd7b3d7f -r d9063574a9ef web/js/menuKeyboard.js
--- a/web/js/menuKeyboard.js    Mon May 07 17:15:04 2012 +0200
+++ b/web/js/menuKeyboard.js    Tue May 08 19:15:57 2012 +0200
@@ -55,7 +55,7 @@
 }
 
 function changeState(evt, element) {
-  if (window.navigator.appName.indexOf("Microsoft")!=-1) onFocusMenu();
+  if (window.navigator.userAgent.indexOf("MSIE")!=-1) onFocusMenu();
   if(element == null) {
     element = (!document.all) ? evt.target : event.srcElement;
   } else if (evt == null) {
diff -r 8f9bfd7b3d7f -r d9063574a9ef web/js/utils.js
--- a/web/js/utils.js   Mon May 07 17:15:04 2012 +0200
+++ b/web/js/utils.js   Tue May 08 19:15:57 2012 +0200
@@ -33,8 +33,12 @@
   if (isWindowInMDIPage) {
     adaptSkinToMDIEnvironment();
   }
-}
-
+  if (getBrowserInfo('documentMode') >= 8) {
+    isIE8Strict = true;
+  }
+}
+
+var isIE8Strict = false;
 var isWindowInMDIPopup = false;
 var isWindowInMDITab = false;
 var isWindowInMDIPage = false;
@@ -175,6 +179,12 @@
     return browserMajorVersion;
   } else if (param == "nameAndVersion" || typeof param == "undefined" || param 
== "" || param == null) {
     return browserNameAndVersion;
+  } else if (param == "documentMode") {
+    if (document.documentMode) {
+      return document.documentMode;
+    } else {
+      return null;
+    }
   } else {
     return false;
   }
@@ -203,7 +213,7 @@
 function getObjAttribute(obj, attribute) {
   attribute = attribute.toLowerCase();
   var attribute_text = "";
-  if (navigator.userAgent.toUpperCase().indexOf("MSIE") == -1) {
+  if (navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 || isIE8Strict) {
     attribute_text = obj.getAttribute(attribute);
   } else {
     attribute_text = obj.getAttribute(attribute).toString();
@@ -221,7 +231,7 @@
   attribute = attribute.toLowerCase();
   attribute_text = attribute_text.toString();
   attribute_text = attribute_text.replace(/^(\s|\&nbsp;)*|(\s|\&nbsp;)*$/g,"");
-  if (navigator.userAgent.toUpperCase().indexOf("MSIE") == -1) {
+  if (navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 || isIE8Strict) {
     obj.setAttribute(attribute, attribute_text);
   } else {
     obj[attribute]=new Function(attribute_text);
@@ -236,7 +246,7 @@
 function getElementsByName(name, tag) {
   var resultArray = [];
   if (!tag || tag == "" || tag == null || typeof tag == "undefined") {
-    if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
+    if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1 && 
!isIE8Strict) {
       var inputs = document.all;
       for (var i=0; i<inputs.length; i++){
         if (inputs.item(i).getAttribute('name') == name){
@@ -266,13 +276,13 @@
 */
 function getElementsByClassName(className, tag) {
   var resultArray = [], classAttributeName;
-  if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1) {
+  if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1 && 
!isIE8Strict) {
     classAttributeName = 'className';
   } else {
     classAttributeName = 'class';
   }
   if (!tag) {
-    if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1) {
+    if (navigator.userAgent.toUpperCase().indexOf('MSIE') !== -1 && 
!isIE8Strict) {
       var inputs = document.all;
       for (var i=0; i<inputs.length; i++) {
         if (inputs.item(i).getAttribute(classAttributeName) === className){
@@ -4451,15 +4461,15 @@
   var body = document.getElementsByTagName("BODY");
   var h = body[0].clientHeight;
   var w = body[0].clientWidth;
-  var name = window.navigator.appName;
-  var mnuWidth = w - ((mleft?mleft.clientWidth:0) + 
(mleftSeparator?mleftSeparator.clientWidth:0) + (mright?mright.clientWidth:0)) 
- ((name.indexOf("Microsoft")==-1)?2:0);
-  var mnuHeight = h -((mtop?mtop.clientHeight:0) + 
(mtopToolbar?mtopToolbar.clientHeight:0) + (mtopTabs?mtopTabs.clientHeight:0) + 
(mbottom?mbottom.clientHeight:0) + (mbottombut?mbottombut.clientHeight:0)) - 
((name.indexOf("Microsoft")==-1)?1:0);
+  var name = window.navigator.userAgent;
+  var mnuWidth = w - ((mleft?mleft.clientWidth:0) + 
(mleftSeparator?mleftSeparator.clientWidth:0) + (mright?mright.clientWidth:0)) 
- ((name.indexOf("MSIE")==-1)?2:0);
+  var mnuHeight = h -((mtop?mtop.clientHeight:0) + 
(mtopToolbar?mtopToolbar.clientHeight:0) + (mtopTabs?mtopTabs.clientHeight:0) + 
(mbottom?mbottom.clientHeight:0) + (mbottombut?mbottombut.clientHeight:0)) - 
((name.indexOf("MSIE")==-1)?1:0);
   if (mnuWidth < 0) { mnuWidth = 0; }
   if (mnuHeight < 0) { mnuHeight = 0; }
   mnu.style.width = mnuWidth;
   mnu.style.height = mnuHeight;
   var mbottomButtons = document.getElementById("tdbottomButtons");
-  if (mbottomButtons) mbottomButtons.style.width = w - 
((mleft?mleft.clientWidth:0) + (mleftSeparator?mleftSeparator.clientWidth:0) + 
(mright?mright.clientWidth:0)) - ((name.indexOf("Microsoft")==-1)?2:0);
+  if (mbottomButtons) mbottomButtons.style.width = w - 
((mleft?mleft.clientWidth:0) + (mleftSeparator?mleftSeparator.clientWidth:0) + 
(mright?mright.clientWidth:0)) - ((name.indexOf("MSIE")==-1)?2:0);
 
 /*  try {
     dojo.addOnLoad(dijit.byId('grid').onResize);
@@ -4481,8 +4491,8 @@
   var body = document.getElementsByTagName("BODY");
   var h = body[0].clientHeight;
   var w = body[0].clientWidth;
-  var name = window.navigator.appName;
-//  var mnuWidth = w - 18 - ((name.indexOf("Microsoft")==-1)?2:0);
+  var name = window.navigator.userAgent;
+//  var mnuWidth = w - 18 - ((name.indexOf("MSIE")==-1)?2:0);
   var mnuHeight =  h -(mTopSeparator.clientHeight + 
mTopNavigation.clientHeight) - 2;
 //  if (mnuWidth < 0) { mnuWidth = 0; }
   if (mnuHeight < 0) { mnuHeight = 0; }
@@ -4506,8 +4516,8 @@
   var body = document.getElementsByTagName("BODY");
   var h = body[0].clientHeight;
   var w = body[0].clientWidth;
-  var name = window.navigator.appName;
-//  mnu.style.width = w - 18 - ((name.indexOf("Microsoft")==-1)?2:0);
+  var name = window.navigator.userAgent;
+//  mnu.style.width = w - 18 - ((name.indexOf("MSIE")==-1)?2:0);
   mnu.style.height = h -(mTopSeparator.clientHeight + 
mTopNavigation.clientHeight) - 2;
   mnuIndex.style.height = mnu.style.height;
 
@@ -4530,9 +4540,9 @@
   var body = document.getElementsByTagName("BODY");
   var h = body[0].clientHeight;
   var w = body[0].clientWidth;
-  var name = window.navigator.appName;
+  var name = window.navigator.userAgent;
   var client_middleWidth = w;
-  var client_middleHeight = h -((table_header?table_header.clientHeight:0) + 
(client_top?client_top.clientHeight:0) + 
(client_bottom?client_bottom.clientHeight:0)) - 
((name.indexOf("Microsoft")==-1)?1:0);
+  var client_middleHeight = h -((table_header?table_header.clientHeight:0) + 
(client_top?client_top.clientHeight:0) + 
(client_bottom?client_bottom.clientHeight:0)) - 
((name.indexOf("MSIE")==-1)?1:0);
   if (client_middleWidth < 0) { client_middleWidth = 0; }
   if (client_middleHeight < 170) { client_middleHeight = 170; } // To avoid 
middle area (usually a grid) disappear completly in small windows.
   client_middle.style.height = client_middleHeight;
@@ -4564,7 +4574,7 @@
   var w = body[0].clientWidth;
   var name = window.navigator.appName;
   var client_middleWidth = w - 0;
-  var client_middleHeight = h -((table_header?table_header.clientHeight:0) + 
(client_messagebox?client_messagebox.clientHeight:0) + 
(client_top?client_top.clientHeight:0) + 
(client_bottom?client_bottom.clientHeight:0)) - 
((name.indexOf("Microsoft")==-1)?1:1);
+  var client_middleHeight = h -((table_header?table_header.clientHeight:0) + 
(client_messagebox?client_messagebox.clientHeight:0) + 
(client_top?client_top.clientHeight:0) + 
(client_bottom?client_bottom.clientHeight:0)) - 
((name.indexOf("MSIE")==-1)?1:1);
   if (client_middleWidth < 0) { client_middleWidth = 0; }
   if (client_middleHeight < 80) { client_middleHeight = 80; } // To avoid 
middle area (usually a grid) disappear completly in small windows.
   client_middle.style.height = client_middleHeight;
@@ -4584,8 +4594,8 @@
   var client = document.getElementById("client");
   var client_top = document.getElementById("client_top");
   var installationHistoryGrid = 
document.getElementById("installationHistoryGrid");
-  var name = window.navigator.appName;
-  installationHistoryGrid.style.height = client.clientHeight 
-((client_top?client_top.clientHeight:0) -((name.indexOf("Microsoft")==-1)?1:0) 
+ 8);
+  var name = window.navigator.userAgent;
+  installationHistoryGrid.style.height = client.clientHeight 
-((client_top?client_top.clientHeight:0) -((name.indexOf("MSIE")==-1)?1:0) + 8);
 
 /*  try {
     dojo.addOnLoad(dijit.byId('grid').onResize);
diff -r 8f9bfd7b3d7f -r d9063574a9ef web/js/windowKeyboard.js
--- a/web/js/windowKeyboard.js  Mon May 07 17:15:04 2012 +0200
+++ b/web/js/windowKeyboard.js  Tue May 08 19:15:57 2012 +0200
@@ -461,7 +461,7 @@
       }
       isFirstTime = false;
     } else if (obj.tagName == 'SELECT') {
-      if (navigator.appName.toUpperCase().indexOf('MICROSOFT') == -1) {
+      if (navigator.userAgent.toUpperCase().indexOf('MSIE') == -1) {
         if (obj.className.indexOf(' Combo_focus') == -1) {
           obj.className = obj.className.replace('Login_Combo', 
'Login_Combo_focus');
           obj.className = obj.className + ' Combo_focus';

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to