You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mc...@apache.org on 2007/10/02 03:00:32 UTC

svn commit: r581120 - /myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js

Author: mcooper
Date: Mon Oct  1 18:00:29 2007
New Revision: 581120

URL: http://svn.apache.org/viewvc?rev=581120&view=rev
Log:
TRINIDAD-749 Launching modal dialog when the launcher window body has position:absolute in IE makes launcher page look corrupt

Removed the code where in IE and launching a modal dialog, the opacity of the body element was being changed.  Instead, created a new DIV that appears on top of the page content that is white and 50% opaque to achieve the same visual result.

Now, whenever there are other semi-opaque elements on the page and if the body uses absolute positioning, those semi-opaque elements will be drawn correctly--no incorrectly masked areas and thus a non-corrupt appearance.

Modified:
    myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js

Modified: myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js?rev=581120&r1=581119&r2=581120&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js (original)
+++ myfaces/trinidad/branches/1.2.2-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js Mon Oct  1 18:00:29 2007
@@ -260,15 +260,43 @@
     var atMostIE4 = _agent.atMost("ie", 4.99);
     var alphaFilter = false;
 
-    // body of the aprent window
-    var parentBody = parentWindow.document.body;
+    // document of the parent window
+    var parentDoc = parentWindow.document;
+
+    // body of the parent window
+    var parentBody = parentDoc.body;
 
     if (isModal && !atMostIE4)
     {
       if (_agent.atLeast("ie", 4))
       {
-        parentBody.style.filter = "alpha(opacity=50)";
-        alphaFilter = true;
+        var dimmer = parentDoc.getElementById("_trDialogDimmer");
+        if (dimmer == null)
+        {
+          // Display a div over the browser viewport that will give the entire page the appearance
+          // of being disabled:
+          dimmer = parentDoc.createElement("div");
+          dimmer.id = "_trDialogDimmer";
+          var dimmerStyle = dimmer.style;
+          dimmerStyle.position = "absolute";
+          dimmerStyle.zIndex = "32000";
+          dimmerStyle.backgroundColor = "#FFFFFF";
+          dimmerStyle.filter = "alpha(opacity=50)";
+
+          // Position the dimmer element, account for scrolling:
+          var docElement = parentDoc.documentElement;
+          var width = Math.max(docElement.offsetWidth, docElement.scrollWidth);
+          var height = Math.max(docElement.offsetHeight, docElement.scrollHeight);
+          dimmerStyle.width = width + "px";
+          dimmerStyle.height = height + "px";
+          dimmerStyle.top = "0px";
+          dimmerStyle.left = "0px";
+
+          // Add the dimmer element to the body:
+          parentBody.appendChild(dimmer);
+
+          alphaFilter = true;
+        }
       }
 
       // Capture mouse events.  Note: we special-case IE/Windows,
@@ -488,9 +516,16 @@
   {
     if (effect == 'alpha')
     {
-      // No modal dependent - clear out the alpha filter and
-      // don't bother rescheduling.
-      self.document.body.style.filter = null;
+      // No modal dependent - clear out the alpha filter and don't bother rescheduling.
+
+      // Locate the dialog dimmer element:
+      var dimmerDoc = self.document;
+      var dimmer = dimmerDoc.getElementById("_trDialogDimmer");
+      if (dimmer != null)
+      {
+        // Remove the dimmer div that covers the browser viewport:
+        dimmerDoc.body.removeChild(dimmer);
+      }
     }
   }
 }