Refactor BugLayer to extend connection, and rename it to BugConnection to save confusion
[potlatch2.git] / net / systemeD / potlatch2 / panels / BugPanel.mxml
index b5237ce5ec3206750b7774ca47da42395fa3ccf0..6e3d96ad22f3e62169189ecc770c350f757795e9 100644 (file)
 
       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;
@@ -77,8 +77,8 @@
       [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 = BugLayer(layer).bugDetailsUrl(Marker(selectedEntity));
+            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;