]> git.openstreetmap.org Git - potlatch2.git/blobdiff - net/systemeD/potlatch2/save/OAuthPanel.mxml
making oAuth open up in a smaller centred window
[potlatch2.git] / net / systemeD / potlatch2 / save / OAuthPanel.mxml
index 096222e27a549f15739fb3bf3525fb80affd2b0a..090b08494cd733ae0bb61ec91d2cd21b4d8ea1c4 100644 (file)
        </mx:ControlBar>
        
        <mx:Script><![CDATA[
+               import flash.display.InteractiveObject;
         import flash.events.Event;
         import flash.net.*;
+               import flash.system.Capabilities;
         import mx.managers.PopUpManager;
         import net.systemeD.halcyon.connection.*;
         import org.iotashan.oauth.*;
+               import flash.external.ExternalInterface;
 
         private var connection:Connection;
         private var requestToken:OAuthToken;
         }
         
         private function openURL(url:String):void {
-            var urlRequest:URLRequest = new URLRequest(url);
-            navigateToURL(urlRequest, "_blank");
-        }
+                       if (ExternalInterface.available) {
+                               var winH:int = 560;
+                               var winW:int = 600;
+                               var leftPos:int  = (Capabilities.screenResolutionX - winW) / 2;
+                               var topPos:int = (Capabilities.screenResolutionY - winH) / 2;
+                               ExternalInterface.call( "window.open", url,"oAuthWin","height=" + winH + ",width=" + winW +",top=" + topPos + ", left=" + leftPos +", toolbar=no,scrollbars=no,status=no,location=no,menubar=no,directories=no");
+                               }               
+                       else
+                       {
+                               var urlRequest:URLRequest = new URLRequest(url);
+                               navigateToURL(urlRequest,"_blank");
+                       }
+               }
         
         private function getRequestToken():void {
             connection = Connection.getConnectionInstance();
             
             var url:String = Connection.getParam("oauth_auth_url", "http://127.0.0.1:3000/oauth/authorize");            
             link.label = url;
-            authoriseURL = url + "?oauth_token="+requestToken.key;
-            progress.visible = false;
+                       authoriseURL = url + "?oauth_token="+requestToken.key;
+                       progress.visible = false;
             gotLinkBox.visible = true;
         }