You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2011/11/24 10:30:14 UTC

svn commit: r1205765 - in /myfaces/extensions/cdi/trunk: examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/ jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ jee-mod...

Author: struberg
Date: Thu Nov 24 09:30:13 2011
New Revision: 1205765

URL: http://svn.apache.org/viewvc?rev=1205765&view=rev
Log:
EXTCDI-242 properly add windowId param 

properly handle the windowId GET param
and prevent user from clicking the intermediate page

Modified:
    myfaces/extensions/cdi/trunk/examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/windowhandler.js
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html

Modified: myfaces/extensions/cdi/trunk/examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/windowhandler.js
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/windowhandler.js?rev=1205765&r1=1205764&r2=1205765&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/windowhandler.js (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-playground/clientside_windowhandler_jsf20/src/main/resources/META-INF/resources/js/windowhandler.js Thu Nov 24 09:30:13 2011
@@ -61,6 +61,10 @@ function storeWindowTree()
     //X TODO: store ALL attributes of the body tag
     localStorage.setItem(window.name + '_bodyAttrs', body.getAttribute("class"));
 
+    // store x and y scroll positions
+    localStorage.setItem(window.name + '_x', window.pageXOffset);
+    localStorage.setItem(window.name + '_y', window.pageYOffset);
+
     return true;
 }
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java?rev=1205765&r1=1205764&r2=1205765&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java Thu Nov 24 09:30:13 2011
@@ -160,7 +160,9 @@ public abstract class ConversationUtils
             id = tryToRestoreWindowIdFromRequestParameterMap(requestParameterSupported, requestParameterMap);
         }
 
-        if(id != null && id.length() > 0 && !cacheWindowId(externalContext, id, allowUnknownWindowIds))
+        if(id != null && id.length() > 0 &&
+           (!cacheWindowId(externalContext, id, allowUnknownWindowIds) ||
+            WindowContextManager.AUTOMATED_ENTRY_POINT_PARAMETER_KEY.equals(id)))
         {
             id = null;
         }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html?rev=1205765&r1=1205764&r2=1205765&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/resources/static/windowhandler.html Thu Nov 24 09:30:13 2011
@@ -108,9 +108,16 @@ function replaceContent() {
 
         //X TODO should restore all attribs of the body tag
         document.body.setAttribute("class", getOldBodyAttrs());
+        document.body.setAttribute("style", " cursor: wait !important;");
 
         localStorage.removeItem(window.name + '_body');
         localStorage.removeItem(window.name + '_bodyAttrs');
+
+        // overlay the doc with an un-clickable full-size div
+        var newDiv = document.createElement("div");
+        newDiv.setAttribute("style", "position:absolute; z-index:1000; background-color:transparent; top:0; left:0; width:100%; height: 100%");
+        newDiv.setAttribute("class", "fulldiv");
+        document.body.appendChild(newDiv);
     }
     else {
         document.getElementById('message').textContent = "Loading...";
@@ -148,14 +155,24 @@ function setUrlParam(baseUrl, paramName,
     return newQuery;
 }
 
+function scrollToOldPosition() {
+    if (isHtml5()) {
+        var x = localStorage.getItem(window.name + '_x');
+        var y = localStorage.getItem(window.name + '_y');
+        window.scrollTo(x, y);
 
-replaceContent();
+        var x = localStorage.removeItem(window.name + '_x');
+        var y = localStorage.removeItem(window.name + '_y');
+    }
+}
 
+replaceContent();
 
 
 window.onload = function() {
 
     loadCss(true);
+    //X scrollToOldPosition();
 
     // this will be replaced in the phase listener
     var windowId = '$$windowIdValue$$';
@@ -186,6 +203,7 @@ window.onload = function() {
 
     var requestToken = Math.floor(Math.random()*10001);
     var newUrl = setUrlParam(window.location.href, "mfRid", requestToken);
+    newUrl = setUrlParam(newUrl, "windowId", windowId);
 
     document.cookie = requestToken + '-codiWindowId=' + windowId + expires;