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           '|xns' : 'Roo.form',
136           name : 'id',
137           xns : Roo.form,
138           xtype : 'Hidden'
139          }
140         ]
141
142        }
143       ]
144
145      }
146     ]
147
148    });
149  }
150 };