[fusion-commits] r2359 - in trunk/widgets: . LinkToView

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Apr 4 16:25:47 EDT 2011


Author: madair
Date: 2011-04-04 13:25:47 -0700 (Mon, 04 Apr 2011)
New Revision: 2359

Modified:
   trunk/widgets/LinkToView.js
   trunk/widgets/LinkToView/LinkToView.css
Log:
closes #440: uses Jx3 style and link is in an input

Modified: trunk/widgets/LinkToView/LinkToView.css
===================================================================
--- trunk/widgets/LinkToView/LinkToView.css	2011-04-04 20:21:15 UTC (rev 2358)
+++ trunk/widgets/LinkToView/LinkToView.css	2011-04-04 20:25:47 UTC (rev 2359)
@@ -1,7 +1,8 @@
-a.anchorLinkToView {
+input.anchorLinkToView {
   font-family:  Arial, Helvetica, sans-serif;
   font-size: 11px; 
   line-height: 14px;
   padding: 4px;
+  width: 90%;
 }
 

Modified: trunk/widgets/LinkToView.js
===================================================================
--- trunk/widgets/LinkToView.js	2011-04-04 20:21:15 UTC (rev 2358)
+++ trunk/widgets/LinkToView.js	2011-04-04 20:25:47 UTC (rev 2359)
@@ -59,15 +59,15 @@
         this.anchorLabel = json.Label ? json.Label[0] : (this.domObj ? (this.domObj.innerHTML ? this.domObj.innerHTML : 'Link to View') : 'Link to View');
 
         Fusion.addWidgetStyleSheet(widgetTag.location + 'LinkToView/LinkToView.css');
-        this.anchor = document.createElement('a');
+        this.anchor = document.createElement('input');
         this.anchor.className = 'anchorLinkToView';
-        this.anchor.href = this.baseUrl;
-        this.anchor.innerHTML = this.anchorLabel;
+        this.anchor.value = this.baseUrl;
         this.anchor.title = json.Tooltip ? json.Tooltip[0] : 'Right-click to copy or bookmark link to current view';
+        this.anchor.onfocus = OpenLayers.Function.bind(this.selectAnchorValue, this);
         
         if(this.domObj){
             this.domObj.innerHTML = '';
-            this.domObj.appendChild(this.anchor);
+            this.domObj.appendChild(this.anchor);
         }
         
         this.getMap().oMapOL.events.register("addlayer", this, this.setListener);
@@ -83,6 +83,10 @@
         }
     },
     
+    selectAnchorValue: function() {
+        this.anchor.select();
+    },
+    
     setListener: function(evt) {
         var layer = evt.layer;
         //register on the OL loadend event to update the link because this event
@@ -93,6 +97,7 @@
     updateLink: function() {
         var join = (this.baseUrl.indexOf('?')==this.baseUrl.length-1)?'':'&';
         var queryStr = this.getMap().getLinkParams();
-        this.anchor.href = this.baseUrl + join + queryStr;
+        this.anchor.value = this.baseUrl + join + queryStr;
+        //this.anchor.select();
     }
 });



More information about the fusion-commits mailing list