New Bookmarks menu
[potlatch2.git] / net / systemeD / potlatch2 / dialogs / BookmarkNameDialog.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:TitleWindow
3         xmlns:fx="http://ns.adobe.com/mxml/2009"
4         xmlns:mx="library://ns.adobe.com/flex/mx"
5         xmlns:potlatch2="net.systemeD.potlatch2.*"
6         title="New Bookmark" width="350" height="160"
7         creationComplete="bookmarkName.setFocus()"
8         showCloseButton="true" close="PopUpManager.removePopUp(this);">
9         
10         <mx:HBox paddingLeft="3" paddingTop="4">
11                 <mx:Label text="Bookmark name: " />
12                 <mx:TextInput id="bookmarkName" enter="addBookmark();" />
13         </mx:HBox>
14     <mx:ControlBar>
15       <mx:Spacer width="100%"/>
16       <mx:Button label="Add" click="addBookmark();" styleName="titleWindowButton" />
17     </mx:ControlBar>
18         <fx:Script><![CDATA[
19                 import net.systemeD.halcyon.*;
20                 import net.systemeD.halcyon.connection.*;
21                 import net.systemeD.potlatch2.*;
22                 import mx.managers.PopUpManager;
23                 import mx.core.FlexGlobals;
24
25                 public function addBookmark():void {
26                         var controller:EditController = FlexGlobals.topLevelApplication.theController;
27                         FlexGlobals.topLevelApplication.bookmarkButton.popUp.bookmarks.addItem({ name: bookmarkName.text, lat: controller.map.centre_lat, lon: controller.map.centre_lon });
28                 PopUpManager.removePopUp(this);
29                 }
30
31     ]]></fx:Script>
32 </mx:TitleWindow>
33