Pman.Gnumeric.js
[Pman.Core] / Pman.Dialog.CoreEnum.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.CoreEnum = {
8
9  _strings : {
10   '518ad9ed87d3ca17e223a91604b464d5' :"Add / Edit Core Enum",
11   'cfcd208495d565ef66e7dff9f98764da' :"0",
12   'b48968e1c912da07df5e8d6d246291ec' :"Display Name",
13   'c4ca4238a0b923820dcc509a6f75849b' :"1",
14   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
15   '49ee3087348e8d44e1feda1917443987' :"Name",
16   '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
17   'e0aa021e21dddbd6d8cecec71e9cf564' :"OK"
18  },
19  _named_strings : {
20   'display_name_fieldLabel' : 'b48968e1c912da07df5e8d6d246291ec' /* Display Name */ ,
21   'seqid_value' : 'cfcd208495d565ef66e7dff9f98764da' /* 0 */ ,
22   'name_fieldLabel' : '49ee3087348e8d44e1feda1917443987' /* Name */ ,
23   'active_fieldLabel' : '4d3d769b812b6faa6b76e1a8abaece2d' /* Active */ ,
24   'active_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ 
25  },
26
27  dialog : false,
28  callback:  false,
29
30  show : function(data, cb)
31  {
32   if (!this.dialog) {
33    this.create();
34   }
35
36   this.callback = cb;
37   this.data = data;
38   this.dialog.show(this.data._el);
39   if (this.form) {
40    this.form.reset();
41    this.form.setValues(data);
42    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
43   }
44
45  },
46
47  create : function()
48  {
49    var _this = this;
50    this.dialog = Roo.factory({
51     xtype : 'LayoutDialog',
52     background : true,
53     closable : false,
54     collapsible : false,
55     height : 150,
56     modal : true,
57     resizable : false,
58     title : _this._strings['518ad9ed87d3ca17e223a91604b464d5'] /* Add / Edit Core Enum */,
59     width : 400,
60     listeners : {
61      show : function (_self)
62       {
63           
64       }
65     },
66     xns : Roo,
67     '|xns' : 'Roo',
68     center : {
69      xtype : 'LayoutRegion',
70      titlebar : false,
71      xns : Roo,
72      '|xns' : 'Roo'
73     },
74     buttons : [
75      {
76       xtype : 'Button',
77       text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
78       listeners : {
79        click : function() {
80             _this.form.reset();
81             _this.dialog.hide();
82         }
83       },
84       xns : Roo,
85       '|xns' : 'Roo'
86      },
87      {
88       xtype : 'Button',
89       text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */,
90       listeners : {
91        click : function() {
92         
93             var name =     _this.form.findField('name').getValue();
94             name = name.toUpperCase().replace(/[^A-Z]+/g, '');
95             if (!name.length) {
96                 Roo.MessageBox.alert("Error","Please fill in a valid name");
97                 return;
98             }
99             _this.form.findField('name').setValue(name);
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                   if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){
129                       Roo.MessageBox.alert('Error', 'Missing etype');
130                       _this.dialog.hide();
131                       return;
132                   }
133                   
134                   if(typeof(_this.data.title) != 'undefined' && _this.data.title.length){
135                       _this.dialog.setTitle(_this.data.title);
136                   }
137             
138                   if(_this.data.id){
139                       _this.dialog.el.mask("Loading");
140                       this.load({ method: 'GET', params: { '_id' : _this.data.id }}); 
141                   }
142                  
143                  return;
144               }
145               if (action.type == 'load') {
146                   _this.dialog.el.unmask();
147                   return;
148               }
149               if (action.type == 'submit' ) {
150                   _this.dialog.el.unmask();
151                   _this.dialog.hide();
152           
153                   if (_this.callback) {
154                      _this.callback.call(_this, action.result.data);
155                   }
156                   _this.form.reset();
157               }
158           },
159          rendered : function (form)
160           {
161              _this.form = form;
162           }
163         },
164         xns : Roo.form,
165         '|xns' : 'Roo.form',
166         items  : [
167          {
168           xtype : 'TextField',
169           actionMode : 'fieldEl',
170           allowBlank : false,
171           fieldLabel : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
172           hidden : true,
173           name : 'name',
174           width : 200,
175           xns : Roo.form,
176           '|xns' : 'Roo.form'
177          },
178          {
179           xtype : 'TextField',
180           allowBlank : false,
181           fieldLabel : _this._strings['b48968e1c912da07df5e8d6d246291ec'] /* Display Name */,
182           name : 'display_name',
183           width : 200,
184           listeners : {
185            keyup : function (_self, e)
186             {
187                 _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
188                 
189             }
190           },
191           xns : Roo.form,
192           '|xns' : 'Roo.form'
193          },
194          {
195           xtype : 'Checkbox',
196           actionMode : 'fieldEl',
197           checked : true,
198           fieldLabel : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
199           hidden : true,
200           inputValue : 1,
201           name : 'active',
202           value : 1,
203           valueOff : 0,
204           xns : Roo.form,
205           '|xns' : 'Roo.form'
206          },
207          {
208           xtype : 'Hidden',
209           name : 'etype',
210           xns : Roo.form,
211           '|xns' : 'Roo.form'
212          },
213          {
214           xtype : 'Hidden',
215           name : 'seqid',
216           value : 0,
217           xns : Roo.form,
218           '|xns' : 'Roo.form'
219          },
220          {
221           xtype : 'Hidden',
222           name : 'id',
223           xns : Roo.form,
224           '|xns' : 'Roo.form'
225          }
226         ]
227        }
228       ]
229      }
230     ]
231    });
232  }
233 };