Provide a link to the website, if the <details> parameter is filled out for bug layers.
authorAndy Allan <gravitystorm@gmail.com>
Tue, 30 Nov 2010 15:52:43 +0000 (15:52 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Tue, 30 Nov 2010 15:52:43 +0000 (15:52 +0000)
net/systemeD/potlatch2/AutoVectorBackground.as
net/systemeD/potlatch2/BugLayer.as
net/systemeD/potlatch2/panels/BugPanel.mxml
net/systemeD/potlatch2/utils/BugLoader.as
resources/vectors.xml

index 39b3e7b..948b05c 100644 (file)
@@ -60,7 +60,7 @@ package net.systemeD.potlatch2 {
                 case "BugLoader":
                   if (set.url && set.apiKey) {
                     name ||= 'Bugs';
-                    var bugLoader:BugLoader = new BugLoader(map, String(set.url), String(set.apikey), name);
+                    var bugLoader:BugLoader = new BugLoader(map, String(set.url), String(set.apikey), name, String(set.details));
                     if (set.@loaded == "true") {
                       bugLoader.load();
                     }
index 948eb31..35b47fa 100644 (file)
@@ -12,6 +12,7 @@ package net.systemeD.potlatch2 {
 
         private var baseUrl:String;
         private var apiKey:String;
+        private var detailsUrl:String;
 
         // as strings, since that's how they are in tags and http calls
         public static var BUG_STATUS_OPEN:String = "1";
@@ -19,9 +20,10 @@ package net.systemeD.potlatch2 {
         public static var BUG_STATUS_INVALID:String = "3"; // or 'non-reproduceable'
         public static const status:Array = ["", "open", "fixed", "invalid"];
 
-        public function BugLayer(n:String, map:Map, s:String, baseUrl:String, apiKey:String) {
+        public function BugLayer(n:String, map:Map, s:String, baseUrl:String, apiKey:String, detailsURL:String) {
             this.baseUrl = baseUrl;
             this.apiKey = apiKey;
+            this.detailsUrl = detailsURL;
             super(n,map,s);
         }
 
@@ -83,5 +85,11 @@ package net.systemeD.potlatch2 {
             }
         }
 
+        public function bugDetailsUrl(m:Marker):String {
+            if (detailsUrl == '')
+              return null;
+            return detailsUrl+m.id;
+        }
+
     }
 }
index d091053..b5237ce 100644 (file)
@@ -21,6 +21,9 @@
     <mx:Text text="Type of bug: " />
     <mx:Text text="{bugType}" fontWeight="bold"/>
   </mx:HBox>
+  <mx:HBox id="bugDetailsHbox" visible="false">
+    <mx:Text fontWeight="bold" text="View full details on website..." click="navigateToURL(new URLRequest(bugDetails), 'potlatch_browse')" />
+  </mx:HBox>
   <mx:TextArea editable="false" text="{bugDescription}" width="100%" fontSize="14" minHeight="100" maxHeight="400"/>
 
   <mx:ViewStack id="bugControlStack" resizeToContent="true" width="100%">
@@ -72,6 +75,7 @@
       [Bindable] private var bugTitle:String;
       [Bindable] private var bugCreated:Date;
       [Bindable] private var bugUpdated:Date;
+      [Bindable] private var bugDetails:String;
 
       public function init(entity:Entity, layer:VectorLayer):void {
             this.layer = layer;
             } else {
               bugControlStack.selectedChild = bugControl;
             }
+
+            var u:String = BugLayer(layer).bugDetailsUrl(Marker(selectedEntity));
+            if (u) {
+              bugDetails = u;
+              bugDetailsHbox.visible=true;
+            }
       }
 
       private function closeBug():void {
index 17b2b88..509c84a 100644 (file)
@@ -13,16 +13,18 @@ package net.systemeD.potlatch2.utils {
         private var map:Map;
         private var bugBaseURL:String;
         private var bugApiKey:String;
+        private var bugDetailsURL:String;
         private var _layer:VectorLayer;
         private var name:String;
         private static const STYLESHEET:String="bugs.css";
 
 
-        public function BugLoader(map:Map, url:String, bugApiKey:String, name:String):void {
+        public function BugLoader(map:Map, url:String, bugApiKey:String, name:String, details:String = ''):void {
             this.map = map;
             this.bugBaseURL = url;
             this.bugApiKey = bugApiKey;
             this.name = name;
+            this.bugDetailsURL = details;
         }
 
         public function load():void {
@@ -36,7 +38,7 @@ package net.systemeD.potlatch2.utils {
                 var policyFile:String = bugBaseURL+"crossdomain.xml";
                 Security.loadPolicyFile(policyFile);
 
-                _layer=new BugLayer(name,map,STYLESHEET,bugBaseURL,bugApiKey);
+                _layer=new BugLayer(name,map,STYLESHEET,bugBaseURL,bugApiKey,bugDetailsURL);
                 map.addVectorLayer(_layer);
             }
             return _layer;
index 0a7b960..5fef714 100644 (file)
@@ -5,6 +5,7 @@
       <name>Mapdust Bugs</name>
       <loader>BugLoader</loader>
       <url>http://www.mapdust.com/api/</url>
+      <details>http://www.mapdust.com/detail/</details>
       <apikey>e4d47b6b8c26e822a62d747b802f98ac</apikey>
     </set>
     <set>