Commits

elem...@60038091-bd4c-0410-8356-ef1767570a53  committed bbacc27

Various minor updates

  • Participants
  • Parent commits e96f5e3

Comments (0)

Files changed (7)

File .flexLibProperties

 <?xml version="1.0" encoding="UTF-8"?>
 <flexLibProperties version="1">
 <includeClasses>
-<classEntry path="com.photobucket.webapi.oauth.OAuthBaseService"/>
-<classEntry path="com.photobucket.webapi.service.PhotobucketService"/>
-<classEntry path="com.photobucket.webapi.objects.User"/>
-<classEntry path="com.photobucket.webapi.interfaces.IMedia"/>
-<classEntry path="com.photobucket.webapi.interfaces.IContact"/>
-<classEntry path="com.photobucket.webapi.objects.MediaType"/>
-<classEntry path="com.photobucket.webapi.interfaces.IUser"/>
-<classEntry path="com.photobucket.webapi.service.PhotobucketException"/>
-<classEntry path="com.photobucket.webapi.oauth.urlEncode"/>
-<classEntry path="com.photobucket.webapi.factory.MediaFactory"/>
-<classEntry path="com.photobucket.webapi.objects.Tag"/>
-<classEntry path="com.photobucket.webapi.objects.PhotobucketRemoteObject"/>
-<classEntry path="com.photobucket.webapi.factory.ContactFactory"/>
-<classEntry path="com.photobucket.webapi.objects.Login"/>
+<classEntry path="com.photobucket.webapi.air.LoginAir"/>
+<classEntry path="com.photobucket.webapi.air.LoginAirWindow"/>
+<classEntry path="com.photobucket.webapi.events.MediaEvent"/>
+<classEntry path="com.photobucket.webapi.events.MediasEvent"/>
 <classEntry path="com.photobucket.webapi.events.PhotobucketRemoteObjectEvent"/>
 <classEntry path="com.photobucket.webapi.events.PhotobucketServiceEvent"/>
+<classEntry path="com.photobucket.webapi.events.PhotobucketServiceExceptionEvent"/>
+<classEntry path="com.photobucket.webapi.factory.AlbumFactory"/>
+<classEntry path="com.photobucket.webapi.factory.ContactFactory"/>
+<classEntry path="com.photobucket.webapi.factory.MediaFactory"/>
+<classEntry path="com.photobucket.webapi.factory.TagFactory"/>
+<classEntry path="com.photobucket.webapi.factory.UserFactory"/>
+<classEntry path="com.photobucket.webapi.interfaces.IAlbum"/>
+<classEntry path="com.photobucket.webapi.interfaces.IContact"/>
+<classEntry path="com.photobucket.webapi.interfaces.IMedia"/>
+<classEntry path="com.photobucket.webapi.interfaces.ITag"/>
+<classEntry path="com.photobucket.webapi.interfaces.IUser"/>
+<classEntry path="com.photobucket.webapi.oauth.OAuthBaseService"/>
+<classEntry path="com.photobucket.webapi.oauth.OAuthRequest"/>
+<classEntry path="com.photobucket.webapi.oauth.OAuthRequestMethod"/>
+<classEntry path="com.photobucket.webapi.oauth.urlEncode"/>
+<classEntry path="com.photobucket.webapi.objects.Album"/>
+<classEntry path="com.photobucket.webapi.objects.Contact"/>
+<classEntry path="com.photobucket.webapi.objects.Login"/>
+<classEntry path="com.photobucket.webapi.objects.Media"/>
+<classEntry path="com.photobucket.webapi.objects.MediaType"/>
+<classEntry path="com.photobucket.webapi.objects.PhotobucketAPIObject"/>
+<classEntry path="com.photobucket.webapi.objects.PhotobucketRemoteObject"/>
+<classEntry path="com.photobucket.webapi.objects.Search"/>
+<classEntry path="com.photobucket.webapi.objects.Tag"/>
+<classEntry path="com.photobucket.webapi.objects.User"/>
 <classEntry path="com.photobucket.webapi.service.PhotobucketChannel"/>
-<classEntry path="com.photobucket.webapi.objects.Album"/>
-<classEntry path="com.photobucket.webapi.interfaces.IAlbum"/>
-<classEntry path="com.photobucket.webapi.factory.AlbumFactory"/>
-<classEntry path="com.photobucket.webapi.objects.Search"/>
-<classEntry path="com.photobucket.webapi.oauth.OAuthRequestMethod"/>
-<classEntry path="com.photobucket.webapi.events.PhotobucketServiceExceptionEvent"/>
-<classEntry path="com.photobucket.webapi.events.MediasEvent"/>
-<classEntry path="com.photobucket.webapi.factory.TagFactory"/>
-<classEntry path="com.photobucket.webapi.interfaces.ITag"/>
-<classEntry path="com.photobucket.webapi.oauth.OAuthRequest"/>
-<classEntry path="com.photobucket.webapi.events.MediaEvent"/>
-<classEntry path="com.photobucket.webapi.objects.PhotobucketAPIObject"/>
-<classEntry path="com.photobucket.webapi.objects.Media"/>
 <classEntry path="com.photobucket.webapi.service.PhotobucketChannelSet"/>
-<classEntry path="com.photobucket.webapi.objects.Contact"/>
-<classEntry path="com.photobucket.webapi.factory.UserFactory"/>
+<classEntry path="com.photobucket.webapi.service.PhotobucketException"/>
+<classEntry path="com.photobucket.webapi.service.PhotobucketService"/>
 </includeClasses>
 <includeResources/>
 <namespaceManifests/>

