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