Created
March 5, 2012 13:39
-
-
Save bartvde/1978338 to your computer and use it in GitHub Desktop.
imageloaderror
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OpenLayers.Util.onImageLoadError = function(){ | |
| // this.src provides the wms request | |
| var errorStr = this.src.substring(0, (this.src.indexOf("?") + 1)); | |
| var childStr = ""; | |
| var foundBadWMS = false; | |
| var root = tree.getRootNode(); | |
| var children = root.childNodes; | |
| if (!(foundBadWMS)) { | |
| // src may be returning with a different sub-domain but the same parent domain/hostname | |
| errorStr = getHostname(this.src); | |
| var count = errorStr.split("."); | |
| if (count.length > 2) { | |
| // www.xxx.com counts the same as yyy.xxx.com | |
| var parentDomain = errorStr.substring((errorStr.indexOf(".") + 1), errorStr.length); | |
| for (var j = 0; j < children.length; j++) { | |
| parentDomainOfNode = getHostname(children[j].text); | |
| parentDomainOfNode = parentDomainOfNode.substring((parentDomainOfNode.indexOf(".") + 1), parentDomainOfNode.length); | |
| if (parentDomain == parentDomainOfNode) { | |
| Ext.MessageBox.alert('Error', ("The WMS source: " + children[j].text + " has failed to load - please switch it off or try a different projection.")); | |
| // children[j].cascade(function(m){ | |
| // var ui2 = m.getUI(); | |
| // ui2.toggleCheck(false); | |
| // }); | |
| foundBadWMS = true; | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment