Pman.Dialog.AdminWatch.bjs
[Pman.Admin] / Pman.Dialog.AdminWatch.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.AdminWatch = {
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             height : 230,
36             resizable : false,
37             title : "Edit / Create core_watch",
38             width : 400,
39             items : [
40                 {
41                     xtype: 'ContentPanel',
42                     xns: Roo,
43                     region : 'center',
44                     items : [
45                         {
46                             xtype: 'Form',
47                             xns: Roo.form,
48                             listeners : {
49                                 actioncomplete : function(_self,action)
50                                 {
51                                     if (action.type == 'setdata') {
52                                        //_this.dialog.el.mask("Loading");
53                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
54                                        return;
55                                     }
56                                     if (action.type == 'load') {
57                                         _this.dialog.el.unmask();
58                                         return;
59                                     }
60                                     if (action.type =='submit') {
61                                     
62                                         _this.dialog.el.unmask();
63                                         _this.dialog.hide();
64                                     
65                                          if (_this.callback) {
66                                             _this.callback.call(_this, _this.form.getValues());
67                                          }
68                                          _this.form.reset();
69                                          return;
70                                     }
71                                 },
72                                 rendered : function (form)
73                                 {
74                                     _this.form= form;
75                                 }
76                             },
77                             method : 'POST',
78                             style : 'margin:10px;',
79                             url : baseURL + '/Roo/core_watch.php',
80                             items : [
81                                 {
82                                     xtype: 'TextField',
83                                     xns: Roo.form,
84                                     fieldLabel : 'Ontable',
85                                     name : 'ontable',
86                                     width : 200
87                                 },
88                                 {
89                                     xtype: 'TextField',
90                                     xns: Roo.form,
91                                     fieldLabel : 'Onid',
92                                     name : 'onid',
93                                     width : 75
94                                 },
95                                 {
96                                     xtype: 'ComboBox',
97                                     xns: Roo.form,
98                                     allowBlank : 'false',
99                                     editable : 'false',
100                                     emptyText : "Select Person",
101                                     forceSelection : true,
102                                     listWidth : 400,
103                                     loadingText : "Searching...",
104                                     minChars : 2,
105                                     pageSize : 20,
106                                     qtip : "Select Person",
107                                     selectOnFocus : true,
108                                     triggerAction : 'all',
109                                     typeAhead : true,
110                                     width : 300,
111                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
112                                     queryParam : 'query[name]',
113                                     fieldLabel : 'Person',
114                                     valueField : 'id',
115                                     displayField : 'name',
116                                     hiddenName : 'person_id',
117                                     name : 'person_id_name',
118                                     store : {
119                                         xtype: 'Store',
120                                         xns: Roo.data,
121                                         remoteSort : true,
122                                         sortInfo : { direction : 'ASC', field: 'id' },
123                                         listeners : {
124                                             beforeload : function (_self, o){
125                                                 o.params = o.params || {};
126                                                 // set more here
127                                             }
128                                         },
129                                         proxy : {
130                                             xtype: 'HttpProxy',
131                                             xns: Roo.data,
132                                             method : 'GET',
133                                             url : baseURL + '/Roo/Person.php'
134                                         },
135                                         reader : {
136                                             xtype: 'JsonReader',
137                                             xns: Roo.data,
138                                             id : 'id',
139                                             root : 'data',
140                                             totalProperty : 'total',
141                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
142                                         }
143                                     }
144                                 },
145                                 {
146                                     xtype: 'TextField',
147                                     xns: Roo.form,
148                                     fieldLabel : 'Event',
149                                     name : 'event',
150                                     width : 200
151                                 },
152                                 {
153                                     xtype: 'TextField',
154                                     xns: Roo.form,
155                                     fieldLabel : 'Medium',
156                                     name : 'medium',
157                                     width : 200
158                                 },
159                                 {
160                                     xtype: 'TextField',
161                                     xns: Roo.form,
162                                     fieldLabel : 'Active',
163                                     name : 'active',
164                                     width : 75
165                                 },
166                                 {
167                                     xtype: 'Hidden',
168                                     xns: Roo.form,
169                                     name : 'id'
170                                 }
171                             ]
172                         }
173                     ]
174                 }
175             ],
176             center : {
177                 xtype: 'LayoutRegion',
178                 xns: Roo
179             },
180             buttons : [
181                 {
182                     xtype: 'Button',
183                     xns: Roo,
184                     listeners : {
185                         click : function (_self, e)
186                         {
187                             _this.dialog.hide();
188                         }
189                     },
190                     text : "Cancel"
191                 },
192                 {
193                     xtype: 'Button',
194                     xns: Roo,
195                     listeners : {
196                         click : function (_self, e)
197                         {
198                             // do some checks?
199                              
200                             
201                             _this.dialog.el.mask("Saving");
202                             _this.form.doAction("submit");
203                         
204                         }
205                     },
206                     text : "Save"
207                 }
208             ]
209         });
210     }
211 };