Uncommited changes synced
[Pman.Cms] / Pman.Dialog.CmsCategoryType.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.CmsCategoryType = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             listeners : {
34                 show : function (_self)
35                 {
36                   this.form.findField('name').focus();
37                 
38                 }
39             },
40             closable : false,
41             collapsible : false,
42             height : 120,
43             resizable : false,
44             title : "Edit / Create Category Type",
45             width : 400,
46             items : [
47                 {
48                     xtype: 'ContentPanel',
49                     xns: Roo,
50                     region : 'center',
51                     items : [
52                         {
53                             xtype: 'Form',
54                             xns: Roo.form,
55                             listeners : {
56                                 actioncomplete : function(_self,action)
57                                 {
58                                     if (action.type == 'setdata') {
59                                        //_this.dialog.el.mask("Loading");
60                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
61                                        return;
62                                     }
63                                     if (action.type == 'load') {
64                                         _this.dialog.el.unmask();
65                                         return;
66                                     }
67                                     if (action.type =='submit') {
68                                     
69                                         _this.dialog.el.unmask();
70                                         _this.dialog.hide();
71                                     
72                                          if (_this.callback) {
73                                             _this.callback.call(_this, _this.form.getValues());
74                                          }
75                                          _this.form.reset();
76                                          return;
77                                     }
78                                 },
79                                 rendered : function (form)
80                                 {
81                                     _this.form= form;
82                                 }
83                             },
84                             method : 'POST',
85                             style : 'margin:10px;',
86                             url : baseURL + '/Roo/cms_category_type.php',
87                             items : [
88                                 {
89                                     xtype: 'TextField',
90                                     xns: Roo.form,
91                                     fieldLabel : 'Name',
92                                     name : 'name',
93                                     width : 240
94                                 },
95                                 {
96                                     xtype: 'Hidden',
97                                     xns: Roo.form,
98                                     name : 'id'
99                                 }
100                             ]
101                         }
102                     ]
103                 }
104             ],
105             center : {
106                 xtype: 'LayoutRegion',
107                 xns: Roo
108             },
109             buttons : [
110                 {
111                     xtype: 'Button',
112                     xns: Roo,
113                     listeners : {
114                         click : function (_self, e)
115                         {
116                             _this.dialog.hide();
117                         }
118                     },
119                     text : "Cancel"
120                 },
121                 {
122                     xtype: 'Button',
123                     xns: Roo,
124                     listeners : {
125                         click : function (_self, e)
126                         {
127                             // do some checks?
128                              
129                             
130                             _this.dialog.el.mask("Saving");
131                             _this.form.doAction("submit");
132                         
133                         }
134                     },
135                     text : "Save"
136                 }
137             ]
138         });
139     }
140 };