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              
78              _this.form.doAction('submit');
79              
80          }
81        }
82       }
83     ],
84     items : [
85      {
86       '|xns' : 'Roo',
87       background : true,
88       fitToFrame : true,
89       region : 'center',
90       xns : Roo,
91       xtype : 'ContentPanel',
92       items : [
93        {
94         '|xns' : 'Roo.form',
95         method : 'POST',
96         style : 'margin: 5px',
97         url : baseURL + '/Roo/core_enum.php',
98         xns : Roo.form,
99         xtype : 'Form',
100         listeners : {
101          actioncomplete : function (_self, action)
102           {
103             if (action.type == 'setdata') {
104           
105                  return;
106               }
107               if (action.type == 'load') {
108                   _this.dialog.el.unmask();
109                   return;
110               }
111               if (action.type == 'submit' ) {
112                   _this.dialog.el.unmask();
113                   _this.dialog.hide();
114           
115                   if (_this.callback) {
116                      _this.callback.call(_this, action.result.data);
117                   }
118                   _this.form.reset();
119               }
120           },
121          rendered : function (form)
122           {
123              _this.form = form;
124           }
125         },
126         items : [
127          {
128           store : {
129            proxy : {
130             '|xns' : 'Roo.data',
131             method : 'GET',
132             url : baseURL + '/Roo/Core_enum.php',
133             xns : Roo.data,
134             xtype : 'HttpProxy'
135            },
136            reader : {
137             '|xns' : 'Roo.data',
138             fields : [
139                 {
140                     "name":"id",
141                     "type":"int"
142                 },
143                 {
144                     "name":"display_name",
145                     "type":"string"
146                 }
147             ],
148             id : 'id',
149             root : 'data',
150             totalProperty : 'total',
151             xns : Roo.data,
152             xtype : 'JsonReader'
153            },
154            '|xns' : 'Roo.data',
155            remoteSort : true,
156            sortInfo : { direction : 'ASC', field: 'display_name' },
157            xns : Roo.data,
158            xtype : 'Store',
159            listeners : {
160             beforeload : function (_self, o){
161                  o.params = o.params || {};
162                  
163                  o.params.active = 1;
164                  o.params.etype = _this.data.etype;
165                  o.params['!id'] = _this.data.id;
166              }
167            },
168            items : [
169
170            ]
171
172           },
173           '|xns' : 'Roo.form',
174           alwaysQuery : true,
175           displayField : 'display_name',
176           editable : true,
177           fieldLabel : 'Merge with',
178           forceSelection : true,
179           hiddenName : '_merge_id',
180           listWidth : 250,
181           minChars : 2,
182           name : 'merge_display_name',
183           pageSize : 50,
184           queryParam : 'query[search]',
185           selectOnFocus : true,
186           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> </div>',
187           triggerAction : 'all',
188           valueField : 'id',
189           width : 250,
190           xns : Roo.form,
191           xtype : 'ComboBox',
192           items : [
193
194           ]
195
196          },
197          {
198           '|xns' : 'Roo.form',
199           name : 'id',
200           xns : Roo.form,
201           xtype : 'Hidden'
202          }
203         ]
204
205        }
206       ]
207
208      }
209     ]
210
211    });
212  }
213 };