add browser help links for map features
[potlatch2.git] / net / systemeD / potlatch2 / TagViewer.mxml
index ab2a04f8df215025fa0a53ef62b8e24b0948c70f..d47478cb55a3fd0b0bbe7298269aa6106634d9f9 100644 (file)
@@ -68,6 +68,7 @@
       import mx.core.*;
       import mx.managers.PopUpManager;
       import flash.geom.Point;
+      import flash.net.*;
       
       private var mapFeatures:MapFeatures;
       private var selectedEntity:Entity;
           var txt:String = feature.htmlDetails(entity);
           iconText.htmlText = txt;
           popupChange.label = feature.name;
+          setLimitTypes(entity);
           tw.setSelectedFeature(feature);
+          helpLabel.visible = feature.hasHelpURL();
+      }
+      
+      private function setLimitTypes(entity:Entity):void {
+          var type:String = null;
+          if ( entity is Node )
+              type = "point";
+          else if ( entity is Way )
+              type = Way(entity).isArea() ? "area" : "line";
+          else if ( entity is Relation )
+              type = "relation";
+          tw.setLimitTypes(type);
       }
 
       private function blankFeatureIcon(entity:Entity):void {
                "<i>Nothing selected</i>" :
                "<b>Not recognised</b><br/>Try looking at the tags under the advanced properties";
           popupChange.label = "unknown";
+          setLimitTypes(entity);
           tw.setSelectedFeature(null);
+          helpLabel.visible = false;
       }
 
       private function initialiseEditors():void {
 
       public function openDescription():void {
           trace("open description here");
+          if ( feature != null && feature.hasHelpURL() )
+              navigateToURL(new URLRequest(feature.helpURL), "potlatch_help");
       }
 
       public function addNewTag():void {