1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.CmsTranslateTemplates = new Roo.XComponent({
10 '0a52da7a03a6de3beefe54f8c03ad80d' :"Original",
11 '0b8d92bc19b720bb1065649535463409' :"Translations",
12 '9d1ead73e678fa2f51a70a933b0bf017' :"Not Found",
13 '6dd08874f83507e9c7b23f1a46b7fa7c' :"Translation",
14 'e2f9d206562d8f5ea421ad51100f7151' :"Displaying petition_entry{0} - {1} of {2}",
15 'dc00a593c8be0a664ba934335b093154' :"Translate Templates",
16 'cd6ae20e52d83f601c5fa12b66f0f6d0' :"Rescan",
17 '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
18 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
19 '03c2e7e41ffc181a4e84080b4710e81e' :"New",
20 '193cfc9be3b995831c6af2fea6650e60' :"Page",
21 '1bc29b36f623ba82aaf6724fd3b16718' :"md5"
24 part : ["Cms", "TranslateTemplates" ],
25 order : '800-Pman.Tab.CmsTranslateTemplates',
27 parent : 'Pman.Tab.Cms',
28 name : "Pman.Tab.CmsTranslateTemplates",
37 title : _this._strings['dc00a593c8be0a664ba934335b093154'] /* Translate Templates */,
40 xtype : 'NestedLayoutPanel',
44 xtype : 'BorderLayout',
48 xtype : 'LayoutRegion'
55 xtype : 'LayoutRegion'
64 render : function (_self)
66 _this.treepanel = _self;
75 text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
77 '|xns' : 'Roo.Toolbar',
80 click : function (_self, e)
82 Pman.Dialog.CmsLanguagePick.show( { }, function(lang) {
85 url : baseURL + '/Roo/cms_templatestr',
92 _this.treepanel.tree.getRootNode().reload();
103 '|xns' : 'Roo.Toolbar',
107 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
109 '|xns' : 'Roo.Toolbar',
112 click : function (_self, e)
114 var tree = _this.treepanel.tree;
115 var sn = tree.getSelectionModel().getSelectedNode();
117 if (!sn || typeof(sn.attributes.language) == 'undefined' || !sn.attributes.language) {
118 Roo.MessageBox.alert("Error", "Select a language");
122 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete the language", function (v){
126 Roo.MessageBox.alert("Not yet", "not done yet");
129 url : baseURL + '/Roo/cms_language.php',
132 _delete : _t.selectedNode.id
136 _this.treepanel.tree.getRootNode().reload();
137 //g.getDataSource().reload();
141 Roo.MessageBox.alert("Error",
142 "There was a problem saving the data - try reloading");
157 '|xns' : 'Roo.Toolbar',
161 text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
163 '|xns' : 'Roo.Toolbar',
166 click : function (_self, e)
168 var tree = _this.treepanel.tree;
170 var sn = tree.getSelectionModel().getSelectedNode();
173 Roo.MessageBox.alert("Error", "Select a node");
177 var syncTemplate = function(){
179 url : baseURL + '/Cms/UpdateBjsTemplates',
181 mask : 'Processing...',
185 _this.treepanel.tree.getRootNode().reload();
192 var syncLanguage = function(){
194 url : baseURL + '/Roo/cms_templatestr',
196 mask : 'Processing...',
198 _rescan : sn.attributes.id
202 _this.treepanel.tree.getRootNode().reload();
207 if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){
212 if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){
226 '|xns' : 'Roo.Toolbar',
230 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
232 '|xns' : 'Roo.Toolbar',
235 click : function (_self, e)
237 _this.treepanel.tree.getRootNode().reload();
245 containerScroll : false,
252 text : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
255 xtype : 'AsyncTreeNode'
260 xtype : 'DefaultSelectionModel',
262 selectionchange : function (_self, node)
266 //if (node.id.split('/').length < 2) {
270 _this.grid.footer.onClick('first');
277 baseParams : { _tree : 1 },
278 dataUrl : baseURL + '/Roo/cms_templatestr',
279 requestMethod : 'GET',
282 xtype : 'TreeLoader',
284 beforeload : function (This, node, callback)
288 this.baseParams._tree = 1;
290 //this.baseParams.category = node.attributes.category;
292 loadexception : function (This, node, response)
294 Roo.MessageBox.alert("Error", "Problem loading tree");
306 title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
311 activate : function() {
314 _this.grid.footer.onClick('first');
319 autoExpandColumn : 'txt',
324 xtype : 'EditorGrid',
326 afteredit : function (e)
330 beforeedit : function (e)
332 /*if (e.record.data.src_id_txt.indexOf('<') > -1) {
333 // console.log("HTML EDITOR!!");
334 Pman.Dialog.CmsTranslateEditor.show(e.record);
338 var str=e.record.data.src_id_txt;
346 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
349 e.record.set('txt', v.txt);
353 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
356 e.record.set('txt', text);
363 if(str.length > 150){
365 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
367 e.record.set('txt', v.txt);
371 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
374 e.record.set('txt', text);
382 if (e.record.data.txt.replace(/\s+/, '').length) {
386 var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
389 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
391 if (tl == 'en' && !e.value.length) {
393 e.value = e.record.data.src_id_txt;
394 e.record.set('txt', e.record.data.src_id_txt);
398 Pman.GoogleTranslate(e.record.data.src_id_txt, "en", tl, function(result) {
400 _this.grid.activeEditor.setValue(result);
401 //console.log(result.translation);
411 //_this.dialog = Pman.Dialog.FILL_IN
412 if (_this.panel.active) {
413 this.footer.onClick('first');
414 // this.ds.onc.onClick('first');
417 rowdblclick : function (_self, rowIndex, e)
419 if (!_this.dialog) return;
420 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
421 _this.grid.footer.onClick('first');
427 displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
428 emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
432 xtype : 'PagingToolbar'
436 sortInfo : { field : 'src_id_txt', direction: 'ASC' },
441 beforeload : function (_self, o)
444 var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
446 if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) {
447 _this.grid.ds.removeAll();
451 o.params = o.params || {};
452 o.params.lang = sn.parentNode.attributes.id ;
453 o.params.template_id = sn.attributes.id * 1;
455 o.params['!src_id'] = 0;
457 if(sn.attributes.on_table){
458 o.params.on_table = sn.attributes.on_table;
462 update : function (_self, rec, operation)
466 if (operation != 'commit') {
471 _this.grid.getView().el.mask("Saving");
473 url : baseURL + '/Roo/cms_templatestr',
481 _this.grid.getView().el.unmask();
482 //g.getDataSource().reload();
486 _this.grid.getView().el.unmask();
487 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
496 url : baseURL + '/Roo/cms_templatestr.php',
515 totalProperty : 'total',
523 dataIndex : 'src_id_txt',
524 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
525 renderer : function(v,x,r)
528 if (r.data.updated < r.data.src_id_updated) {
532 return String.format('<div style="color:'+c+'";>{0}</div>', v)
538 xtype : 'ColumnModel'
542 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
543 renderer : function(v,x,r)
547 if (r.data.updated < r.data.src_id_updated) {
551 return String.format('<div style="color:'+c+'";>{0}</div>', v)
557 xtype : 'ColumnModel',
561 xtype : 'GridEditor',
571 dataIndex : 'src_id_txt',
572 header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
573 renderer : function(v,x,r)
576 if (r.data.updated < r.data.src_id_updated) {
580 return String.format('<div style="color:'+c+'";>{0}</div>', v)
586 xtype : 'ColumnModel'