<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>examples/movement_test.html</filename>
    </added>
    <added>
      <filename>platforms/webOS/helpers/network.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,4 @@
 .DS_Store
-SpazCore.kpf
+*.kpf
 docs
 spazcore-*.js
-</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -61,10 +61,29 @@ SpazFileUploader.prototype.getAPIs = function() {
 	var thisSFU = this;
 
 	var apis = {
+		'pikchur' : {
+		    'upload_url' : 'http://api.pikchur.com/simple/upload',
+			'api_key_field': 'api_key', // setting this to non-empty means we MUST set an api key
+			'processResult': function(event, apiobj) {
+				var loader = event.target;
+
+				var parser=new DOMParser();
+				var xmldoc = parser.parseFromString(loader.data,&quot;text/xml&quot;);
+
+				var rspAttr = xmldoc.getElementsByTagName(&quot;rsp&quot;)[0].attributes;
+				if (rspAttr.getNamedItem(&quot;stat&quot;).nodeValue === 'ok')
+				{
+					var mediaurl = jQuery(xmldoc).find('mediaurl').text();
+				} 
+				else
+				{
+					var errAttributes = xmldoc.getElementsByTagName(&quot;err&quot;)[0].attributes;
+					var errMsg = errAttributes.getNamedItem(&quot;msg&quot;).nodeValue;
+				}
+			}
+		},
 		'yfrog' : {
 		    'upload_url' : 'http://yfrog.com/api/upload',
-			'gethumb_url': '',
-			'getfull_url': '',
 			'processResult': function(event, apiobj) {
 				var loader = event.target;
 
@@ -85,8 +104,6 @@ SpazFileUploader.prototype.getAPIs = function() {
 		},
 	    'twitpic' : {
 			'upload_url' : 'http://twitpic.com/api/upload',
-			'gethumb_url': '',
-			'getfull_url': '',
 			'processResult': function(event, apiobj) {
 				var loader = event.target;
 
@@ -107,8 +124,6 @@ SpazFileUploader.prototype.getAPIs = function() {
 		},
 		'twitgoo' : {
 			'upload_url' : 'http://twitgoo.com/api/upload',
-			'gethumb_url': '',
-			'getfull_url': '',
 			'processResult': function(event, apiobj) {
 				var loader = event.target;
 
@@ -126,7 +141,34 @@ SpazFileUploader.prototype.getAPIs = function() {
 					var errMsg = errAttributes.getNamedItem(&quot;msg&quot;).nodeValue;
 				}
 			}
-		}
+		}//,
+		/*
+			Not sure if we should continue to support tweetphoto; API is complex
+		*/
+		// 'tweetphoto': {
+		// 	'upload_url' : 'http://tweetphotoapi.com/api/tpapi.svc/upload2',
+		// 	'api_key_field': 'TPAPIKEY', // this means we need to set the api key
+		// 	'onBeforeSend' : function(extraParams, api.upload_url, file_url) {
+		// 	
+		// 	},
+		// 	'processResult': function(event, apiobj) {
+		// 		var loader = event.target;
+		// 
+		// 		var parser=new DOMParser();
+		// 		var xmldoc = parser.parseFromString(loader.data,&quot;text/xml&quot;);
+		// 
+		// 		if (jQuery(xmldoc).find('Status').text().toLowerCase() === 'ok')
+		// 		{
+		// 			var mediaurl = jQuery(xmldoc).find('MediaUrl').text();
+		// 		} 
+		// 		else
+		// 		{
+		// 			sch.error('There was an error uploading to TweetPhoto')
+		// 			var errAttributes = xmldoc.getElementsByTagName(&quot;err&quot;)[0].attributes;
+		// 			var errMsg = errAttributes.getNamedItem(&quot;msg&quot;).nodeValue;
+		// 		}
+		// 	}	
+		// }
 		
 	};
 
@@ -143,6 +185,30 @@ SpazFileUploader.prototype.setAPI = function(apilabel) {
 };
 
 /**
+ * some services require an api key or app identifier. This sets that.
+ * @param {string} api_key
+ */
+SpazFileUploader.prototype.setAPIkey = function(api_key) {
+	if (this.api) {
+		this.api.api_key = api_key;
+	} else {
+		sch.error('Must set the API before setting API key');
+	}
+};
+
+/**
+ * some services require an api key or app identifier. This sets that.
+ * @param {string} api_key
+ */
+SpazFileUploader.prototype.getAPIkey = function() {
+	if (this.api) {
+		return this.api.api_key;
+	} else {
+		sch.error('Must set the API before getting API key');
+	}
+};
+
+/**
  * opts = {
  *   'api':'', // use if not set already
  *   'username':'xxx',
@@ -156,14 +222,17 @@ SpazFileUploader.prototype.setAPI = function(apilabel) {
  */
 SpazFileUploader.prototype.upload = function(file_url, opts) {
 
-	var api;
+	var api, api_key;
 
 	var thisSFU = this;
 
 	if (opts.api) {
 		api = this.apis.api;
-	} else {
+	} else if (this.api) {
 		api = this.api;
+	} else {
+		sch.error('Must set the API before uploading');
+		return;
 	}
 	
 	var username = opts.username || null;
@@ -173,20 +242,35 @@ SpazFileUploader.prototype.upload = function(file_url, opts) {
 
 	var onStart = opts.onStart || null;
 
+	var extraParams = {
+		&quot;username&quot;: username,
+		&quot;password&quot;: password,
+		&quot;source&quot;:   source,
+		&quot;message&quot;:  message
+	};
+	
+	/**
+	 * if we have an API key field, then we need the api key 
+	 */
+	if ( (api.api_key_field) ) {
+		extraParams[api.api_key_field] = api.getAPIkey();
+	}
 
-
+	/*
+		A callback in case we need to massage the data before upload
+	*/
+	if (api.onBeforeSend) {
+		api.onBeforeSend.call(api, extraParams, api.upload_url, file_url);
+	}
+	
+	
 	// upload the file
-	sc.helpers.uploadFile({
-		'extra'  :{
-			&quot;username&quot;: username,
-			&quot;password&quot;: password,
-			&quot;source&quot;:   source,
-			&quot;message&quot;:  message
-		},
+	sc.helpers.HTTPUploadFile({
+		'extra'  :extraParams,
 		'url'    :api.upload_url,
 		'file_url':file_url,
-		'onStart' : function(event) {},
-		'onComplete': function(event) {
+		'onSuccess' : function(event) {},
+		'onFailure': function(event) {
 			api.processResult.call(thisSFU, event, api);
 		}
 	});</diff>
      <filename>libs/spazfileuploader.js</filename>
    </modified>
    <modified>
      <diff>@@ -1007,7 +1007,8 @@ SpazTwit.prototype._processSearchItem = function(item, section_name) {
 	*/
 	item.user = {
 		'profile_image_url':item.profile_image_url,
-		'screen_name':item.from_user
+		'screen_name':item.from_user,
+		'id':item.from_user_id
 	};
 	
 	/*</diff>
      <filename>libs/spaztwit.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>20847c2cbb4cbedaeedc14c7b628bbf4fdc6f74c</id>
    </parent>
  </parents>
  <author>
    <name>Ed Finkler</name>
    <email>funkatron@gmail.com</email>
  </author>
  <url>http://github.com/funkatron/spazcore/commit/f3553976fac476ace4e41376e1758212388f4c7d</url>
  <id>f3553976fac476ace4e41376e1758212388f4c7d</id>
  <committed-date>2009-10-14T08:01:01-07:00</committed-date>
  <authored-date>2009-10-14T08:01:01-07:00</authored-date>
  <message>- refactored search result tweet objects in SpazTwit.js to map better to standard structure
- finished up basic work on spazfileuploader.js and added HTTPUploadFile helper (only in WebOS so far). Not tested AT ALL yet, tho.
- added basics of a keyboard-navigatable scrolling view in examples/movement_test.html, although this functionality is not yet set up as a spazcore library</message>
  <tree>be64d9d1e373a95fadd6f4e9172beb5207121bd0</tree>
  <committer>
    <name>Ed Finkler</name>
    <email>funkatron@gmail.com</email>
  </committer>
</commit>
