If the upload freaks out and refuses to save, the user can at least copy and paste the raw XML for later use.
public function setAccessToken(key:String, secret:String):void {}
public function createChangeset(tags:Object):void {}
public function closeChangeset():void {}
public function setAccessToken(key:String, secret:String):void {}
public function createChangeset(tags:Object):void {}
public function closeChangeset():void {}
- public function uploadChanges():void {}
+ public function uploadChanges():* {}
public function fetchUserTraces(refresh:Boolean=false):void {}
public function fetchTrace(id:Number, callback:Function):void {}
public function hasAccessToken():Boolean { return false; }
public function fetchUserTraces(refresh:Boolean=false):void {}
public function fetchTrace(id:Number, callback:Function):void {}
public function hasAccessToken():Boolean { return false; }
- override public function uploadChanges():void {
+ /** Create XML changeset and send it to the server. Returns the XML string for use in the 'Show data' button.
+ (We don't mind what's returned as long as it implements .toString() ) */
+
+ override public function uploadChanges():* {
var changeset:Changeset = getActiveChangeset();
var upload:XML = <osmChange version="0.6"/>
upload.appendChild(addCreated(changeset, getAllNodeIDs, getNode, serialiseNode));
var changeset:Changeset = getActiveChangeset();
var upload:XML = <osmChange version="0.6"/>
upload.appendChild(addCreated(changeset, getAllNodeIDs, getNode, serialiseNode));
serv.addEventListener(FaultEvent.FAULT, diffUploadIOError);
serv.send(upload);
serv.addEventListener(FaultEvent.FAULT, diffUploadIOError);
serv.send(upload);
- dispatchEvent(new Event(SAVE_STARTED));
+ dispatchEvent(new Event(SAVE_STARTED));
+ return upload;
}
private function diffUploadComplete(event:ResultEvent):void {
}
private function diffUploadComplete(event:ResultEvent):void {
<mx:Text width="100%" styleName="failText" text="{failureText}"/>
</mx:VBox>
<mx:Text width="100%" styleName="failText" text="{failureText}"/>
</mx:VBox>
+ <mx:VBox width="100%" height="100%" id="dataTab">
+ <mx:TextArea width="100%" height="100%" id="dataText"/>
+ </mx:VBox>
+
</mx:ViewStack>
<mx:ControlBar>
</mx:ViewStack>
<mx:ControlBar>
+ <mx:Button id="dataButton" label="View data" visible="false" click="processSequence.selectedChild=dataTab" styleName="titleWindowButton" />
<mx:Spacer width="100%"/>
<mx:Button id="cancelButton" label="Cancel" click="close();" styleName="titleWindowButton" />
<mx:Button id="saveButton" label="Save >" click="startSave();" styleName="titleWindowButton" />
<mx:Spacer width="100%"/>
<mx:Button id="cancelButton" label="Cancel" click="close();" styleName="titleWindowButton" />
<mx:Button id="saveButton" label="Save >" click="startSave();" styleName="titleWindowButton" />
saveProgress.label = "Uploading changes";
_connection.addEventListener(Connection.SAVE_COMPLETED, saveCompleted);
saveProgress.label = "Uploading changes";
_connection.addEventListener(Connection.SAVE_COMPLETED, saveCompleted);
- _connection.uploadChanges();
+ var rawData:*=_connection.uploadChanges();
+ if (rawData) {
+ dataText.text=rawData.toString();
+ dataButton.visible=true;
+ }
}
private function changesetError(event:Event):void {
}
private function changesetError(event:Event):void {
private function saveCompleted(event:SaveCompleteEvent):void {
if ( event.saveOK ) {
_connection.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, "Changes successfully saved"));
private function saveCompleted(event:SaveCompleteEvent):void {
if ( event.saveOK ) {
_connection.dispatchEvent(new AttentionEvent(AttentionEvent.ALERT, null, "Changes successfully saved"));
+ if (processSequence.selectedChild!=dataTab) close();
} else {
fail("Failure when uploading data");
}
} else {
fail("Failure when uploading data");
}
processSequence.selectedChild = failureTab;
failureText = text;
}
processSequence.selectedChild = failureTab;
failureText = text;
}
private function close():void {
_connection.removeEventListener(Connection.NEW_CHANGESET, changesetCreated);
_connection.removeEventListener(Connection.NEW_CHANGESET_ERROR, changesetError);
private function close():void {
_connection.removeEventListener(Connection.NEW_CHANGESET, changesetCreated);
_connection.removeEventListener(Connection.NEW_CHANGESET_ERROR, changesetError);