[fusion-commits] r1903 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Sep 22 11:18:44 EDT 2009


Author: madair
Date: 2009-09-22 11:18:40 -0400 (Tue, 22 Sep 2009)
New Revision: 1903

Modified:
   trunk/widgets/Maptip.js
Log:
closes #265: if hyperlink field doesn't contain a "href=" string, it is treated as a URL and an anchor tag is added to the hyperlink

Modified: trunk/widgets/Maptip.js
===================================================================
--- trunk/widgets/Maptip.js	2009-09-21 17:54:01 UTC (rev 1902)
+++ trunk/widgets/Maptip.js	2009-09-22 15:18:40 UTC (rev 1903)
@@ -235,7 +235,16 @@
 
                 if (hyperlink) {
                     var mapTipContent = document.createElement('DIV');
-                    mapTipContent.innerHTML =  hyperlink.replace(/\n/g, "<br>");
+                    hyperlink =  hyperlink.replace(/\n/g, "<br>");
+                    if ( hyperlink.indexOf("href=")>0 ) {
+                      mapTipContent.innerHTML = hyperlink
+                    } else {
+                      var anchor = document.createElement('A');
+                      anchor.href = hyperlink;
+                      anchor.target = "_blank";
+                      anchor.innerHTML = hyperlink;
+                      mapTipContent.appendChild(anchor);
+                    }
                     contentDiv.appendChild(mapTipContent);
                     empty = false;
                 }



More information about the fusion-commits mailing list