Merge branch 'localfile'
authorRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 15:24:09 +0000 (16:24 +0100)
committerRichard Fairhurst <richard@systemeD.net>
Sun, 25 Mar 2012 15:24:09 +0000 (16:24 +0100)
1  2 
l10n/map/LocalizationMap.mxml
net/systemeD/potlatch2/collections/VectorBackgrounds.as
potlatch2.mxml

index b88785431b66f679203cb2fd18fbb15e96c9e485,08e5ce942cda63f89bf481dbb1a817560476b2fd..c96738c0f9a0e37b31cbc97184ba345c61401bb6
@@@ -7,7 -7,7 +7,7 @@@
    <!-- Support for Locale ResourceBundle changes -->
    <mx:Script>
      <![CDATA[
 -      import org.babelfx.commands.ExternalLocaleCommand;
 +      import net.systemeD.potlatch2.CustomLocaleCommand;
        import org.babelfx.events.LocaleEvent;
        import mx.resources.ResourceManager;
        import mx.resources.IResourceManager;
@@@ -22,7 -22,7 +22,7 @@@
        import net.systemeD.potlatch2.save.OAuthPanel;
        import net.systemeD.potlatch2.save.SaveDialog;
  
-       import net.systemeD.potlatch2.options.OptionsDialog;
+       import net.systemeD.potlatch2.dialogs.OptionsDialog;
  
        private function onLocaleChanged(event:Event):void {
            var rMngr : IResourceManager = ResourceManager.getInstance();
@@@ -46,9 -46,9 +46,9 @@@
    </mx:Script>
  
    <commandFactory>
 -    <factory:ClassFactory generator="{ExternalLocaleCommand}">
 +    <factory:ClassFactory generator="{CustomLocaleCommand}">
        <factory:properties>
 -        <mx:Object externalPath="locales/\{0\}.swf"/>
 +        <mx:Object defaultExternalPath="locales/\{0\}.swf"/>
        </factory:properties>
      </factory:ClassFactory>
    </commandFactory>
index 446799b5537c9aeb0fa4ae6db0ac6f127ce3f4c5,9b64e3a0a7ac6b3324124c01bc7d6357239ac02e..0a8d61086548fd4d982f9a6800b0942e89a2952d
@@@ -6,7 -6,7 +6,7 @@@ package net.systemeD.potlatch2.collecti
        import net.systemeD.halcyon.Map;
        import net.systemeD.halcyon.MapPaint;
        import net.systemeD.halcyon.connection.Connection;
 -      import net.systemeD.halcyon.DebugURLRequest;
 +      import net.systemeD.halcyon.FileBank;
        import net.systemeD.potlatch2.utils.*;
                
        public class VectorBackgrounds extends EventDispatcher {
  
                public function init(map:Map):void {
                        _map = map;
 -                      var request:DebugURLRequest = new DebugURLRequest("vectors.xml");
 -                      var loader:URLLoader = new URLLoader();
 -                      loader.addEventListener(Event.COMPLETE, onConfigLoad);
 -                      loader.load(request.request);
 +            FileBank.getInstance().addFromFile("vectors.xml", onConfigLoad);
                }
  
 -              public function onConfigLoad(e:Event):void {
 -                      var xml:XML = XML(e.target.data);
 +              private function onConfigLoad(fileBank:FileBank, filename:String):void {
 +                      var xml:XML = new XML(fileBank.getAsString(filename));
  
                        // reconstitute results as Array, as we can't run .forEach over an XMLList
                        var sets:Array = [];
                                                                                var gpx_url:String = String(set.url);
  
                                                                                var connection:Connection = new Connection(name, gpx_url, null, null);
-                                                                               var gpx:GpxImporter=new GpxImporter(connection, _map, [gpx_url],
+                                                                               var gpx:GpxImporter=new GpxImporter(connection, _map, 
                                                                                function(success:Boolean,message:String=null):void {
                                                                                        if (!success) return;
                                                                                        var paint:MapPaint = _map.addLayer(connection, "stylesheets/gpx.css");
                                                                                        paint.updateEntityUIs(false, false);
                                                                                        dispatchEvent(new Event("layers_changed"));
                                                                                }, false);
+                                                                               gpx.importFromRemoteFiles([gpx_url]);
                                                                        } else {
                                                                        trace("VectorBackgrounds: configured but not loaded isn't supported yet");
                                                                        }
diff --combined potlatch2.mxml
index 32bc8d8a98143251e36bd9ea4e1943bf24b6b268,c6e29f8cd35eedc5d767536848fb4480c21960a2..af5e5c4891e76f4c0ee4e53f8ec439e54822f128
@@@ -99,7 -99,7 +99,7 @@@
                import net.systemeD.potlatch2.collections.*;
                import net.systemeD.potlatch2.controller.*;
                import net.systemeD.potlatch2.help.*;
-               import net.systemeD.potlatch2.options.*;
+               import net.systemeD.potlatch2.dialogs.*;
                import net.systemeD.potlatch2.utils.*;
          import net.systemeD.potlatch2.mygpx.*;
                import net.systemeD.controls.FloatingAlert;
                private function startInit():void {
                        var loader:Loader = new Loader();
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startApp);
 -                      loader.load(new URLRequest("FontLibrary.swf"));
 +            if (loaderInfo.parameters['font_library']) {
 +                          loader.load(new URLRequest(loaderInfo.parameters['font_library']));
 +            } else {
 +                          loader.load(new URLRequest("FontLibrary.swf"));
 +            }
  
              if (loaderInfo.parameters['locale'] && loaderInfo.parameters['locale']!='en_US') {
                  // we don't bother with localisation if the user is en_US, as P2 is in English by default
                  Globals.vars.locale = loaderInfo.parameters['locale'];
 +                Globals.vars.locale_paths = loaderInfo.parameters['locale_paths'];
                  dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE, loaderInfo.parameters['locale']));
                  dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE, 'en_US')); // think en_US is default
                  resourceManager.localeChain = [loaderInfo.parameters['locale'], 'en_US'];
                  var gpx_url:String = loaderInfo.parameters['gpx_url'];
  
                  var connection:Connection = new Connection(name, gpx_url, null, null);
-                 var gpx:GpxImporter=new GpxImporter(connection, theMap, [gpx_url],
+                 var gpx:GpxImporter=new GpxImporter(connection, theMap,
                                                  function(success:Boolean,message:String=null):void {
                                                      if (!success) return;
                                                      var paint:MapPaint = theMap.addLayer(connection, "stylesheets/gpx.css");
                                                      paint.updateEntityUIs(false, false);
                                                      dispatchEvent(new Event("layers_changed"));
                                                  }, false);
+                               gpx.importFromRemoteFiles([gpx_url]);
                        }
  
                        // create GPS trackloader