details:   /erp/devel/pi/rev/c74c3267b3d6
changeset: 6494:c74c3267b3d6
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu Feb 25 22:17:51 2010 +0100
summary:   Related to issue 12479: Added getFrame('main') to get the global _FS 
from any position

diffstat:

 src/org/openbravo/erpCommon/security/Login_F1.html |   2 +-
 web/js/appStatus.js                                |  20 ++++++-----
 web/js/utils.js                                    |  37 +++++++++++++++++++--
 3 files changed, 44 insertions(+), 15 deletions(-)

diffs (104 lines):

diff -r caf8b663e118 -r c74c3267b3d6 
src/org/openbravo/erpCommon/security/Login_F1.html
--- a/src/org/openbravo/erpCommon/security/Login_F1.html        Thu Feb 25 
19:05:35 2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html        Thu Feb 25 
22:17:51 2010 +0100
@@ -78,7 +78,7 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('6490')) || (isOpsInstance() != 
isOpsInstanceCached())) {
+    if ((!revisionControl('6494')) || (isOpsInstance() != 
isOpsInstanceCached())) {
       alert("Your browser's cache has outdated files. Please clean it and 
reload the page.");
     }
 
diff -r caf8b663e118 -r c74c3267b3d6 web/js/appStatus.js
--- a/web/js/appStatus.js       Thu Feb 25 19:05:35 2010 +0100
+++ b/web/js/appStatus.js       Thu Feb 25 22:17:51 2010 +0100
@@ -275,22 +275,24 @@
 }
 
 function setMenuLoading(value) {
-  var frame = top.document;
-  var frameset = frame.getElementById("framesetMenu");
-  if (!frameset) 
+  var frameContainer = getFrame('main');
+  var framesetMenu = frameContainer.document.getElementById("framesetMenu");
+  var isRTL = frameContainer.isRTL;
+  var menuWidth = frameContainer.menuWidth;
+  if (!framesetMenu)
     return false;
   try {
     if (value == true) {
-      if (top.isRTL == true) {
-        frameset.cols = "*,0%," + top.menuWidth;
+      if (isRTL == true) {
+        framesetMenu.cols = "*,0%," + menuWidth;
       } else {
-        frameset.cols = top.menuWidth + ",0%,*";
+        framesetMenu.cols = menuWidth + ",0%,*";
       }
     } else if (value == false) {
-      if (top.isRTL == true) {
-        frameset.cols = "*," + top.menuWidth + ",0%";
+      if (isRTL == true) {
+        framesetMenu.cols = "*," + menuWidth + ",0%";
       } else {
-        frameset.cols = "0%," + top.menuWidth + ",*";
+        framesetMenu.cols = "0%," + menuWidth + ",*";
       }
     }
   }
diff -r caf8b663e118 -r c74c3267b3d6 web/js/utils.js
--- a/web/js/utils.js   Thu Feb 25 19:05:35 2010 +0100
+++ b/web/js/utils.js   Thu Feb 25 22:17:51 2010 +0100
@@ -72,7 +72,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 = '6490';
+  var number = '6494';
   return number;
 }
 
@@ -2928,11 +2928,38 @@
  * @returns null if not find it, or a reference to the frame DOM element
  */
 function getFrame(frameName) {
-  var op = top.opener;
-  if(op == null) {
-    return top.frames[frameName];
+  var targetFrame;
+  if (frameName == 'main') {
+    targetFrame = 'window';
+    var targetFrame_parent = 'window.parent';
+    var targetFrame_opener = 'window.opener';
+    var securityEscape = 0;
+    var securityEscapeLimit = 50;
+
+    while (eval(targetFrame) !== eval(targetFrame_opener)) {
+      while (eval(targetFrame) !== eval(targetFrame_parent)) {
+        if (eval(targetFrame).document.getElementById('paramFrameMenuLoading') 
|| securityEscape > securityEscapeLimit) { //paramFrameMenuLoading is an 
existing Login_FS.html ID to check if we are aiming at this html
+          break;
+        }
+        targetFrame = targetFrame + '.parent';
+        targetFrame_parent = targetFrame + '.parent';
+        securityEscape = securityEscape + 1;
+      }
+      if (eval(targetFrame).document.getElementById('paramFrameMenuLoading') 
|| securityEscape > securityEscapeLimit) { //paramFrameMenuLoading is an 
existing Login_FS.html ID to check if we are aiming at this html
+        break;
+      }
+      targetFrame = targetFrame + '.opener';
+      targetFrame_opener = targetFrame + '.opener';
+      securityEscape = securityEscape + 1;
+      if (typeof eval(targetFrame) === 'undefined' || eval(targetFrame) === 
null || eval(targetFrame) === 'null' || eval(targetFrame) === '') {
+        break;
+      }
+    }
+    targetFrame = eval(targetFrame);
+  } else {
+    targetFrame = getFrame('main').frames[frameName];
   }
-  return op.top.frames[frameName];     
+  return targetFrame;
 }
 
 /**

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to