initial import
[roojs1] / examples / view / chooser-example.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */\r
11 \r
12 Roo.onReady(function(){\r
13     var chooser, btn;\r
14     \r
15     function insertImage(data){\r
16         Roo.DomHelper.append('images', {\r
17                 tag: 'img', src: data.url, style:'margin:10px;visibility:hidden;'\r
18         }, true).show(true);\r
19         btn.getEl().focus();\r
20     };\r
21     \r
22     function choose(btn){\r
23         if(!chooser){\r
24                 chooser = new ImageChooser({\r
25                         url:'get-images.php',\r
26                         width:515, \r
27                         height:400\r
28                 });\r
29         }\r
30         chooser.show(btn.getEl(), insertImage);\r
31     };\r
32     \r
33     btn = new Roo.Button('buttons', {\r
34             text: "Insert Image",\r
35                 handler: choose\r
36         });\r
37 });\r