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",
32 _tree : function(_data)
37 xtype : 'NestedLayoutPanel',
39 title : _this._strings['dc00a593c8be0a664ba934335b093154'] /* Translate Templates */,
43 xtype : 'BorderLayout',
47 xtype : 'LayoutRegion',
52 xtype : 'LayoutRegion',
63 render : function (_self)
65 _this.treepanel = _self;
77 text : _this._strings['03c2e7e41ffc181a4e84080b4710e81e'] /* New */,
79 click : function (_self, e)
81 Pman.Dialog.CmsLanguagePick.show( { }, function(lang) {
84 url : baseURL + '/Roo/cms_templatestr',
91 _this.treepanel.tree.getRootNode().reload();
100 '|xns' : 'Roo.Toolbar'
105 '|xns' : 'Roo.Toolbar'
109 text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
111 click : function (_self, e)
113 var tree = _this.treepanel.tree;
114 var sn = tree.getSelectionModel().getSelectedNode();
116 if (!sn || typeof(sn.attributes.language) == 'undefined' || !sn.attributes.language) {
117 Roo.MessageBox.alert("Error", "Select a language");
121 Roo.MessageBox.confirm("Confirm", "Are sure you want to delete the language", function (v){
125 Roo.MessageBox.alert("Not yet", "not done yet");
128 url : baseURL + '/Roo/cms_language.php',
131 _delete : _t.selectedNode.id
135 _this.treepanel.tree.getRootNode().reload();
136 //g.getDataSource().reload();
140 Roo.MessageBox.alert("Error",
141 "There was a problem saving the data - try reloading");
154 '|xns' : 'Roo.Toolbar'
159 '|xns' : 'Roo.Toolbar'
163 text : _this._strings['cd6ae20e52d83f601c5fa12b66f0f6d0'] /* Rescan */,
165 click : function (_self, e)
167 var tree = _this.treepanel.tree;
169 var sn = tree.getSelectionModel().getSelectedNode();
172 Roo.MessageBox.alert("Error", "Select a node");
176 var syncTemplate = function(){
178 url : baseURL + '/Cms/UpdateBjsTemplates',
180 mask : 'Processing...',
184 _this.treepanel.tree.getRootNode().reload();
191 var syncLanguage = function(){
193 url : baseURL + '/Roo/cms_templatestr',
195 mask : 'Processing...',
197 _rescan : sn.attributes.id
201 _this.treepanel.tree.getRootNode().reload();
206 if(typeof(sn.isRoot) != 'undefined' && sn.isRoot){
211 if(typeof(sn.attributes.language) != 'undefined' && sn.attributes.language){
223 '|xns' : 'Roo.Toolbar'
228 '|xns' : 'Roo.Toolbar'
232 text : _this._strings['4d1c8263ba1036754f8db14a98f9f006'] /* Reload */,
234 click : function (_self, e)
236 _this.treepanel.tree.getRootNode().reload();
241 '|xns' : 'Roo.Toolbar'
247 containerScroll : false,
252 xtype : 'AsyncTreeNode',
254 text : _this._strings['0b8d92bc19b720bb1065649535463409'] /* Translations */,
259 xtype : 'DefaultSelectionModel',
261 selectionchange : function (_self, node)
265 //if (node.id.split('/').length < 2) {
269 _this.grid.footer.onClick('first');
278 xtype : 'TreeLoader',
279 baseParams : { _tree : 1 },
280 dataUrl : baseURL + '/Roo/cms_templatestr',
281 requestMethod : 'GET',
283 beforeload : function (This, node, callback)
287 this.baseParams._tree = 1;
289 //this.baseParams.category = node.attributes.category;
291 loadexception : function (This, node, response)
293 Roo.MessageBox.alert("Error", "Problem loading tree");
308 title : _this._strings['193cfc9be3b995831c6af2fea6650e60'] /* Page */,
310 activate : function() {
313 _this.grid.footer.onClick('first');
320 xtype : 'EditorGrid',
321 autoExpandColumn : 'txt',
325 afteredit : function (e)
329 beforeedit : function (e)
331 /*if (e.record.data.src_id_txt.indexOf('<') > -1) {
332 // console.log("HTML EDITOR!!");
333 Pman.Dialog.CmsTranslateEditor.show(e.record);
337 var str=e.record.data.src_id_txt;
345 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
348 e.record.set('txt', v.txt);
352 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
355 e.record.set('txt', text);
362 if(str.length > 150){
364 Pman.Dialog.CmsTranslateTemplates.show(e.record.data, function(v){
366 e.record.set('txt', v.txt);
370 Roo.MessageBox.prompt('WARNING', 'This text is with {TEMPLATE VARIABLE}, PLEASE BE CAREFUL EDITING. What\'s change? '+str, function(btn, text){
373 e.record.set('txt', text);
381 if (e.record.data.txt.replace(/\s+/, '').length) {
385 var tl = _this.treepanel.tree.getSelectionModel().getSelectedNode().parentNode.attributes.id;
388 tl = (tl == 'zh_HK') ? 'zh-TW' : tl;
390 if (tl == 'en' && !e.value.length) {
392 e.value = e.record.data.src_id_txt;
393 e.record.set('txt', e.record.data.src_id_txt);
397 Pman.GoogleTranslate(e.record.data.src_id_txt, "en", tl, function(result) {
399 _this.grid.activeEditor.setValue(result);
400 //console.log(result.translation);
410 //_this.dialog = Pman.Dialog.FILL_IN
411 if (_this.panel.active) {
412 this.footer.onClick('first');
413 // this.ds.onc.onClick('first');
416 rowdblclick : function (_self, rowIndex, e)
421 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
422 _this.grid.footer.onClick('first');
429 xtype : 'PagingToolbar',
431 displayMsg : _this._strings['e2f9d206562d8f5ea421ad51100f7151'] /* Displaying petition_entry{0} - {1} of {2} */,
432 emptyMsg : _this._strings['9d1ead73e678fa2f51a70a933b0bf017'] /* Not Found */,
444 emptyText : _this._strings['e3d388b2c43e5ba0905702620ae2abc1'] /* Search for */,
446 render : function (_self)
448 _this.searchBox = this;
450 specialkey : function (_self, e)
452 _this.grid.footer.onClick('first');
461 icon : rootURL + '/Pman/templates/images/search.gif',
463 click : function (_self, e)
465 _this.grid.footer.onClick('first');
469 '|xns' : 'Roo.Toolbar'
474 icon : rootURL + '/Pman/templates/images/edit-clear.gif',
476 click : function (_self, e)
478 _this.searchBox.setValue('');
480 _this.grid.footer.onClick('first');
484 '|xns' : 'Roo.Toolbar'
491 sortInfo : { field : 'src_id_txt', direction: 'ASC' },
493 beforeload : function (_self, o)
496 var sn = _this.treepanel.tree.getSelectionModel().getSelectedNode();
498 if (!sn || typeof(sn.attributes) == 'undefined' || typeof(sn.attributes.leaf) == 'undefined' || !sn.attributes.leaf) {
499 _this.grid.ds.removeAll();
503 o.params = o.params || {};
505 //var pn = sn.parentNode.attributes.id.split(':')[1]; // should be view:en:{module}
508 o.params.lang = sn.parentNode.attributes.id;
509 o.params.template_id = sn.attributes.id * 1;
511 o.params['!src_id'] = 0;
513 if (_this.searchBox && _this.searchBox.getValue().length) {
514 o.params['_search_txt'] = _this.searchBox.getValue();
518 if(sn.attributes.on_table){
519 o.params.on_table = sn.attributes.on_table;
523 update : function (_self, rec, operation)
527 if (operation != 'commit') {
532 _this.grid.getView().el.mask("Saving");
534 url : baseURL + '/Roo/cms_templatestr',
542 _this.grid.getView().el.unmask();
543 //g.getDataSource().reload();
547 _this.grid.getView().el.unmask();
548 Roo.MessageBox.alert("Error", "There was a problem saving the data - try reloading");
560 url : baseURL + '/Roo/cms_templatestr.php',
565 xtype : 'JsonReader',
579 totalProperty : 'total',
586 xtype : 'ColumnModel',
587 dataIndex : 'src_id_txt',
588 header : _this._strings['0a52da7a03a6de3beefe54f8c03ad80d'] /* Original */,
589 renderer : function(v,x,r)
592 if (r.data.updated < r.data.src_id_updated) {
596 return String.format('<div style="color:'+c+'";>{0}</div>', v)
604 xtype : 'ColumnModel',
606 header : _this._strings['6dd08874f83507e9c7b23f1a46b7fa7c'] /* Translation */,
607 renderer : function(v,x,r)
611 if (r.data.updated < r.data.src_id_updated) {
615 return String.format('<div style="color:'+c+'";>{0}</div>', v)
622 xtype : 'GridEditor',
634 xtype : 'ColumnModel',
635 dataIndex : 'src_id_mdsum',
636 header : _this._strings['1bc29b36f623ba82aaf6724fd3b16718'] /* md5 */,
638 renderer : function(v,x,r)