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 'e3d388b2c43e5ba0905702620ae2abc1' :"Search for",
15 'e2f9d206562d8f5ea421ad51100f7151' :"Displaying petition_entry{0} - {1} of {2}",
16 'dc00a593c8be0a664ba934335b093154' :"Translate Templates",
17 'cd6ae20e52d83f601c5fa12b66f0f6d0' :"Rescan",
18 '4d1c8263ba1036754f8db14a98f9f006' :"Reload",
19 'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
20 '03c2e7e41ffc181a4e84080b4710e81e' :"New",
21 '193cfc9be3b995831c6af2fea6650e60' :"Page",
22 '1bc29b36f623ba82aaf6724fd3b16718' :"md5"
25 part : ["Cms", "TranslateTemplates" ],
26 order : '800-Pman.Tab.CmsTranslateTemplates',
28 parent : 'Pman.Tab.Cms',
29 name : "Pman.Tab.CmsTranslateTemplates",
38 title : _this._strings['dc00a593c8be0a664ba934335b093154'] /* Translate Templates */,
41 xtype : 'NestedLayoutPanel',
45 xtype : 'BorderLayout',
49 xtype : 'LayoutRegion'
56 xtype : 'LayoutRegion'
65 render : function (_self)
67 _this.treepanel = _self;
76 text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
78 '|xns' : 'Roo.Toolbar',
81 click : function (_self, e)
83 Pman.Dialog.CmsLanguagePick.show( { }, function(lang) {
86 url : baseURL + '/Roo/cms_templatestr',
93 _this.treepanel.tree.getRootNode().reload();
104 '|xns' : 'Roo.Toolbar',
108 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
110 '|xns' : 'Roo.Toolbar',
113 click : function (_self, e)
115 var tree = _this.treepanel.tree;
116 var sn = tree.getSelectionModel().getSelectedNode();
118 if (!sn || typeof(sn.attributes.language) == 'undefined' || !sn.attributes.language) {
119 Roo.MessageBox.alert("Error", "Select a language");
123 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete the language", function (v){
127 Roo.MessageBox.alert("Not yet", "not done yet");
130 url : baseURL + '/Roo/cms_language.php',
133 _delete : _t.selectedNode.id
137 _this.treepanel.tree.getRootNode().reload();
138 //g.getDataSource().reload();
142 Roo.MessageBox.alert("Error",
143 "There was a problem saving the data - try reloading");
158 '|xns' : 'Roo.Toolbar',
162 text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
164 '|xns' : 'Roo.Toolbar',
167 click : function (_self, e)
169 var tree = _this.treepanel.tree;
171 var sn = tree.getSelectionModel().getSelectedNode();
174 Roo.MessageBox.alert("Error", "Select a node");
178 var syncTemplate = function(){
180 url : baseURL + '/Cms/UpdateBjsTemplates',
182 mask : 'Processing...',
186 _this.treepanel.tree.getRootNode().reload();
193 var syncLanguage = function(){
195 url : baseURL + '/Roo/cms_templatestr',
197 mask : 'Processing...',
199 _rescan : sn.attributes.id
203 _this.treepanel.tree.getRootNode().reload();
208 if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){
213 if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){
227 '|xns' : 'Roo.Toolbar',
231 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
233 '|xns' : 'Roo.Toolbar',
236 click : function (_self, e)
238 _this.treepanel.tree.getRootNode().reload();
246 containerScroll : false,
253 text : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
256 xtype : 'AsyncTreeNode'
261 xtype : 'DefaultSelectionModel',
263 selectionchange : function (_self, node)
267 //if (node.id.split('/').length < 2) {
271 _this.grid.footer.onClick('first');
278 baseParams : { _tree : 1 },
279 dataUrl : baseURL + '/Roo/cms_templatestr',
280 requestMethod : 'GET',
283 xtype : 'TreeLoader',
285 beforeload : function (This, node, callback)
289 this.baseParams._tree = 1;
291 //this.baseParams.category = node.attributes.category;
293 loadexception : function (This, node, response)
295 Roo.MessageBox.alert("Error", "Problem loading tree");
307 title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
312 activate : function() {
315 _this.grid.footer.onClick('first');
320 autoExpandColumn : 'txt',
325 xtype : 'EditorGrid',
327 afteredit : function (e)
331 beforeedit : function (e)
333 /*if (e.record.data.src_id_txt.indexOf('<') > -1) {
334 // console.log("HTML EDITOR!!");
335 Pman.Dialog.CmsTranslateEditor.show(e.record);
339 var str=e.record.data.src_id_txt;
347 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
350 e.record.set('txt', v.txt);
354 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
357 e.record.set('txt', text);
364 if(str.length > 150){
366 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
368 e.record.set('txt', v.txt);
372 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
375 e.record.set('txt', text);
383 if (e.record.data.txt.replace(/\s+/, '').length) {
387 var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
390 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
392 if (tl == 'en' && !e.value.length) {
394 e.value = e.record.data.src_id_txt;
395 e.record.set('txt', e.record.data.src_id_txt);
399 Pman.GoogleTranslate(e.record.data.src_id_txt, "en", tl, function(result) {
401 _this.grid.activeEditor.setValue(result);
402 //console.log(result.translation);
412 //_this.dialog = Pman.Dialog.FILL_IN
413 if (_this.panel.active) {
414 this.footer.onClick('first');
415 // this.ds.onc.onClick('first');
418 rowdblclick : function (_self, rowIndex, e)
423 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
424 _this.grid.footer.onClick('first');
430 displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
431 emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
435 xtype : 'PagingToolbar'
443 emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
448 render : function (_self)
450 _this.searchBox = this;
452 specialkey : function (_self, e)
454 _this.grid.footer.onClick('first');
460 icon : rootURL + '/Pman/templates/images/search.gif',
462 '|xns' : 'Roo.Toolbar',
465 click : function (_self, e)
467 _this.grid.footer.onClick('first');
473 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
475 '|xns' : 'Roo.Toolbar',
478 click : function (_self, e)
480 _this.searchBox.setValue('');
482 _this.grid.footer.onClick('first');
490 sortInfo : { field : 'src_id_txt', direction: 'ASC' },
495 beforeload : function (_self, o)
498 var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
500 if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) {
501 _this.grid.ds.removeAll();
505 o.params = o.params || {};
506 o.params.lang = sn.parentNode.attributes.id ;
507 o.params.template_id = sn.attributes.id * 1;
509 o.params['!src_id'] = 0;
511 if (_this.searchBox && _this.searchBox.getValue().length) {
512 o.params['_search_txt'] = _this.searchBox.getValue();
516 if(sn.attributes.on_table){
517 o.params.on_table = sn.attributes.on_table;
521 update : function (_self, rec, operation)
525 if (operation != 'commit') {
530 _this.grid.getView().el.mask("Saving");
532 url : baseURL + '/Roo/cms_templatestr',
540 _this.grid.getView().el.unmask();
541 //g.getDataSource().reload();
545 _this.grid.getView().el.unmask();
546 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
555 url : baseURL + '/Roo/cms_templatestr.php',
574 totalProperty : 'total',
582 dataIndex : 'src_id_txt',
583 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
584 renderer : function(v,x,r)
587 if (r.data.updated < r.data.src_id_updated) {
591 return String.format('<div style="color:'+c+'";>{0}</div>', v)
597 xtype : 'ColumnModel'
601 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
602 renderer : function(v,x,r)
606 if (r.data.updated < r.data.src_id_updated) {
610 return String.format('<div style="color:'+c+'";>{0}</div>', v)
616 xtype : 'ColumnModel',
620 xtype : 'GridEditor',
630 dataIndex : 'src_id_mdsum',
631 header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
633 renderer : function(v,x,r)
641 xtype : 'ColumnModel'