deff50e961cdaf776f2c1c039a773598dc2b9ea9
[Pman.Core] / Pman.Dialog.CoreColumnConfig.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.CoreColumnConfig = {
8
9  _strings : {
10   'cfcd208495d565ef66e7dff9f98764da' :"0",
11   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
12   'c40cab5f875bb6c270d800eff77a4af0' :"Save Column Configuration",
13   'b5a7adde1af5c87d7fd797b6245c2a39' :"Description",
14   'c9cc8cce247e49bae79f15173ce97354' :"Save"
15  },
16  _named_strings : {
17   'description_fieldLabel' : 'b5a7adde1af5c87d7fd797b6245c2a39' /* Description */ ,
18   'name_value' : 'cfcd208495d565ef66e7dff9f98764da' /* 0 */ 
19  },
20
21  dialog : false,
22  callback:  false,
23
24  show : function(data, cb)
25  {
26   if (!this.dialog) {
27    this.create();
28   }
29
30   this.callback = cb;
31   this.data = data;
32   this.dialog.show(this.data._el);
33   if (this.form) {
34    this.form.reset();
35    this.form.setValues(data);
36    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
37   }
38
39  },
40
41  create : function()
42  {
43    var _this = this;
44    this.dialog = Roo.factory({
45     xtype : 'LayoutDialog',
46     background : true,
47     closable : false,
48     collapsible : false,
49     height : 110,
50     modal : true,
51     resizable : false,
52     title : _this._strings['c40cab5f875bb6c270d800eff77a4af0'] /* Save Column Configuration */,
53     width : 400,
54     listeners : {
55      show : function (_self)
56       {
57           
58       }
59     },
60     xns : Roo,
61     '|xns' : 'Roo',
62     center : {
63      xtype : 'LayoutRegion',
64      titlebar : false,
65      xns : Roo,
66      '|xns' : 'Roo'
67     },
68     buttons : [
69      {
70       xtype : 'Button',
71       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
72       listeners : {
73        click : function() {
74             _this.form.reset();
75             _this.dialog.hide();
76         }
77       },
78       xns : Roo,
79       '|xns' : 'Roo'
80      },
81      {
82       xtype : 'Button',
83       text : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
84       listeners : {
85        click : function() {
86         
87             var name =     _this.form.findField('name').getValue();
88             name = name.toUpperCase().replace(/[^A-Z]+/g, '');
89             if (!name.length) {
90                 Roo.MessageBox.alert("Error","Please fill in a valid name");
91                 return;
92             }
93             _this.form.findField('name').setValue(name);
94          
95             _this.form.doAction('submit');
96             
97         }
98       },
99       xns : Roo,
100       '|xns' : 'Roo'
101      }
102     ],
103     items  : [
104      {
105       xtype : 'ContentPanel',
106       background : true,
107       fitToFrame : true,
108       region : 'center',
109       xns : Roo,
110       '|xns' : 'Roo',
111       items  : [
112        {
113         xtype : 'Form',
114         method : 'POST',
115         style : 'padding:5px',
116         url : baseURL + '/Roo/core_setting',
117         listeners : {
118          actioncomplete : function (_self, action)
119           {
120             if (action.type == 'setdata') {
121           
122                   
123                   
124                   if(typeof(_this.data.title) != 'undefined' && _this.data.title.length){
125                       _this.dialog.setTitle(_this.data.title);
126                   }
127             
128                   if(_this.data.id){
129                       _this.dialog.el.mask("Loading");
130                       this.load({ method: 'GET', params: { '_id' : _this.data.id }}); 
131                   }
132                  
133                  return;
134               }
135               if (action.type == 'load') {
136                   _this.dialog.el.unmask();
137                   return;
138               }
139               if (action.type == 'submit' ) {
140                   _this.dialog.el.unmask();
141                   _this.dialog.hide();
142           
143                   if (_this.callback) {
144                      _this.callback.call(_this, action.result.data);
145                   }
146                   _this.form.reset();
147               }
148           },
149          rendered : function (form)
150           {
151              _this.form = form;
152           }
153         },
154         xns : Roo.form,
155         '|xns' : 'Roo.form',
156         items  : [
157          {
158           xtype : 'TextField',
159           allowBlank : false,
160           fieldLabel : _this._strings['b5a7adde1af5c87d7fd797b6245c2a39'] /* Description */,
161           name : 'description',
162           width : 250,
163           listeners : {
164            keyup : function (_self, e)
165             {
166                 _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
167                 
168             }
169           },
170           xns : Roo.form,
171           '|xns' : 'Roo.form'
172          },
173          {
174           xtype : 'Hidden',
175           name : 'module',
176           xns : Roo.form,
177           '|xns' : 'Roo.form'
178          },
179          {
180           xtype : 'Hidden',
181           name : 'val',
182           xns : Roo.form,
183           '|xns' : 'Roo.form'
184          },
185          {
186           xtype : 'Hidden',
187           name : 'name',
188           value : 0,
189           xns : Roo.form,
190           '|xns' : 'Roo.form'
191          },
192          {
193           xtype : 'Hidden',
194           name : 'id',
195           xns : Roo.form,
196           '|xns' : 'Roo.form'
197          }
198         ]
199        }
200       ]
201      }
202     ]
203    });
204  }
205 };