The problem:
Open the map viewer.
Below the map viewer, click "+".
Click on "NASA JPL . . .".
See the little blue "i" next to some services,
e.g. "WMS Global Mosaic, not pan sharpened".
Click one of the little blue "i" buttons.
Nothing happens!
You should get a popup. You don't.
The problem is that setting innerHTML isn't
enough to cause execution of an embedded <script> tag,
which in this case contains the definition of
getWmsLayerInfo().
Here is a fix, which I have tested on Linux and Windows,
Firefox 2 and IE7.
My guess is that these buttons have not worked since the
definition of getWmsLayerInfo() was commented out
in main-page.xsl in SVN revision 955, i.e. in November.
Sorry, this is really a fix for Intermap - what
is the correct protocol here?
The fix deliberately evaluates _only_ the first
<script> tag it finds in the AJAX reply so there's
no chance of a picking up a <script>
tag from a malicious remote server's data.
I don't know if that's even possible, but
better safe than sorry . . . .
-- Richard Walker
Software Improvements Pty Ltd
Phone: +61 2 6273 2055
Fax: +61 2 6273 2082
Index: web/intermap/scripts/im_extras.js
--- web/intermap/scripts/im_extras.js (revision 1125)
+++ web/intermap/scripts/im_extras.js (working copy)
@@ -8,6 +8,7 @@
requires:
clearNode(node)
+ extractScripts() // from prototype.js
getIMServiceURL(service)
imc_addServices(url, services, type, im_servicesAdded);
im_buildLayerList(req); // rebuild layers' list
@@ -143,9 +144,13 @@
function im_servicesLoaded(req)
{
- // Dinamically generate content
+ // Dynamically generate content
var im = $('im_serverList');
im.innerHTML =req.responseText;
+ var reqScripts = req.responseText.extractScripts();
+ // Only evaluate the first script
+ if (reqScripts.length > 0)
+ eval(reqScripts[0]);
}
/*
Index: web/intermap/xsl/im_get-services-embedded.xsl
--- web/intermap/xsl/im_get-services-embedded.xsl (revision 1125)
+++ web/intermap/xsl/im_get-services-embedded.xsl (working copy)
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- requires unescapeHTML() from prototype.js -->
+<!-- only the first script tag will be evaluated by im_servicesLoaded() -->
+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Main template -->
@@ -10,7 +13,7 @@
<script language="javascript">
//function getWmsLayerInfo(name) {
getWmsLayerInfo = function(name) {
- window.open('<xsl:value-of select="/root/gui/locService" />/map.service.wmsLayerInfo?url=<xsl:value-of select="/root/response/url"/>&name=' + name, 'dialog', 'HEIGHT=300,WIDTH=400,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no,resizable=yes');
+ window.open(('<xsl:value-of select="/root/gui/locService" />/map.service.wmsLayerInfo?url=<xsl:value-of select="/root/response/url"/>&name=' + name).unescapeHTML(), 'dialog', 'HEIGHT=300,WIDTH=400,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no,resizable=yes').focus();
}
</script>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork