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   '03e956f1dca2b4d525df03cb1899cb6f' :"Merge with",
12   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
13   'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
14  },
15
16  dialog : false,
17  callback:  false,
18
19  show : function(data, cb)
20  {
21   if (!this.dialog) {
22    this.create();
23   }
24
25   this.callback = cb;
26   this.data = data;
27   this.dialog.show(this.data._el);
28   if (this.form) {
29    this.form.reset();
30    this.form.setValues(data);
31    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
32   }
33
34  },
35
36  create : function()
37  {
38    var _this = this;
39    this.dialog = Roo.factory({
40     background : true,
41     closable : false,
42     collapsible : false,
43     height : 150,
44     modal : true,
45     resizable : false,
46     title : _this._strings['0b3e4317865feb6f0224397600b7cafc'] /* Merge Core Enum */,
47     width : 400,
48     xns : Roo,
49     '|xns' : 'Roo',
50     xtype : 'LayoutDialog',
51     listeners : {
52      show : function (_self)
53       {
54           _this.merge.focus();
55       }
56     },
57     center : {
58      titlebar : false,
59      xns : Roo,
60      '|xns' : 'Roo',
61      xtype : 'LayoutRegion'
62     },
63     buttons : [
64      {
65       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
66       xns : Roo,
67       '|xns' : 'Roo',
68       xtype : 'Button',
69       listeners : {
70        click : function() {
71             _this.form.reset();
72             _this.dialog.hide();
73         }
74       }
75      },
76      {
77       text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
78       xns : Roo,
79       '|xns' : 'Roo',
80       xtype : 'Button',
81       listeners : {
82        click : function() {
83         
84             
85             _this.form.doAction('submit');
86             
87         }
88       }
89      }
90     ],
91     items  : [
92      {
93       background : true,
94       fitToFrame : true,
95       region : 'center',
96       xns : Roo,
97       '|xns' : 'Roo',
98       xtype : 'ContentPanel',
99       items  : [
100        {
101         method : 'POST',
102         style : 'margin: 5px',
103         url : baseURL + '/Roo/core_enum.php',
104         xns : Roo.form,
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           alwaysQuery : true,
136           displayField : 'display_name',
137           editable : true,
138           fieldLabel : _this._strings['03e956f1dca2b4d525df03cb1899cb6f'] /* Merge with */,
139           forceSelection : true,
140           hiddenName : '_merge_id',
141           listWidth : 250,
142           minChars : 2,
143           name : 'merge_display_name',
144           pageSize : 50,
145           queryParam : 'query[search]',
146           selectOnFocus : true,
147           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
148           triggerAction : 'all',
149           valueField : 'id',
150           width : 250,
151           xns : Roo.form,
152           '|xns' : 'Roo.form',
153           xtype : 'ComboBox',
154           listeners : {
155            render : function (_self)
156             {
157                 _this.merge = this;
158             }
159           },
160           store : {
161            remoteSort : true,
162            sortInfo : { direction : 'ASC', field: 'display_name' },
163            xns : Roo.data,
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            proxy : {
176             method : 'GET',
177             url : baseURL + '/Roo/Core_enum.php',
178             xns : Roo.data,
179             '|xns' : 'Roo.data',
180             xtype : 'HttpProxy'
181            },
182            reader : {
183             fields : [
184                 {
185                     "name":"id",
186                     "type":"int"
187                 },
188                 {
189                     "name":"display_name",
190                     "type":"string"
191                 }
192             ],
193             id : 'id',
194             root : 'data',
195             totalProperty : 'total',
196             xns : Roo.data,
197             '|xns' : 'Roo.data',
198             xtype : 'JsonReader'
199            }
200           }
201          },
202          {
203           name : 'id',
204           xns : Roo.form,
205           '|xns' : 'Roo.form',
206           xtype : 'Hidden'
207          }
208         ]
209        }
210       ]
211      }
212     ]
213    });
214  }
215 };