override public function loadEntity(entity:Entity):void {
var url:String=Connection.apiBaseURL + entity.getType() + "/" + entity.id;
- if (entity is Relation || entity is Way) url+="/full";
+ if (entity is Way) url+="/full";
sendLoadRequest(new URLRequest(url));
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<mx:TitleWindow
+ xmlns:mx="http://www.adobe.com/2006/mxml"
+ xmlns:potlatch2="net.systemeD.potlatch2.*"
+ title="Load Relation" width="350" height="200"
+ showCloseButton="true" close="PopUpManager.removePopUp(this);">
+
+ <mx:HBox>
+ <mx:Label text="Relation ID: " />
+ <mx:TextInput id="requestedID" restrict="0-9" />
+ </mx:HBox>
+ <mx:ControlBar>
+ <mx:Spacer width="100%"/>
+ <mx:Button label="Load" click="loadRelation();" styleName="titleWindowButton" />
+ </mx:ControlBar>
+ <mx:Script><![CDATA[
+ import net.systemeD.halcyon.*;
+ import net.systemeD.halcyon.connection.*;
+ import net.systemeD.potlatch2.*;
+ import mx.managers.PopUpManager;
+
+ // ** FIXME: should automatically focus on id field (like the Changeset dialogue)
+
+ public function loadRelation():void {
+ var conn:Connection = Connection.getConnectionInstance();
+ var id:uint = uint(requestedID.text);
+ if (requestedID.text) {
+ var rel:Relation=conn.getRelation(id);
+ if (!rel) {
+ rel = conn.createRelation({}, [], MainUndoStack.getGlobalStack().addAction);
+ rel.renumber(id,1);
+ }
+ conn.loadEntity(rel);
+ // add an eventListener of some sort to pop up the panel again once it's loaded
+ }
+ PopUpManager.removePopUp(this);
+ }
+ ]]></mx:Script>
+</mx:TitleWindow>
+
panel.setRelation(relation);
PopUpManager.centerPopUp(panel);
}
+
+ public function closeAndLoadRelation():void {
+ PopUpManager.removePopUp(this);
+ var panel:RelationLoaderPanel = RelationLoaderPanel(
+ PopUpManager.createPopUp(Application(Application.application), RelationLoaderPanel, true));
+ PopUpManager.centerPopUp(panel);
+ }
]]></mx:Script>
<mx:Text id="warning" text="" />
</mx:List>
<mx:ControlBar>
<mx:Button label="New Relation..." click="closeAndNewRelation();" styleName="titleWindowButton" />
+ <mx:Button label="Load Relation..." click="closeAndLoadRelation();" styleName="titleWindowButton" />
<mx:Spacer width="100%"/>
<mx:Button label="Select" click="updateEntityAndClose();" enabled="{relationSelector.selectedItems.length>0}" styleName="titleWindowButton" />
</mx:ControlBar>