You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ta...@apache.org on 2017/12/19 09:19:28 UTC

deltaspike git commit: DELTASPIKE-1305, DELTASPIKE-1306: improved window handling on IE and avoid multiple init

Repository: deltaspike
Updated Branches:
  refs/heads/master aca68af77 -> 150924773


DELTASPIKE-1305, DELTASPIKE-1306: improved window handling on IE and avoid multiple init

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/15092477
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/15092477
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/15092477

Branch: refs/heads/master
Commit: 1509247730cbe639bdf51e0d886823f7bba90cf5
Parents: aca68af
Author: Thomas Andraschko <ta...@apache.org>
Authored: Tue Dec 19 10:18:30 2017 +0100
Committer: Thomas Andraschko <ta...@apache.org>
Committed: Tue Dec 19 10:19:21 2017 +0100

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js       | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/15092477/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index a543b73..2498775 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -22,6 +22,7 @@ window.dswh = window.dswh || {
     TEMP_WINDOW_NAME : 'tempWindowId',
     MANAGED_WINDOW_NAME_PREFIX : 'ds-',
 
+    initialized: false,
     windowId : null,
     clientWindowRenderMode : null,
     maxWindowIdLength : 10,
@@ -29,6 +30,13 @@ window.dswh = window.dswh || {
 
     init : function(windowId, clientWindowRenderMode, maxWindowIdLength, cfg) {
 
+        if (dswh.initialized === true)
+        {
+            return;
+        }
+
+        dswh.initialized = true;
+
         dswh.utils.log('------- DeltaSpike windowhandler.js -------');
         dswh.utils.log('--- #init(\'' + windowId + '\', \'' + clientWindowRenderMode + '\',' + maxWindowIdLength + ',' + dswh.utils.stringify(cfg) + ')');
         dswh.utils.log('window.name: ' + window.name);
@@ -131,9 +139,9 @@ window.dswh = window.dswh || {
                                 link.onclick = function(evt) {
                                     // IE handling added
                                     evt = evt || window.event;
-                                    
+
                                     // skip open in new tab
-                                    if (!evt.ctrlKey) {                                    
+                                    if (!evt.ctrlKey) {
                                         if (storeWindowTreeEnabled) {
                                             dswh.strategy.CLIENTWINDOW.storeWindowTree();
                                         }
@@ -158,9 +166,9 @@ window.dswh = window.dswh || {
 
                                             var proceed = oldonclick.bind(this)(evt);
                                             if (typeof proceed === 'undefined' || proceed === true) {
-                                                
+
                                                 // skip open in new tab
-                                                if (!evt.ctrlKey) { 
+                                                if (!evt.ctrlKey) {
                                                     if (storeWindowTreeEnabled) {
                                                         dswh.strategy.CLIENTWINDOW.storeWindowTree();
                                                     }
@@ -438,8 +446,12 @@ window.dswh = window.dswh || {
         requestNewWindowId : function() {
             // set temp window name to remember the current state
             dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);
+
             // we remove the dswid if available and redirect to the same url again to create a new windowId
             window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', null);
+
+            // set temp window name to remember the current state (again - sometimes required for IE!?)
+            dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);
         },
 
         isHtml5 : function() {