[fusion-commits] r1617 - in branches/fusion-1.1: MapGuide widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Oct 27 15:26:24 EDT 2008
Author: madair
Date: 2008-10-27 15:26:24 -0400 (Mon, 27 Oct 2008)
New Revision: 1617
Modified:
branches/fusion-1.1/MapGuide/MapGuide.js
branches/fusion-1.1/widgets/Maptip.js
Log:
re #99: parse out href if maptip hyperlink contains an anchor tag
Modified: branches/fusion-1.1/MapGuide/MapGuide.js
===================================================================
--- branches/fusion-1.1/MapGuide/MapGuide.js 2008-10-27 18:07:36 UTC (rev 1616)
+++ branches/fusion-1.1/MapGuide/MapGuide.js 2008-10-27 19:26:24 UTC (rev 1617)
@@ -985,7 +985,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: branches/fusion-1.1/widgets/Maptip.js
===================================================================
--- branches/fusion-1.1/widgets/Maptip.js 2008-10-27 18:07:36 UTC (rev 1616)
+++ branches/fusion-1.1/widgets/Maptip.js 2008-10-27 19:26:24 UTC (rev 1617)
@@ -200,13 +200,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;
}
@@ -265,7 +273,7 @@
this.bOverTip = false;
},
- openLink : function(url, evt) {
+ openLink: function(url, evt) {
var taskPaneTarget = Fusion.getWidgetById(this.sTarget);
if ( taskPaneTarget ) {
taskPaneTarget.setContent(url);
More information about the fusion-commits
mailing list