OutputTranslations.php
[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 : 450,
37             modal : true,
38             resizable : true,
39             title : "Edit Translation",
40             width : 800,
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                                        
64                                        Roo.log(_this.data);
65                                        return;
66                                     }
67                                     if (action.type == 'load') {
68                                          return;
69                                     }
70                                     if (action.type =='submit') {
71                                         _this.dialog.hide();
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: 5px',
86                             items : [
87                                 {
88                                     xtype: 'Row',
89                                     xns: Roo.form,
90                                     labelAlign : 'top',
91                                     items : [
92                                         {
93                                             xtype: 'TextArea',
94                                             xns: Roo.form,
95                                             readOnly : true,
96                                             fieldLabel : 'Original',
97                                             height : 150,
98                                             name : 'src_id_txt',
99                                             value : "",
100                                             width : 750
101                                         }
102                                     ]
103                                 },
104                                 {
105                                     xtype: 'Row',
106                                     xns: Roo.form,
107                                     labelAlign : 'top',
108                                     items : [
109                                         {
110                                             xtype: 'TextArea',
111                                             xns: Roo.form,
112                                             fieldLabel : 'Translation',
113                                             height : 150,
114                                             name : 'txt',
115                                             width : 750
116                                         }
117                                     ]
118                                 }
119                             ]
120                         }
121                     ]
122                 }
123             ],
124             center : {
125                 xtype: 'LayoutRegion',
126                 xns: Roo,
127                 titlebar : true,
128                 title : "Note: If the original text contains template variables like  {TEMPLATE_VARIABLE} <br/>Be careful to retain them otherwise the translation may not work"
129             },
130             buttons : [
131                 {
132                     xtype: 'Button',
133                     xns: Roo,
134                     text : "Cancel",
135                     listeners : {
136                         click : function() {
137                             _this.form.reset();
138                             _this.dialog.hide();
139                         }
140                     }
141                 },
142                 {
143                     xtype: 'Button',
144                     xns: Roo,
145                     listeners : {
146                         click : function() {
147                             _this.dialog.el.mask("Saving");
148                             //_this.form.doAction('submit');
149                             _this.dialog.hide();
150                             if (_this.callback) {
151                                 _this.callback.call(_this, _this.form.getValues());
152                             }
153                             _this.dialog.el.unmask();
154                             _this.form.reset();
155                         }
156                     },
157                     text : "OK"
158                 }
159             ]
160         });
161     }
162 };