Pman.Dialog.AdminEnumMerge.bjs
[Pman.Admin] / Pman.Dialog.AdminEnumMerge.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.AdminEnumMerge = {
8
9  _strings : {
10   '0b3e4317865feb6f0224397600b7cafc' :"Merge Core Enum",
11   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
12   'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
13  },
14
15  dialog : false,
16  callback:  false,
17
18  show : function(data, cb)
19  {
20   if (!this.dialog) {
21    this.create();
22   }
23
24   this.callback = cb;
25   this.data = data;
26   this.dialog.show(this.data._el);
27   if (this.form) {
28    this.form.reset();
29    this.form.setValues(data);
30    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
31   }
32
33  },
34
35  create : function()
36  {
37    var _this = this;
38    this.dialog = Roo.factory({
39     center : {
40      '|xns' : 'Roo',
41      titlebar : false,
42      xns : Roo,
43      xtype : 'LayoutRegion'
44     },
45     '|xns' : 'Roo',
46     background : true,
47     closable : false,
48     collapsible : false,
49     height : 150,
50     modal : true,
51     resizable : false,
52     title : _this._strings['0b3e4317865feb6f0224397600b7cafc'],
53     width : 400,
54     xns : Roo,
55     xtype : 'LayoutDialog',
56     buttons : [
57       {
58        '|xns' : 'Roo',
59        text : _this._strings['ea4788705e6873b424c65e91c2846b19'],
60        xns : Roo,
61        xtype : 'Button',
62        listeners : {
63         click : function() {
64              _this.form.reset();
65              _this.dialog.hide();
66          }
67        }
68       },
69 {
70        '|xns' : 'Roo',
71        text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'],
72        xns : Roo,
73        xtype : 'Button',
74        listeners : {
75         click : function() {
76          
77              var name =     _this.form.findField('name').getValue();
78              name = name.toUpperCase().replace(/[^A-Z]+/g, '');
79              if (!name.length) {
80                  Roo.MessageBox.alert("Error","Please fill in a valid name");
81                  return;
82              }
83              _this.form.findField('name').setValue(name);
84           
85              _this.form.doAction('submit');
86              
87          }
88        }
89       }
90     ],
91     items : [
92      {
93       '|xns' : 'Roo',
94       background : true,
95       fitToFrame : true,
96       region : 'center',
97       xns : Roo,
98       xtype : 'ContentPanel',
99       items : [
100        {
101         '|xns' : 'Roo.form',
102         method : 'POST',
103         style : 'margin: 5px',
104         url : baseURL + '/Roo/core_enum.php',
105         xns : Roo.form,
106         xtype : 'Form',
107         listeners : {
108          actioncomplete : function (_self, action)
109           {
110             if (action.type == 'setdata') {
111           
112                  return;
113               }
114               if (action.type == 'load') {
115                   _this.dialog.el.unmask();
116                   return;
117               }
118               if (action.type == 'submit' ) {
119                   _this.dialog.el.unmask();
120                   _this.dialog.hide();
121           
122                   if (_this.callback) {
123                      _this.callback.call(_this, action.result.data);
124                   }
125                   _this.form.reset();
126               }
127           },
128          rendered : function (form)
129           {
130              _this.form = form;
131           }
132         },
133         items : [
134          {
135           store : {
136            proxy : {
137             '|xns' : 'Roo.data',
138             method : 'GET',
139             url : baseURL + '/Roo/Core_enum.php',
140             xns : Roo.data,
141             xtype : 'HttpProxy'
142            },
143            reader : {
144             '|xns' : 'Roo.data',
145             fields : [
146                 {
147                     "name":"id",
148                     "type":"int"
149                 },
150                 {
151                     "name":"display_name",
152                     "type":"string"
153                 }
154             ],
155             id : 'id',
156             root : 'data',
157             totalProperty : 'total',
158             xns : Roo.data,
159             xtype : 'JsonReader'
160            },
161            '|xns' : 'Roo.data',
162            remoteSort : true,
163            sortInfo : { direction : 'ASC', field: 'display_name' },
164            xns : Roo.data,
165            xtype : 'Store',
166            listeners : {
167             beforeload : function (_self, o){
168                  o.params = o.params || {};
169                  
170                  o.params.active = 1;
171                  o.params.etype = _this.data.etype;
172                  o.params['!id'] = _this.data.id;
173              }
174            },
175            items : [
176
177            ]
178
179           },
180           '|xns' : 'Roo.form',
181           alwaysQuery : true,
182           displayField : 'display_name',
183           editable : true,
184           fieldLabel : 'Merge with',
185           forceSelection : true,
186           hiddenName : '_merge_id',
187           listWidth : 250,
188           minChars : 2,
189           name : 'merge_display_name',
190           pageSize : 50,
191           queryParam : 'query[search]',
192           selectOnFocus : true,
193           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
194           triggerAction : 'all',
195           valueField : 'id',
196           width : 250,
197           xns : Roo.form,
198           xtype : 'ComboBox',
199           items : [
200
201           ]
202
203          },
204          {
205           '|xns' : 'Roo.form',
206           name : 'id',
207           xns : Roo.form,
208           xtype : 'Hidden'
209          }
210         ]
211
212        }
213       ]
214
215      }
216     ]
217
218    });
219  }
220 };