Merge pull request #41 from stevage/pedestrian-crossings
[potlatch2.git] / net / systemeD / potlatch2 / panels / BugPanel.mxml
index d09105340eb3292b91a463ee883ca54563e16e86..c13b496498b74a0965c72b32573bdde49d2166b2 100644 (file)
@@ -4,7 +4,11 @@
     Bug Panel
 -->
 
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" paddingTop="10">
+<mx:VBox
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
+    height="100%"
+    paddingTop="10">
   <mx:HBox>
     <mx:Image source="{bugImage}" width="32" height="32" />
     <mx:Text text="{bugTitle}" fontWeight="bold" fontSize="18" />
@@ -21,6 +25,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%">
     </mx:VBox>
   </mx:ViewStack>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
       import net.systemeD.halcyon.connection.*;
-      import net.systemeD.halcyon.VectorLayer;
-      import net.systemeD.potlatch2.BugLayer;
+      import net.systemeD.potlatch2.BugConnection;
       import mx.collections.*;
       import com.adobe.utils.DateUtil;
 
       private var selectedEntity:Entity;
-      private var layer:VectorLayer;
+      private var connection:BugConnection;
 
       [Bindable] private var bugId:String;
       [Bindable] private var bugStatus:String;
       [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;
+      public function init(entity:Entity, connection:BugConnection):void {
+            this.connection = connection;
             selectedEntity=entity;
 
             bugId = selectedEntity.getTag("bug_id");
             bugCreated = DateUtil.parseW3CDTF(selectedEntity.getTag("date_created"));
             bugUpdated = DateUtil.parseW3CDTF(selectedEntity.getTag("date_updated"));
 
-            if ( bugStatus == BugLayer.status[int(BugLayer.BUG_STATUS_FIXED)] ) {
+            if ( bugStatus == BugConnection.status[int(BugConnection.BUG_STATUS_FIXED)] ) {
               bugControlStack.selectedChild = bugFixed;
-            } else if ( bugStatus == BugLayer.status[int(BugLayer.BUG_STATUS_INVALID)] ) {
+            } else if ( bugStatus == BugConnection.status[int(BugConnection.BUG_STATUS_INVALID)] ) {
               bugControlStack.selectedChild = bugInvalid;
             } else {
               bugControlStack.selectedChild = bugControl;
             }
+
+            var u:String = connection.bugDetailsUrl(Marker(selectedEntity));
+            if (u) {
+              bugDetails = u;
+              bugDetailsHbox.visible=true;
+            }
       }
 
       private function closeBug():void {
-            var status:String = option_invalid.selected ? BugLayer.BUG_STATUS_INVALID : BugLayer.BUG_STATUS_FIXED;
+            var status:String = option_invalid.selected ? BugConnection.BUG_STATUS_INVALID : BugConnection.BUG_STATUS_FIXED;
             trace(status);
-            BugLayer(layer).closeBug(selectedEntity as Marker, nickName.text, closeComment.text, status);
+            connection.closeBug(selectedEntity as Marker, nickName.text, closeComment.text, status);
             bugStatus = selectedEntity.getTag("status");
             // this should really be a 'saving...' state, with a callback depending on the server result
             bugControlStack.selectedChild = option_invalid.selected ? bugInvalid : bugFixed;
       }
 
       ]]>
-  </mx:Script>
+  </fx:Script>
 </mx:VBox>
\ No newline at end of file