details:   /erp/devel/pi/rev/6528f3ffeb0a
changeset: 8794:6528f3ffeb0a
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu Nov 04 13:13:59 2010 +0100
summary:   Improved performance of getFrame('LayoutMDI')

diffstat:

 src/org/openbravo/erpCommon/security/Login_F1.html |   2 +-
 web/js/utils.js                                    |  65 ++++++++++++---------
 2 files changed, 37 insertions(+), 30 deletions(-)

diffs (120 lines):

diff -r 64907b1ed4c4 -r 6528f3ffeb0a 
src/org/openbravo/erpCommon/security/Login_F1.html
--- a/src/org/openbravo/erpCommon/security/Login_F1.html        Thu Nov 04 
10:22:03 2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html        Thu Nov 04 
13:13:59 2010 +0100
@@ -121,7 +121,7 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('8790')) || (isOpsInstance() != 
isOpsInstanceCached())) {
+    if ((!revisionControl('8794')) || (isOpsInstance() != 
isOpsInstanceCached())) {
       alert(cacheMsg);
     }
 
diff -r 64907b1ed4c4 -r 6528f3ffeb0a web/js/utils.js
--- a/web/js/utils.js   Thu Nov 04 10:22:03 2010 +0100
+++ b/web/js/utils.js   Thu Nov 04 13:13:59 2010 +0100
@@ -50,6 +50,7 @@
 var defaultDateFormat = "%d-%m-%Y";
 
 var mainFrame_windowObj = "";
+var LayoutMDI_windowObj = "";
 
 //Days of a Month
 var daysOfMonth = [[0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],  //No 
leap year
@@ -94,7 +95,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 = '8790';
+  var number = '8794';
   return number;
 }
 
@@ -3094,7 +3095,7 @@
 function getFrame(frameName) {
   var targetFrame;
   if (frameName == 'main') {
-    if (mainFrame_windowObj !== "") {  //to avoid make the 'main' frame search 
logic several times in the same html
+    if (mainFrame_windowObj !== "") {  //to avoid go inside the 'main' frame 
search logic several times in the same html
       targetFrame = mainFrame_windowObj;
     } else {
       var success = false;
@@ -3195,38 +3196,43 @@
       targetFrame = null;
     }
   } else if (frameName === 'LayoutMDI') {
-    var mainParent = getFrame('mainParent');
-    targetFrame = null;
-    if (mainParent !== null) {
-      if (LayoutMDICheck(mainParent)) {
-        targetFrame = mainParent;
+    if (LayoutMDI_windowObj !== "") {  //to avoid go inside the 'LayoutMDI' 
frame search logic several times in the same html
+      targetFrame = LayoutMDI_windowObj;
+    } else {
+      var mainParent = getFrame('mainParent');
+      targetFrame = null;
+      if (mainParent !== null) {
+        if (LayoutMDICheck(mainParent)) {
+          targetFrame = mainParent;
+        } else {
+          targetFrame = null;
+        }
       } else {
-        targetFrame = null;
-      }
-    } else {
-      if (targetFrame === null) {  // For case of classic ob popups opened 
from a MDI tab
-        try {
-          targetFrame = top.opener;
-          while (targetFrame !== null && !LayoutMDICheck(targetFrame)) {
-            targetFrame = targetFrame.top.opener;
+        if (targetFrame === null) {  // For case of classic ob popups opened 
from a MDI tab
+          try {
+            targetFrame = top.opener;
+            while (targetFrame !== null && !LayoutMDICheck(targetFrame)) {
+              targetFrame = targetFrame.top.opener;
+            }
+          } catch (e) {
+            targetFrame = null;
           }
-        } catch (e) {
+        }
+        if (targetFrame === null) {  // For case of classic ob windows/popups 
opened inside a MDI modal popup
+          try {
+            targetFrame = parent;
+            while (targetFrame !== null && targetFrame !== targetFrame.parent 
&& !LayoutMDICheck(targetFrame)) {
+              targetFrame = targetFrame.parent;
+            }
+          } catch (e) {
+            targetFrame = null;
+          }
+        }
+        if (!LayoutMDICheck(targetFrame)) {
           targetFrame = null;
         }
       }
-      if (targetFrame === null) {  // For case of classic ob windows/popups 
opened inside a MDI modal popup
-        try {
-          targetFrame = parent;
-          while (targetFrame !== null && targetFrame !== targetFrame.parent && 
!LayoutMDICheck(targetFrame)) {
-            targetFrame = targetFrame.parent;
-          }
-        } catch (e) {
-          targetFrame = null;
-        }
-      }
-      if (!LayoutMDICheck(targetFrame)) {
-        targetFrame = null;
-      }
+      LayoutMDI_windowObj = targetFrame;
     }
   } else {
     if (getFrame('main') && getFrame('main').frames[frameName]) {
@@ -5408,6 +5414,7 @@
   if (result === true && 
       MDIPopupId !== null && 
       document.title && 
+      getFrame('LayoutMDI') && 
       getFrame('LayoutMDI').OB && 
       getFrame('LayoutMDI').OB.Layout && 
       getFrame('LayoutMDI').OB.Layout.ClassicOBCompatibility && 

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to