Merge pull request #31 from gravitystorm/errors
authorRichard Fairhurst <richard@systemeD.net>
Sun, 4 Mar 2012 14:27:57 +0000 (06:27 -0800)
committerRichard Fairhurst <richard@systemeD.net>
Sun, 4 Mar 2012 14:27:57 +0000 (06:27 -0800)
Errors

1  2 
potlatch2.mxml

diff --combined potlatch2.mxml
index b365c7ddc692b7ac48f050e8b43252a79fb65f7d,90b8932f0d53f4249b5129e8b6efacc30227f2a7..279d08f947299aeaa363d48fbe8c78aeaeaab0aa
                import net.systemeD.potlatch2.utils.*;
          import net.systemeD.potlatch2.mygpx.*;
                import net.systemeD.controls.FloatingAlert;
 +              import net.systemeD.controls.Spinner;
                import mx.managers.PopUpManager;
                import flash.system.Security;
                import flash.net.*;
  
                private var savecount:uint=0;
                private var loadcount:uint=0;
 +              private var spinner:Spinner;
                private var saveLabel:String='Save';
                private var saveTimer:Timer;
  
              // Auto-load vector backgrounds from config
              theMap.addEventListener(MapEvent.INITIALISED, function(e:Event):void { VectorBackgrounds.instance().init(theMap); });
  
 +                      // Add loading 'spinner' indicator
 +                      spinner=new Spinner();
 +                      _root.addChild(spinner);
 +                      spinner.x=dataWorking.x-20;
 +                      spinner.y=dataWorking.y+dataWorking.height/2;
 +
                        // Set start position of map
                        // ** FIXME: if lat/lon/zoom aren't supplied, we need to keep the map in a non-loading state 
                        //           until the user has decided where to start editing (e.g. when the first GPX loads)
                
                public function onMapError(mapEvent:MapEvent):void {
                        var buttons:uint=0;
-                       if (mapEvent.params.no) { trace("no is set"); }
                        if (mapEvent.params.yes             ) buttons|=mx.controls.Alert.YES;
                        if (mapEvent.params.no              ) buttons|=mx.controls.Alert.NO;
                        if (mapEvent.params.cancel          ) buttons|=mx.controls.Alert.CANCEL;
                        if (mapEvent.params.ok || buttons==0) buttons|=mx.controls.Alert.OK;
-                       trace("showing alert with "+buttons);
                        Alert.show(mapEvent.params.message, 'Error', buttons, null, function(closeEvent:CloseEvent):void { 
                                switch (closeEvent.detail) {
                                        case mx.controls.Alert.CANCEL:  mapEvent.params.cancel(); break; //fixme? this gets called if user presses escape, even if there's no cancel button.
                        else if (savecount>0)           { t="Saving data..."; }
                        else                            { t=""; }
                        dataWorking.text=t.replace("#",(loadcount>1) ? (" ("+loadcount+")") : "");
 -                      dataWorking.visible=(dataWorking.text!="");
 +
 +                      var previousState:Boolean=dataWorking.visible;
 +                      var newState:Boolean=(dataWorking.text!="");
 +                      if (!previousState && newState) spinner.start();
 +                      if (previousState && !newState) spinner.stop();
 +                      dataWorking.visible=newState;
                }
          private function onDataDirty(event:Event):void {
                        saveButton.enabled=true;