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