Pman.Dialog.CoreImportUrl.bjs
[Pman.Core] / Pman.Dialog.CoreImportUrl.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CoreImportUrl = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             draggable : false,
36             height : 140,
37             modal : true,
38             resizable : false,
39             title : "Import URL",
40             width : 500,
41             items : [
42                 {
43                     xtype: 'ContentPanel',
44                     xns: Roo,
45                     region : 'center',
46                     items : [
47                         {
48                             xtype: 'Form',
49                             xns: Roo.form,
50                             listeners : {
51                                 actioncomplete : function (_self, action)
52                                 {
53                                      if (action.type == 'setdata') {\r
54                                        // _this.dialog.el.mask("Loading");\r
55                                        // if(_this.data.id*1 > 0)\r
56                                        //     this.load({ method: 'GET', params: { '_id' : _this.data.id }});\r
57                                        \r
58                                        return;\r
59                                     }\r
60                                     if (action.type == 'load') {\r
61                                  \r
62                                         return;\r
63                                     }\r
64                                     if (action.type =='submit') {\r
65                                     \r
66                                         //action.result.data\r
67                                         _this.dialog.hide();\r
68                                     //    Roo.log(_this.callback);\r
69                                          if (_this.callback) {\r
70                                             _this.callback.call(_this, action.result.data);\r
71                                          }\r
72                                          _this.form.reset();\r
73                                          return;\r
74                                     }
75                                 },
76                                 rendered : function (form)
77                                 {
78                                     _this.form= form;
79                                 }
80                             },
81                             method : 'POST',
82                             style : 'margin:10px;',
83                             url : baseURL,
84                             items : [
85                                 {
86                                     xtype: 'TextField',
87                                     xns: Roo.form,
88                                     fieldLabel : 'URL',
89                                     name : 'importUrl',
90                                     vtype : 'url',
91                                     width : 250
92                                 }
93                             ]
94                         }
95                     ]
96                 }
97             ],
98             center : {
99                 xtype: 'LayoutRegion',
100                 xns: Roo
101             },
102             buttons : [
103                 {
104                     xtype: 'Button',
105                     xns: Roo,
106                     listeners : {
107                         click : function (_self, e)
108                         {
109                             _this.dialog.hide();
110                         }
111                     },
112                     text : "Cancel"
113                 },
114                 {
115                     xtype: 'Button',
116                     xns: Roo,
117                     listeners : {
118                         click : function (_self, e)
119                         {
120                             _this.form.doAction("submit");
121                         }
122                     },
123                     text : "OK"
124                 }
125             ]
126         });
127     }
128 };