15 "xtype" : "LayoutRegion"
20 "xtype" : "LayoutRegion"
30 "$ xns" : "Roo.Toolbar",
33 "function (_self, e)",
35 " Pman.Dialog.CmsLanguagePick.show( { }, function(lang) {",
37 " new Pman.Request({",
38 " url : baseURL + '/Roo/cms_templatestr',",
43 " success : function()",
45 " _this.treepanel.tree.getRootNode().reload();",
58 "$ xns" : "Roo.Toolbar",
62 "$ xns" : "Roo.Toolbar",
65 "function (_self, e)",
67 " var tree = _this.treepanel.tree;",
68 " var sn = tree.getSelectionModel().getSelectedNode();",
70 " if (!sn || typeof(sn.attributes.language) == 'undefined' || !sn.attributes.language) {",
71 " Roo.MessageBox.alert(\"Error\", \"Select a language\");",
75 " Roo.MessageBox.confirm(\"Confirm\", \"Are sure you want to delete the language\", function (v){",
79 " Roo.MessageBox.alert(\"Not yet\", \"not done yet\");",
81 " Roo.Ajax.request({",
82 " url : baseURL + '/Roo/cms_language.php',",
85 " _delete : _t.selectedNode.id ",
87 " success : function()",
89 " _this.treepanel.tree.getRootNode().reload();",
90 " //g.getDataSource().reload();",
92 " failure : function()",
94 " Roo.MessageBox.alert(\"Error\", ",
95 " \"There was a problem saving the data - try reloading\");",
112 "$ xns" : "Roo.Toolbar",
113 "xtype" : "Separator"
116 "$ xns" : "Roo.Toolbar",
119 "function (_self, e)",
121 " var tree = _this.treepanel.tree;",
123 " var sn = tree.getSelectionModel().getSelectedNode();",
126 " Roo.MessageBox.alert(\"Error\", \"Select a node\");",
130 " var syncTemplate = function(){",
131 " new Pman.Request({",
132 " url : baseURL + '/Cms/UpdateBjsTemplates',",
134 " mask : 'Processing...',",
135 " timeout : 9000000,",
136 " success : function()",
138 " _this.treepanel.tree.getRootNode().reload();",
145 " var syncLanguage = function(){",
146 " new Pman.Request({",
147 " url : baseURL + '/Roo/cms_templatestr',",
149 " mask : 'Processing...',",
151 " _rescan : sn.attributes.id",
153 " success : function()",
155 " _this.treepanel.tree.getRootNode().reload();",
160 " if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){",
165 " if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){",
181 "$ xns" : "Roo.Toolbar",
182 "xtype" : "Separator"
185 "$ xns" : "Roo.Toolbar",
188 "function (_self, e)",
192 " Pman.Dialog.Image.show({",
193 " _url : baseURL + '/Cms/Import/Cms_templatestr' ",
196 " _this.treepanel.tree.getRootNode().reload();",
208 "$ xns" : "Roo.Toolbar",
211 "function (_self, e)",
213 " var tree = _this.treepanel.tree;",
215 " var sn = tree.getSelectionModel().getSelectedNode();",
218 " csvCols : 'src_id_mdsum,template_id_view_name,template_id_template,src_id_txt,lang,txt',",
219 " csvTitles : 'Code,Module,Template,Original,Language,Translation',",
221 " sort: 'template_id_view_name,template_id_template,src_id_txt',",
224 " if (!sn || sn.id == 'transtree') {",
225 " Roo.MessageBox.alert(\"Error\", \"Select language, module or page\");",
228 " if (typeof(sn.id) == 'number') {",
229 " p.template_id = sn.id;",
230 " p.lang = sn.parentNode.attributes.id;",
235 " if (sn.id.match(/^table:/)) {",
236 " var sns = sn.id.split(':');",
238 " p.on_table = sns[2];",
239 " p.csvCols = 'src_id_mdsum,on_table,on_id,on_col,src_id_txt,lang,txt';",
240 " p.csvTitles = 'Code,Table,Table id,Column,Language,Translation';",
243 " if (sn.id.match(/^view:/)) {",
244 " var sns = sn.id.split(':');",
246 " p.template_id_view_name = sns[2];",
249 " if (sn.id.match(/^lang:/)) {",
250 " var sns = sn.id.split(':');",
256 " // view: {lang} : {view_name}",
259 " new Pman.Download({",
260 " url : baseURL + '/Roo/Cms_templatestr',",
276 "$ xns" : "Roo.Toolbar",
280 "$ xns" : "Roo.Toolbar",
283 "function (_self, e)",
285 " _this.treepanel.tree.getRootNode().reload();",
297 "$ xns" : "Roo.tree",
299 "containerScroll" : false,
302 "$ baseParams" : "{ _tree : 1 }",
303 "$ dataUrl" : "baseURL + '/Roo/cms_templatestr'",
304 "$ xns" : "Roo.tree",
308 "function (This, node, callback)",
310 " // set some params.",
312 " this.baseParams._tree = 1;",
314 " //this.baseParams.category = node.attributes.category;",
318 "function (This, node, response)",
320 " Roo.MessageBox.alert(\"Error\", \"Problem loading tree\");",
324 "requestMethod" : "GET",
325 "xtype" : "TreeLoader"
328 "$ xns" : "Roo.tree",
331 "text" : "Translations",
332 "xtype" : "AsyncTreeNode"
335 "$ xns" : "Roo.tree",
336 "* prop" : "selModel",
338 "selectionchange" : [
339 "function (_self, node)",
343 " //if (node.id.split('/').length < 2) {",
347 " _this.grid.footer.onClick('first');",
353 "xtype" : "DefaultSelectionModel"
356 "rootVisible" : true,
357 "xtype" : "TreePanel"
364 " _this.treepanel = _self;",
369 "xtype" : "TreePanel"
373 "background" : false,
374 "fitContainer" : true,
378 "$ xns" : "Roo.grid",
380 "autoExpandColumn" : "txt",
385 "* prop" : "toolbar",
388 "$ xns" : "Roo.form",
389 "String emptyText" : "Search for",
394 " _this.searchBox = this;",
398 "function (_self, e)",
400 "_this.grid.footer.onClick('first');",
404 "xtype" : "TextField"
407 "$ icon" : "rootURL + '/Pman/templates/images/search.gif'",
408 "$ xns" : "Roo.Toolbar",
409 "cls" : "x-btn-icon",
412 "function (_self, e)",
414 "_this.grid.footer.onClick('first');",
421 "$ icon" : "rootURL + '/Pman/templates/images/edit-clear.gif'",
422 "$ xns" : "Roo.Toolbar",
423 "cls" : "x-btn-icon",
426 "function (_self, e)",
428 " _this.searchBox.setValue('');",
430 " _this.grid.footer.onClick('first');",
442 "displayInfo" : true,
443 "displayMsg" : "Displaying petition_entry{0} - {1} of {2}",
444 "emptyMsg" : "Not Found",
446 "xtype" : "PagingToolbar"
449 "$ sortInfo" : "{ field : 'src_id_txt', direction: 'ASC' }",
450 "$ xns" : "Roo.data",
451 "* prop" : "dataSource",
454 "$ url" : "baseURL + '/Roo/cms_templatestr.php'",
455 "$ xns" : "Roo.data",
458 "xtype" : "HttpProxy"
468 " 'name': 'shortname',",
474 "$ xns" : "Roo.data",
478 "totalProperty" : "total",
479 "xtype" : "JsonReader"
484 "function (_self, o)",
487 " var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();",
489 " if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) { ",
490 " _this.grid.ds.removeAll();",
494 " o.params = o.params || {};",
496 " //var pn = sn.parentNode.attributes.id.split(':')[1]; // should be view:en:{module}",
499 " o.params.lang = sn.parentNode.attributes.id;",
500 " o.params.template_id = sn.attributes.id * 1;",
501 " o.params.active = 1;",
502 " o.params['!src_id'] = 0;",
504 " if (_this.searchBox && _this.searchBox.getValue().length) { ",
505 " o.params['_search_txt'] = _this.searchBox.getValue();",
509 " if(sn.attributes.on_table){",
510 " o.params.on_table = sn.attributes.on_table;",
519 "function (_self, rec, operation)",
521 " Roo.log(operation);",
523 " if (operation != 'commit') {",
528 " _this.grid.getView().el.mask(\"Saving\");",
529 " new Pman.Request({",
530 " url : baseURL + '/Roo/cms_templatestr',",
533 " id : rec.get('id'),",
534 " txt : rec.get('txt')",
536 " success : function()",
538 " _this.grid.getView().el.unmask();",
539 " //g.getDataSource().reload();",
541 " failure : function()",
543 " _this.grid.getView().el.unmask();",
544 " Roo.MessageBox.alert(\"Error\", \"There was a problem saving the data - try reloading\");",
560 " if (r.data.updated < r.data.src_id_updated) {",
564 " return String.format('<div style=\"color:'+c+'\";>{0}</div>', v)",
568 "$ xns" : "Roo.grid",
570 "dataIndex" : "src_id_txt",
571 "header" : "Original",
573 "xtype" : "ColumnModel"
581 " if (r.data.updated < r.data.src_id_updated) {",
585 " return String.format('<div style=\"color:'+c+'\";>{0}</div>', v)",
589 "$ xns" : "Roo.grid",
592 "header" : "Translation",
595 "$ xns" : "Roo.grid",
599 "$ xns" : "Roo.form",
601 "allowBlank" : false,
602 "xtype" : "TextField"
605 "xtype" : "GridEditor"
609 "xtype" : "ColumnModel"
615 " return v ? v : '';",
619 "$ xns" : "Roo.grid",
621 "Boolean hidden" : true,
622 "dataIndex" : "src_id_mdsum",
625 "xtype" : "ColumnModel"
632 " e.record.commit();",
638 " /*if (e.record.data.src_id_txt.indexOf('<') > -1) {",
639 " // console.log(\"HTML EDITOR!!\");",
640 " Pman.Dialog.CmsTranslateEditor.show(e.record);",
644 " var str=e.record.data.src_id_txt;",
645 " var patt=/{(.*?)}/g;",
647 " Roo.log(str.length);",
650 " if(patt.test(str)){",
652 " Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){",
655 " e.record.set('txt', v.txt);",
656 " e.record.commit();",
659 " Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){",
660 " if (btn == 'ok'){",
662 " e.record.set('txt', text);",
663 " e.record.commit();",
669 " if(str.length > 150){",
671 " Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){",
673 " e.record.set('txt', v.txt);",
674 " e.record.commit();",
677 " Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\\'s change? '+str, function(btn, text){",
678 " if (btn == 'ok'){",
680 " e.record.set('txt', text);",
681 " e.record.commit();",
688 " if (e.record.data.txt.replace(/\\s+/, '').length) {",
692 " var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;",
695 " tl = (tl == 'zh_HK') ? 'zh-TW' : tl;",
697 " if (tl == 'en' && !e.value.length) {",
699 " e.value = e.record.data.src_id_txt;",
700 " e.record.set('txt', e.record.data.src_id_txt);",
704 " Pman.GoogleTranslate(e.record.data.src_id_txt, \"en\", tl, function(result) {",
705 " // Roo.log(result);",
706 " _this.grid.activeEditor.setValue(result);",
707 " //console.log(result.translation);",
718 " _this.grid = this; ",
719 " //_this.dialog = Pman.Dialog.FILL_IN",
720 " if (_this.panel.active) {",
721 " this.footer.onClick('first');",
722 " // this.ds.onc.onClick('first');",
727 "function (_self, rowIndex, e)",
729 " if (!_this.dialog) {",
732 " _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {",
733 " _this.grid.footer.onClick('first');",
740 "xtype" : "EditorGrid"
746 " _this.panel = this;",
747 " if (_this.grid) {",
748 " _this.grid.footer.onClick('first');",
754 "tableName" : "Page",
756 "xtype" : "GridPanel"
759 "xtype" : "BorderLayout"
763 "title" : "Translate Templates",
764 "xtype" : "NestedLayoutPanel"
768 "name" : "Pman.Tab.CmsTranslateTemplates",
769 "parent" : "Pman.Tab.Cms",
770 "path" : "/home/leon/gitlive/Pman.Cms/Pman.Tab.CmsTranslateTemplates.bjs",
773 "03c2e7e41ffc181a4e84080b4710e81e" : "New",
774 "0a52da7a03a6de3beefe54f8c03ad80d" : "Original",
775 "0b8d92bc19b720bb1065649535463409" : "Translations",
776 "193cfc9be3b995831c6af2fea6650e60" : "Page",
777 "1bc29b36f623ba82aaf6724fd3b16718" : "md5",
778 "4d1c8263ba1036754f8db14a98f9f006" : "Reload",
779 "6dd08874f83507e9c7b23f1a46b7fa7c" : "Translation",
780 "801ab24683a4a8c433c6eb40c48bcd9d" : "Download",
781 "91412465ea9169dfd901dd5e7c96dd99" : "Upload",
782 "9d1ead73e678fa2f51a70a933b0bf017" : "Not Found",
783 "cd6ae20e52d83f601c5fa12b66f0f6d0" : "Rescan",
784 "dc00a593c8be0a664ba934335b093154" : "Translate Templates",
785 "e2f9d206562d8f5ea421ad51100f7151" : "Displaying petition_entry{0} - {1} of {2}",
786 "e3d388b2c43e5ba0905702620ae2abc1" : "Search for",
787 "f2a6c498fb90ee345d997f888fce3b18" : "Delete"
789 "title" : "Pman.Tab.CmsTranslateTemplates"