Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on authorization change: WMS GetCapabilities should be forced reload for IE #27

Open
bartvde opened this issue Jan 6, 2014 · 15 comments

Comments

@bartvde
Copy link

bartvde commented Jan 6, 2014

In IE the WMSSource does not reload properly due to caching when the authorizationchange event is fired.

See: https://opengeo.zendesk.com/tickets/2302

@bartvde
Copy link
Author

bartvde commented Jan 13, 2014

a possible patch could be:

diff --git a/src/script/plugins/WMSSource.js b/src/script/plugins/WMSSource.js
index 13466bb..90f5c98 100644
--- a/src/script/plugins/WMSSource.js
+++ b/src/script/plugins/WMSSource.js
@@ -217,7 +217,11 @@ gxp.plugins.WMSSource = Ext.extend(gxp.plugins.LayerSource, {
      */
     onAuthorizationChange: function() {
         if (this.store && this.url.charAt(0) === "/") {
-            this.store.reload();
+            var lastOptions = this.store.lastOptions;
+            Ext.apply(lastOptions.params, {
+                '_dc': Math.random()
+            });
+            this.store.reload(lastOptions);
         }
     },

@M-abdelaziz
Copy link

How can i apply the above patch to my OpenGeo Suite 4.0.1 on windows server 2012

@bartvde
Copy link
Author

bartvde commented Jan 20, 2014

there was actually a small error in the patch above, should be:

diff --git a/src/script/plugins/WMSSource.js b/src/script/plugins/WMSSource.js
index 13466bb..92df32f 100644
--- a/src/script/plugins/WMSSource.js
+++ b/src/script/plugins/WMSSource.js
@@ -217,7 +217,11 @@ gxp.plugins.WMSSource = Ext.extend(gxp.plugins.LayerSource, {
      */
     onAuthorizationChange: function() {
         if (this.store && this.url.charAt(0) === "/") {
-            this.store.reload();
+            var lastOptions = this.store.lastOptions || {params: {}};
+            Ext.apply(lastOptions.params, {
+                '_dc': Math.random()
+            });
+            this.store.reload(lastOptions);
         }
     },

@bartvde
Copy link
Author

bartvde commented Jan 20, 2014

To apply just open up templates/composer.html from the WAR file and add an extra script tag after:

 <script type="text/javascript" src="../script/GeoExplorer.js"></script>

with the following contents:

 <script type="text/javascript">
gxp.plugins.WMSSource.prototype.onAuthorizationChange = function() {
    if (this.store && this.url.charAt(0) === "/") {
        var lastOptions = this.store.lastOptions || {params: {}};
        Ext.apply(lastOptions.params, {
            '_dc': Math.random()
        });
        this.store.reload(lastOptions);
    }
};
</script>

@M-abdelaziz
Copy link

Ok Bart, It was worked, but with one additional issue:

When i logout and never login with any user and click on "Add Layer" toolbar button, i don't find any layer (ok, this is an expected good behavior) then when i login using any user i still don't find any layers to add until i log out again then relogin directly

What is the issue?

Thank you

@bartvde
Copy link
Author

bartvde commented Jan 20, 2014

@M-abdelaziz I'm not seeing how the additional issue you describe is different from the original issue? Can you elaborate on the difference?

@M-abdelaziz
Copy link

Ok, after doing the changes composer.html, i perform the following experiment:

1- Open GeoExplorer using http://127.0.0.1:8080/geoexplorer.
2- Click on "Add Layer" toolbar button before login with any user; then i see nothing (that is OK).
3- Click on "Login" and enter "user1" with password "user1". "user1" is supposed to see only "layer1".
4- Click on "Add Layer" toolbar button again; then i still see nothing, it was expected to see layer1 but there is no layers at all !!

5- Logout from "user1" and relogin with "user1" again; then i can see layer1.

6- Logout from "user1" and click on "Add Layer" toolbar button without login with any user; then i see nothing (that is OK).

7- Click on "Login" and enter "user1" with password "user1"; then click on "Add Layer" toolbar button ; then i still see nothing, (This is not ok).

Note:
When i logout from user1 then immediately relogin with user2 it worked well and showing me "layer2" was available and vice versa. ("user2" is supposed to see only "layer2")

I ask about points number 4 and 7

Thank you

@M-abdelaziz
Copy link

Any reply ?

@bartvde
Copy link
Author

bartvde commented Jan 22, 2014

I haven't had time to look into this as yet

@M-abdelaziz
Copy link

I am sorry for disturbance

Thank you for your efforts

I’ll follow up your replies

From: Bart van den Eijnden [mailto:[email protected]]
Sent: Wednesday, January 22, 2014 3:40 PM
To: boundlessgeo/GeoExplorer
Cc: Mahamed Abdelrahman
Subject: Re: [GeoExplorer] on authorization change: WMS GetCapabilities should be forced reload for IE (#27)

I haven't had time to look into this as yet


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-33022300.


Attention:

This e-mail is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. Any views or opinions presented are solely those of the email sender.

This email was scanned and has been certified virus free with the pattern file currently in use. This however cannot guarantee that it does not contain malicious content.

Please consider the environmental impact before printing this document and its attachment(s).

@bartvde
Copy link
Author

bartvde commented Jan 27, 2014

@M-abdelaziz I cannot reproduce this in IE9

Do you see any javascript errors or any pointers in IE developer tools (F12)?

@bartvde
Copy link
Author

bartvde commented Jan 27, 2014

Also, what is the IE version you're testing on?

@M-abdelaziz
Copy link

IE 10

@M-abdelaziz
Copy link

in IE 10 developer tools:

When i login using any user i get the following error:

SCRIPT5007: Unable to get property 'namespaceURI' of undefined or null reference
GeoExplorer.js, line 189 character 403

@bartvde
Copy link
Author

bartvde commented Jan 28, 2014

which OpenGeo Suite version are you using? If you haven't done already, please use the 4.0.2 release instead of the 4.0.1 release, but still apply the patch as outlined in this ticket in composer.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants