Pman.Dialog.CmsTranslateTemplates.bjs
[Pman.Cms] / Pman.Dialog.CmsTranslateTemplates.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.CmsTranslateTemplates = {
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             background : true,
34             closable : false,
35             collapsible : false,
36             height : 300,
37             modal : true,
38             resizable : false,
39             title : "Add / Edit Location Details",
40             width : 400,
41             items : [
42                 {
43                     xtype: 'ContentPanel',
44                     xns: Roo,
45                     background : true,
46                     fitToFrame : true,
47                     region : 'center',
48                     items : [
49                         {
50                             xtype: 'Form',
51                             xns: Roo.form,
52                             listeners : {
53                                 actionfailed : function (_self, action)
54                                 {
55                                     _this.dialog.el.unmask();
56                                     Pman.standardActionFailed(_self, action);
57                                 },
58                                 actioncomplete : function (_self, action)
59                                 {
60                                       
61                                     if (action.type == 'setdata') {
62                                        //_this.dialog.el.mask("Loading");
63                                        if (_this.data.id) {
64                                            this.load({ method: 'GET', params: { '_id' : _this.data.id }});
65                                        }
66                                        return;
67                                     }
68                                     if (action.type == 'load') {
69                                          return;
70                                     }
71                                     if (action.type =='submit') {
72                                         _this.dialog.hide();
73                                         if (_this.callback) {
74                                             _this.callback.call(_this, _this.form.getValues());
75                                         }
76                                         _this.form.reset();
77                                         return;
78                                     }
79                                 },
80                                 rendered : function (form)
81                                 {
82                                    _this.form = form;
83                                 }
84                             },
85                             method : 'POST',
86                             style : 'margin: 5px',
87                             url : baseURL + '/Roo/Ris_location.php',
88                             items : [
89                                 {
90                                     xtype: 'Row',
91                                     xns: Roo.form,
92                                     labelAlign : 'top',
93                                     items : [
94                                         {
95                                             xtype: 'TextArea',
96                                             xns: Roo.form,
97                                             disabled : true,
98                                             fieldLabel : 'Original',
99                                             name : 'src_id_txt'
100                                         }
101                                     ]
102                                 },
103                                 {
104                                     xtype: 'Row',
105                                     xns: Roo.form,
106                                     labelAlign : 'top',
107                                     items : [
108                                         {
109                                             xtype: 'TextArea',
110                                             xns: Roo.form,
111                                             fieldLabel : 'Translation',
112                                             name : 'txt'
113                                         }
114                                     ]
115                                 },
116                                 {
117                                     xtype: 'DisplayField',
118                                     xns: Roo.form,
119                                     value : "aaaaaaaaaaaaaaa"
120                                 },
121                                 {
122                                     xtype: 'Row',
123                                     xns: Roo.form
124                                 }
125                             ]
126                         }
127                     ]
128                 }
129             ],
130             center : {
131                 xtype: 'LayoutRegion',
132                 xns: Roo,
133                 titlebar : false
134             },
135             buttons : [
136                 {
137                     xtype: 'Button',
138                     xns: Roo,
139                     text : "Cancel",
140                     listeners : {
141                         click : function() {
142                             _this.form.reset();
143                             _this.dialog.hide();
144                         }
145                     }
146                 },
147                 {
148                     xtype: 'Button',
149                     xns: Roo,
150                     text : "OK",
151                     listeners : {
152                         click : function() {
153                             _this.dialog.el.mask("Saving");
154                             _this.form.doAction('submit');
155                             
156                         }
157                     }
158                 }
159             ]
160         });
161     }
162 };