File src/com/photobucket/webapi/air/LoginAir.as

 THE SOFTWARE.
  */
  
-package com.photobucket.webapi.objects
+package com.photobucket.webapi.air
 {
 	import com.photobucket.webapi.oauth.OAuthRequest;
 	import com.photobucket.webapi.oauth.OAuthRequestMethod;
+	import com.photobucket.webapi.objects.Login;
+	
 	
 	/**
 	 * Login Class for use with AIR. 

File src/com/photobucket/webapi/air/LoginAirWindow.as

-Unexpected error.  File contents could not be restored from local history during undo/redo.
+/*
+The License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+ */
+ 
+package com.photobucket.webapi.air
+{
+        import flash.events.Event;
+       
+        import mx.controls.HTML;
+        import mx.core.Window;
+        import mx.events.FlexEvent;
+        import mx.rpc.IResponder;
+        import com.photobucket.webapi.service.PhotobucketException;
+
+        /**
+         * Login Window that handles the track of the user authorization process and is used by LoginAir
+         * @author jlewark
+         *
+         */
+        public final class LoginAirWindow extends Window
+        {
+                private var _url:String;
+                private var html:HTML;
+                public var result:Function;
+                public var fault:Function;
+               
+                public function LoginAirWindow(url:String)
+                {
+                        super();
+                        _url = url;
+                        this.title = "Welcome to Photobucket";
+                        this.addEventListener(FlexEvent.CREATION_COMPLETE, onCreateComplete);
+                }
+       
+                override public function open(openWindowActive:Boolean=true):void {
+                        this.width = this.windowWidth;
+                        this.height = this.windowHeight;
+                        this.visible = false;
+                        super.open(openWindowActive);
+                }
+               
+                private function onCreateComplete(event:Event):void {
+                        html = new HTML();
+                        this.addChild(html);
+                        html.percentHeight = 100;
+                        html.percentWidth = 100;
+                        html.addEventListener(Event.LOCATION_CHANGE, onLocationChange);
+                        html.addEventListener(Event.COMPLETE, onHTMLComplete);
+                        callLater(later);
+                }
+
+                private function onHTMLComplete(event:Event):void {
+                        if ((html.location.indexOf("status=done") < 0)||(html.location.indexOf("crossdomain.xml") < 0)) {
+                                this.visible = true;
+                        }
+                }
+
+                private function later():void {
+                        html.location = _url;  
+                }
+               
+                private function onLocationChange(event:Event):void {
+                        html.visible = true;
+                        if (html.location.indexOf("status=denied") >= 0) {
+                                fault(new PhotobucketException(0, 500, "User Denied Applicaiton"));
+                                this.close();
+                                return;
+                        }
+                        if (html.location.indexOf("status=done") >= 0) {
+                                result("applicationAuthorized");
+                                this.close();
+                                return;
+                        }
+                        if (html.location.indexOf("crossdomain.xml") >= 0) {
+                                result("applicationAuthorized");
+                                this.close();
+                                return;
+                        }
+                        if (html.location.indexOf("about:blank") >= 0) {
+                                result("applicationAuthorized");
+                                this.close();
+                                return;
+                        }
+                }
+               
+                private function get windowWidth():int {
+                        return 1000;
+                }
+
+                private function get windowHeight():int {
+                        return 500;
+                }
+               
+        }
+}

File src/com/photobucket/webapi/interfaces/IUser.as

 		function get defaultImageUploadSize():String;
 		function set defaultImageUploadSize(value:String):void;
 		function get contacts():ArrayCollection;
+		function get isPro():Boolean;
+		function setUploadOptions(defaultSize:String, autoTagging:String = "noChange", bulkuploadQuality:String = "noChange"):void
 		function getRecentMedia(type:String = "all", number:Number = 20, page:Number = 1):ArrayCollection;
 		function getRootAlbum():IAlbum;
 	}

File src/com/photobucket/webapi/objects/User.as

 			}
 		}
 
+		public function setUploadOptions(defaultSize:String, autoTagging:String = "noChange", bulkuploadQuality:String = "noChange"):void {
+				var request:IOAuthRequest = createRequest();
+				request.url = server + "/user/"+ id +"/uploadoption";
+				request.method = OAuthRequestMethod.PUT;
+				request.needsLogin = true;
+				request.addParameter("defaultimagesize", defaultSize);
+				if (autoTagging != "noChange") {
+					request.addParameter("autotagging", autoTagging);
+				}
+				if (bulkuploadQuality != "noChange") {
+					request.addParameter("bulkuploadquality", bulkuploadQuality);
+				}
+				request.fault = this.fault;
+				request.result = this.result;
+				pbservice.makeRequest(request);
+			
+		}
+
+
 		public function get contacts():ArrayCollection {
 			var contactList:ArrayCollection = new ArrayCollection();
 			var request:IOAuthRequest = createRequest();

File src/com/photobucket/webapi/service/PhotobucketChannel.as

 					onResult(new XML());
 				}
 			} else {
-				onFault(new PhotobucketException(lastResponceCode, xml.code, xml.message));
+				onFault(new PhotobucketException(lastResponceCode, xml.code, xml.toXMLString()));
 			}
 		
 		}

File src/com/photobucket/webapi/service/PhotobucketService.as

 		override oauth_internal function signRequest(request:IOAuthRequest):void {
 			request.addParameter("format", "XML");
 			request.addParameter("_method", request.method);
+			//request.addParameter("skiphttpcode", "true");
 			super.signRequest(request);
 		}