[fusion-commits] r1618 - in trunk: MapGuide widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Oct 27 15:26:51 EDT 2008
Author: madair
Date: 2008-10-27 15:26:51 -0400 (Mon, 27 Oct 2008)
New Revision: 1618
Modified:
trunk/MapGuide/MapGuide.js
trunk/widgets/Maptip.js
Log:
closes #99: parse out href if maptip hyperlink contains an anchor tag
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-10-27 19:26:24 UTC (rev 1617)
+++ trunk/MapGuide/MapGuide.js 2008-10-27 19:26:51 UTC (rev 1618)
@@ -1071,7 +1071,17 @@
eval('o='+xhr.responseText);
var h = o['FeatureInformation']['Hyperlink'];
if (h) {
- window.open(h[0], "");
+ var linkURL;
+ if (h[0].indexOf('href=') > 0) {
+ //MGOS allows full anchor tag as the hyperlink, extract the href
+ var tempDiv = document.createElement('div');
+ tempDiv.innerHTML = h[0];
+ linkURL = tempDiv.firstChild.href;
+ tempDiv = null;
+ } else {
+ linkURL = h[0];
+ }
+ window.open(linkURL, "");
}
}
},
Modified: trunk/widgets/Maptip.js
===================================================================
--- trunk/widgets/Maptip.js 2008-10-27 19:26:24 UTC (rev 1617)
+++ trunk/widgets/Maptip.js 2008-10-27 19:26:51 UTC (rev 1618)
@@ -195,13 +195,21 @@
}
var h = tooltip['FeatureInformation']['Hyperlink'];
if (h) {
+ var a, linkURL;
var linkDiv = document.createElement('div');
- var a = document.createElement('a');
- a.innerHTML = h[0];
+ if (h[0].indexOf('href=') > 0) { //MGOS allows complete anchor tags as the hyperlink
+ linkDiv.innerHTML = h[0];
+ a = linkDiv.firstChild;
+ linkURL = a.href;
+ } else {
+ a = document.createElement('a');
+ a.innerHTML = h[0];
+ linkURL = h[0];
+ linkDiv.appendChild(a);
+ }
a.href = 'javascript:void(0)';
- var openLink = OpenLayers.Function.bind(this.openLink, this, h[0]);
+ var openLink = OpenLayers.Function.bind(this.openLink, this, linkURL);
a.onclick = OpenLayers.Function.bindAsEventListener(openLink, this);
- linkDiv.appendChild(a);
contentDiv.appendChild(linkDiv);
empty = false;
}
More information about the fusion-commits
mailing list